Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion test/rng_quality.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
using af::allTrue;
using af::array;
using af::constant;
using af::deviceGC;
using af::dtype;
using af::dtype_traits;
using af::randomEngine;
Expand All @@ -16,7 +17,10 @@ using af::sum;
template<typename T>
class RandomEngine : public ::testing::Test {
public:
virtual void SetUp() {}
virtual void SetUp() {
// Ensure all unlocked buffers are freed
deviceGC();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you want to unlock all buffers, you need to add af::sync() before the deviceGC().
Without the sync, the buffers which are still in use by executing kernels will not be freed.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That is not the case with deviceGC in this location. When test finishes, all arrays involved are already evaluated because they need to be brought to host for comparison. So, they will be marked as unused by the time this line hits before the next test starts.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Additionally all allocation and free function are device synchronization events.

}
};

// create a list of types to be tested
Expand Down