Skip to content

Commit a3ed692

Browse files
authored
Update README.md
1 parent ce80ad2 commit a3ed692

File tree

1 file changed

+54
-5
lines changed
  • Apptainer-Examples/Nvidia-Tensorflow-Build

1 file changed

+54
-5
lines changed

Apptainer-Examples/Nvidia-Tensorflow-Build/README.md

Lines changed: 54 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,33 +17,82 @@ Start by navigating to the [Nvidia Registry](https://catalog.ngc.nvidia.com/). T
1717

1818
<img src="nvidia-catalog-search.png" alt="nvidia-catalog-search" width="500"/>
1919

20-
Once you find and click the image repository you're looking for, go to the Tags tab. In this example, we'll use the latest (as of this writing) image that uses Python 3. The information needed to bootstrap off this image is the image path. Click the ellipses (```...```) in the top right of the relevant tag's tile and click "Copy Image Path":
20+
Once you find and click the image repository you're looking for, go to the Tags tab. In this example, we'll use the latest (as of this writing) image that uses Python 3. The information needed to bootstrap off this image is the image path. Click the clipboard in the top right of the relevant tag to copy the path:
2121

22-
<img src="tensorflow-tags.png" alt="tensorflow-tags" width="500"/>
22+
<img src="tags.png" alt="tags" width="500"/>
2323

24-
We'll now use this to create our recipe.
24+
This should give you something like ```nvcr.io/nvidia/tensorflow:23.06-tf2-py3```. We'll use this to create our recipe.
2525

2626
### Recipe
2727

28+
Now, take the image path you got from the NGC site and add it to the image's header under ```FROM```. Under ```%post```
29+
30+
```
31+
Bootstrap: docker
32+
FROM: nvcr.io/nvidia/tensorflow:23.06-tf2-py3
33+
34+
%post
35+
pip install astropy
36+
```
37+
2838

2939
### Build
3040

3141
```
32-
[netid@cpu1 ~]$ apptainer build nvidia-tensorflow.sif nvidia-tensorflow.recipe
42+
[netid@cpu6 ~]$ singularity build nvidia-tf23.06.astro.sif nvidia-tf23.06.astro.recipe
3343
INFO: User not listed in /etc/subuid, trying root-mapped namespace
3444
INFO: The %post section will be run under fakeroot
3545
INFO: Starting build...
3646
. . .
47+
INFO: Creating SIF file...
48+
INFO: Build complete: nvidia-tf23.06.astro.sif
3749
```
3850

3951
## Job Example
4052

53+
### Python Script
54+
55+
```python
56+
#!/usr/bin/env python3
57+
58+
import tensorflow as tf
59+
import astropy
60+
61+
print("Num GPUs Available: ", len(tf.config.list_physical_devices('GPU')))
62+
```
63+
4164
### Batch Script
4265

66+
```bash
67+
#!/bin/bash
68+
69+
#SBATCH --account=YOUR_GROUP_HERE
70+
#SBATCH --partition=standard
71+
#SBATCH --nodes=1
72+
#SBATCH --ntasks=1
73+
#SBATCH --gres=gpu:1
74+
#SBATCH --time=00:05:00
75+
76+
singularity exec --nv nvidia-tf23.06.astro.sif python3 nvidia-test.py
77+
```
78+
4379
### Submission
80+
```terminal
81+
[netid@wentletrap ~]$ sbatch nvidia-test.slurm
82+
Submitted batch job 2067225
83+
```
4484

4585
### Output
46-
86+
```terminal
87+
[netid@wentletrap ~]$ cat slurm-2067225.out
88+
INFO: underlay of /etc/localtime required more than 50 (91) bind mounts
89+
INFO: underlay of /usr/bin/nvidia-smi required more than 50 (523) bind mounts
90+
13:4: not a valid test operator: (
91+
13:4: not a valid test operator: 530.30.02
92+
2023-07-18 14:38:09.613020: I tensorflow/core/platform/cpu_feature_guard.cc:183] This TensorFlow binary is optimized to use available CPU instructions in performance-critical operations.
93+
To enable the following instructions: SSE3 SSE4.1 SSE4.2 AVX, in other operations, rebuild TensorFlow with the appropriate compiler flags.
94+
Num GPUs Available: 1
95+
```
4796

4897
-----
4998
[![](/Images/home.png)](https://ua-researchcomputing-hpc.github.io/)

0 commit comments

Comments
 (0)