Difference between revisions of "DAIM-Guide/Python"
(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...") |
|||
| (2 intermediate revisions by the same user not shown) | |||
| Line 1: | Line 1: | ||
| − | |||
| − | |||
| − | |||
== Installing Packages == | == Installing Packages == | ||
<pre> | <pre> | ||
| Line 17: | Line 14: | ||
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: |
| − | |||
<pre> | <pre> | ||
>>> import tensorflow as tf | >>> import tensorflow as tf | ||
| Line 24: | Line 20: | ||
[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 [[General/GettingHelp| Getting help]]) | ||
Latest revision as of 09:16, 3 October 2025
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)