It is possible to build NIFTYREG
with CUDA support but linking SIRF
will generate the following error (on CentOS7).
[ 82%] Linking CXX shared module _pyreg.so
/opt/rh/devtoolset-7/root/usr/libexec/gcc/x86_64-redhat-linux/7/ld: /home/edo/GitHub/PETMR/build2/INSTALL/lib/lib_reg_cuda_kernels.a(_reg_cuda_kernels_generated_affineDeformationKernel.cu.o): relocation R_X86_64_32 against symbol `_Z12affineKernelPfS_Pi5uint3mb' can not be used when making a shared object; recompile with -fPIC
/opt/rh/devtoolset-7/root/usr/libexec/gcc/x86_64-redhat-linux/7/ld: /home/edo/GitHub/PETMR/build2/INSTALL/lib/lib_reg_cuda_kernels.a(_reg_cuda_kernels_generated_blockMatchingKernel.cu.o): relocation R_X86_64_32 against symbol `_Z21blockMatchingKernel2DPfS_PiS_Pj' can not be used when making a shared object; recompile with -fPIC
/opt/rh/devtoolset-7/root/usr/libexec/gcc/x86_64-redhat-linux/7/ld: /home/edo/GitHub/PETMR/build2/INSTALL/lib/lib_reg_cuda_kernels.a(_reg_cuda_kernels_generated_resampleKernel.cu.o): relocation R_X86_64_32 against symbol `_Z15ResampleImage2DPfS_S_PiS_6ulong25uint35uint2fi' can not be used when making a shared object; recompile with -fPIC
/opt/rh/devtoolset-7/root/usr/libexec/gcc/x86_64-redhat-linux/7/ld: /home/edo/GitHub/PETMR/build2/INSTALL/lib/lib_reg_common_cuda.a(_reg_common_cuda_generated__reg_common_cuda.cu.o): relocation R_X86_64_32 against `.rodata._Z40cudaCommon_transferNiftiToNiftiOnDevice1IfEiPP11nifti_imageS1_.str1.8' can not be used when making a shared object; recompile with -fPIC
I tried to add -DCMAKE_POSITION_INDEPENDENT_CODE:BOOL=ON
to the CMAKE_ARGS
section in External_NIFTYREG.cmake
but the error persists.
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub, or mute the thread.
Just given this a go but it looks like it's not possible (as far as I can see) because you can't have dynamic libraries that depend on static libraries.
Swig requires shared libraries (_pyreg.so
), yet NiftyReg with CUDA seems to require static libraries (warning is displayed in NiftyReg with -DBUILD_SHARED_LIBS=ON
: CUDA is not compatible with shared libraries. Forcing BUILD_SHARED_LIBS to OFF
).
Seems therefore that SIRF python wrappers and CUDA-NiftyReg are mutually exclusive.
Swig requires shared libraries
Swig doesn't. we build a shared lib as Python needs it.
you can combine static libs in shared libs, as long as the static ones are compiled with -fPIC
(i.e. -DCMAKE_POSITION_INDEPENDENT_CODE:BOOL=ON
). NiftyReg doesn't need to be built with shared libs. (example: STIR isn't currently either, and you can use NiftyPET's CUDA)
hang on, just realised I can create python swig libraries as static.
PRs #270 and CCPPETMR/SIRF#457 will hopefully do what we want.
I wonder if CMAKE_POSITION_INDEPENDENT_CODE:BOOL=ON
maybe doesn't make it to the CUDA compiler. could be CMake version dependent.
I wonder if CMAKE_POSITION_INDEPENDENT_CODE:BOOL=ON maybe doesn't make it to the CUDA compiler. could be CMake version dependent.
That was my current guess.
Seems python doesn't work with static libraries, I just hadn't deleted the installation directory so was using the old .so
. So I'm not sure what the solution here is...