I just want to "use" a complex af::array for a Cuda kernel. Unfortunately, the transformation which is described in the af documentation (http://arrayfire.org/docs/interop_cuda.htm) doesn't work here:
#include <arrayfire.h>
#include <af/cuda.h>
#include <thrust/complex.h>
#include <cuComplex.h>
using namespace af;
typedef thrust::complex<double> D2;
void test(){
randomEngine en = randomEngine();
dim4 dims(4, 4);
array a = randn(dims, c64, en); // array a = randn(dims, f64, en);
a.eval();
D2 *d_A = a.device<D2>(); // double *d_A = a.device<double>(); --------error line----------
a.unlock();
}
int main(){
test();
return 0;
}
When I tried to build this I got this error:
/usr/bin/ld: CMakeFiles/test.dir/comp.cu.o: in function `test()':
tmpxft_00003e39_00000000-5_comp.cudafe1.cpp:(.text+0x2e6): undefined reference to `thrust::complex<double>* af::array::device<thrust::complex<double> >() const'
It worked with normal doubles. My Cuda-version is V10.1.105. My OS is Ubuntu 19.04.
Thanks for your help!
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…