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

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.

Related

Installing nvcc

Is there any way to install only the nvcc compiler without installing cuda toolkit?
I want this because I want to compile the cuda program just for syntax check.
Please suggest if there are any other ways for cuda syntax checking
As far I as know, the smallest level of installation granularity in current CUDA distributions is the entire toolkit. There is no way to just install nvcc (and in reality that implies installing a number of binary components beyond the compiler driver, plus all the toolchain header files).

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

What is the difference between the CUDA tookit and the CUDA sdk

I am installing CUDA on Ubuntu 14.04 and have a Maxwell card (GTX 9** series) and I think I have installed everything properly with the toolkit as I can compile my samples. However, I read that in places that I should install the SDK (This appears to be talked about with the sdk 4). I am not sure if the toolkit and sdk are different? As I have a later 9 series card does that mean I have CUDA 6 running? Here is my nvcc version
nvcc: NVIDIA (R) Cuda compiler driver
Copyright (c) 2005-2014 NVIDIA Corporation
Built on Wed_Aug_27_10:36:36_CDT_2014
Cuda compilation tools, release 6.5, V6.5.16
I am following a book and I need to include <cutil.h> and I can't find that file in the includes anywhere where I installed it.
I followed this guide provided by nvidia and as I have done what they say this is why I am confused http://developer.download.nvidia.com/compute/cuda/6_5/rel/docs/CUDA_Getting_Started_Linux.pdf
Thanks for help
CUDA Toolkit is a software package that has different components. The main pieces are:
CUDA SDK (The compiler, NVCC, libraries for developing CUDA software, and CUDA samples)
GUI Tools (such as Eclipse Nsight for Linux/OS X or Visual Studio Nsight for Windows)
Nvidia Driver (system driver for driving the card)
It has also many other components such as CUDA-debugger, profiler, memory checker, etc.
The fact that you are able to compile and run samples means that you probably installed the Toolkit fully and have the SDK, the driver, and the Samples at least.
As for the cutil.h, doing a search in my CUDA 6.5 installation with find -L . -iname "cutil.h" yielded no results. Also looking at other related questions on SO, it seems like this header file does not exist in CUDA installations anymore (since CUDA 5.0). However, looking at the samples, you can find some newer utility headers such as helper_cuda.h being in use. Helpers like these should be located in somewhere like /usr/local/cuda/samples/common/inc in your OS. helper_cuda.h is a header I almost always include in my CUDA programs since I find utility functions such as checkCudaErrors() very useful.
If you are following a book, my recommendation is; try to compile the code, and whenever you get an error saying a utility function is missing, do a grep search in the header files included in samples/common/inc. You will most probably find the missing utility functions there and then you can include the necessary headers accordingly.

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)

Compiling CUDA SDK examples in hardware emulation mode

I'm trying to do some CUDA development on a PC without CUDA-capable GPU via emulation mode. The OS is Linux Mint Debian (can be considered Debian testing for all practical purposes) 32bit (2.6.32-5-686 kernel). Here's what I did so far:
Grabbed the CUDA Toolkit 32 bit and SDK for Ubuntu from http://developer.nvidia.com/cuda-toolkit-40
Installed the CUDA Toolkit in /usr/local/cuda/lib
Added the paths to bashrc
echo "# CUDA stuff
PATH=\$PATH:/usr/local/cuda/bin
LD_LIBRARY_PATH=\$LD_LIBRARY_PATH:/usr/local/cuda/lib
export PATH
export LD_LIBRARY_PATH" >> ~/.bashrc
Added the path to /etc/ld.so.conf.d/cuda.conf:
/usr/local/cuda/lib
Executed "sudo ldconfig"
Restarted the session
Then installed the SDK in /home/user/NVIDIA_GPU_Computing_SDK folder
When I got to NVIDIA_GPU_Computing_SDK/C and type "make emu=1" to compile the examples I get:
nvcc warning : option 'device-emulation' has been deprecated and is ignored
/usr/bin/ld: cannot find -lcudartemu
/usr/bin/ld: cannot find -lcudartemu
collect2: ld returned 1 exit status
Seems like a library missing (rt = runtime ?). There is libcudart3 in the package manager, but wants a whole bunch of nvidia stuff as a dependency, including drivers and I don't even have an NVIDIA card on this machine. Also apparently the GPU emulation is now deprecated... Does anybody have some experience with CUDA emulation?
There is no emulation in CUDA any more. It was deprecated and removed during the 3.x release cycle. There is no emulation support beyond CUDA 3.1 IIRC. Certainly there is nothing you can do in CUDA 4.0.
On Linux, your best bet is to try gpuocelot, which provides a PTX level emulation on x86 processors and a reimplementation of the CUDA APIs.
Although I agree with the suggestion to try Ocelot, when I was in the same boat I found it easiest to go on eBay and get a cheap CUDA capable card to use for testing (I think I paid < $40). If you have the ability to open the hardware (I realize this isn't an option for some people) and to install drivers, that's what I'd suggest.