How to do it...

Let's look at the steps, as follows:

  1. With the first instruction, we import the Python driver (that is, pycuda.driver) to the CUDA library installed on our PC:
import pycuda.driver as drv
  1. Initialize CUDA. Note also that the following instruction must be called before any other instruction in the pycuda.driver module:
drv.init()
  1. Enumerate the number of GPU cards on the PC:
print ("%d device(s) found." % drv.Device.count())
  1. For each of the GPU cards present, print the model name, the computing capability, and the total amount of memory on the device in kilobytes:
for ordinal i n range(drv.Device.count()): 
       dev = drv.Device(ordinal) 
       print ("Device #%d: %s" % (ordinal, dev.name()) 
       print ("Compute Capability: %d.%d"% dev.compute_capability()) 
       print ("Total Memory: %s KB" % (dev.total_memory()//(1024))) 
..................Content has been hidden....................

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