Skip to content

how to use it ?

tutorials

Login to the JupyterHub

FIrst step

login to the jupyterhub

login

Go to the GPU Cluster homepage. 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 activate 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 slrum 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
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