4/12/2023 0 Comments Cudalaunch reviews![]() ![]() Unfortunately, compilation fails and I don’t know how to debug. This code is some university assignment that I am trying out. Rm -f testmain test1.o test2.o link.o libtest.so main.I am compiling some code that runs saxpy on GPU. Even though the gtx1060 FP16 computing power is too low. Nvcc -m64 -arch=sm_20 -Xcompiler '-fPIC' -dlink test1.o test2.o -o link.o My cuda version is 10.0 My gpu is RTX2080 Who can help me see what is the cause of the error Interestingly, I can run the code well on my gtx1060 gpu. Nvcc -m64 -arch=sm_20 -dc -Xcompiler '-fPIC' test1.cu test2.cu Link.o : test1.cu test2.cu test1.h test2.h G -shared -Wl,-soname,libtest.so -o libtest.so test1.o test2.o link.o -L/usr/local/cuda/lib64 -lcudart ltest -L/usr/local/cuda/lib64 -lcudart main.o However the following relatively simple modification (example Makefile) should work under either cuda 5.0 or cuda 5.5. You may wish to also review the relevant section of the nvcc manual and also review the examples.ĮDIT: I tested this under cuda 5.5 RC, and the final application link step complained about not finding the cudart lib ( warning: libcudart.so.5.5., needed by. I'm sure there is more than one way to accomplish this. I don't believe it makes any difference, but it may be more familiar syntax. Note that if you prefer, you may generate a libtest.so instead of test.so, and then you may use a modified build sequence for the test executable: g -c main.cpp When I compile according to the commands given, and run. Int idx = threadIdx.x (blockDim.x *blockIdx.x) ĬudaMemcpy(h_data, d_data, DSIZE * sizeof(int), cudaMemcpyDeviceToHost) These are the files I used for test purposes:ĬudaError_t _err = cudaGetLastError() \įprintf(stderr, "Fatal error: %s (%s at %s:%d)\n", \įprintf(stderr, "*** FAILED - ABORTING\n") \ To run it, simply execute the testmain executable, but be sure the test.so library is on your LD_LIBRARY_PATH. Now, for the test executable, the build commands are as follows: g -c main.cpp It seems you may be missing the second step above in your makefile, but I haven't analyzed if there are any other issues with your makefile. G -shared -o test.so test1.o test2.o link.o -L/usr/local/cuda/lib64 -lcudart Nvcc -arch=sm_20 -Xcompiler '-fPIC' -dlink test1.o test2.o -o link.o The build commands for this are as follows: nvcc -arch=sm_20 -Xcompiler '-fPIC' -dc test1.cu test2.cu create a shared library containing my CUDA kernels that has aįirst the shared library.Here's an example linux shared object creation along the lines you indicated: So CUDA somehow did not get linked to the shared library MYLIB.soĬUDA did not even get linked to the object file somehow: Nm libMYLIB.so shows that all CUDA api functions are "undefined symbols": U _cudaRegisterFunction Nvcc -m64 -arch=sm_20 -dc -Xcompiler '-fPIC' MYLIB.cu -o MYLIB.o -L/the/cuda/lib/dir -lcudart G -shared -Wl,-soname,libMYLIB.so -o libMYLIB.so MYLIB.o -L/the/cuda/lib/dir -lcudart Simplified makefile: libMYlib.so : MYLIB.o shared library MYLIB.so seems to compile fine.create a test executable for the shared library.create a shared library containing my CUDA kernels that has a CUDA-free wrapper/header. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |