error af::replace(af::array&, af::array const&, double const&) in /opt/arrayfire/lib64/libafcuda.so.3

17 views
Skip to first unread message

Mpereke Evans

unread,
Aug 12, 2021, 9:33:01 AMAug 12
to ArrayFire Users
ArrayFire v3.8.0 (CUDA, 64-bit Linux, build d99887a)
Platform: CUDA Runtime 11.4, Driver: 470.57.02
[0] Quadro T2000, 3912 MB, CUDA Compute 7.5

I have the following code:

gfor(seq m, all_ref_cels.dims(0)) {
af::array notZeros = !af::iszero(all_ref_cels(m, span)); // find all entries that are zeros
af::array temp_hold = all_ref_cels(m, span);

// replace all zero entries with NaN - this so as zeros dont enterfere when finding min
replace(temp_hold, notZeros, NaN);
// reorder to dimansions that make sense
all_ref_cels = reorder(temp_hold, 3, 1, 0, 2);
}
it work fine on OpenCL runtime.
However for CUDA runtime I get the following error:

rrayFire Exception (Internal error:998):
In function void cuda::Enqueuer::operator()(void*, const cuda::EnqueueArgs&, Args ...) [with Args = {cuda::Param<float>, cuda::CParam<char>, cuda::CParam<float>, float, int, int}]
In file src/backend/cuda/Kernel.hpp:31
CU Error CUDA_ERROR_INVALID_VALUE(1): invalid argument

 0# 0x00007F7C5231D604 in /opt/arrayfire/lib64/libafcuda.so.3
 1# 0x00007F7C5231DC79 in /opt/arrayfire/lib64/libafcuda.so.3
 2# af_replace_scalar in /opt/arrayfire/lib64/libafcuda.so.3
 3# af::replace(af::array&, af::array const&, double const&) in /opt/arrayfire/lib64/libafcuda.so.3
 4# OS_CFAR(af::array&, af::array&, int, int, int, int, int) in ./GMTI_Processor_opencl
 5# main in ./GMTI_Processor_opencl
 6# __libc_start_main in /lib/x86_64-linux-gnu/libc.so.6
 7# _start in ./GMTI_Processor_opencl

In function void af::replace(af::array&, const af::array&, const double&)
In file src/api/cpp/data.cpp:313
terminate called after throwing an instance of 'af::exception'
  what():  ArrayFire Exception (Internal error:998):
In function void cuda::Enqueuer::operator()(void*, const cuda::EnqueueArgs&, Args ...) [with Args = {cuda::Param<float>, cuda::CParam<char>, cuda::CParam<float>, float, int, int}]
In file src/backend/cuda/Kernel.hpp:31
CU Error CUDA_ERROR_INVALID_VALUE(1): invalid argument

 0# 0x00007F7C5231D604 in /opt/arrayfire/lib64/libafcuda.so.3
 1# 0x00007F7C5231DC79 in /opt/arrayfire/lib64/libafcuda.so.3
 2# af_replace_scalar in /opt/arrayfire/lib64/libafcuda.so.3
 3# af::replace(af::array&, af::array const&, double const&) in /opt/arrayfire/lib64/libafcuda.so.3
 4# OS_CFAR(af::array&, af::array&, int, int, int, int, int) in ./GMTI_Processor_opencl
 5# main in ./GMTI_Processor_opencl
 6# __libc_start_main in /lib/x86_64-linux-gnu/libc.so.6
 7# _start in ./GMTI_Processor_opencl

In function void af::replace(af::array&, const af::array&, const double&)
In file src/api/cpp/data.cpp:313
Aborted (core dumped)

May you please help resolve the issue?

Pradeep Garigipati

unread,
Aug 13, 2021, 1:42:13 AMAug 13
to Mpereke Evans, ArrayFire Users
Hello Mpereke,

We have feature parity across backends so it is interesting that it works with OpenCL and doesn't on CUDA backend in your trials.

Given below is what I tried and it runs successfully on both backends. Although, I am not quite sure what your objective is with the gfor loop.

        array A = randu(5, 5, f32);

        A(span, 2) = 0.0;
        af_print(A);
        gfor(seq m, A.dims(0)) {
            array notZeros = af::iszero(A(m, span));
            array temp_hold = A(m, span);
            replace(temp_hold, notZeros, NAN);
            A = reorder(temp_hold, 3, 1, 0, 2);
        }
        af_print(A);

If you are trying to set non-zero values to NANs, then you can do that without gfor as well.

Perhaps if you can share a stand alone snippet that illustrates your target logic, I can suggest a better alternative if possible.

Regards,
Pradeep.

--
You received this message because you are subscribed to the Google Groups "ArrayFire Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to arrayfire-use...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/arrayfire-users/ec351807-6e73-45bc-b283-d0b3865c86b7n%40googlegroups.com.


--
Reply all
Reply to author
Forward
0 new messages