Hello,
I try to sort a vector of long thanks to CUDA. I have for that two files : a .cpp file creates and instantiates the vector, transforms it in an array (it’s to make some comparison with the std::sort function) and call a a C function contained the .cu file. The C function calls the function that sorts the array on the GPU.
I made a makefile to compile all that :
[codebox]
all : sorting_aos_vs_soa
test_vector : test_vector.o sorting_aos_vs_soa.cuo
g++ test_vector.o sorting_aos_vs_soa.cuo -o test_vector -lcuda -L/usr/local/cuda/lib -L /opt/NVIDIA_GPU_Computing_SDK/shared/lib/linux/ -I /usr/include/cuda -I /usr/local/cuda/include
test_vector.o : test_vector.cpp
g++ -c test_vector.cpp -o test_vector.o -lcuda -I /usr/include/cuda -I /usr/local/cuda/include
sorting_aos_vs_soa: sorting_aos_vs_soa.cuo
gcc sorting_aos_vs_soa.cuo -o sorting_aos_vs_soa -lcuda -I /usr/include/cuda -I /usr/local/cuda/include
sorting_aos_vs_soa.cuo: sorting_aos_vs_soa.cu
nvcc -c sorting_aos_vs_soa.cu -o sorting_aos_vs_soa.cuo -l cuda -I /usr/include/cuda -I /usr/local/cuda/include -I /usr/local/cuda/lib/ -L /usr/local/cuda/lib
test_vector.cpp : sorting_aos_vs_soa.h
[/codebox]
There are two targets : all and test_vector. The target “all” compiles with no problem and I can execute sorting_aos_vs_soa (it sorts an arrray). When I want to compile “test_vector”, it has some errors when it links the object files. The errors are all like :
[codebox]sorting_aos_vs_soa.cuo: In function `__sti____cudaRegisterAll_53_tmpxft_00003c4a_00000000_4_s
orting_aos_vs_soa_cpp1_ii_66e8d9ac’:
tmpxft_00003c4a_00000000-10_sorting_aos_vs_soa.ii:(.text+0xbeed): undefined reference to `__cudaRegisterShared’
tmpxft_00003c4a_00000000-10_sorting_aos_vs_soa.ii:(.text+0xbefe): undefined reference to `__cudaRegisterShared’
tmpxft_00003c4a_00000000-10_sorting_aos_vs_soa.ii:(.text+0xbf0f): undefined reference to `__cudaRegisterShared’
tmpxft_00003c4a_00000000-10_sorting_aos_vs_soa.ii:(.text+0xbf20): undefined reference to `__cudaRegisterShared’
tmpxft_00003c4a_00000000-10_sorting_aos_vs_soa.ii:(.text+0xbf31): undefined reference to `__cudaRegisterShared’[/codebox]
I’ve also executed these commands :
export LD_LIBRARY_PATH=/home_nfs/fremals/local/starpu/lib/:/usr/local/cuda/lib
export C_INCLUDE_PATH=/home_nfs/fremals/local/starpu/include/:/usr/include/cuda:/usr/local/cuda/include:/home_nfs/fremals/local/myLib:/usr/local/cuda/lib/
I don’t know what to do else so it can compile with no errors. Can someone help me please ?
Thank you !!