Cannot load .cubin module in CUDA Driver API - cuda

I am using 0.3.1 JCuda and 3.1 nvidia cuda sdk. I am trying to run JCudaRuntimeDriverMixSample.java from here. I compiled the .cu file with "nvcc -keep invertVectorElements.cu". I set the cuModuleLoad filename to the .sm_10.cubin file generated.
When I run the compiled java file, I get CUDA_ERROR_INVALID_SOURCE. I am running nvidia driver version 256.53 on a GTS 450 gpu.

Have you tried loading the .ptx file rather than the .cubin file? As I understand it, .cubin files are already assembled for very particular architectures, whereas .ptx are JIT-compiled by the driver. (You can still use cuModuleLoad with .ptx). You're attempting to load the sm_10 version of the cubin - but do you have a compute capability 1.0 device?

Related

Cannot find libspirv-nvptx64--nvidiacl.bc when used intel clang++ to build binary for nvidia cuda GPU

I used below command to build binary for nvidia GPU:
clang++ -fsycl -fsycl-targets=nvptx64-nvidia-cuda simple-sycl-app.cpp -o simple-sycl-app-cuda
But got below error message:
clang++: error: cannot find 'libspirv-nvptx64--nvidiacl.bc'; provide path to libspirv library via '-fsycl-libspirv-path', or pass '-fno-sycl-libspirv' to build without linking with libspirv
I searched in both intel oneAPI installation path and cuda toolkit path, but cannot find the spirv-nvptx64-nvidiacl.bc.
Anyone knows where to find libspirv-nvptx64—nvidiacl.bc?
It looks like you are trying to compile using the DPC++ compiler for Nvidia GPUs.
This option is not included in the oneAPI release installations from the Intel website. At the moment you will need to compile the DPC++ LLVM project with this enabled to be able to use the appropriate flag to target Nvidia devices.
You can follow the instructions on this page to compile the project and then it explains how to use the ptx target. In the future Codeplay, the company I work for, intends to publish release binaries that include the ptx compiler option.

Is libcudpp.so missing from CUDA 7.0?

I am using jCuda and tried to compile and run one of its examples(JCudppHashSample) available on jcuda on Ubuntu 14.04 with CUDA 7.0.
But at compile time the library jcudpp says that there is no libcudpp available. And I am wondering is it missing from cuda sdk or not?
I don't like the idea of getting its source and make it manually.
It's not part of the CUDA toolkit or CUDA SDK.
You will have to get it from its source.
The JCuda pages you linked indicate:
JCudpp is only a Java binding for CUDPP. That means, in order to use JCudpp, you need the CUDPP library. This library can be compiled from the source code that is available at the CUDPP home page

Correctly understanding cuda versioning and compatibility

CUDA programming guide states that:
the driver API is backward compatible, meaning that applications, plug-ins, and libraries (including the C runtime) compiled against a particular version of the driver API will continue to work on subsequent device driver releases
I understand this as that, if my code was compiled on CUDA4, the binary will run on CUDA5. However, it turned out that running the CUDA5-compiled binary on CUDA5 led to:
error while loading shared libraries: libcudart.so.4: cannot open shared object file: No such file or directory
Note that I am using the "module" facility in Linux to switch in between different cuda versions, i.e.
module load cuda4
compile
module unload cuda4
module load cuda5
run
It is the developers responsibility to package libcudart.so.4 with the application. The module command is likely changing your LD_LIBRARY_PATH or your PATH variable so LDD is not finding libcudart.so.4. I recommend you add a post build step to copy the required .so into your application directory.
ATTACHMENT A in EULA.txt at the root of the CUDA Toolkit directory lists the Redistributable Software. This includes libcudart.so (and variations that have version number information embedded in the file name). This also includes libcufft, libcublas, ...

CUDA 5.0 wants the libcudart from CUDA 4.0?

I just upgraded from CUDA 4.2 to CUDA 5.0. Not surprisingly, the library that used to be named libcudart.so.4 is now called libcudart.so.5.0. After recompiling my code with nvcc 5.0, and attempting to running the code, I got this message:
./main: error while loading shared libraries: libcudart.so.4: cannot open shared object file: No such file or directory
Yeah, you stupid system, I know there's no libcudart.so.4. That's because it's now called libcudart.so.5.0. Why is it looking for libcudart.so.4 instead of libcudart.so.5.0, and how can I fix it?
What I've tried so far:
I've checked that all my paths are in order. These environment variables are set:
export PATH=$PATH:/usr/local/cuda/bin:/usr/lib
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/cuda/lib:/usr/local/cuda/lib64:/lib
#note: /usr/local/cuda is symlinked to /usr/local/cuda-5.0
I've verified that libcudart.so.5.0 can be found in one of the LD_LIBRARY_PATH directories.
I recompiled my CUDA application with the the CUDA 5.0 version of nvcc. I successfully compiled and ran my application on an other machine with CUDA 4.2, and on an other machine with CUDA 4.0.
I confirmed that nvcc is really on version 5.0:
user#host$ nvcc --version
nvcc: NVIDIA (R) Cuda compiler driver
Copyright (c) 2005-2012 NVIDIA Corporation
Built on Fri_Sep_21_17:28:58_PDT_2012
Cuda compilation tools, release 5.0, V0.2.122
I'd like to get this question off the unanswered list, and I don't think #Jared Hoberock will mind, so I'm going to post his comment as an answer. If there's a concern and Jared or solvingPuzzles posts an answer, I'll delete mine (assuming it's not accepted -- I can't delete an accepted answere AFAIK).
nvcc seems to be statically linking against libcudart.a version 4.
Somewhere in your lib path, it seems that nvcc is finding an old libcudart.a, which needs to be removed.
For other readers, it's probably just sufficient to find all instances of libcudart.* on the system and delete any that don't match your desired CUDA version (assuming you're not trying to run a machine with multiple CUDA versions available -- in that case, the library paths for both compiling and running have to be managed appropriately)

cutil.h CUT_SAFE_CALL in CUDA 4.0

I am using CUDA 4.0 . I am trying to use the following functions.
CUT_DEVICE_INIT();
CUT_SAFE_CALL(cutCreateTimer(&hTimer));
I included cutil.h to use the above functions. But the compiler reports the following..
fatal error C1083: Cannot open include file: 'cutil.h': No such file or directory
I searched in the CUDA directory but there is no file 'cutil.h'.
How can I find the time needed for a CUDA function using the above method? (not using the C++ timer)
You probably didn't tell your compiler where to find the file. I can't tell you exactly because you didn't provide details on what system you are using but for example, on Windows XP and assuming a default installation of version 4.0 of the SDK the cutil.h header file is in:
C:\Documents and Settings\All Users\Application Data\NVIDIA Corporation\NVIDIA GPU Computing SDK 4.0\C\common\inc
For Windows 7 I think it is:
C:\Program Data\NVIDIA Corporation\NVIDIA GPU Computing SDK 4.0\C\common\inc
but not sure.