Skip to content

janvaneck1994/ICS-GPU-tutorial

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ICS GPU Tutorial on CS01

Follow these instructions to set up and test a GPU environment for the ICS GPU tutorial on CS01.

Step 1: Access Your Scratch Directory

Navigate to your scratch directory on CS01:

cd /scratch/<solis-id>

Replace <solis-id> with your actual SOLIS ID.

Step 2: Clone the Tutorial Repository

Clone the ICS GPU tutorial repository from GitHub:

git clone https://github.com/janvaneck1994/ICS-GPU-tutorial.git

Make it your working dir

cd ICS-GPU-tutorial

Step 3: Load Python Module

Load the Python module on CS01:

module load python

Step 4: Verify Python Version

Check if the correct version of Python is loaded:

which python

You should see the output similar to:

alias python='python3.9'
/usr/bin/python3.9

Step 5: Create a Python Virtual Environment

Create a new Python virtual environment for the tutorial:

python -m venv ics_gpu_tutorial

Step 6: Activate the Virtual Environment

Activate the created virtual environment:

source ics_gpu_tutorial/bin/activate

Step 7: Verify Python Version in Virtual Environment

Check if the correct version of Python is being used in the virtual environment:

which python

You should see the output similar to:

alias python='python3.9'
/storage/scratch/<solis-id>/ICS-GPU-tutorial/ics_gpu_tutorial/bin/python3.9

Ensure you replace <solis-id> with your actual SOLIS ID.

Step 8: Install PyTorch

Install PyTorch and torchvision in your newly created venv using pip:

pip install torch torchvision

Step 9: Submit the GPU Test Job

Submit the test job to SLURM. This job will check if the gpu is available from pytorch:

sbatch test_gpu.sh

Step 10: Check the Test Output

After the job has succeeded, check the output file test_gpu.out:

You should see:

GPU is available.

This confirms that the GPU is properly configured and available for use.

Step 11: Run MNIST example

You can now run the MNIST example:

Make mnist_example your working dir:

cd mnist_example

Run a job to train and test a FNN on the MNIST dataset

sbatch test_mnist.sh

Step 12: Inspect MNIST result

After the job is complete you can inspect the output in test_mnist.out:

GPU is available.
...
...
...
Test set: Average loss: 0.0001, Accuracy: 9626/10000 (96%)

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors