Difference between revisions of "DAIM-Guide/Python"

From HPC
Jump to: navigation , search
(Checking for GPU Access)
(Checking for GPU Access)
Line 30: Line 30:
 
</pre>
 
</pre>
  
Please report any issues via the Support portal (see
+
Please report any issues via the Support portal (see [[General/GettingHelp| Getting help]])

Revision as of 14:42, 2 July 2025

= DAIM


Installing Packages

!conda install -y python_package


Checking for GPU Access

Even if you have requested a Jupyter session on one of the GPU resources, it is important to check that you actually have GPU access for your notebook when first setting up your workflow. You can do this as follows:

With Torch:

>>> import torch
>>> torch.cuda.is_available()
True

If this reports 'False' then Torch cannot find a valid GPU device. Similarly, with Tensorflow you can check with the following. If you don't see a similar output referencing a device, and instead see an error mentioning not being able to load libcuda library or indicating nvidia drivers not existing, then the Tensorflow cannot find the GPU device:

>>> import tensorflow as tf
>>> tf.config.list_physical_devices('GPU')
[PhysicalDevice(name='/physical_device:GPU:0', device_type='GPU')]

If your session does not find a GPU device, please confirm you are running on a GPU enabled system, the following should report a gpu hostname (e.g. gpu01 - gpu09) etc:

!hostname

Please report any issues via the Support portal (see Getting help)