SSH Port Forwarding 을 통한 Jupyter 작업 실행
뉴론에서 작업 제출로 Jupyter 실행하는 방법
가. 작업 스크립트 작성 및 제출
1. 작성 스크립트 작성
#!/bin/bash
#SBATCH --comment=pytorch
#SBATCH --partition=eme_h200nv_8
#SBATCH --time=12:00:00 # walltime
#SBATCH --nodes=1 # the number of nodes
#SBATCH --ntasks-per-node=1 # number of tasks per node
#SBATCH --gres=gpu:1 # number of gpus per node
#SBATCH --cpus-per-task=4 # number of cpus per task
#removing the old port forwading
if [ -e port_forwarding_command ]
then
rm port_forwarding_command
fi
#getting the port and node name
SERVER="`hostname`"
PORT_JU=$(($RANDOM + 10000 )) # some random number greaten than 10000
echo $SERVER
echo $PORT_JU
echo "ssh -L localhost:8888:${SERVER}:${PORT_JU} ${USER}@neuron.ksc.re.kr" > port_forwarding_command
echo "load module-environment"
module load gcc/10.2.0 cuda/12.3 # pre-load module needed
echo "execute jupyter"
source ~/.bashrc
conda activate notebook
cd /scratch/$USER
# the root/work directory of Jupyter lab/notebook
jupyter lab --ip=0.0.0.0 --port=${PORT_JU} --NotebookApp.token=${USER}
#jupyter token: your account ID
echo "end of the job"2. 작업 스크립트 제출
나. 작업 제출 디렉터리의 Port Forwarding Command 파일 확인
다. SSH Port Forwarding 설정
1. Windows OS일 경우 명령 프롬프트 예시

2. Mac OS일 경우 터미널 예시
라. 웹 브라우저 접속

Last updated