shibatch / sleef

SIMD Library for Evaluating Elementary Functions, vectorized libm and DFT
https://sleef.org
Boost Software License 1.0
661 stars 133 forks source link

Fail to compile the CUDA test code #446

Open kuangllbnu opened 2 years ago

kuangllbnu commented 2 years ago

Hi,

I try to compile the CUDA test code from the Tutorial after building the lib. First time I just compile with this command: $ nvcc -o hellocudaquad hellocudaquad.cu -I/home/her/raidStorage/lkuang/qc/GBS/sleef/build/include

And failed with output as:

/usr/bin/ld: /tmp/tmpxft_000870e8_00000000-11_hellocudaquad.o: in function `main':
tmpxft_000870e8_00000000-6_hellocudaquad.cudafe1.cpp:(.text+0x762e): undefined reference to `powq'
/usr/bin/ld: tmpxft_000870e8_00000000-6_hellocudaquad.cudafe1.cpp:(.text+0x7644): undefined reference to `fabsq'
collect2: error: ld returned 1 exit status

Then I add the head file "sleefquad.h" in the test code, because I found the powq and fabsq are both defined in this head file. This time errors become this:

/home/her/raidStorage/lkuang/qc/GBS/sleef/build/include/sleefquadinline_cuda.h(4516): error: invalid redeclaration of type name "Sleef_quadx1"
/home/her/raidStorage/lkuang/qc/GBS/sleef/build/include/sleefquad.h(74): here

1 error detected in the compilation of "hellocudaquad.cu".

As the error mentioned, "Sleef_quadx1" is declared in both "sleefquad.h" and "sleefquadinline_cuda.h".

Any suggestions to aviod this? Thanks.