Skip to content

Commit

Permalink
Condense environment file activations (#194)
Browse files Browse the repository at this point in the history
This is related to running the IMI at Harvard on Cannon. For @laestrada and I, the combination of first sourcing the GEOS-Chem environment file and then activating the conda environment (an alias for micromamba in our case) results in GEOS-Chem not being able to run (./gcclassic: error while loading shared libraries: libnetcdf.so.18: cannot open shared object file: No such file or directory).

This order was introduced in 7c57d91. This PR is a fix that makes sure the Conda environment and GEOS-Chem environment file are only activated a single time each (now in run_imi.sh) and than the order is Conda then GEOS-Chem environment file.
  • Loading branch information
nicholasbalasus authored Mar 23, 2024
1 parent 1957416 commit b5787eb
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 44 deletions.
6 changes: 6 additions & 0 deletions run_imi.sh
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,12 @@ if ! "$isAWS"; then
printf "\nLoading GEOS-Chem environment: ${GEOSChemEnv}\n"
source ${GEOSChemEnv}
fi
else
# Source Conda environment file
source $CondaFile

# Activate Conda environment
conda activate ${CondaEnv}
fi

# Check all necessary config variables are present
Expand Down
6 changes: 0 additions & 6 deletions src/components/inversion_component/inversion.sh
Original file line number Diff line number Diff line change
Expand Up @@ -67,12 +67,6 @@ run_inversion() {
cd ${RunDirs}/inversion
fi

if ! "$isAWS"; then
# Activate Conda environment
printf "\nActivating conda environment: ${CondaEnv}\n"
conda activate $CondaEnv
fi

# Execute inversion driver script
sbatch --mem $SimulationMemory \
-c $SimulationCPUs \
Expand Down
10 changes: 0 additions & 10 deletions src/components/jacobian_component/jacobian.sh
Original file line number Diff line number Diff line change
Expand Up @@ -186,11 +186,6 @@ run_jacobian() {

cd ${RunDirs}/jacobian_runs

if ! "$isAWS"; then
# Load environment with modules for compiling GEOS-Chem Classic
source ${GEOSChemEnv}
fi

# Submit job to job scheduler
source submit_jacobian_simulations_array.sh

Expand All @@ -213,11 +208,6 @@ run_jacobian() {

# Run the prior simulation
cd ${JacobianRunsDir}

if ! "$isAWS"; then
# Load environment with modules for compiling GEOS-Chem Classic
source ${GEOSChemEnv}
fi

# Submit prior simulation to job scheduler
printf "\n=== SUBMITTING PRIOR SIMULATION ===\n"
Expand Down
5 changes: 0 additions & 5 deletions src/components/posterior_component/posterior.sh
Original file line number Diff line number Diff line change
Expand Up @@ -94,11 +94,6 @@ setup_posterior() {
run_posterior() {
posterior_start=$(date +%s)
cd ${RunDirs}/posterior_run

if ! "$isAWS"; then
# Load environment with modules for compiling GEOS-Chem Classic
source ${GEOSChemEnv}
fi

if "$OptimizeBCs"; then
if "$KalmanMode"; then
Expand Down
24 changes: 1 addition & 23 deletions src/components/setup_component/setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -22,29 +22,7 @@ setup_imi() {
SpinupEnd=${StartDate}

# Use global boundary condition files for initial conditions
UseBCsForRestart=true

printf "\nActivating conda environment: ${CondaEnv}\n"
if "$isAWS"; then
# Get max process count for spinup, production, and run_inversion scripts
output=$(echo $(slurmd -C))
array=($output)
cpu_str=$(echo ${array[1]})
cpu_count=$(echo ${cpu_str:5})

# With sbatch reduce cpu_count by 1 to account for parent sbatch process
# using 1 core
if "$UseSlurm"; then
cpu_count="$((cpu_count-1))"
fi

# Source Conda environment file
source $CondaFile

fi

# Activate Conda environment
conda activate $CondaEnv
UseBCsForRestart=true

##=======================================================================
## Download Boundary Conditions files if requested
Expand Down

0 comments on commit b5787eb

Please sign in to comment.