-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathjupyter_notebook.job
54 lines (45 loc) · 2.08 KB
/
jupyter_notebook.job
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
#!/bin/bash
#
#SBATCH --job-name=jupyter_test_Job
#SBATCH --output=logfiles/jupyter-notebook-%J.log
#SBATCH --nodes=1
#SBATCH --ntasks=20
#SBATCH --partition=normal
#SBATCH --time=20:00:00
#SBATCH --cpus-per-task=2
##SBATCH --mail-type=ALL
##SBATCH --mail-user=<ENTER_YOUR_USERNAME>@crimson.ua.edu
## Printing information about the Slurm Job
export OMP_NUM_THREADS=$SLURM_CPUS_PER_TASK
echo "Name of the cluster on which the job is executing." $SLURM_CLUSTER_NAME
echo "Number of tasks to be initiated on each node." $SLURM_TASKS_PER_NODE
echo "Number of cpus requested per task." $SLURM_CPUS_PER_TASK
echo "Number of CPUS on the allocated node." $SLURM_CPUS_ON_NODE
echo "Total number of processes in the current job." $SLURM_NTASKS
echo "List of nodes allocated to the job" $SLURM_NODELIST
echo "Total number of nodes in the job's resource allocation." $SLURM_NNODES
echo "List of allocated GPUs." $CUDA_VISIBLE_DEVICES
## Load any module that you need
module load Anaconda3
## Run any spacific environment you have
source activate ar-goes
echo 'environment activated'
# get tunneling info
XDG_RUNTIME_DIR=""
ipnport=$(shuf -i8000-9999 -n1)
ipnip=$(hostname -i)
## print tunneling instructions to jupyter-log-{jobid}.txt
echo -e "\n\n Copy/Paste this in your local terminal to ssh tunnel with remote "
echo " ------------------------------------------------------------------"
echo " ssh -N -L $ipnport:$ipnip:$ipnport [email protected] "
echo " ------------------------------------------------------------------"
echo -e "\n\n Then open a browser on your local machine to the following address"
echo " ------------------------------------------------------------------"
echo " localhost:$ipnport "
echo -e " ------------------------------------------------------------------\n\n"
sleep 1
## start an ipcluster instance and launch jupyter server
## For Jupyter Notebook
#jupyter-notebook --no-browser --port=$ipnport --ip=$ipnip
## For Jupyter Lab
jupyter-lab --no-browser --port=$ipnport --ip=$ipnip