Skip to content

Commit 227d007

Browse files
authored
Merge pull request #77 from carlos-encs/tensorf-cuda
Add Tensorflow - Conda/CUDA example
2 parents 7cc256f + 4355e2c commit 227d007

File tree

3 files changed

+400
-0
lines changed

3 files changed

+400
-0
lines changed

src/tensorflow-conda/README.md

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# Tensorflow in Conda
2+
Installation and configuration of a Conda environment for tensorflow with Cuda compatibility
3+
4+
## Instructions
5+
* Conda environment creation, tensorflow and cuda packages installation
6+
7+
* Connect to a node (salloc):
8+
```bash
9+
mkdir -p /speed-scratch/$USER/envs/{tmp,pkgs,cache}
10+
setenv ENV_DIR /speed-scratch/$USER/envs
11+
setenv CONDA_PKGS_DIRS /speed-scratch/$USER/envs/pkgs
12+
conda create -y -p $ENV_DIR/conda-env python=3.10
13+
conda activate $ENV_DIR/conda-env
14+
conda install -c nvidia cuda-toolkit=12.5
15+
conda install -c conda-forge tensorflow-gpu matplotlib numpy
16+
```
17+
* Modify according your needs (path, Environment_Name) the script `tf-speed.sh`
18+
* In a submit node, run the script `tf-speed.sh`
19+
```bash
20+
sbatch -ppg tf-speed.sh
21+
```
22+
The `-p` parameter could have any of our GPU partitions: `pt`, `pg`, `pa`, `cl`, `em`, `pn`
23+

src/tensorflow-conda/tf-speed.sh

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
#!/encs/bin/tcsh
2+
3+
#SBATCH --nodes=1
4+
#SBATCH --mem=10G
5+
#SBATCH --gpus=1
6+
7+
set ENV_NAME = conda-env
8+
set ENV_DIR = /speed-scratch/$USER/envs
9+
set ENV_PATH = $ENV_DIR/$ENV_NAME
10+
setenv CONDA_PKGS_DIRS $ENV_DIR/pkgs
11+
# activate the environment created before
12+
conda activate $ENV_PATH
13+
# Directory where the script is located
14+
srun python $PWD/tf-stress.py
15+
conda deactivate

0 commit comments

Comments
 (0)