Using the ElementwiseKernel Python program example in Chapter 6, Working with CUDA and PyCUDA, (6.4) and the discussion in the How computing in CuPy works on Python section, develop a CuPy version of the same program.
With or without an ElementwiseKernel, use Numba and CuPy to compute the following formula given based on our earlier Numba examples:
The Pollution Index or Pollution Standard Index (PSI) is used to check pollution levels in a certain city, region, or country. It considers six air pollutants: sulphur dioxide (SO2), particulate matter (PM10), fine particulate matter (PM2.5), nitrogen dioxide (NO2), carbon monoxide (CO), and ozone (O3). It is scaled between 0–500 and can be classified into the following five levels:
PSI |
Descriptor |
General health effects |
0–50 |
Good |
None. |
51–100... |