#!/bin/bash

# SLURM configuration for MN5
#SBATCH --qos=acc_debug
#SBATCH --output=torch_test_%j.out
#SBATCH --error=torch_test_%j.err
#SBATCH --ntasks=1
#SBATCH --time=00:05:00
#SBATCH --job-name=testing_torch
#SBATCH --mail-type=end
#SBATCH --mail-user=enric.millan@bsc.es
#SBATCH --gres=gpu:1

# For each gpu requested at least 20 cpu are required
#SBATCH --cpus-per-task=20 

# Machine-specific setup
if [ "$BSC_MACHINE" = "mn5" ]; then
    export MODULEPATH=$MODULEPATH:/apps/GPP/EASYBUILD/modules/all
    conda init
    source /apps/GPP/MINICONDA/24.1.2/etc/profile.d/conda.sh
    conda activate /home/bsc/bsc558537/.conda/envs/acc_gpu
    export PYTHONPATH=/home/bsc/bsc558537/.conda/envs/acc_gpu/lib/python3.12/site-packages:$PYTHONPATH
elif [ "$BSC_MACHINE" = "nord3v2" ]; then
    module load GDAL/3.3.2-foss-2019b-Python-3.7.4
    module load pycdo/1.5.3-foss-2019b-Python-3.7.4
    module load pynco/0.0.2-foss-2019b-Python-3.7.4
fi

# Run the following Python script to test if Pytorch is working
python pytorch_test.py
