Skip to content

Commit

Permalink
feat(bash): generic compile and build scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
yoctoyotta1024 committed Apr 10, 2024
1 parent 2d2513f commit 656d6ef
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 31 deletions.
4 changes: 2 additions & 2 deletions scripts/bash/build_cleo.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
#SBATCH --error=./build/bin/build_cleo_err.%j.out

buildtype=$1
path2CLEO=${HOME}/CLEO/
path2build=${HOME}/CLEO/build/
path2CLEO=$2
path2build=$3
path2buildbash=${path2CLEO}/scripts/bash/

### ------------------ build_compile.sh ---------------- ###
Expand Down
38 changes: 12 additions & 26 deletions scripts/bash/compile_cleo.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,35 +16,21 @@
### ------------- have already built CLEO in path2build ------------ ###
### ------------------- directory using cmake -------------------- ###

### ----- You need to edit these lines to set your ----- ###
### ----- default compiler and python environment ---- ###
### ---- and paths for CLEO and build directories ---- ###
module load gcc/11.2.0-gcc-11.2.0
module load python3/2022.01-gcc-11.2.0
module load nvhpc/23.7-gcc-11.2.0
### ------------------ input parameters ---------------- ###
### ----- You need to edit these lines to specify ------ ###
### ----- (your environment and) build directory ------- ###
### -------- path and executable to compile ------------ ###
spack load [email protected]%gcc
source activate /work/mh1126/m300950/cleoenv
python=python
path2CLEO=$1 # get from command line argument
path2build=$2 # get from command line argument
configfile=${HOME}/CLEO/src/config/config.txt
### ---------------------------------------------------- ###

### ------------------- compile_run.sh ----------------- ###
if [ "${path2build}" == "" ]
then
path2build=${HOME}/CLEO/build/
fi
path2build=$1 # get from command line argument
executable=$2 # get from command line argument
### ---------------------------------------------------- ###

### compile CLEO in ./build directory
### ----------------- compile executable --------------- ###
echo "path to build directory: ${path2build}"
cd ${path2build} && pwd
make -j 128
echo "executable: ${executable}"

### run CLEO
export OMP_PROC_BIND=spread
export OMP_PLACES=threads
runcmd="${path2build}/src/cleocoupledsdm ${configfile}"
echo ${runcmd}
${runcmd}
cd ${path2build}
make clean
make -j 128 ${executable}
### ---------------------------------------------------- ###
4 changes: 1 addition & 3 deletions src/compile_run_cleocoupledsdm.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,7 @@

### ------------------ input parameters ---------------- ###
### ----- You need to edit these lines to specify ------ ###
### ------- your environment and directory paths ------- ###
module load python3/2022.01-gcc-11.2.0

### ------ (your environment and) directory paths ------ ###
executable="cleocoupledsdm"
path2CLEO=${HOME}/CLEO/
path2build=$1 # get from command line argument
Expand Down

0 comments on commit 656d6ef

Please sign in to comment.