Difference between revisions of "DAIM-Guide/Python"

From HPC
Jump to: navigation , search
(Created page with "= DAIM == Installing Packages == <pre> !conda install -y python_package </pre> == Checking for GPU Access == Even if you have requested a Jupyter session on one of the GP...")
 
(Checking for GPU Access)
Line 17: Line 17:
 
True
 
True
 
</pre>
 
</pre>
If this reports 'False' then Torch cannot find a valid GPU device.
+
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:
Or with Tensorflow:
 
 
<pre>
 
<pre>
 
>>> import tensorflow as tf
 
>>> import tensorflow as tf
Line 24: Line 23:
 
[PhysicalDevice(name='/physical_device:GPU:0', device_type='GPU')]
 
[PhysicalDevice(name='/physical_device:GPU:0', device_type='GPU')]
 
</pre>
 
</pre>
 +
 +
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:
 +
 +
<pre>
 +
!hostname
 +
</pre>
 +
 +
Please report any issues via the Support portal (see

Revision as of 14:40, 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