-
Notifications
You must be signed in to change notification settings - Fork 1
/
base_script.sh
28 lines (21 loc) · 1.11 KB
/
base_script.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#!/bin/bash
#SBATCH -p c-iq # To use the IQ cluster, or -p c-aphex to use our machine
#SBATCH --job-name=output # The name of the file in which your outputs will be printed
#SBATCH --time=01:00:00 # Time given to run your job (1 hour in this case)
#SBATCH --account=def-ko1 # Keep this as it is
#SBATCH --cpus-per-task=1 # Asked CPUs per task for your job
#SBATCH --mem=8GB # Memory asked for your job
#SBATCH --mail-user=<your email> # Receive a notification when your jobs finish running
#SBATCH --mail-type=ALL
# Define virtual environment name and the files' names
env_name="venv" # Virtual environment name
python_script="job.py" # Your job's file name
# Load important modules
module load python/3.9 # Load a certain Python version
module load scipy-stack # Load basic Pyton packages like numpy and scipy
# Activate your virtual environment
source "$env_name"/bin/activate
# Run your python job
python -u "$python_script"
# Deactivate the virtual environment once the job is finished
deactivate