- edited description
make fails if both phython and cuda are enabled
Hi,
I tried to install shtns using:
./cofigure --enable-python --enable-cuda
make
Using:
cuda 10 and 10.2
gcc 6.4
make produces the following error after the call to nvcc is finished:
CC="cc" python setup.py build
running build
running build_py
running build_ext
building '_shtns' extension
cc -fno-strict-aliasing -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -m64 -mtune=generic -D_GNU_SOURCE -fPIC -fwrapv -DNDEBUG -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -m64 -mtune=generic -D_GNU_SOURCE -fPIC -fwrapv -fPIC -I/usr/lib64/python2.7/site-packages/numpy/core/include -I/usr/include/python2.7 -c shtns_numpy_wrap.c -o build/temp.linux-x86_64-2.7/shtns_numpy_wrap.o -std=c99 -fopenmp
gcc -pthread -shared -Wl,-z,relro build/temp.linux-x86_64-2.7/shtns_numpy_wrap.o sht_init.o sht_kernels_a.o sht_kernels_s.o sht_fly.o sht_omp.o sht_gpu.o -L/usr/local/lib -L/usr/lib64 -lfftw3_omp -lfftw3 -lcufft -lcudart -lm -lstdc++ -lpython2.7 -o build/lib.linux-x86_64-2.7/_shtns.so -L/software/cuda/cuda-10.2/lib64
/software/gcc/6.3/lib/gcc/x86_64-pc-linux-gnu/6.3.0/../../../../x86_64-pc-linux-gnu/bin/ld: sht_gpu.o: relocation R_X86_64_32 against `.rodata' can not be used when making a shared object; recompile with -fPIC
/software/gcc/6.3/lib/gcc/x86_64-pc-linux-gnu/6.3.0/../../../../x86_64-pc-linux-gnu/bin/ld: final link failed: nonrepresentable section on output
collect2: error: ld returned 1 exit status
error: command 'gcc' failed with exit status 1
make: *** [Makefile:114: _shtns.so] Error 1
If I drop either --enable-python or --enable-cuda the call to make works fine.
Best, Tim
Comments (3)
-
reporter -
repo owner Hello,
Yes, this does not work. I have no idea how to make python modules that use cuda.
Unfortunately, I cannot take the time to investigate this issue further in the near future. But if someone can provide a patch or pull request, it will be much appreciated. -
Hi Tim and Nathanael,
I’m not an expert in python, but I had a look at setup.py
(1) I think cargs should have a hook to the cuda include libraries, e.g., -I/usr/local/cuda-11.4/targets/x86_64-linux/include/
(2) I don’t think the call is setup.py tells the compiler where to find the mkl libraries
(3) After addressing those issues I get /software/anaconda/anaconda3/compiler_compat/ld: sht_gpu.o: relocation R_X86_64_32 against `.rodata' can not be used when making a shared object; recompile with -fPIC
Not sure I’ve helped fix anything, but maybe these provide some hints.
– Pete
- Log in to comment