IT wiki

VU MIF STSC

User Tools

Site Tools


en:hpc-new:getting_started

This is an old revision of the document!


First Successful Job (15 Minutes)

This guide walks you through the basic HPC workflow:

  1. Connect to the HPC system
  2. Create and submit your first job
  3. Monitor job execution
  4. View job results
  5. Request CPU and memory resources
  6. Learn how project allocations work
  7. Run a Python application
  8. Submit a GPU job

If you can complete this guide, you are ready to start running your own workloads on the HPC cluster.

Before You Start

Make sure that:

  • You have completed Registration
  • You have an active HPC account
  • You have an SSH client installed
  • You can connect to the HPC login node

Need access first?

Step 1: Connect to the Cluster

Open a terminal and connect to the HPC login node:

ssh username@login.hpc.mif.vu.lt

Replace username with your HPC username.

Verify that you are connected:

hostname
pwd

You should see the hostname of the login node and your home directory path.

For detailed instructions see:

Step 2: Create a Working Directory

Create a directory for this tutorial:

mkdir getting-started
cd getting-started

Verify your location:

pwd

Step 3: Create Your First Job Script

Create a new file:

nano hello.sh

Paste the following content:

#!/bin/bash
#SBATCH --job-name=hello
#SBATCH --partition=main
#SBATCH --output=hello.out
#SBATCH --time=00:01:00
 
echo "Hello from HPC!"
hostname
date

Save the file and exit the editor.

Step 4: Submit the Job

Submit the script to the scheduler:

sbatch hello.sh

Example output:

Submitted batch job 12345

The number is your Job ID.

Step 5: Monitor the Job

Check the status of your jobs:

squeue -u $USER

When the job disappears from the queue, it has finished.

Step 6: View the Results

Display the output file:

cat hello.out

Example output:

Hello from HPC!
compute01
Mon Nov 17 14:32:05 EET 2026

Congratulations! You have successfully executed your first HPC job.

Step 7: Request Resources for a Job

Real HPC workloads usually require specific CPU, memory, and runtime allocations. These resources are requested using SLURM directives.

Create a new script:

nano resources.sh

Paste the following content:

#!/bin/bash
#SBATCH --job-name=resources-demo
#SBATCH --partition=main
#SBATCH --cpus-per-task=4
#SBATCH --mem=4G
#SBATCH --time=00:05:00
#SBATCH --output=resources.out
 
echo "Running on:"
hostname
 
echo ""
echo "Allocated CPUs:"
nproc
 
echo ""
echo "Available Memory:"
free -h
 
echo ""
echo "Finished."

Submit the job:

sbatch resources.sh

Understanding Resource Requests

Directive Description
–partition=main Run the job in the standard CPU partition
–partition=gpu Run the job in the GPU partition
–cpus-per-task=4 Request 4 CPU cores
–mem=4G Request 4 GB of RAM
–time=00:05:00 Request up to 5 minutes of runtime
–output=resources.out Save output to a file

<note tip> If no runtime limit is specified, SLURM uses a default limit of 2 hours. However, specifying a realistic runtime is recommended because it helps the scheduler start jobs more efficiently. </note>

<note tip> Request only the resources you actually need. Smaller jobs generally start faster and help ensure fair sharing of cluster resources. </note>

Check the Job Output

Once the job completes:

cat resources.out

You should see information about the compute node and the allocated resources.

Step 8: Using Project Allocations

Some users are assigned project allocations that provide additional CPU, GPU, memory, or storage resources.

If your project administrator provides an allocation name, add it to your job script:

#!/bin/bash
#SBATCH --job-name=project-demo
#SBATCH --partition=main
#SBATCH --account=alloc_xxxx_project
#SBATCH --cpus-per-task=4
#SBATCH --mem=8G
#SBATCH --time=01:00:00
 
hostname

The allocation name determines which project's resources are used to run the job.

<note important> VU MIF users using the default allocation do NOT need to specify the –account parameter.

Only users associated with a project allocation should add:

#SBATCH --account=alloc_xxxx_project

</note>

Step 9: Run a Python Job

Python is one of the most commonly used programming languages on HPC systems. This example demonstrates how to execute a Python application through SLURM.

Create a Python Script

Create a file named hello.py:

nano hello.py

Paste:

import platform
from datetime import datetime
 
print("Hello from Python!")
print("Hostname:", platform.node())
print("Current time:", datetime.now())

Save the file.

Create a SLURM Job Script

Create a new file:

nano python-job.sh

Paste:

#!/bin/bash
#SBATCH --job-name=python-demo
#SBATCH --partition=main
#SBATCH --cpus-per-task=1
#SBATCH --mem=1G
#SBATCH --time=00:05:00
#SBATCH --output=python-demo.out
 
python3 hello.py

Submit the job:

sbatch python-job.sh

Check the Results

After the job finishes:

cat python-demo.out

Example output:

Hello from Python!
Hostname: compute01
Current time: 2026-11-19 15:45:12

Congratulations! You have successfully executed a Python application on the HPC cluster.

Optional: Load a Python Module

Depending on the cluster software environment, a specific Python version may need to be loaded first:

module avail Python

Load a version:

module load Python/3.x.y

Verify:

python3 --version

Step 10: Submit a GPU Job

To run a job on a GPU node:

nano gpu-demo.sh

Paste:

#!/bin/bash
#SBATCH --job-name=gpu-demo
#SBATCH --partition=gpu
#SBATCH --gpus=1
#SBATCH --cpus-per-task=4
#SBATCH --mem=16G
#SBATCH --time=01:00:00
 
nvidia-smi

Submit the job:

sbatch gpu-demo.sh

The command nvidia-smi displays information about the allocated GPU.

Useful Commands

Command Purpose
pwd Show current directory
ls List files
cd Change directory
sbatch job.sh Submit a job
squeue -u $USER View your jobs
sacct -j JOBID View completed job information
scancel JOBID Cancel a job
cat file Display file contents

Typical Resource Requests

Workload Partition CPUs Memory GPUs
Learning and testing main 1-2 1-4 GB None
Data analysis main 4-8 8-32 GB Optional
Scientific simulations main 8-64 16-128 GB Optional
Machine learning and AI gpu 4-16 16-64 GB 1 or more

Next Steps

You now know how to:

  • Connect to the HPC cluster
  • Create job scripts
  • Submit jobs
  • Monitor job execution
  • Review job outputs
  • Request CPU and memory resources
  • Run Python applications
  • Use project allocations
  • Submit GPU jobs

Continue with:

Common Problems

Permission denied

Verify that:

  • Your account has been activated
  • You are using the correct username
  • Your SSH credentials are correct

sbatch: command not found

You are probably running the command on your local computer instead of the HPC login node.

Verify your connection:

hostname

Invalid account or account/partition combination specified

Possible causes:

  • Your SLURM account is still being created.
  • The specified allocation does not exist.
  • You do not have permission to use the specified allocation.

Wait a few minutes after your first login or contact the project administrator.

Job remains in PENDING state

Resources may currently be unavailable.

Check your jobs:

squeue -u $USER

More information can be found in:

GPU job does not start

Verify that:

  • The job uses –partition=gpu
  • GPU resources are available
  • Your allocation includes GPU access

Python command not found

Verify that Python is installed in the environment or load the appropriate Python module:

module avail Python

Where to Go Next

Recommended learning path:


<note> This guide was prepared and updated by the VU MIF HPC team with the assistance of Microsoft Copilot. All procedures and examples should be validated against the current HPC environment, software stack, and operational policies. </note>

en/hpc-new/getting_started.1795096929.txt.gz · Last modified: by eduardas

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki