Skip to content

how to use it ?

tutorials

Login to the JupyterHub

FIrst step

login to the jupyterhub

login

Go to the RebelX JupyterHub. Login with your username and password.

–> If your account is for research purposes, your account will be sent to you via UNLV email.
–> If your account is for educational purposes, your account will be sent to your lecturer. Please ask.

Create the Virtual Environment

second step

create the virtual environment

Install Miniconda

Before you create your virtual environment, you need to install Miniconda. Please follow these steps.

Step 1: Open terminal in JupyterHub

Step 2: Type wget https://repo.anaconda.com/miniconda/Miniconda3-py39_23.1.0-1-Linux-x86_64.sh

You can see the Miniconda installer is downloaded.

Step 3: Type bash Miniconda3-py39_23.1.0-1-Linux-x86_64.sh

Press enter to continue and follow the prompts.
Following the prompts, you will see that Miniconda3 is installed.

Step 4: Type conda update conda

Step5: After installation, type rm Miniconda3-py39_23.1.0-1-Linux-x86_64.sh to delete the installer.

Create Virtual Environment

Now, you can create your own virtual environment. To create a virtual env, please follow the instructions.

Step 1: Type conda create -n yourenv python=3.9.16 anaconda **** Note: yourenv will be your virtual env name. Use your own.

Type conda env list to verify the new environment was installed.

Step 2: Close the terminal window and open a new terminal. Your prompt shows which environment is active. For now, it is (base) which is the default.

Step 3: Type conda activate yourenv
Now, you can see the environment has changed. Make sure parenthesis with your virtual environment in front of your account.

Step 4: Install the packages you want to the virtual environment. To find the appropriate command, see https://anaconda.org/anaconda/repo?page=2

Step 5: Type python -m ipykernel install --user --name=yourenv
This command will create the kernel on your JupyterHub home.
In case if the ipykernel is not available, install the ipykernel using this pip install command: pip install ipykernel

Open [File – New Launcher] in the menu. You can see the kernel with the name as your virtual environment.
(This might take some time. If it doesn’t appear after a few minutes, try opening a new window.)

Step 6: Go back to the terminal. Type conda deactivate to come out of the environment. The setting done above will remain as it is.

Delete Virtual Environment

If your project is done or if you no longer require a virtual environment, please follow the step to delete your environment and kernel.

Step 1: Type conda remove -n youenv --all

Step 2: Type jupyter kernelspec uninstall yourenv

Submit a SLURM job

third step

submit a sluRm job

Please run your code only using the SLRUM. Any jobs not submitted through SLURM will be terminated manually and repeatedly.

SLURM is an open-source resource manager. It helps to organize and schedule the multiple jobs from multiple users. By submitting a job script via SLURM, your job will be scheduled in order and efficiently.
To submit a job script, you need to have your own virtual environment, shell script for SLURM, and your python code for the project.

Prepare the Script

Step 1: Open terminal in JupyterHub

Step 2: Type nano run.sh and write the following script according to your own needs.

#! /bin/bash

#SBATCH ––job-name=yourjob
#SBATCH ––partition=gpuq-a30
#SBATCH ––nodelist=gpu[001]

source /home/username/miniconda3/bin/activate
conda activate yourenv

srun –– unbuffered python example.py

GPU partition and nodelist:

Select one of the partition and nodelist based on your needs.
Please note that if you have an education account and run your project on gpuq-a40 or sxmq, it might be terminated.

GPU partitionNodelist in partitionPurposes
gpuq-a30gpu[001] / gpu[002]for outreach and education
gpuq-a40gpu[003] / gpu[004]for research
sxmqsxm[001] / sxm[002]for data-intensive research
Before submitting a script

Step 1: Before submitting a SLURM job script, check the current GPU node usage. Type ssh gpu_node to log in to the specific GPU node where you want to run your project.

Step 2: Type nvidia-smi to check the current usage of the gpu node.

Step 3: Check the “Volatile GPU-Util” in the prompt screen. If it is not 0%, then someone already occupy their job in that node. Make sure avoid to use the same node to prevent excessive usage.

Step 4: Repeat the same steps after submitting your job. If ‘Volatile GPU-Util’ is close to 100%, the node has reached its full capacity, which could cause potential hardware issues. In this case, reduce the batch size or model size, clear the caches, or wait until other jobs are completed.

No one is using gpu002. You can schedule your job on any node within gpu002.
All nodes are occupied and running at full capacity, which could lead to a cluster breakdown. Please avoid this situation.
Submit a Script

Step 1: We recommend you to create a folder for your project and save all following scripts in it. To create a folder for your project, click the ‘New Folder’ icon.

Step 2: Type cd yourproject to change the working directory. Now, we will write the python code and shell script here.

You can check your working directory is changed with your folder name following after your account.

Step 3: Write the python code for your project and save it in your project folder.

a. You can drag and drop the code file in your desktop into your project folder on jupyterhub.
b. Go to the new launcher and write the python code with the icon ‘Python File’ under Other. Make sure your python code is in your project folder.

Step 4: Prepare the SLURM job script in the same folder.

Step 5: Type sbatch run.sh to submit your job script.

When you submit your job script, you can see the following line: Submitted batch job ####
Then, the file name slurm-####.out will be created in your folder. the file with the same number gives you the result of your code.

The file remains updated, but you need to reopen it to see the latest results.
Check your job status

You can check your job status or cancel your job. You will see two job state codes R and PD.
–> R : RUNNING : The job currently is allocated to a node and is running
–> PD : PENDING : The job is waiting for resource allocation, and it will eventually run.

Show all the submitted jobs: Type squeue
You can see the all the submitted job and their running time and status

Show all the submitted jobs with username: Type squeue -u username
You can see the all the submitted jobs of given username

Show all the submitted jobs with job name: Type squeue -n jobname
You can see the all the submitted jobs of given job name

Show all the submitted jobs with job ID: Type squeue -j jobID
You can see the all the submitted jobs of given job ID

Cancel the submitted job: To cancel your submitted job, Type scancel jobID

the result of cancelation in output file

LET’S Go to the

rebelX jupyterHub