I have worked quite a lot but I am not sure if everything is ok.

Sun May 21 11:29:57 2017       
| NVIDIA-SMI 375.39                 Driver Version: 375.39                    |
| GPU  Name        Persistence-M| Bus-Id        Disp.A | Volatile Uncorr. ECC |
| Fan  Temp  Perf  Pwr:Usage/Cap|         Memory-Usage | GPU-Util  Compute M. |
|   0  GeForce GT 730      Off  | 0000:01:00.0     N/A |                  N/A |
| 40%   39C    P8    N/A /  N/A |    295MiB /  1984MiB |     N/A      Default |

| Processes:                                                       GPU Memory |
|  GPU       PID  Type  Process name                               Usage      |
|    0                  Not Supported                                         |


 nvcc --version
nvcc: NVIDIA (R) Cuda compiler driver
Copyright (c) 2005-2015 NVIDIA Corporation
Built on Tue_Aug_11_14:27:32_CDT_2015
Cuda compilation tools, release 7.5, V7.5.17

And finally

which nvcc

But my installation directory is

ldconfig -p | grep cuda
    libnvrtc.so.8.0 (libc6,x86-64) => /usr/local/cuda-8.0/targets/x86_64-linux/lib/libnvrtc.so.8.0
    libnvrtc.so (libc6,x86-64) => /usr/local/cuda-8.0/targets/x86_64-linux/lib/libnvrtc.so
    libnvrtc-builtins.so.8.0 (libc6,x86-64) => /usr/local/cuda-8.0/targets/x86_64-linux/lib/libnvrtc-builtins.so.8.0
    libnvrtc-builtins.so (libc6,x86-64) => /usr/local/cuda-8.0/targets/x86_64-linux/lib/libnvrtc-builtins.so

Is this ok?Why is nvcc pointing to other directory?

2 Answers 2


Is this ok?

Yes, everything is as expected.

Why is nvcc pointing to other directory?

nvcc lives on the typical folder for executables whereas the others are CUDA "drivers". It's mostly a Nvidia decision but it makes sense.


Compile and run a CUDA hello world

The best answer to "is something installed properly" questions tends to be: "try to use it for whatever you want to use it, and see if blows up and if it is as fast as you would expect".

If the "blows up" part fails, you might then want to try and make a hello world work:


#include <cassert>

#define N 3

__global__ void inc(int *a) {
    int i = blockIdx.x;
    if (i<N) {

int main() {
    int ha[N], *da;
    cudaMalloc((void **)&da, N*sizeof(int));
    for (int i = 0; i<N; ++i) {
        ha[i] = i;
    cudaMemcpy(da, ha, N*sizeof(int), cudaMemcpyHostToDevice);
    inc<<<N, 1>>>(da);
    cudaMemcpy(ha, da, N*sizeof(int), cudaMemcpyDeviceToHost);
    for (int i = 0; i < N; ++i) {
        assert(ha[i] == i + 1);
    return 0;

GitHub upstream.

and compile and run with:

nvcc -o main.out main.cu

and the assert does not fail on my properly working setup.

Then if that fails, go over how to install questions:

Run some CPU vs GPU benchmarks

A more interesting performance check would be to take a well optimized program that does a single GPU-acceleratable algorithm either CPU or GPU, and run both to see if the GPU version is faster.

TODO propose and test one here, e.g. matrix multiplication with both MAGMA (GPU) and LAPACKE (CPU). They might expose the same C API, so it could be easy to compare results.

You could then also open nvidia-settings while that runs to see if the GPU is actually getting used only in the GPU version: How do I check if Ubuntu is using my NVIDIA graphics card?

  • No output from ./inc.out is the expected response? I.e., no error?
    – M1GEO
    Apr 1, 2020 at 1:41
  • 1
    @M1GEO yes, the program has an assert that checks results. Apr 1, 2020 at 7:36
  • I am getting: inc.out: inc.cu:22: int main(): Assertion `ha[i] == i + 1' failed. Aborted (core dumped)
    – harryfeng
    Aug 3, 2020 at 23:57
  • Hi @harryfeng, let me know if you manage to find out if there's a bug in my program or on the installation on your side. I retested on my computer and it worked on Ubuntu 20.04 nvidia-384 driver. The assertion is meant to fail only if something is going wrong. Aug 4, 2020 at 7:39

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .