1

My development environment is: Ubuntu 18.04.5 LTS, Python3.6 and I have installed via conda (numba and cudatoolkit). Nvidia GPU GeForce GTX 1050 Ti, which is supported by cuda.

The installation of conda and numba seem to work as intended as I can import numba within python3.6 scripts.

The problem seems identical situation to the question asked here: Cuda: library nvvm not found but none of the proposed solutions seem to work in my case, and I'm not sure how to highlight my situation properly (I can't do it through an answer in the other thread...). If raising a duplicate of the question is inappropriate, then guide me to proper conduct.

When I try to run the code below I get the following error: numba.cuda.cudadrv.error.NvvmSupportError: libNVVM cannot be found. Do conda install cudatoolkit: library nvvm not found

from numba import cuda, float32

#Controls threads per block and shared memory usage.
#The computation will be done on blocks of TPBxTPB elements.

TPB = 16

@cuda.jit
def fast_matmul(A, B, C):
    # Define an array in the shared memory
    # The size and type of the arrays must be known at compile time
    sA = cuda.shared.array(shape=(TPB, TPB), dtype=float32)
    sB = cuda.shared.array(shape=(TPB, TPB), dtype=float32)

    x, y = cuda.grid(2)

    tx = cuda.threadIdx.x
    ty = cuda.threadIdx.y
    bpg = cuda.gridDim.x    # blocks per grid

    if x >= C.shape[0] and y >= C.shape[1]:
        # Quit if (x, y) is outside of valid C boundary
        return

    # Each thread computes one element in the result matrix.
    # The dot product is chunked into dot products of TPB-long vectors.
    tmp = 0.
    for i in range(bpg):
        # Preload data into shared memory
        sA[tx, ty] = A[x, ty + i * TPB]
        sB[tx, ty] = B[tx + i * TPB, y]

        # Wait until all threads finish preloading
        cuda.syncthreads()

        # Computes partial product on the shared memory
        for j in range(TPB):
            tmp += sA[tx, j] * sB[j, ty]

        # Wait until all threads finish computing
        cuda.syncthreads()

    C[x, y] = tmp
    

import numpy as np
matrix_A = np.array([[0.1,0.2],[0.1,0.2]])

Doing as suggested and running conda install cudatoolkit does not work. I have tried many variations on this install that I've found online to no avail.

In the other post a solution that seems to have worked for many is to add lines about environment variables in the .bashrc file in the home directory. The suggestions however refer to files that exist in the /usr directory, where I have no cuda data since I've installed through conda. I have tried many variations on these exports without success. This is perhaps where the solution lies, but if so then the solution would benefit from being generalized.

Does anyone have any up-to-date or generalized solutions to this problem?

EDIT: adding information from terminal outputs (thanks for the hint of editing the question to do so)

> conda list numba
# packages in environment at /home/tobka/anaconda3:
#
# Name                    Version          Build  Channel
numba                     0.51.2           py38h0573a6f_1 

> conda list cudatoolkit
# packages in environment at /home/tobka/anaconda3:
#
# Name                    Version          Build  Channel
cudatoolkit               11.0.221         h6bb024c_0

Also adding output from numba -s: https://pastebin.com/raw/6u1MUkxg

Idea of possible cause (not yet confirmed): I noticed in the numba -s output that it specifies Python Version: 3.8.3, where I've been explicitly using python3.6 in the terminal since simply using python has usually meant using python2.7. I checked however, and my system now uses Python 3.8.3 with the python command, and Python 3.6.9 with the python3.6. And when running the code using python I get a syntax error instead, which is a good sign: raise ValueError(missing_launch_config_msg).

I will try to fix the syntax errors and confirm that the code works, after which I will report here of the situation.

thecpaptain
  • 361
  • 2
  • 4
  • 10
  • 3
    [this](https://github.com/numba/numba/issues/3411) may be of interest. what is the result of running `conda list numba` and `conda list cudatoolkit` ? You don't have to jam the results into comments, you can edit your question. – Robert Crovella Sep 24 '20 at 20:40

1 Answers1

1

Confirmation of solution: using python instead of python3.6 in the terminal solved the problem. The root cause was the user.

thecpaptain
  • 361
  • 2
  • 4
  • 10