diff --git a/test/apps/iodemo/README.md b/test/apps/iodemo/README.md index fdff55c20b2..577780c9348 100644 --- a/test/apps/iodemo/README.md +++ b/test/apps/iodemo/README.md @@ -7,15 +7,15 @@ The run_io_demo.sh will generate launch script with name ```iodemo_commands_$(hostname).sh``` ``` bash -%./run_io_demo.sh --dry-run -i eth0 -H $(hostname),$(hostname) --num-clients 5 \ - --num-servers 5 --tasks-per-node 10 --duration $((10*60)) $PWD/tester +%./run_io_demo.sh --dry-run -i eth0 -H node1,node2 --num-clients 5 \ + --num-servers 5 --tasks-per-node 10 --duration $((10*60)) --log-dir $PWD/logs $PWD/io_demo Launch configuration: - host_list : 'mtr-vdi-326,mtr-vdi-326' + host_list : 'node1,node2' tasks_per_node : '10' map_by : 'node' num_clients : '5' num_servers : '5' - iodemo_exe : '/labhome/miked/workspace/git/forks/ucx/test/apps/iodemo/tester' + iodemo_exe : '/labhome/miked/workspace/git/forks/ucx/test/apps/iodemo/io_demo' iodemo_client_args : '' net_if : 'eth0' base_port_num : '20000' @@ -23,24 +23,15 @@ Launch configuration: client_wait_time : '2' launcher : 'pdsh -b -w' dry_run : '1' -iodemo_mtr-vdi-326_server_00.log -iodemo_mtr-vdi-326_server_01.log -iodemo_mtr-vdi-326_client_00.log -iodemo_mtr-vdi-326_client_01.log -iodemo_mtr-vdi-326_server_00.log -iodemo_mtr-vdi-326_server_01.log -iodemo_mtr-vdi-326_client_00.log -iodemo_mtr-vdi-326_client_01.log - -% ls -1 iodemo_commands_mtr-vdi-326.sh -iodemo_commands_mtr-vdi-326.sh + node1 : /labhome/miked/workspace/git/forks/ucx/test/apps/iodemo/iodemo_commands_node1.sh + node2 : /labhome/miked/workspace/git/forks/ucx/test/apps/iodemo/iodemo_commands_node2.sh ``` ## Check what tags are provided by script for start/stop/status operations ``` bash -%./iodemo_commands_mtr-vdi-326.sh -show-tags +%./iodemo_commands_node1.sh -show-tags Showing tags ==== Servers: server_0 @@ -61,15 +52,15 @@ client_4 ``` bash -%./iodemo_commands_mtr-vdi-326.sh -tag server_0 -status -%./iodemo_commands_mtr-vdi-326.sh -tag server_0 -stop -%./iodemo_commands_mtr-vdi-326.sh -tag server_0 -start +%./iodemo_commands_node1.sh -tag server_0 -status +%./iodemo_commands_node1.sh -tag server_0 -stop +%./iodemo_commands_node1.sh -tag server_0 -start ``` ## Running all processes ``` bash -%./iodemo_commands_mtr-vdi-326.sh +%./iodemo_commands_node1.sh ``` diff --git a/test/apps/iodemo/run_io_demo.sh b/test/apps/iodemo/run_io_demo.sh index deaa0ac8ad1..aa5c62c87ef 100755 --- a/test/apps/iodemo/run_io_demo.sh +++ b/test/apps/iodemo/run_io_demo.sh @@ -93,6 +93,7 @@ init_config() client_wait_time=2 launcher="pdsh -b -w" dry_run=0 + log_dir=$PWD # command line args will override slurm env vars check_slurm_env @@ -108,7 +109,7 @@ show_config() iodemo_exe iodemo_client_args \ net_if base_port_num \ duration client_wait_time \ - launcher dry_run + launcher dry_run log_dir do show_var ${key} done @@ -142,6 +143,7 @@ usage() echo " The syntax of launcher command should be:" echo " host1,host2,... " echo " --dry-run Do not launch the application, just generate run scripts" + echo " --log-dir Path to log directory, default: $PWD" echo } @@ -167,6 +169,10 @@ parse_args() net_if="$2" shift ;; + --log-dir) + log_dir="$2" + shift + ;; -d|--duration) duration="$2" shift @@ -216,7 +222,7 @@ parse_args() check_params() { - if [ -z ${iodemo_exe} ] + if [ ! -x "${iodemo_exe}" ] then error "missing executable from command line" fi @@ -427,6 +433,21 @@ make_scripts() kill_iodemo } + usage() + { + echo + echo "Usage: $command_file [options] " + echo + echo "Where options are:" + + echo " -h Show this message" + echo " -show-tags Show available tags" + echo " -tag - start/stop/status iodemo role for selected tag" + echo + echo Default: Run all tags when run with no options + echo + } + # kill existing processes and trap signals @@ -476,8 +497,14 @@ make_scripts() echo exit 0 ;; + -h|--help) + usage + exit 0 + ;; *) - error "Invalid parameter '${key}'" + echo "Invalid parameter '${key}'" + usage + exit 1 ;; esac shift @@ -539,15 +566,17 @@ make_scripts() # Add servers commands cat >>${command_file} <<-EOF + # create log_dir if needed + [ ! -d "$log_dir" ] && mkdir -p $log_dir + # Server commands EOF - cmd_prefix="stdbuf -e0 -o0 timeout -s 9 $((duration + client_wait_time))s" for ((i=0;i<${num_servers_per_host[${host}]};++i)) do port_num=$((base_port_num + i)) - log_file=$(printf "iodemo_%s_server_%02d.log" ${host} $i) - cmd_prefix+=" env IODEMO_ROLE=server_${i} " + log_file=${log_dir}/$(printf "iodemo_%s_server_%02d.log" ${host} $i) + cmd_prefix="stdbuf -e0 -o0 timeout -s 9 $((duration + client_wait_time))s env IODEMO_ROLE=server_${i} " echo ${log_file} cat >>${command_file} <<-EOF function start_server_${i}() { @@ -566,11 +595,10 @@ make_scripts() # Client commands EOF - cmd_prefix="stdbuf -e0 -o0 timeout -s 9 ${duration}s" for ((i=0;i>${command_file} <<-EOF function start_client_${i}() {