carpentries-incubator / lesson-gpu-programming

GPU Programming with Python and CUDA.
https://carpentries-incubator.github.io/lesson-gpu-programming/
Other
19 stars 12 forks source link

Missing dependency for non-Colab Setup #94

Closed Sparrow0hawk closed 1 year ago

Sparrow0hawk commented 1 year ago

Hi 👋

I'm testing out this code in advance of a workshop running this lesson. We're using a different system to colab and I noticed that matplotlib is missing as a dependency in the setup section.

import pylab as pyl

# Necessary command to render a matplotlib image in a Jupyter notebook.

%matplotlib inline

# Display the image

# You can zoom in using the menu in the window that will appear

pyl.imshow(deltas[0:32, 0:32])

pyl.show()

​

---------------------------------------------------------------------------
ModuleNotFoundError                       Traceback (most recent call last)
Cell In[7], line 1
----> 1 import pylab as pyl
      2 # Necessary command to render a matplotlib image in a Jupyter notebook.
      3 get_ipython().run_line_magic('matplotlib', 'inline')

ModuleNotFoundError: No module named 'pylab'

After installing matplotlib this issue went away. I'll raise a PR and suggest it back.

Sparrow0hawk commented 1 year ago

Just to note I discovered this setting up my environment with conda but assume the same will be true of pip.

isazi commented 1 year ago

Thanks, I guess that both on Colab and the system we use usually to teach this course matplotlib is installed and we never noticed.

Sparrow0hawk commented 1 year ago

Also found that scipy is missing:

from scipy.signal import convolve2d as convolve2d_cpu

convolved_image_using_CPU = convolve2d_cpu(deltas, gauss)

pyl.imshow(convolved_image_using_CPU[0:32, 0:32])

pyl.show()

%timeit -n 1 -r 1 convolve2d_cpu(deltas, gauss)
---------------------------------------------------------------------------
ModuleNotFoundError                       Traceback (most recent call last)
Cell In[13], line 1
----> 1 from scipy.signal import convolve2d as convolve2d_cpu
      3 convolved_image_using_CPU = convolve2d_cpu(deltas, gauss)
      4 pyl.imshow(convolved_image_using_CPU[0:32, 0:32])

ModuleNotFoundError: No module named 'scipy'
Sparrow0hawk commented 1 year ago

I'm still working through the lesson so will get through everything post what I find here and submit a more fulsome PR!

Sparrow0hawk commented 1 year ago

astropy is also missing for real world example section.