Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/hpcraink/fsprj2
Browse files Browse the repository at this point in the history
  • Loading branch information
PhilKoe committed Jan 9, 2024
2 parents ee79ff6 + b4d23b7 commit 9e2c6b0
Show file tree
Hide file tree
Showing 13 changed files with 337 additions and 1 deletion.
2 changes: 2 additions & 0 deletions libiotrace/scripts/testscripts/config/config.sample
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@ base_path="/home/es/es_es/<username>/<path>"
# test_mpi_file_io_2
# test_posix_file_io_random
# test_openFOAM_VirgilioRe22Pr7_Perfomance_2_worker
# test_openFOAM_VirgilioRe22Pr7_Perfomance_2_worker_measurement
# test_openFOAM_VirgilioRe22Pr7_Perfomance_4_worker
# test_python_simple_write
test_config="test_mpi_file_io"

export test_base_script_dir="$(dirname "$0")"
Expand Down
1 change: 1 addition & 0 deletions libiotrace/scripts/testscripts/config/test_mpi_file_io
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ test_libiotrace_cmake_options=(
# slurm
test_nodes=3
test_processes_per_worker=40
export test_processes_per_influxdb=40
test_mem="90000mb"
test_time="00:10:00"
test_queue_name="dev_multiple"
Expand Down
1 change: 1 addition & 0 deletions libiotrace/scripts/testscripts/config/test_mpi_file_io_2
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ test_libiotrace_cmake_options=(
# slurm
test_nodes=3
test_processes_per_worker=40
export test_processes_per_influxdb=40
test_mem="90000mb"
test_time="00:10:00"
test_queue_name="dev_multiple"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ test_libiotrace_cmake_options=(
# slurm
test_nodes=3
test_processes_per_worker=40
export test_processes_per_influxdb=40
test_mem="249600mb"
test_time="00:30:00"
test_queue_name="dev_multiple_il"
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
# dependencies
test_source_configs=("influxdb" "gcc_mpi" "openfoam_com_2106")
test_source=("${test_openfoam_dir}/etc/bashrc")
test_modules=("compiler/gnu/${test_gcc_version}" "mpi/openmpi/${test_mpi_version}")
test_file_url=("https://bwsyncandshare.kit.edu/s/MQfkypzfHfmZZtM/download VirgilioRe22Pr7_Perfomance.zip")
test_unzip_files=("VirgilioRe22Pr7_Perfomance.zip")

# libiotrace
test_libiotrace_cmake_options=(
-DALL_WRAPPERS_ACTIVE=OFF
-DENABLE_FILESYSTEM_METADATA=OFF
-DENABLE_OUTPUT=INFLUXDB
-DENABLE_REMOTE_CONTROL=OFF
-DFILENAME_RESOLUTION_ENABLED=OFF
-DLOGGING=OFF
-DLOG_WRAPPER_TIME=OFF
-DREALTIME=ON
-DSENDING=ON
-DWITH_ALLOC=OFF
-DWITH_DL_IO=OFF
-DWITH_MPI_IO=OFF
-DWITH_POSIX_AIO=OFF
-DWITH_POSIX_IO=ON
-DWITH_STD_IO=OFF
)

# slurm
test_nodes=3
test_processes_per_worker=40
export test_processes_per_influxdb=80
test_mem="249600mb"
test_time="05:00:00"
test_queue_name="multiple_il"

# test script
test_script="./openFOAM_VirgilioRe22Pr7_Perfomance_measurement.sh"
export test_source_dir="${PWD}/VirgilioRe22Pr7_Perfomance"
export test_source_1="${test_source_dir}/1"
export test_source_constant="${test_source_dir}/constant"
export test_source_system="${test_source_dir}/system"
export test_end_time=1.001
export test_iterations=20
# newline separated list of functions to trace
#export IOTRACE_WHITELIST_FUNCTIONS=""
export IOTRACE_WHITELIST_FUNCTIONS="
read
pread
pread64
write
pwrite
pwrite64
readv
writev
preadv
preadv64
pwritev
pwritev64
preadv2
preadv64v2
pwritev2
pwritev64v2
copy_file_range
getline
getdelim
fread
fwrite
fprintf
fwprintf
vfprintf
vfwprintf
fscanf
fwscanf
vfscanf
vfwscanf"

# output
test_name="3_nodes_VirgilioRe22Pr7_Perfomance"
export IOTRACE_LOG_NAME=openFOAM_VirgilioRe22Pr7_Perfomance_test1
export performance_data_file=${PWD}/performance_test
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ test_libiotrace_cmake_options=(
# slurm
test_nodes=5
test_processes_per_worker=40
export test_processes_per_influxdb=40
test_mem="249600mb"
test_time="00:30:00"
test_queue_name="multiple_il"
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
# dependencies
test_source_configs=("influxdb" "gcc_mpi" "openfoam_com_2106")
test_source=("${test_openfoam_dir}/etc/bashrc")
test_modules=("compiler/gnu/${test_gcc_version}" "mpi/openmpi/${test_mpi_version}")
test_file_url=("https://bwsyncandshare.kit.edu/s/MQfkypzfHfmZZtM/download VirgilioRe22Pr7_Perfomance.zip")
test_unzip_files=("VirgilioRe22Pr7_Perfomance.zip")

# libiotrace
test_libiotrace_cmake_options=(
-DALL_WRAPPERS_ACTIVE=OFF
-DENABLE_FILESYSTEM_METADATA=OFF
-DENABLE_OUTPUT=INFLUXDB
-DENABLE_REMOTE_CONTROL=OFF
-DFILENAME_RESOLUTION_ENABLED=OFF
-DLOGGING=OFF
-DLOG_WRAPPER_TIME=OFF
-DREALTIME=ON
-DSENDING=ON
-DWITH_ALLOC=OFF
-DWITH_DL_IO=OFF
-DWITH_MPI_IO=OFF
-DWITH_POSIX_AIO=OFF
-DWITH_POSIX_IO=ON
-DWITH_STD_IO=OFF
)

# slurm
test_nodes=5
test_processes_per_worker=40
export test_processes_per_influxdb=80
test_mem="249600mb"
test_time="03:00:00"
test_queue_name="multiple_il"

# test script
test_script="./openFOAM_VirgilioRe22Pr7_Perfomance_measurement.sh"
export test_source_dir="${PWD}/VirgilioRe22Pr7_Perfomance"
export test_source_1="${test_source_dir}/1"
export test_source_constant="${test_source_dir}/constant"
export test_source_system="${test_source_dir}/system"
export test_end_time=1.001
export test_iterations=20
# newline separated list of functions to trace
#export IOTRACE_WHITELIST_FUNCTIONS=""
export IOTRACE_WHITELIST_FUNCTIONS="
read
pread
pread64
write
pwrite
pwrite64
readv
writev
preadv
preadv64
pwritev
pwritev64
preadv2
preadv64v2
pwritev2
pwritev64v2
copy_file_range
getline
getdelim
fread
fwrite
fprintf
fwprintf
vfprintf
vfwprintf
fscanf
fwscanf
vfscanf
vfwscanf"

# output
test_name="3_nodes_VirgilioRe22Pr7_Perfomance"
export IOTRACE_LOG_NAME=openFOAM_VirgilioRe22Pr7_Perfomance_test1
export performance_data_file=${PWD}/performance_test
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ test_libiotrace_cmake_options=(
# slurm
test_nodes=3
test_processes_per_worker=16
export test_processes_per_influxdb=40
test_mem="90000mb"
test_time="00:10:00"
test_queue_name="dev_multiple"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ test_libiotrace_cmake_options=(
# slurm
test_nodes=3
test_processes_per_worker=2
export test_processes_per_influxdb=40
test_mem="90000mb"
test_time="00:20:00"
test_queue_name="dev_multiple"
Expand Down
36 changes: 36 additions & 0 deletions libiotrace/scripts/testscripts/config/test_python_simple_write
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# dependencies
test_source_configs=("influxdb")

# libiotrace
test_libiotrace_cmake_options=(
-DALL_WRAPPERS_ACTIVE=ON
-DENABLE_FILESYSTEM_METADATA=OFF
-DENABLE_OUTPUT=INFLUXDB
-DENABLE_REMOTE_CONTROL=OFF
-DFILENAME_RESOLUTION_ENABLED=OFF
-DLOGGING=OFF
-DLOG_WRAPPER_TIME=OFF
-DREALTIME=ON
-DSENDING=ON
-DWITH_ALLOC=OFF
-DWITH_DL_IO=OFF
-DWITH_MPI_IO=OFF
-DWITH_POSIX_AIO=OFF
-DWITH_POSIX_IO=ON
-DWITH_STD_IO=OFF
)

# slurm
test_nodes=2
test_processes_per_worker=1
export test_processes_per_influxdb=40
test_mem="90000mb"
test_time="00:30:00"
test_queue_name="dev_multiple"

# test script
test_script="./python_simple_write.sh"

# output
test_name="2_nodes_python_simple_write"
export IOTRACE_LOG_NAME=python_simple_write_test1
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ export PATH="$PWD:$PATH"
rm -f ${GLOBAL_TMP_DIR}/ib0_${TEST_NAME}

# start influxDB
bash -c "srun -N 1 -n 1 -w $DBNODE bash -c \"export PATH="${PATH}" && ${test_base_script_dir}/runs_on_db_node.sh ${TEST_NAME} ${INFLUXDB_DIR} ${GLOBAL_TMP_DIR}\"" &
bash -c "srun -N 1 -n 1 -c ${test_processes_per_influxdb} -w $DBNODE bash -c \"export PATH="${PATH}" && ${test_base_script_dir}/runs_on_db_node.sh ${TEST_NAME} ${INFLUXDB_DIR} ${GLOBAL_TMP_DIR}\"" &
echo "influxDB starting on node ${DBNODE}"

# wait until influxDB is started
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@
#!/bin/bash
IOTRACE_DATABASE_IP=$1
MPI_PATH=$(which mpirun)
MPI_PATH="${MPI_PATH%/*}/../lib64/libmpi.so"
IOTRACE_LD_PRELOAD=${MPI_PATH}:${test_libiotrace_so}
IOTRACE_WHITELIST=${3}/${2}/whitelist

format="\t%E\t%U\t%S\t%D\t%K\t%M"

PROCESS_COUNT=$(( ${5} * ${6} ))
echo " process count: ${PROCESS_COUNT}"

# source tutorial run functions
echo " source tutorial run functions"
. $WM_PROJECT_DIR/bin/tools/RunFunctions

# copy testcase to test directory
echo " copy test case"
rm -rf ${3}/${2}
mkdir -p ${3}/${2}
ln -s ${test_source_1} ${3}/${2}/
ln -s ${test_source_constant} ${3}/${2}/
cp -r ${test_source_system} ${3}/${2}/

# patch test case
echo " patch test case (use ${PROCESS_COUNT} subdomains with ${PROCESS_COUNT} processes)"
sed -i -r "s:^numberOfSubdomains 280;:numberOfSubdomains ${PROCESS_COUNT};:" "${3}/${2}/system/decomposeParDict"
case ${PROCESS_COUNT} in
4)
SUBDOMAINS="2 2 1"
;;
20)
SUBDOMAINS="20 1 1"
;;
40)
SUBDOMAINS="40 1 1"
;;
80)
SUBDOMAINS="80 1 1"
;;
160)
SUBDOMAINS="160 1 1"
;;
168)
SUBDOMAINS="168 1 1"
;;
320)
SUBDOMAINS="320 1 1"
;;
*)
echo "unknown subdomain count: ${PROCESS_COUNT}"
exit 1
;;
esac
sed -i -r "s:^ n \(168 1 1\);: n (${SUBDOMAINS});:" "${3}/${2}/system/decomposeParDict"
sed -i -r "s:^SimuEnd\t\t100;:SimuEnd ${test_end_time};:" "${3}/${2}/system/controlDict"

