Skip to content
Snippets Groups Projects
Commit 433fef0f authored by Christoph Alt's avatar Christoph Alt
Browse files

refactored the run script a bit

parent 035d694f
No related branches found
No related tags found
1 merge request!7Add a new benchmark case
Pipeline #709244 passed
Pipeline: cx-test

#709245

    ......@@ -12,34 +12,48 @@ FULL_ARGUMENT="${BUILD_DIR}/${DIR}/${ARGUMENT}"
    dev_name=$(nvidia-smi --id=${VISABLE_DEVICE} --query-gpu=gpu_name --format=csv,noheader 2> /dev/null | tr -d '[:blank:]' || echo "GPU_${VISABLE_DEVICE}")
    # first test case channelflow
    basename_exe=$(basename ${EXECUTABLE})
    profile_file="ncuprofile_channelflow_${dev_name}"
    # with profling
    cmdChannelFlow="${PROFILING} -o $profile_file $MPIRUN $FULL_EXECUTABLE $FULL_ARGUMENT -NumericalSetup.timeSteps=2 -NumericalSetup.useParticles=false"
    export DB_FILE="gpu_profile_percolation_${dev_name}.sqlite3"
    echo "Runing $cmdChannelFlow"
    $cmdChannelFlow && ncu -i "${profile_file}.ncu-rep" --csv --page=raw > "$(basename -s ".ncu-rep" ${profile_file})".csv || echo "${cmdChannelFlow} failed"
    # without profling
    cmdChannelFlow="$MPIRUN $FULL_EXECUTABLE $FULL_ARGUMENT -NumericalSetup.useParticles=false"
    echo "Runing $cmdChannelFlow"
    export DB_FILE="gpu_benchmark_percolation_${dev_name}.sqlite3"
    $cmdChannelFlow || echo "$cmdChannelFlow failed"
    # second test case percolation
    profile_file="ncuprofile_percolation_${dev_name}"
    # with profling
    cmdPercolation="${PROFILING} -o $profile_file $MPIRUN $FULL_EXECUTABLE $FULL_ARGUMENT -NumericalSetup.timeSteps=2"
    echo "Runing $cmdPercolation"
    export DB_FILE="gpu_profile_percolation_${dev_name}.sqlite3"
    $cmdPercolation && ncu -i "${profile_file}.ncu-rep" --csv --page=raw > "$(basename -s ".ncu-rep" ${profile_file})".csv || echo "${cmdPercolation} failed"
    # without profiling
    cmdPercolation="$MPIRUN $FULL_EXECUTABLE $FULL_ARGUMENT"
    echo "Runing $cmdPercolation"
    export DB_FILE="gpu_benchmark_percolation_${dev_name}.sqlite3"
    $cmdPercolation || echo "$cmdPercolation failed"
    PROFILE_EXT=".ncu-rep"
    CSV_EXT=".csv"
    # Function to run the command with profiling
    run_with_profiling() {
    local profile_file=$1
    local db_file=$2
    local cmd=$3
    echo "Running $cmd with profiling"
    export DB_FILE=$db_file
    $cmd && ncu -i "${profile_file}${PROFILE_EXT}" --csv --page=raw > "${profile_file}${CSV_EXT}" || echo "$cmd failed"
    }
    # Function to run the command without profiling
    run_without_profiling() {
    local db_file=$1
    local cmd=$2
    echo "Running $cmd without profiling"
    export DB_FILE=$db_file
    $cmd || echo "$cmd failed"
    }
    # Setup common command parameters
    cmd_channelflow="${MPIRUN} ${FULL_EXECUTABLE} ${FULL_ARGUMENT} -NumericalSetup.useParticles=false"
    cmd_percolation="${MPIRUN} ${FULL_EXECUTABLE} ${FULL_ARGUMENT}"
    # First test case: ChannelFlow
    profile_file_channelflow="ncuprofile_channelflow_${dev_name}"
    db_file_channelflow_profile="gpu_profile_percolation_${dev_name}.sqlite3"
    db_file_channelflow_benchmark="gpu_benchmark_percolation_${dev_name}.sqlite3"
    cmd_channelflow_profile="${PROFILING} -o $profile_file_channelflow $cmd_channelflow -NumericalSetup.timeSteps=2"
    run_with_profiling "$profile_file_channelflow" "$db_file_channelflow_profile" "$cmd_channelflow_profile"
    run_without_profiling "$db_file_channelflow_benchmark" "$cmd_channelflow"
    # Second test case: Percolation
    profile_file_percolation="ncuprofile_percolation_${dev_name}"
    db_file_percolation_profile="gpu_profile_percolation_${dev_name}.sqlite3"
    db_file_percolation_benchmark="gpu_benchmark_percolation_${dev_name}.sqlite3"
    cmd_percolation_profile="${PROFILING} -o $profile_file_percolation $cmd_percolation -NumericalSetup.timeSteps=2"
    run_with_profiling "$profile_file_percolation" "$db_file_percolation_profile" "$cmd_percolation_profile"
    run_without_profiling "$db_file_percolation_benchmark" "$cmd_percolation"
    0% Loading or .
    You are about to add 0 people to the discussion. Proceed with caution.
    Finish editing this message first!
    Please register or to comment