PyCuda install linux

1. Download the source

Official site, but the download link is broken down, when I visited it. (We can go directly to pypi site to download the source)

# tar the source
tar xfz pycuda-VERSION.tar.gz

2. Build

2.1 NVCC

When I build the project, I faced error with “NVCC”. we could ignore it, and we can build successfully, while it will greatly limit the functions.
So we should first source correctly the NVCC library to PATH.

export PATH=$PATH:/usr/local/cuda-10.2/bin

To find your cuda path (for me it is “/usr/local/cuda-10.2”) :

find / -type d -name cuda 2>/dev/null

Then add NVCC path to the file

def compile_plain(source, options, keep, nvcc, cache_dir, target="cubin"):
    from os.path import join

    assert target in ["cubin", "ptx", "fatbin"]
    # add the following line
    nvcc = '/usr/local/cuda-10.2/bin/'+nvcc

2.2 configure and make

Use the cuda path you have found above.

python --cuda-root=/where/ever/you/installed/cuda

For me the full commend is :

/home/viki/virtualenv/bastian/bin/python --cuda-root=/usr/local/cuda-10.2

Then make the project :

sudo make install


2.3 Test

For test the library:

cd test

I get a pass. .............................                                                   [100%]

========================================== warnings summary ==========================================
  /home/viki/UTOPA/virtualenv/utopa/lib/python3.6/site-packages/pycuda-2019.1.2-py3.6-linux-x86_64.egg/pycuda/ PytestUnknownMarkWarning: Unknown pytest.mark.cuda - is this a typo?  You can register custom marks to avoid this warning - for details, see
    return mark_test.cuda(f)

-- Docs:
=================================== 29 passed, 1 warning in 19.01s ===================================
©️2020 CSDN 皮肤主题: 大白 设计师:CSDN官方博客 返回首页