Skip to content

Commit

Permalink
Values extraction #53 cases deletion and shell enhancement
Browse files Browse the repository at this point in the history
  • Loading branch information
tanguypierre committed Jun 21, 2024
1 parent c2a3e16 commit 6abadc9
Show file tree
Hide file tree
Showing 7 changed files with 160 additions and 81 deletions.
30 changes: 20 additions & 10 deletions launchProcess.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,28 +8,38 @@ if [ $# -eq 0 ]; then
echo "Usage: $0 <hostname>"
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
21 changes: 0 additions & 21 deletions src/feelpp/benchmarking/cases/case2-bench.cfg

This file was deleted.

21 changes: 0 additions & 21 deletions src/feelpp/benchmarking/cases/case3-bench.cfg

This file was deleted.

22 changes: 0 additions & 22 deletions src/feelpp/benchmarking/cases/case4-bench.cfg

This file was deleted.

15 changes: 12 additions & 3 deletions src/feelpp/benchmarking/reframe/regression-tests/heatTest.py
Original file line number Diff line number Diff line change
Expand Up @@ -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\-]+)'
Expand Down
5 changes: 1 addition & 4 deletions src/feelpp/benchmarking/reframe/regression-tests/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -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')
Expand Down
127 changes: 127 additions & 0 deletions test.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,127 @@
#!/bin/bash

usage() {
echo "Usage: $0 <machine> [-a|--all] [-tb name|--toolbox=name] [-c path|--case=path] [-h|--help]"
echo " <machine> 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>
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

0 comments on commit 6abadc9

Please sign in to comment.