Skip to content
GitLab
  • Explore
  • Sign in
  • EDA Guides
  • eda-servers-guide
  • Wiki
  • gpu limit

gpu limit · Changes

Page history
Update gpu limit authored May 07, 2021 by Daniele Jahier Pagliari's avatar Daniele Jahier Pagliari
Hide whitespace changes
Inline Side-by-side
gpu-limit.md
View page @ e4d0ca88
...@@ -2,4 +2,24 @@ ...@@ -2,4 +2,24 @@
> :warning: Thesis students only have access to `philae.polito.it`, which does not have a GPU installed (see ["Servers Information"](/servers)). So, this page is only for other group members. > :warning: Thesis students only have access to `philae.polito.it`, which does not have a GPU installed (see ["Servers Information"](/servers)). So, this page is only for other group members.
As explained in ["Monitoring Resources"](/monitoring) As explained in the ["Monitoring Resources"](/monitoring) page, GPU memory is a critical resource, since most programs will simply crash when the GPU runs out of memory. It is your responsibility to make sure that you are not monopolizing the entire memory of a GPU for a long time.
\ No newline at end of file
This page lists a set of tricks to limit your GPU memory from commonly used applications and libraries.
## Limiting GPU Memory in Tensorflow 2.0
If you use TensorFlow 2.0 (or Keras with a TensorFlow backend), you can limit the total GPU memory requested by your script directly from the Python code. The basic code snippet to insert in your script is the following:
```python
import tensorflow as tf
gpus = tf.config.experimental.list_physical_devices('GPU')
if gpus:
tf.config.experimental.set_virtual_device_configuration(
gpus[0], [tf.config.experimental.VirtualDeviceConfiguration(memory_limit=megabytes)]
)
```
## Limiting GPU Memory in PyTorch
Clone repository
Home

Servers Information
Accounts
Connecting to the Servers
Storage Management and Quotas
Monitoring Resources
Software, Libraries and Data
  • Using Custom Software
  • Software Modules on Philae
  • Remote Code Deployment
  • Python Virtual Environments
  • EDA Technology Libraries
  • Shared Datasets
Miscellaneous Settings
  • Setting Up CUDA Libraries
  • Choosing which GPU to Use
  • Limiting GPU Memory
  • Limiting CPU Threads
Gitlab

Sidebar