How it works...

The following command is used to import the pyopencl library:

import pyopencl as cl

This allows us to use the get_platforms method, which returns a list of platform instances, that is, a list of devices in the system:

for platform in cl.get_platforms():

Then, for each device found, the following main features are shown:

  • Name and device type
  • Max clock speed
  • Compute units
  • Local/constant/global memory

The output for this example is as follows:

(base) C:>python deviceInfoPyopencl.py

=============================================================
OpenCL Platforms and Devices
============================================================
Platform - Name: NVIDIA CUDA
Platform - Vendor: NVIDIA Corporation
Platform - Version: OpenCL 1.2 CUDA 10.1.152
Platform - Profile: FULL_PROFILE
--------------------------------------------------------
Device - Name: GeForce 840M
Device - Type: GPU
Device - Max Clock Speed: 1124 Mhz
Device - Compute Units: 3
Device - Local Memory: 48 KB
Device - Constant Memory: 64 KB
Device - Global Memory: 2 GB
Device - Max Buffer/Image Size: 512 MB
Device - Max Work Group Size: 1024
============================================================
Platform - Name: Intel(R) OpenCL
Platform - Vendor: Intel(R) Corporation
Platform - Version: OpenCL 2.0
Platform - Profile: FULL_PROFILE
--------------------------------------------------------
Device - Name: Intel(R) HD Graphics 5500
Device - Type: GPU
Device - Max Clock Speed: 950 Mhz
Device - Compute Units: 24
Device - Local Memory: 64 KB
Device - Constant Memory: 64 KB
Device - Global Memory: 3 GB
Device - Max Buffer/Image Size: 808 MB
Device - Max Work Group Size: 256
--------------------------------------------------------
Device - Name: Intel(R) Core(TM) i7-5500U CPU @ 2.40GHz
Device - Type: CPU
Device - Max Clock Speed: 2400 Mhz
Device - Compute Units: 4
Device - Local Memory: 32 KB
Device - Constant Memory: 128 KB
Device - Global Memory: 8 GB
Device - Max Buffer/Image Size: 2026 MB
Device - Max Work Group Size: 8192
..................Content has been hidden....................

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