Hi,
I try to use the scan operator to compare it with my own implementation.
Unfortunately, I am not able to make the scan work correctly.
Based on the guide regarding interoperability with OpenCl the implementation currently looks like this (tried also some other variants with the same results).
clfinish(cq)
af::sync();
af::array af_input = afcl::array(entries_number,
input_mem,
s64,
true);
af::array prefix_sum = af::scan(af_input);
clEnqueueCopyBuffer(device_command_queue->getValue(),
*prefix_sum.device<cl_mem>(),
output_mem,
0,
0,
entries_number * sizeof(long),
0,
nullptr,
nullptr
);
clfinish(cq)
I included this call within a function of a wrapper.
I defined several test cases using the TestWithParam option of GTest and a SetUp to initialize the wrapper.
If I execute each test case one by one the tests are passed successfully.
If I run all tests only the first test passes.
Similarly, if I repeat the test multiple times only the first test passes.
Interestingly, I can use the scan multiple times within one test without a problem
The problem seems to be that after the first run the array or respective mem object of af_input is not created.
According to af::info the devices are initialized correctly.
Furthermore, calling the constructor of the array does not provide a warning, error or exception.
An exception is thrown only after the af_input is used:
unknown file: Failure
C++ exception with description "ArrayFire Exception (Internal error:998):
OpenCL Error (-38): Invalid Memory Object when calling clSetKernelArg
In function af::array af::scan(const af::array&, int, af::binaryOp, bool)
In file src/api/cpp/scan.cpp:26" thrown in the test body.
If i switch the call from af::scan to af::sort at least the call is successfully executed.
Hi,
I try to use the scan operator to compare it with my own implementation.
Unfortunately, I am not able to make the scan work correctly.
Based on the guide regarding interoperability with OpenCl the implementation currently looks like this (tried also some other variants with the same results).
I included this call within a function of a wrapper.
I defined several test cases using the TestWithParam option of GTest and a SetUp to initialize the wrapper.
If I execute each test case one by one the tests are passed successfully.
If I run all tests only the first test passes.
Similarly, if I repeat the test multiple times only the first test passes.
Interestingly, I can use the scan multiple times within one test without a problem
The problem seems to be that after the first run the array or respective mem object of af_input is not created.
According to af::info the devices are initialized correctly.
Furthermore, calling the constructor of the array does not provide a warning, error or exception.
An exception is thrown only after the af_input is used:
If i switch the call from af::scan to af::sort at least the call is successfully executed.