# prepare whitelist
rm -f $IOTRACE_WHITELIST
# prepare output file
rm -f ${performance_data_file}
echo -e "name\ttest\treal h:m:s\tuser CPU-seconds\tsys CPU-seconds\tavg unshared data kb\tavg data+stack+text kb\tmax kb">>${performance_data_file}

# define libiotrace and necessary environment variables for use with and without mpirun
LIBIOTRACE_WITH_ENV="IOTRACE_LOG_NAME=$IOTRACE_LOG_NAME IOTRACE_DATABASE_IP=$IOTRACE_DATABASE_IP IOTRACE_DATABASE_PORT=$IOTRACE_INFLUX_PORT IOTRACE_INFLUX_ORGANIZATION=$IOTRACE_INFLUX_ORGANIZATION IOTRACE_INFLUX_BUCKET=$IOTRACE_INFLUX_BUCKET IOTRACE_INFLUX_TOKEN=$IOTRACE_INFLUX_TOKEN IOTRACE_WHITELIST=$IOTRACE_WHITELIST LD_PRELOAD=$IOTRACE_LD_PRELOAD"
MPI_LIBIOTRACE_WITH_ENV="-x "${LIBIOTRACE_WITH_ENV// / -x }

# start test
echo " start test"
echo " running redistributePar"
#cd ${3}/${2}/ && mpirun -N ${6} -H ${4} -np ${PROCESS_COUNT} ${MPI_LIBIOTRACE_WITH_ENV} redistributePar -decompose -parallel < /dev/null > log.redistributePar 2>&1
cd ${3}/${2}/ && mpirun -N ${6} -H ${4} -np ${PROCESS_COUNT} redistributePar -decompose -parallel < /dev/null > log.redistributePar 2>&1

# test with libiotrace and POSIX functions in whitelist
echo -e "${IOTRACE_WHITELIST_FUNCTIONS}">$IOTRACE_WHITELIST
for ((i = 0; i < test_iterations; i += 1)); do
echo " running buoyantPimpleFoam"
cd ${3}/${2}/ && /usr/bin/time -o ${performance_data_file} -a -f "posix_active\t$i$format" mpirun -N ${6} -H ${4} -np ${PROCESS_COUNT} ${MPI_LIBIOTRACE_WITH_ENV} buoyantPimpleFoam -parallel < /dev/null > log.buoyantPimpleFoam 2>&1
rm -rf ${3}/${2}/processor[0-9]*/1.*
rm -f log.*
rm -rf postProcessing
done
echo " with libiotrace and active wrapper: done"

# test with libiotrace and empty whitelist
echo -e "">$IOTRACE_WHITELIST
for ((i = 0; i < test_iterations; i += 1)); do
echo " running buoyantPimpleFoam"
cd ${3}/${2}/ && /usr/bin/time -o ${performance_data_file} -a -f "all_inactive\t$i$format" mpirun -N ${6} -H ${4} -np ${PROCESS_COUNT} ${MPI_LIBIOTRACE_WITH_ENV} buoyantPimpleFoam -parallel < /dev/null > log.buoyantPimpleFoam 2>&1
rm -rf ${3}/${2}/processor[0-9]*/1.*
rm -f log.*
rm -rf postProcessing
done
echo " with libiotrace and inactive wrapper: done"

# test without libiotrace
for ((i = 0; i < test_iterations; i += 1)); do
echo " running buoyantPimpleFoam"
cd ${3}/${2}/ && /usr/bin/time -o ${performance_data_file} -a -f "without_libiotrace\t$i$format" mpirun -N ${6} -H ${4} -np ${PROCESS_COUNT} buoyantPimpleFoam -parallel < /dev/null > log.buoyantPimpleFoam 2>&1
rm -rf ${3}/${2}/processor[0-9]*/1.*
rm -f log.*
rm -rf postProcessing
done
echo " without libiotrace: done"

rm -f $IOTRACE_WHITELIST
28 changes: 28 additions & 0 deletions libiotrace/scripts/testscripts/tests/python_simple_write.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
#!/bin/bash
IOTRACE_DATABASE_IP=$1
IOTRACE_LD_PRELOAD=${test_libiotrace_so}

# define libiotrace and necessary environment variables
LIBIOTRACE_WITH_ENV="IOTRACE_LOG_NAME=$IOTRACE_LOG_NAME IOTRACE_DATABASE_IP=$IOTRACE_DATABASE_IP IOTRACE_DATABASE_PORT=$IOTRACE_INFLUX_PORT IOTRACE_INFLUX_ORGANIZATION=$IOTRACE_INFLUX_ORGANIZATION IOTRACE_INFLUX_BUCKET=$IOTRACE_INFLUX_BUCKET IOTRACE_INFLUX_TOKEN=$IOTRACE_INFLUX_TOKEN IOTRACE_WHITELIST=$IOTRACE_WHITELIST LD_PRELOAD=$IOTRACE_LD_PRELOAD"

# start test
echo " start test"
python_script='import os
import time
data_size = 1 << 30
data_buffer = bytearray(data_size)
start_time = time.time()
with open("output.txt", "wb") as file:
file.write(data_buffer)
end_time = time.time()
os.remove("output.txt")
elapsed_time = end_time - start_time
print(f"Wrote {data_size} bytes to file in {elapsed_time:.4f} seconds.")
'
python3 -c "${python_script}"
env ${LIBIOTRACE_WITH_ENV} python3 -c "${python_script}"

0 comments on commit 9e2c6b0

Please sign in to comment.