Getting ready

Numba (release 0.45) is compatible with Python 2.7 and 3.5 or later, as well as NumPy versions 1.7 to 1.16

To install numba, it is recommended as per pyopencl to use the Anaconda framework, so, from the Anaconda Prompt, just type the following:

(base) C:> conda install numba

In addition, to use the full potential of numba, the cudatoolkit library must be installed:

(base) C:> conda install cudatoolkit

After that, it's possible to verify whether the CUDA library and GPU are properly detected.

Open the Python interpreter from the Anaconda Prompt:

(base) C:> python
Python 3.7.3 (default, Apr 24 2019, 15:29:51) [MSC v.1915 64 bit (AMD64)] :: Anaconda, Inc. on win32
Type "help", "copyright", "credits" or "license" for more information.
>>

The first test entails checking whether the CUDA library (cudatoolkit) is properly installed:

>>> import numba.cuda.api
>>> import numba.cuda.cudadrv.libs
>>> numba.cuda.cudadrv.libs.test()

The following output shows the quality of the installation, where all the checks returned a positive result:

Finding cublas from Conda environment
located at C:UsersGiancarloAnaconda3Libraryincublas64_10.dll
trying to open library... ok
Finding cusparse from Conda environment
located at C:UsersGiancarloAnaconda3Libraryincusparse64_10.dll
trying to open library... ok
Finding cufft from Conda environment
located at C:UsersGiancarloAnaconda3Libraryincufft64_10.dll
trying to open library... ok
Finding curand from Conda environment
located at C:UsersGiancarloAnaconda3Libraryincurand64_10.dll
trying to open library... ok
Finding nvvm from Conda environment
located at C:UsersGiancarloAnaconda3Libraryin vvm64_33_0.dll
trying to open library... ok
Finding libdevice from Conda environment
searching for compute_20... ok
searching for compute_30... ok
searching for compute_35... ok
searching for compute_50... ok
True

In the second test, we verify the presence of a graphics card: 

>>> numba.cuda.api.detect()

The output shows the graphic card found and whether it is supported:

Found 1 CUDA devices
id 0 b'GeForce 840M' [SUPPORTED]
compute capability: 5.0
pci device id: 0
pci bus id: 8
Summary:
1/1 devices are supported
True
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.225.31.159