This repository has been archived by the owner on Dec 12, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
376 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,117 @@ | ||
#!/bin/bash | ||
|
||
# Exit immediately on failure | ||
set -e | ||
|
||
################### | ||
# BENCHMARK SETUP # | ||
################### | ||
|
||
# Prepare temporary directory for benchmark RMG-Py and RMG-db | ||
benchmark=$DATA_DIR/code/benchmark/$(date +%Y-%m-%d:%H:%M:%S) | ||
rm -rf $benchmark | ||
mkdir -p $benchmark | ||
cd $benchmark | ||
|
||
# Prepare benchmark RMG-Py | ||
git clone -q https://github.com/ReactionMechanismGenerator/RMG-Py.git | ||
cd RMG-Py | ||
git checkout $RMGPY_BENCHMARK_BRANCH | ||
export benchmark_py_sha=$(git rev-parse HEAD) | ||
cd .. | ||
|
||
# Prepare benchmark RMG-database: | ||
git clone -q https://github.com/ReactionMechanismGenerator/RMG-database.git | ||
cd RMG-database | ||
git checkout $RMGDB_BENCHMARK_BRANCH | ||
export benchmark_db_sha=$(git rev-parse HEAD) | ||
|
||
# Rename benchmark code folder | ||
cd $DATA_DIR/code/benchmark | ||
|
||
export benchmark_tag=py${benchmark_py_sha:0:12}_db${benchmark_db_sha:0:12} | ||
|
||
if [ ! -d "${benchmark_tag}" ]; then | ||
mv $benchmark $benchmark_tag | ||
else | ||
rm -rf $benchmark | ||
fi | ||
|
||
export benchmark=$DATA_DIR/code/benchmark/$benchmark_tag | ||
|
||
# Prepare benchmark environment if requested | ||
if [ "$CLEAN_ENV" == true ]; then | ||
cd $benchmark/RMG-Py | ||
export benchmark_env="benchmark_env" | ||
conda remove --name $benchmark_env --all -y | ||
conda env create -n $benchmark_env -f environment_${CURRENT_OS}.yml | ||
else | ||
export benchmark_env="rmg_env" | ||
fi | ||
|
||
# Compile benchmark RMG-Py: | ||
cd $benchmark/RMG-Py | ||
source activate $benchmark_env | ||
make | ||
source deactivate | ||
|
||
export RMG_BENCHMARK=$benchmark/RMG-Py | ||
export RMGDB_BENCHMARK=$benchmark/RMG-database | ||
|
||
################# | ||
# TESTING SETUP # | ||
################# | ||
|
||
# Prepare temporary directory for testing RMG-Py and RMG-db | ||
testing=$DATA_DIR/code/testing/$(date +%Y-%m-%d:%H:%M:%S) | ||
rm -rf $testing | ||
mkdir -p $testing | ||
cd $testing | ||
|
||
# Prepare testing RMG-Py: | ||
git clone -q https://github.com/ReactionMechanismGenerator/RMG-Py.git | ||
cd RMG-Py | ||
git checkout ${RMG_TESTING_BRANCH} | ||
export testing_py_sha=$(git rev-parse HEAD) | ||
cd .. | ||
|
||
# Prepare testing RMG-database | ||
git clone -q https://github.com/ReactionMechanismGenerator/RMG-database.git | ||
cd RMG-database | ||
git checkout ${RMGDB_TESTING_BRANCH} | ||
export testing_db_sha=$(git rev-parse HEAD) | ||
|
||
# Rename testing code folder | ||
cd $DATA_DIR/code/testing | ||
|
||
export testing_tag=py${testing_py_sha:0:12}_db${testing_db_sha:0:12} | ||
|
||
if [ ! -d "${testing_tag}" ]; then | ||
mv $testing $testing_tag | ||
else | ||
rm -rf $testing | ||
fi | ||
export testing=$DATA_DIR/code/testing/$testing_tag | ||
|
||
# Prepare testing environment if requested | ||
if [ "$SEPARATE_ENV" == true]; then | ||
cd $testing/RMG-Py | ||
export testing_env="testing_env" | ||
conda remove --name $testing_env --all -y | ||
conda env create -n $testing_env -f environment_${CURRENT_OS}.yml | ||
else | ||
export testing_env=$benchmark_env | ||
fi | ||
|
||
# Compile RMG-Py: | ||
cd $testing/RMG-Py | ||
source activate $testing_env | ||
make | ||
source deactivate | ||
|
||
export RMG_TESTING=$testing/RMG-Py | ||
export RMGDB_TESTING=$testing/RMG-database | ||
|
||
# Go to RMG-tests folder: | ||
cd $DATA_DIR | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
#!/bin/bash | ||
|
||
# Set RMG-tests base directory | ||
export BASE_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )/.." && pwd )" | ||
echo "Local tests base dir: "$BASE_DIR | ||
|
||
# Set data directory | ||
export DATA_DIR=$BASE_DIR/data_dir | ||
|
||
# Figure out OS | ||
if [[ $MACHTYPE == *"apple"* ]]; then | ||
export CURRENT_OS="mac" | ||
elif [[ $MACHTYPE == *"linux"* ]]; then | ||
export CURRENT_OS="linux" | ||
else | ||
echo "$MACHTYPE not supported. Exiting..." | ||
exit 0 | ||
fi | ||
echo "Current OS: "$CURRENT_OS | ||
|
||
# Print input settings | ||
echo "Benchmark Branches:" | ||
echo " RMG-Py: "$RMGPY_BENCHMARK_BRANCH | ||
echo " RMG-database: "$RMGDB_BENCHMARK_BRANCH | ||
echo "Testing Branches:" | ||
echo " RMG-Py: "$RMGPY_TESTING_BRANCH | ||
echo " RMG-database: "$RMGDB_TESTING_BRANCH | ||
echo "Testing Jobs: "$JOBS | ||
echo "Data Directory: "$DATA_DIR | ||
|
||
. $BASE_DIR/color_define.sh | ||
. $BASE_DIR/local/install_local.sh | ||
. $BASE_DIR/version_summary.sh | ||
|
||
echo "INSTALLATION COMPLETE" | ||
|
||
cd $BASE_DIR/local | ||
|
||
# Run RMG test jobs | ||
if [ $JOBS == "all" ]; then | ||
for i in eg1 eg3 eg5 eg6 eg7 NC solvent_hexane MCH | ||
do | ||
if [ $PARALLEL == "true" ]; then | ||
export SBATCH_JOB_NAME=run_$i | ||
sbatch $BASE_DIR/local/submit_job.sl $i no | ||
else | ||
. $BASE_DIR/local/run_job.sh $i no | ||
fi | ||
done | ||
else | ||
if [ $PARALLEL == "true" ]; then | ||
export SBATCH_JOB_NAME=run_$i | ||
sbatch $BASE_DIR/local/submit_job.sl $JOBS no | ||
else | ||
. $BASE_DIR/local/run_job.sh $JOBS no | ||
fi | ||
fi | ||
|
||
# Run thermo validation jobs | ||
if [ $THERMOVAL == "true" ]; then | ||
for i in hc_cyclics hco_cyclics rmg_internal_cyclics | ||
do | ||
. $BASE_DIR/local/thermo_val.sh $i | ||
done | ||
fi | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,100 @@ | ||
#!/bin/bash | ||
|
||
job=$1 | ||
scoop_test=$2 | ||
|
||
set -e | ||
|
||
if [ -z ${RMG_BENCHMARK+x} ]; then | ||
echo "RMG variable is unset. Exiting..." | ||
exit 0 | ||
fi | ||
|
||
export ORIGIN_PYTHONPATH=$PYTHONPATH | ||
echo "Running Job: $1" | ||
|
||
############# | ||
# BENCHMARK # | ||
############# | ||
|
||
# Make folder for models generated by the benchmark version of RMG-Py/RMG-database: | ||
export benchmark_tests=$DATA_DIR/tests/benchmark/$benchmark_tag | ||
mkdir -p $benchmark_tests/rmg_jobs/$job | ||
rm -rf $benchmark_tests/rmg_jobs/$job/* | ||
cp $BASE_DIR/examples/rmg/$job/input.py $benchmark_tests/rmg_jobs/$job/input.py | ||
|
||
source activate ${benchmark_env} | ||
|
||
echo "Benchmark Version of RMG: "$RMG_BENCHMARK | ||
export PYTHONPATH=$RMG_BENCHMARK:$ORIGIN_PYTHONPATH | ||
|
||
python $RMG_BENCHMARK/rmg.py $benchmark_tests/rmg_jobs/$job/input.py > /dev/null | ||
|
||
source deactivate | ||
export PYTHONPATH=$ORIGIN_PYTHONPATH | ||
|
||
########### | ||
# TESTING # | ||
########### | ||
|
||
# Make folder for models generated by the test version of RMG-Py and RMG-database: | ||
export testing_tests=$DATA_DIR/tests/testing/$testing_tag | ||
mkdir -p $testing_tests/rmg_jobs/$job | ||
rm -rf $testing_tests/rmg_jobs/$job/* | ||
cp $BASE_DIR/examples/rmg/$job/input.py $testing_tests/rmg_jobs/$job/input.py | ||
|
||
source activate ${testing_env} | ||
|
||
echo "Test Version of RMG: "$RMG_TESTING | ||
export PYTHONPATH=$RMG_TESTING:$ORIGIN_PYTHONPATH | ||
|
||
python $RMG_TESTING/rmg.py $testing_tests/rmg_jobs/$job/input.py > /dev/null | ||
|
||
export PYTHONPATH=$ORIGIN_PYTHONPATH | ||
source deactivate | ||
|
||
########### | ||
# COMPARE # | ||
########### | ||
|
||
export check_tests=$DATA_DIR/tests/check/$testing_tag | ||
mkdir -p $check_tests/rmg_jobs/$job | ||
rm -rf $check_tests/rmg_jobs/$job/* | ||
cd $check_tests/rmg_jobs/$job | ||
|
||
source activate ${benchmark_env} | ||
export PYTHONPATH=$RMG_BENCHMARK:$ORIGIN_PYTHONPATH | ||
|
||
bash $BASE_DIR/check.sh $job $benchmark_tests/rmg_jobs/$job $testing_tests/rmg_jobs/$job | ||
|
||
export PYTHONPATH=$ORIGIN_PYTHONPATH | ||
source deactivate | ||
|
||
if [ $scoop_test == "yes" ]; then | ||
# Make folder for models generated by the test version of RMG-Py and RMG-database, with scoop enabled: | ||
mkdir -p $testing_tests/rmg_jobs/$job/scoop | ||
rm -rf $testing_tests/rmg_jobs/$job/scoop/* | ||
cp $BASE_DIR/examples/rmg/$job/input.py $testing_tests/rmg_jobs/$job/scoop/input.py | ||
echo "Version of RMG running with SCOOP: $RMG" | ||
source activate ${testing_env} | ||
export PYTHONPATH=$RMG_TESTING:$ORIGIN_PYTHONPATH | ||
|
||
python -m scoop -n 1 $RMG_TESTING/rmg.py $testing_tests/rmg_jobs/$job/scoop/input.py > /dev/null | ||
|
||
export PYTHONPATH=$ORIGIN_PYTHONPATH | ||
source deactivate | ||
|
||
# compare both generated models | ||
mkdir -p $check_tests/rmg_jobs/$job/scoop | ||
cd $check_tests/rmg_jobs/$job/scoop | ||
source activate ${benchmark_env} | ||
export PYTHONPATH=$RMG_BENCHMARK:$ORIGIN_PYTHONPATH | ||
|
||
bash $BASE_DIR/check.sh $job $benchmark_tests/rmg_jobs/$job $testing_tests/rmg_jobs/$job/scoop | ||
|
||
export PYTHONPATH=$ORIGIN_PYTHONPATH | ||
source deactivate | ||
fi | ||
|
||
echo "$job: TEST JOB COMPLETE" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
#!/bin/bash | ||
#SBATCH -p debug | ||
#SBATCH -J RMG-test | ||
#SBATCH -n 1 | ||
#SBATCH --nodelist=node03 | ||
#SBATCH --output=main_log.out | ||
|
||
# Usage: sbatch submit.sl | ||
|
||
# Specify testing branches here | ||
RMGPY_TESTING_BRANCH="test_branch" | ||
RMGDB_TESTING_BRANCH="master" | ||
|
||
# Specify benchmark branches here | ||
# These should generally be left as master | ||
RMGPY_BENCHMARK_BRANCH="master" | ||
RMGDB_BENCHMARK_BRANCH="master" | ||
|
||
# Specify jobs to run | ||
# Current jobs available: eg1, eg3, eg5, eg6, eg7, NC, solvent_hexane, MCH, methane | ||
JOBS="all" | ||
|
||
# Specify whether to run thermo validation | ||
THERMOVAL=true | ||
|
||
# Specify whether or not to recreate the Anaconda environment | ||
# This is generally not necessary, and can be left as false | ||
CLEAN_ENV=false | ||
|
||
# Specify whether or not the testing and benchmark jobs should use separate environments | ||
# This is generally not necessary, and can be left as false | ||
SEPARATE_ENV=false | ||
|
||
# Specify whether to run jobs in parallel or serial | ||
PARALLEL=true | ||
|
||
# Start the job | ||
. ./run.sh | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
#!/bin/bash | ||
#SBATCH -p debug | ||
#SBATCH -n 1 | ||
|
||
JOB=$1 | ||
SCOOP=$2 | ||
|
||
. $BASE_DIR/local/run_job.sh $JOB $SCOOP |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
#!/bin/bash | ||
job=$1 | ||
|
||
export ORIGIN_PYTHONPATH=$PYTHONPATH | ||
|
||
############# | ||
# BENCHMARK # | ||
############# | ||
|
||
# Make folder for models generated by the benchmark version of RMG-Py/RMG-database: | ||
export benchmark_tests=$DATA_DIR/tests/benchmark/$benchmark_tag | ||
mkdir -p $benchmark_tests/thermo_val_jobs/$job | ||
|
||
cp $BASE_DIR/examples/thermo_val/$job/dataset.txt $benchmark_tests/thermo_val_jobs/$job/dataset.txt | ||
|
||
echo "Benchmark Version of RMG: "$RMG_BENCHMARK | ||
echo "Running thermo validation on benchmark version..." | ||
|
||
source activate ${benchmark_env} | ||
export PYTHONPATH=$RMG_BENCHMARK:$ORIGIN_PYTHONPATH | ||
|
||
python $BASE_DIR/thermo_val/evaluate.py -d $benchmark_tests/thermo_val_jobs/$job/dataset.txt -pb $RMGPY_BENCHMARK_BRANCH -dbb $RMGDB_BENCHMARK_BRANCH -psha ${benchmark_py_sha} -dbsha ${benchmark_db_sha} | ||
|
||
source deactivate | ||
export PYTHONPATH=$ORIGIN_PYTHONPATH | ||
|
||
########### | ||
# TESTING # | ||
########### | ||
|
||
# Make folder for models generated by the test version of RMG-Py and RMG-database: | ||
export testing_tests=$DATA_DIR/tests/testing/$testing_tag | ||
mkdir -p $testing_tests/thermo_val_jobs/$job | ||
|
||
cp $BASE_DIR/examples/thermo_val/$job/dataset.txt $testing_tests/thermo_val_jobs/$job/dataset.txt | ||
|
||
echo "Testing Version of RMG: "$RMG_TESTING | ||
echo "Running thermo validation on testing version..." | ||
|
||
source activate ${testing_env} | ||
export PYTHONPATH=$RMG_TESTING:$ORIGIN_PYTHONPATH | ||
|
||
python $BASE_DIR/thermo_val/evaluate.py -d $testing_tests/thermo_val_jobs/$job/dataset.txt -pb $RMGPY_TESTING_BRANCH -dbb $RMGDB_TESTING_BRANCH -psha ${testing_py_sha} -dbsha ${testing_db_sha} | ||
|
||
source deactivate | ||
export PYTHONPATH=$ORIGIN_PYTHONPATH |