Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a reproducible setup script for TensorFlow with GPU support in the examples folder #154

Open
lebrice opened this issue Jan 26, 2023 · 0 comments

Comments

@lebrice
Copy link
Contributor

lebrice commented Jan 26, 2023

There was a question in the Office Hours: How to get a working TensorFlow setup with GPU on the Mila cluster.

I wasn't able to give a good, definitive answer. I looked online, tried a myriad of different ways to install tensorflow, but didn't manage to get any variation of this kind of script to work, at all.

Perhaps this kind of thing is trivial to someone like @obilaniu . If so, please let me know, and I'll send the instructions along to the student in question.

#!/bin/bash
#SBATCH --job-name=tensorflow_gpu_setup_test
#SBATCH --cpus-per-task=1
#SBATCH --mem=16G
#SBATCH --gres=gpu:1
#SBATCH --time=0-00:10:00              # should setup in under 10 minutes, right?

module load miniconda/3
conda create -p $SLURM_TMPDIR/env python=3.9
conda activate $SLURM_TMPDIR/env

# Now do whatever is necessary (module load, conda install, pip install, env variable magic, ...)
# to make the last line work.
 
python -c "import tensorflow as tf; assert tf.config.list_physical_devices('GPU') != []"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant