- If you don't have a virtual environment, download
create_venv.sh
and do this in your working directory:source create_venv.sh
- Run
run-jupyter.sbatch
and follow the instructions in NYU Prince Tutorial on how to run Jupyter Notebook:sbatch run-jupyter.sbatch
Last active
December 1, 2023 18:25
-
-
Save jimmyahacker/827e5940deb1fcc5f04b51628c2f4fca to your computer and use it in GitHub Desktop.
How to run Jupyter Notebook on NYU HPC to run tensorflow
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# activate existed python3 module to get virtualenv | |
module load python3/intel/3.6.3 | |
# create virtual environment with python3 | |
virtualenv -p python3 .env | |
# activate virtual environment | |
source .env/bin/activate | |
# install tensorflow-gpu | |
pip install --upgrade pip | |
pip install tensorflow-gpu | |
pip install jupyter | |
# uncomment the following line if you have requirements.txt file | |
# pip install -r requirements.txt | |
# unload module | |
module unload python3/intel/3.6.3 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
#SBATCH --job-name=jupyter | |
#SBATCH --nodes=1 | |
#SBATCH --gres=gpu:1 | |
#SBATCH --cpus-per-task=4 | |
#SBATCH --mem=16GB | |
#SBATCH --time=12:00:00 | |
module purge | |
module load cuda/9.0.176 cudnn/9.0v7.0.5 | |
source .env/bin/activate | |
port=$(shuf -i 6000-9999 -n 1) | |
/usr/bin/ssh -N -f -R $port:localhost:$port log-0 | |
/usr/bin/ssh -N -f -R $port:localhost:$port log-1 | |
cat<<EOF | |
Jupyter server is running on: $(hostname) | |
Job starts at: $(date) | |
Step 1 : | |
If you are working in NYU campus, please open an iTerm window, run command | |
ssh -L $port:localhost:$port [email protected] | |
If you are working off campus, you should already have ssh tunneling setup through HPC bastion host, | |
that you can directly login to prince with command | |
ssh $USER@prince | |
Please open an iTerm window, run command | |
ssh -L $port:localhost:$port $USER@prince | |
Step 2: | |
Keep the iTerm windows in the previouse step open. Now open browser, find the line with | |
The Jupyter Notebook is running at: $(hostname) | |
the URL is something: http://localhost:${port}/?token=XXXXXXXX (see your token below) | |
you should be able to connect to jupyter notebook running remotly on prince compute node with above url | |
EOF | |
unset XDG_RUNTIME_DIR | |
if [ "$SLURM_JOBTMP" != "" ]; then | |
export XDG_RUNTIME_DIR=$SLURM_JOBTMP | |
fi | |
jupyter notebook --no-browser --port $port --notebook-dir=$(pwd) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment