You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
EDIT: See my comment below for an even simpler test case.
Data movement is triggered by the copy constructor, right? I have a case where a ManagedArray is a member of a class. The copy constructor of the class is called, which calls the copy constructor of the ManagedArray. However, the following test case fails.
class TestClass {
public:
TestClass(chai::ManagedArray values) : m_values(values) {}
TestClass(const TestClass& other) : m_values(other.m_values) {}
CHAI_HOST_DEVICE int getValue(const int i) const { return m_values[i]; }
private:
chai::ManagedArray m_values;
};
CUDA_TEST(managed_ptr, cuda_inner_ManagedArray)
{
const int expectedValue = rand();
EDIT: See my comment below for an even simpler test case.
Data movement is triggered by the copy constructor, right? I have a case where a ManagedArray is a member of a class. The copy constructor of the class is called, which calls the copy constructor of the ManagedArray. However, the following test case fails.
class TestClass {
public:
TestClass(chai::ManagedArray values) : m_values(values) {}
TestClass(const TestClass& other) : m_values(other.m_values) {}
CHAI_HOST_DEVICE int getValue(const int i) const { return m_values[i]; }
private:
chai::ManagedArray m_values;
};
CUDA_TEST(managed_ptr, cuda_inner_ManagedArray)
{
const int expectedValue = rand();
chai::ManagedArray array(1, chai::CPU);
array[0] = expectedValue;
TestClass temp(array);
chai::ManagedArray results(1, chai::GPU);
forall(cuda(), 0, 1, [=] device (int i) {
results[i] = temp.getValue(i);
});
results.move(chai::CPU);
ASSERT_EQ(results[0], expectedValue);
}
The text was updated successfully, but these errors were encountered: