投递任务,注意资源设置
#!/bin/bash
#SBATCH --nodes=1
#SBATCH --ntasks=1
#SBATCH --cpus-per-task=1
#SBATCH --mem=4G
#SBATCH --time 00:05:00
#SBATCH --job-name jupyter-notebook
#SBATCH --output jupyter-notebook-%J.log
# get tunneling info
XDG_RUNTIME_DIR=""
node=$(hostname -s)
user=$(whoami)
cluster="tigercpu"
port=8889
# print tunneling instructions jupyter-log
echo -e "
Command to create ssh tunnel:
ssh -N -f -L ${port}:${node}:${port} ${user}@${cluster}.princeton.edu
Use a Browser on your local machine to go to:
localhost:${port} (prefix w/ https:// if using password)
"
# load modules or conda environments here
module load anaconda3
# Run Jupyter
jupyter-lab --no-browser --port=${port} --ip=${node}
在本地电脑映射端口
ssh -N -f -L 8889:tiger-h26c2n22:8889 <yourusername>@tigercpu.princeton.edu
在浏览器中打开即可使用
参考:
原文:https://www.cnblogs.com/leezx/p/12009741.html