diff --git a/launchProcess.sh b/launchProcess.sh index 673471f7..b7702a5b 100644 --- a/launchProcess.sh +++ b/launchProcess.sh @@ -8,28 +8,38 @@ if [ $# -eq 0 ]; then echo "Usage: $0 " exit 1 fi -hostname=$1 +hostname=$1 # Arguments handling to be improved # Reframe environment variables export RFM_CONFIG_FILES=$(pwd)/src/feelpp/benchmarking/reframe/cluster-config/${hostname}.py export RFM_PREFIX=$(pwd)/build/reframe/ +disk_path="/home" +#disk_path="/data/home" +#disk_path="/data/scratch/" +#disk_path="/nvme0/" +toolbox="heat" + + +export RFM_TEST_DIR=$(pwd)/src/feelpp/benchmarking/reframe/regression-tests/ +export FEELPP_TOOLBOXES_CASES=/usr/share/feelpp/data/testcases/toolboxes/${toolbox}/cases/ +export FEELPP_OUTPUT_PREFIX="${disk_path}/${USER}/feelppdbTANGUYYYY" -export TEST_DIR=$(pwd)/src/feelpp/benchmarking/reframe/regression-tests/ -export BENCH_CASES_CFG=$(pwd)/src/feelpp/benchmarking/cases/ columns=$(tput cols) current_date=$(date +%Y%m%d) - -find $BENCH_CASES_CFG -type f -name "*.cfg" | while read cfgPath +find $FEELPP_TOOLBOXES_CASES -type f -name "*.cfg" | while read cfgPath do - echo yes '-' | head -n "$columns" | tr -d '\n' - casename=$(basename $cfgPath) - echo "[Launching $casename on $hostname]" - export RFM_REPORT_FILE=$(pwd)/docs/modules/${hostname}/pages/reports/${casename%-bench.cfg}-${current_date}.json - reframe -c $TEST_DIR/heatTest.py -S case=$cfgPath -r --system=$hostname + relative_path=${cfgPath#"$FEELPP_TOOLBOXES_CASES"} + relative_dir=$(dirname "$relative_path") + base_name=$(basename "${relative_path%.cfg}") + + report_path=$(pwd)/docs/modules/${hostname}/pages/reports/${toolbox}/${relative_dir}/${current_date}-${base_name}.json + + echo "[Launching $relative_path on $hostname]" + reframe -c $RFM_TEST_DIR/${toolbox}Test.py -S case=$cfgPath -r --system=$hostname --report-file=$report_path done \ No newline at end of file diff --git a/src/feelpp/benchmarking/cases/case2-bench.cfg b/src/feelpp/benchmarking/cases/case2-bench.cfg deleted file mode 100644 index b7ad4d52..00000000 --- a/src/feelpp/benchmarking/cases/case2-bench.cfg +++ /dev/null @@ -1,21 +0,0 @@ -# Test default value: -# - discretization = P1 -# - filename = $cfgdir/case2.geo -# - hsize = 0.001 - -case.dimension=2 -#case.discretization=P2 # for gaya -case.discretization=P1 # for local - -[heat] -filename=/usr/share/feelpp/data/testcases/toolboxes/heat/cases/Building/ThermalBridgesENISO10211/case2.json - -json.merge_patch={"Meshes":{"heat":{"Import":{"filename": "/usr/share/feelpp/data/testcases/toolboxes/heat/cases/Building/ThermalBridgesENISO10211/case2.geo"}}}} -#json.merge_patch={"Meshes":{"heat":{"Import":{"hsize": 0.0005}}}} # for gaya -json.merge_patch={"Meshes":{"heat":{"Import":{"partition": true}}}} - -#verbose=1 -#verbose_solvertimer=1 -#reuse-prec=1 -pc-type=lu #gamg -ksp-monitor=1 \ No newline at end of file diff --git a/src/feelpp/benchmarking/cases/case3-bench.cfg b/src/feelpp/benchmarking/cases/case3-bench.cfg deleted file mode 100644 index e98f26da..00000000 --- a/src/feelpp/benchmarking/cases/case3-bench.cfg +++ /dev/null @@ -1,21 +0,0 @@ -# Test default value: -# - discretization = P1 -# - filename = $cfgdir/case2.geo -# - hsize = 0.02 - -case.dimension=3 -#case.discretization=P2 # for gaya -case.discretization=P1 # for local - -[heat] -filename=/usr/share/feelpp/data/testcases/toolboxes/heat/cases/Building/ThermalBridgesENISO10211/case3.json - -json.merge_patch={"Meshes":{"heat":{"Import":{"filename": "/usr/share/feelpp/data/testcases/toolboxes/heat/cases/Building/ThermalBridgesENISO10211/case3.geo"}}}} -#json.merge_patch={"Meshes":{"heat":{"Import":{"hsize": 0.01}}}} # for gaya -json.merge_patch={"Meshes":{"heat":{"Import":{"partition": true}}}} - -#verbose=1 -#verbose_solvertimer=1 -#reuse-prec=1 -pc-type=gamg -ksp-monitor=1 diff --git a/src/feelpp/benchmarking/cases/case4-bench.cfg b/src/feelpp/benchmarking/cases/case4-bench.cfg deleted file mode 100644 index b2196b91..00000000 --- a/src/feelpp/benchmarking/cases/case4-bench.cfg +++ /dev/null @@ -1,22 +0,0 @@ -# Test default configuration: -# - discretization = P1 -# - filename = $cfgdir/case4.json -# - hsize = 0.02 - -case.dimension=3 -#case.discretization=P2 # for gaya -case.discretization=P1 # for local - -[heat] -json.filename=/usr/share/feelpp/data/testcases/toolboxes/heat/cases/Building/ThermalBridgesENISO10211/case4.json - -json.merge_patch={"Meshes":{"heat":{"Import":{"filename": "/usr/share/feelpp/data/testcases/toolboxes/heat/cases/Building/ThermalBridgesENISO10211/case4.geo"}}}} -#json.merge_patch={"Meshes":{"heat":{"Import":{"hsize": 0.01}}}} # for gaya -json.merge_patch={"Meshes":{"heat":{"Import":{"partition": true}}}} - - -#verbose=1 -#verbose_solvertimer=1 -#reuse-prec=1 -pc-type=gamg -ksp-monitor=1 diff --git a/src/feelpp/benchmarking/reframe/regression-tests/heatTest.py b/src/feelpp/benchmarking/reframe/regression-tests/heatTest.py index b020cf6f..b6ac3eb0 100644 --- a/src/feelpp/benchmarking/reframe/regression-tests/heatTest.py +++ b/src/feelpp/benchmarking/reframe/regression-tests/heatTest.py @@ -6,15 +6,24 @@ class HeatToolboxTest (Setup): descr = 'Launch testcases from the Heat Toolbox' - executable = 'feelpp_toolbox_heat' + toolbox = 'heat' + #toolbox = variable(str) case = variable(str) + + @run_after('init') + def build_paths(self): + self.caseRelativeDir = self.case.split("cases/")[-1][:-4] + @run_before('run') def set_executable_opts(self): + self.executable = f'feelpp_toolbox_{self.toolbox}' self.executable_opts = [f'--config-file {self.case}', + f'--repository.prefix {self.feelppdbPath}', + f'--repository.case toolboxes/{self.toolbox}/{self.caseRelativeDir}_np{self.nbTask}', '--repository.append.np 0', - '--heat.scalability-save 1', - f'--directory toolboxes/heat/ThermalBridgesENISO10211/Case4_np{self.nbTask}'] + '--heat.scalability-save 1'] + #'--case.discretization PXXX' namePatt = '([a-zA-z\-]+)' diff --git a/src/feelpp/benchmarking/reframe/regression-tests/setup.py b/src/feelpp/benchmarking/reframe/regression-tests/setup.py index f34524cf..14db57c4 100644 --- a/src/feelpp/benchmarking/reframe/regression-tests/setup.py +++ b/src/feelpp/benchmarking/reframe/regression-tests/setup.py @@ -23,14 +23,11 @@ class Setup(rfm.RunOnlyRegressionTest): valid_systems = ['*'] valid_prog_environs = ['*'] - #TODO - homeDir = os.environ['HOME'] - feelLogPath = os.path.join(homeDir, 'feelppdb/') + feelppdbPath = os.environ.get('FEELPP_OUTPUT_PREFIX') # Parametrization nbTask = parameter(parametrizeTaskNumber()) - #nbTask = parameter([4,8]) @run_before('run') diff --git a/test.sh b/test.sh new file mode 100755 index 00000000..beda54d8 --- /dev/null +++ b/test.sh @@ -0,0 +1,127 @@ +#!/bin/bash + +usage() { + echo "Usage: $0 [-a|--all] [-tb name|--toolbox=name] [-c path|--case=path] [-h|--help]" + echo " Name of the machine " + echo " -a, --all Launch every testcase from every toolbox" + echo " (default if no toolbox provided)" + echo " -tb name, --toolbox name Name of the toolbox (multiple names separated by ':')" + echo " -c path, --case path Path to the case .cfg file (multiple paths separated by ':', requires -tb)" + echo " -h, --help Display help" +} + +# Check for --help option +if [ "$*" == "-h" ] || [ "$*" == "--help" ]; then + usage + exit 0 +fi + +valid_machines=("discoverer" "gaya" "karolina" "local" "meluxina") + +# Check for obligatory arguments (=machine) +if [ $# -lt 1 ] || ! [[ " ${valid_machines[*]} " == *" $1 "* ]]; then + usage + exit 1 +fi + + +# Assign the first argument as +machine=$1 +shift + +# Initialiser les variables pour les options +option_a=0 +toolboxes=() +cases=() + +# Traiter les options +while [ $# -gt 0 ]; do + case "$1" in + -a|--all) + option_a=1 + shift + ;; + -tb|--toolbox) + if [[ "$2" != "" && "$2" != -* ]]; then + if [[ "$2" == *=* ]]; then + toolboxes+=("${2#*=}") + shift 2 + else + shift + toolboxes+=("$1") + shift + fi + else + echo "Error: Option -tb|--toolbox requires a non-empty argument." + usage + exit 1 + fi + ;; + -c|--case) + if [[ "$2" != "" && "$2" != -* ]]; then + if [[ "$2" == *=* ]]; then + IFS=':' read -r -a cases <<< "${2#*=}" + shift 2 + else + shift + IFS=':' read -r -a cases <<< "$1" + shift + fi + else + echo "Error: Option -c|--case requires a non-empty argument." + usage + exit 1 + fi + ;; + -h|--help) + usage + exit 0 + ;; + --) + shift + break + ;; + *) + echo "Error: Invalid option: $1" + usage + exit 1 + ;; + esac +done + +# Vérifier si --case est fourni sans --toolbox +if [ ${#cases[@]} -gt 0 ] && [ ${#toolboxes[@]} -eq 0 ]; then + echo "Error: -c|--case requires -tb|--toolbox to be specified." + usage + exit 1 +fi + +# Logique du script en fonction des options +echo "Machine name: $machine" + +if [ $option_a -eq 1 ]; then + echo "Option A activée : Lancer tous les cas de test de toutes les boîtes à outils" +fi + +if [ ${#toolboxes[@]} -ne 0 ]; then + echo "Selected toolboxes: ${toolboxes[*]}" +fi + +if [ ${#cases[@]} -ne 0 ]; then + echo "Selected cases: ${cases[*]}" +fi + +# Afficher les arguments restants +if [ $# -gt 0 ]; then + echo "Remaining arguments: $@" +fi + +# Logique pour lancer les tests pour chaque boîte à outils sélectionnée +for toolbox in "${toolboxes[@]}"; do + echo "Launching tests for toolbox: $toolbox" + for case_path in "${cases[@]}"; do + echo "Using case file: $case_path" + # Ajouter la logique pour utiliser le fichier de cas spécifique pour cette toolbox + done + # Ici, ajouter la logique pour lancer les tests pour chaque toolbox +done