geoschem / integrated_methane_inversion

Integrated Methane Inversion workflow repository.
https://imi.readthedocs.org
MIT License
26 stars 24 forks source link

Bug fix for environment file activations #194

Closed nicholasbalasus closed 6 months ago

nicholasbalasus commented 6 months ago

Name and Institution (Required)

Name: Nick Balasus Institution: Harvard

Describe the update

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 https://github.com/geoschem/integrated_methane_inversion/commit/7c57d9182660319e52f45c09c8ec5b9286ef4650. 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. I have tested this on Cannon with this bash script:

#!/bin/bash

git clone https://github.com/geoschem/integrated_methane_inversion.git
cd integrated_methane_inversion
git checkout bugfix/environment-file-activation

sed -i -e "s|SetupSpinupRun: false|SetupSpinupRun: true|g" \
    -e "s|SetupJacobianRuns: false|SetupJacobianRuns: true|g" \
    -e "s|SetupInversion: false|SetupInversion: true|g" \
    -e "s|SetupPosteriorRun: false|SetupPosteriorRun: true|g" \
    -e "s|DoSpinup: false|DoSpinup: true|g" \
    -e "s|DoJacobian: false|DoJacobian: true|g" \
    -e "s|DoInversion: false|DoInversion: true|g" \
    -e "s|DoPosterior: false|DoPosterior: true|g" envs/Harvard-Cannon/config.harvard-cannon.yml

sbatch --mem 16000 -c 8 -t 0-06:00 -p seas_compute,sapphire run_imi.sh envs/Harvard-Cannon/config.harvard-cannon.yml

I also moved the AWS Conda activate from setup.sh to run_imi.sh but can't test this. @laestrada, let me know if what I did looks okay.