Skip to content

Commit

Permalink
Merge pull request openucx#37 from mike-dubman/topic/iodemo_logdir
Browse files Browse the repository at this point in the history
add --log-dir option, improve help and README
  • Loading branch information
yosefe authored Sep 14, 2020
2 parents 11c6fbf + e71c1aa commit e731e56
Show file tree
Hide file tree
Showing 2 changed files with 48 additions and 29 deletions.
31 changes: 11 additions & 20 deletions test/apps/iodemo/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,40 +7,31 @@
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'
duration : '600'
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
Expand All @@ -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
```

46 changes: 37 additions & 9 deletions test/apps/iodemo/run_io_demo.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -142,6 +143,7 @@ usage()
echo " The syntax of launcher command should be:"
echo " <command> host1,host2,... <exe> <args>"
echo " --dry-run Do not launch the application, just generate run scripts"
echo " --log-dir </path> Path to log directory, default: $PWD"
echo
}

Expand All @@ -167,6 +169,10 @@ parse_args()
net_if="$2"
shift
;;
--log-dir)
log_dir="$2"
shift
;;
-d|--duration)
duration="$2"
shift
Expand Down Expand Up @@ -216,7 +222,7 @@ parse_args()

check_params()
{
if [ -z ${iodemo_exe} ]
if [ ! -x "${iodemo_exe}" ]
then
error "missing executable from command line"
fi
Expand Down Expand Up @@ -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 <tag> -<start|stop|status> 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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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}() {
Expand All @@ -566,11 +595,10 @@ make_scripts()
# Client commands
EOF

cmd_prefix="stdbuf -e0 -o0 timeout -s 9 ${duration}s"
for ((i=0;i<num_clients_per_host[${host}];++i))
do
log_file=$(printf "iodemo_%s_client_%02d.log" ${host} $i)
cmd_prefix+=" env IODEMO_ROLE=client_${i} "
log_file=${log_dir}/$(printf "iodemo_%s_client_%02d.log" ${host} $i)
cmd_prefix="stdbuf -e0 -o0 timeout -s 9 ${duration}s env IODEMO_ROLE=client_${i} "
echo ${log_file}
cat >>${command_file} <<-EOF
function start_client_${i}() {
Expand Down

0 comments on commit e731e56

Please sign in to comment.