Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
63 changes: 63 additions & 0 deletions nemo_env.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
#!/bin/bash

#SBATCH -A ICCS-SL2-CPU # Project account for SLURM
#SBATCH -p icelake # Partition name in cluster (e.g., icelake)
#SBATCH -N 1 # Number of nodes
#SBATCH -t 24:00:00 # Time limit (HH:MM:SS)
#SBATCH -n 36 # Number of tasks (processes) to be run in parallel

# ========================
# Define Environment Variables
# ========================
export WORK_DIR="/home/sg2147/nemo_4.2.1/tests/DINO/EXP00" # Both nemo executable and output directories are at the same location
export NEMO_EXEC="nemo"

# ======================
# LOAD MODULES
# ======================
module purge
module load rhel8/default-ccl
module load netcdf-fortran/4.6.1/intel/intel-oneapi-mpi/kqukipdf
module load boost/1.85.0/gcc/zouxm6hy

echo "******Modules loaded successfully!******"


# =============================
# SET DYNAMIC LIBRARY PATHS
# =============================
export BASE_DIR="/rds/project/rds-5mCMIDBOkPU/ma595/nemo/NEMO/trunk"

export CPATH="$BASE_DIR/inc:$CPATH"
export LD_LIBRARY_PATH="$BASE_DIR/lib:$LD_LIBRARY_PATH"

echo "******Environment paths set successfully!******"


# =============================
# MOVE TO WORKING DIRECTORY
# =============================
cd "$WORK_DIR" || { echo "Directory not found!"; exit 1; }

echo "******Moved to working directory!******"

# =======================================
# DETERMINE RUN TYPE (New Run or Re-run)
# =======================================
RUN_TYPE=${1:-new} # Takes the first argument passed at runtime, and Default to "new" if no argument is given
RUN_ID=$(date +"%Y%m%d_%H%M%S")

if [[ "$RUN_TYPE" == "acc" ]]; then ### For Accelerated run
OUTPUT_DIR="$WORK_DIR/acc_$RUN_ID"
else
OUTPUT_DIR="$WORK_DIR/sim_$RUN_ID" ### For Simulated run
fi

mkdir -p "$OUTPUT_DIR"

echo "******Created new output folder!******"

# =======================================
# DETERMINE RUN TYPE (New Run or Re-run)
# =======================================
mpirun -np 36 "$NEMO_EXEC" ### mpi is a communication protocol to run code in parallel.
10 changes: 10 additions & 0 deletions submit_run.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/bin/bash
export PROJECT_ACCOUNT="ICCS-SL2-CPU"
export PARTITION="icelake"
export NUM_NODES=1
export TIME_LIMIT="24:00:00"
export NUM_TASKS=36
export WORK_DIR="/home/sg2147/nemo_4.2.1/tests/DINO/EXP00"
export NEMO_EXEC="nemo"

sbatch run_nemo.sh
Loading