lele-cecere
commited on
Commit
•
b404604
1
Parent(s):
61f55cc
Added docker commands and gpu_check.py
Browse files- Dockerfile +7 -0
- gpu_check.py +7 -0
Dockerfile
CHANGED
@@ -6,6 +6,13 @@ COPY ./requirements.txt /code/requirements.txt
|
|
6 |
|
7 |
RUN pip install --no-cache-dir --upgrade -r /code/requirements.txt
|
8 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
9 |
# Set up a new user named "user" with user ID 1000
|
10 |
RUN useradd -m -u 1000 user
|
11 |
|
|
|
6 |
|
7 |
RUN pip install --no-cache-dir --upgrade -r /code/requirements.txt
|
8 |
|
9 |
+
# Install PyTorch for GPU check
|
10 |
+
RUN pip install --no-cache-dir torch torchvision
|
11 |
+
|
12 |
+
# Add and run the GPU check script
|
13 |
+
COPY gpu_check.py /code/gpu_check.py
|
14 |
+
RUN python /code/gpu_check.py
|
15 |
+
|
16 |
# Set up a new user named "user" with user ID 1000
|
17 |
RUN useradd -m -u 1000 user
|
18 |
|
gpu_check.py
ADDED
@@ -0,0 +1,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import torch
|
2 |
+
|
3 |
+
if torch.cuda.is_available():
|
4 |
+
print("CUDA GPU is available")
|
5 |
+
print("GPU:", torch.cuda.get_device_name(0))
|
6 |
+
else:
|
7 |
+
print("CUDA GPU is not available")
|