Skip to content

Commit

Permalink
Minor usability tweaks/fixes (#1001)
Browse files Browse the repository at this point in the history
* Add nvme unit/perf tests

* Minor tweaks/fixes

* Format fixes

* Address PR feedback
  • Loading branch information
tjruwase authored Apr 23, 2021
1 parent e88ebbc commit 03d24fe
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 45 deletions.
59 changes: 20 additions & 39 deletions csrc/aio/py_test/parse_aio_stats.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,34 +9,12 @@
import argparse
import re

RAW_RATE = 'raw_rate'
E2E_RATE = 'e2e_rate'
SUBMIT_LATENCY = 'submit_latency'
COMPLETE_LATENCY = 'complete_latency'
READ_SPEED = 'read_speed'
WRITE_SPEED = 'write_speed'

TASK_READ_SPEED = 'task_read_speed'

PERF_METRICS = [
RAW_RATE,
E2E_RATE,
SUBMIT_LATENCY,
COMPLETE_LATENCY,
READ_SPEED,
WRITE_SPEED
]
METRIC_SEARCH = {
RAW_RATE: 'ds_raw_time',
E2E_RATE: 'ds_time',
SUBMIT_LATENCY: 'aggr: submit',
COMPLETE_LATENCY: 'aggr: complete',
READ_SPEED: 'E2E Read Speed',
WRITE_SPEED: 'E2E Write Speed'
}

NUM_BYTES = (400 * 1024 * 1024)
NUM_GIGA_BYTES = (1024 * 1024 * 1024)
PERF_METRICS = [READ_SPEED, WRITE_SPEED]

METRIC_SEARCH = {READ_SPEED: 'E2E Read Speed', WRITE_SPEED: 'E2E Write Speed'}


def parse_arguments():
Expand All @@ -47,13 +25,10 @@ def parse_arguments():
required=True,
help='Folder of statistics logs')

parser.add_argument(
'--metric',
type=str,
required=True,
help=
'Performance metric to report: [raw_rate|e2e_rate|submit_latency|complete_latency]'
)
parser.add_argument('--metric',
type=str,
required=True,
help='Performance metric to report: [read_speed|write_speed]')

args = parser.parse_args()
print(f'args = {args}')
Expand Down Expand Up @@ -101,18 +76,24 @@ def get_thread_count(file):
return 1


"""
Extract performance metric from log file.
Sample file lines are:
Task Read Latency = 0.031647682189941406 sec
Task Read Speed = 12.342926020792527 GB/sec
E2E Read Latency = 0.031697988510131836 sec
E2E Read Speed = 12.323337169333062 GB/sec
For the above sample, -metric = "read_speed" corresponds to "E2E Read Speed", and 12.32 will be returned
"""


def get_metric(file, metric):
thread_count = get_thread_count(file)
num_giga_bytes = NUM_BYTES / NUM_GIGA_BYTES
with open(file) as f:
for line in f.readlines():
if line.startswith(METRIC_SEARCH[metric]):
if metric == RAW_RATE:
fields = line.split()
raw_time_sec = float(fields[2]) / 1e06
raw_rate = (thread_count * num_giga_bytes * 1.0) / raw_time_sec
return raw_rate
elif metric in [READ_SPEED, WRITE_SPEED]:
if metric in [READ_SPEED, WRITE_SPEED]:
fields = line.split()
return float(fields[-2])
else:
Expand Down
2 changes: 1 addition & 1 deletion csrc/aio/py_test/run_read_sweep.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ if [[ ! -f ${INPUT_FILE} ]]; then
exit 1
fi

LOG_DIR=$2
LOG_DIR=$2/aio_perf_sweep
RUN_SCRIPT=./test_ds_aio.py
READ_OPT="--read_file ${INPUT_FILE}"

Expand Down
4 changes: 2 additions & 2 deletions csrc/aio/py_test/run_write_sweep.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ fi

SIZE="$1M"
WRITE_DIR=$2
LOG_DIR=$3
LOG_DIR=$3/aio_perf_sweep

OUTPUT_FILE=${WRITE_DIR}/ds_aio_write_${SIZE}B.pt
WRITE_OPT="--write_file ${OUTPUT_FILE} --write_size ${SIZE}"
Expand All @@ -43,7 +43,7 @@ for sub in single block; do
for p in 1; do
for d in 1 2 4 8 16 32; do
for bs in 128K 256K 512K 1M; do
SCHED_OPTS="${sub_opt} ${ov_opt} --handle --threads 1"
SCHED_OPTS="${sub_opt} ${ov_opt} --handle --threads ${t}"
OPTS="--io_parallel ${p} --queue_depth ${d} --block_size ${bs}"
LOG="${LOG_DIR}/write_${SIZE}B_${sub}_${ov}_t${t}_p${p}_d${d}_bs${bs}.txt"
cmd="python ${RUN_SCRIPT} ${WRITE_OPT} ${OPTS} ${SCHED_OPTS} &> ${LOG}"
Expand Down
6 changes: 3 additions & 3 deletions csrc/aio/py_test/test_ds_aio_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

import os

GIGABYTE = 1024**3
BYTES_PER_GB = 1024**3
LOG_TIDS = [0]


Expand All @@ -32,11 +32,11 @@ def report_results(args, read_op, pool_results):
total_bytes = sum([num_bytes for _, _, num_bytes in pool_results])

task_latency_sec = max([sec for _, sec, _ in pool_results])
task_speed_GB = total_bytes / task_latency_sec / GIGABYTE
task_speed_GB = total_bytes / task_latency_sec / BYTES_PER_GB
print(f'Task {io_string} Latency = {task_latency_sec} sec')
print(f'Task {io_string} Speed = {task_speed_GB} GB/sec')

e2e_latency_sec = max([sec for sec, _, _ in pool_results])
e2e_speed_GB = total_bytes / e2e_latency_sec / GIGABYTE
e2e_speed_GB = total_bytes / e2e_latency_sec / BYTES_PER_GB
print(f'E2E {io_string} Latency = {e2e_latency_sec} sec')
print(f'E2E {io_string} Speed = {e2e_speed_GB} GB/sec')

0 comments on commit 03d24fe

Please sign in to comment.