From 7b7c537ebb20ba87122adbace4f1c85d5ee5e9a1 Mon Sep 17 00:00:00 2001 From: "Mark A. Grondona" Date: Sun, 9 Feb 2020 21:25:55 -0800 Subject: [PATCH] test: update src/test/sched-bench.sh Fix the sched-bench.sh script to work with modern flux-core. Add new -v, --verbose and -o, --sched-opts=OPTS options, and change -n for --nnodes to -N to avoid confusion with other flux commands. --- src/test/sched-bench.sh | 37 ++++++++++++++++++++++++++----------- 1 file changed, 26 insertions(+), 11 deletions(-) diff --git a/src/test/sched-bench.sh b/src/test/sched-bench.sh index 2869c92fcb52..6eafe5cff84a 100755 --- a/src/test/sched-bench.sh +++ b/src/test/sched-bench.sh @@ -8,8 +8,8 @@ declare prog=$(basename $0) declare NNODES=8 declare CPN=32 -declare -r long_opts="help,nnodes:,cores-per-node:,jobs:,noexec" -declare -r short_opts="hn:c:j:" +declare -r long_opts="help,nnodes:,cores-per-node:,jobs:,noexec,sched-opts:verbose" +declare -r short_opts="hvN:c:j:o:" declare -r usage="\ \n\ Usage: $prog [OPTIONS]\n\ @@ -17,14 +17,19 @@ Simple Flux sched/exec test benchmark.\n\ \n\ Options:\n\ -h, --help display this messages\n\ - -n, --nnodes=NNODES set simulated number of nodes (default=${NNODES})\n\ + -v, --verbose run with extra verbose output\n\ + -N, --nnodes=NNODES set simulated number of nodes (default=${NNODES})\n\ -c, --cores-per-node=N set simulated cores per node (default=${CPN})\n\ -j, --jobs=NJOBS set number of jobs to run (default nnodes*cpn)\n\ + -o, --sched-opts=OPTS set scheduler module load options\n\ --noexec do not simulate execution, just scheduling\n" + log() { local fmt=$1; shift; printf >&2 "$prog: $fmt" "$@"; } die() { log "$@" && exit 1; } +verbose() { test $VERBOSE = "t" && log "$@"; } + log_timing_msg() { local name=$1 local start=$2 @@ -43,9 +48,11 @@ fi eval set -- "$GETOPTS" while true; do case "$1" in - -n|--nnodes) NNODES=$2; shift 2 ;; + -v|--verbose) VERBOSE=t; shift ;; + -N|--nnodes) NNODES=$2; shift 2 ;; -c|--cores-per-node) CPN=$2; shift 2 ;; -j|--jobs) NJOBS=$2; shift 2 ;; + -o|--sched-opts) OPTS="$2"; shift 2 ;; --noexec) NOEXEC=t; shift ;; --) shift ; break ; ;; -h|--help) echo -e "$usage" ; exit 0 ;; @@ -64,32 +71,40 @@ log "broker.pid=$(flux getattr broker.pid)\n" flux module remove sched-simple flux kvs put --json \ resource.hwloc.by_rank="{\"[0-$(($NNODES-1))]\":{\"Core\":$CPN}}" -flux jobspec srun hostname | jq '.attributes.system.duration = .0001' > job.json -flux module load sched-simple +flux mini run --dry-run --setattr=system.exec.test.run_duration=.001s hostname \ + > job.json + +log "Loading sched-simple: ${OPTS}\n" +flux module load sched-simple ${OPTS} || die "Failed to load sched-simple" # If not testing exec system, remove the job-exec module test "$NOEXEC" = "t" && flux module remove job-exec t_start=$(date +%s.%N) -t/ingest/submitbench -f 24 -r $NJOBS job.json > job.list +t/ingest/submitbench -f 1024 -r $NJOBS job.json > job.list t_ingest=$(date +%s.%N) log_timing_msg ingested $t_start $t_ingest -first=$(flux job list -s -c 1 | awk '{print $1}') -last=$(flux job list -s | tail -1 | awk '{print $1}') +test "$VERBOSE" = "t" && flux queue status -v + +last=$(tail -1 job.list) +first=$(head -1 job.list) starttime=$(flux job eventlog $first | awk '$2 == "submit" {print $1}') alloctime=$(flux job wait-event $last alloc | awk '$2 == "alloc" {print $1}') log_timing_msg allocated $starttime $alloctime +test "$VERBOSE" = "t" && flux queue status -v + if test -z "$NOEXEC"; then runtime=$(flux job wait-event $last clean | awk '{print $1}') log_timing_msg ran $starttime $runtime fi -flux queue drain +flux job cancelall -f +flux queue idle --quiet -flux job eventlog $last +test "$VERBOSE" = "t" && flux queue status -v t_done=$(date +%s.%N) log_timing_msg "total walltime for" $t_start $t_done