|
| 1 | +#!/bin/bash |
| 2 | + |
| 3 | +# Exit immediately on failure |
| 4 | +set -e |
| 5 | + |
| 6 | +################### |
| 7 | +# BENCHMARK SETUP # |
| 8 | +################### |
| 9 | + |
| 10 | +# Prepare temporary directory for benchmark RMG-Py and RMG-db |
| 11 | +benchmark=$DATA_DIR/code/benchmark/$(date +%Y-%m-%d:%H:%M:%S) |
| 12 | +rm -rf $benchmark |
| 13 | +mkdir -p $benchmark |
| 14 | +cd $benchmark |
| 15 | + |
| 16 | +# Prepare benchmark RMG-Py |
| 17 | +git clone -q https://github.com/ReactionMechanismGenerator/RMG-Py.git |
| 18 | +cd RMG-Py |
| 19 | +git checkout $RMGPY_BENCHMARK_BRANCH |
| 20 | +export benchmark_py_sha=$(git rev-parse HEAD) |
| 21 | +cd .. |
| 22 | + |
| 23 | +# Prepare benchmark RMG-database: |
| 24 | +git clone -q https://github.com/ReactionMechanismGenerator/RMG-database.git |
| 25 | +cd RMG-database |
| 26 | +git checkout $RMGDB_BENCHMARK_BRANCH |
| 27 | +export benchmark_db_sha=$(git rev-parse HEAD) |
| 28 | + |
| 29 | +# Rename benchmark code folder |
| 30 | +cd $DATA_DIR/code/benchmark |
| 31 | + |
| 32 | +export benchmark_tag=py${benchmark_py_sha:0:12}_db${benchmark_db_sha:0:12} |
| 33 | + |
| 34 | +if [ ! -d "${benchmark_tag}" ]; then |
| 35 | + mv $benchmark $benchmark_tag |
| 36 | +else |
| 37 | + rm -rf $benchmark |
| 38 | +fi |
| 39 | + |
| 40 | +export benchmark=$DATA_DIR/code/benchmark/$benchmark_tag |
| 41 | + |
| 42 | +# Prepare benchmark environment if requested |
| 43 | +if [ "$CLEAN_ENV" == true ]; then |
| 44 | + cd $benchmark/RMG-Py |
| 45 | + export benchmark_env="benchmark_env" |
| 46 | + conda remove --name $benchmark_env --all -y |
| 47 | + conda env create -n $benchmark_env -f environment_${CURRENT_OS}.yml |
| 48 | +else |
| 49 | + export benchmark_env="rmg_env" |
| 50 | +fi |
| 51 | + |
| 52 | +# Compile benchmark RMG-Py: |
| 53 | +cd $benchmark/RMG-Py |
| 54 | +source activate $benchmark_env |
| 55 | +make |
| 56 | +source deactivate |
| 57 | + |
| 58 | +export RMG_BENCHMARK=$benchmark/RMG-Py |
| 59 | +export RMGDB_BENCHMARK=$benchmark/RMG-database |
| 60 | + |
| 61 | +################# |
| 62 | +# TESTING SETUP # |
| 63 | +################# |
| 64 | + |
| 65 | +# Prepare temporary directory for testing RMG-Py and RMG-db |
| 66 | +testing=$DATA_DIR/code/testing/$(date +%Y-%m-%d:%H:%M:%S) |
| 67 | +rm -rf $testing |
| 68 | +mkdir -p $testing |
| 69 | +cd $testing |
| 70 | + |
| 71 | +# Prepare testing RMG-Py: |
| 72 | +git clone -q https://github.com/ReactionMechanismGenerator/RMG-Py.git |
| 73 | +cd RMG-Py |
| 74 | +git checkout ${RMGPY_TESTING_BRANCH} |
| 75 | +export testing_py_sha=$(git rev-parse HEAD) |
| 76 | +cd .. |
| 77 | + |
| 78 | +# Prepare testing RMG-database |
| 79 | +git clone -q https://github.com/ReactionMechanismGenerator/RMG-database.git |
| 80 | +cd RMG-database |
| 81 | +git checkout ${RMGDB_TESTING_BRANCH} |
| 82 | +export testing_db_sha=$(git rev-parse HEAD) |
| 83 | + |
| 84 | +# Rename testing code folder |
| 85 | +cd $DATA_DIR/code/testing |
| 86 | + |
| 87 | +export testing_tag=py${testing_py_sha:0:12}_db${testing_db_sha:0:12} |
| 88 | + |
| 89 | +if [ ! -d "${testing_tag}" ]; then |
| 90 | + mv $testing $testing_tag |
| 91 | +else |
| 92 | + rm -rf $testing |
| 93 | +fi |
| 94 | +export testing=$DATA_DIR/code/testing/$testing_tag |
| 95 | + |
| 96 | +# Prepare testing environment if requested |
| 97 | +if [ "$SEPARATE_ENV" == true]; then |
| 98 | + cd $testing/RMG-Py |
| 99 | + export testing_env="testing_env" |
| 100 | + conda remove --name $testing_env --all -y |
| 101 | + conda env create -n $testing_env -f environment_${CURRENT_OS}.yml |
| 102 | +else |
| 103 | + export testing_env=$benchmark_env |
| 104 | +fi |
| 105 | + |
| 106 | +# Compile RMG-Py: |
| 107 | +cd $testing/RMG-Py |
| 108 | +source activate $testing_env |
| 109 | +make |
| 110 | +source deactivate |
| 111 | + |
| 112 | +export RMG_TESTING=$testing/RMG-Py |
| 113 | +export RMGDB_TESTING=$testing/RMG-database |
| 114 | + |
| 115 | +# Go to RMG-tests folder: |
| 116 | +cd $DATA_DIR |
| 117 | + |
0 commit comments