From 20b38ee7dfd56929286c96bdb5ed8096a6e6c701 Mon Sep 17 00:00:00 2001 From: Di Nguyen Date: Tue, 12 Nov 2024 11:32:49 -0700 Subject: [PATCH] [Smoke Test][rocPRIM] Updated smoke test to have shorter runtime and not use more than 2gb of vram (#629) * added smoke test * uypdated change log about bug fix for rtest.py * updated smoketest to smoke * fixed typo from retest to rtest * updated changelog * added new smoketest * updated smoke test to be inclusive * added back old smoke test as smoke_old * added --emulation/-e option * updated changelog * updated changelog with instructions to run old smoke test --- CHANGELOG.md | 7 +++++++ rtest.py | 35 ++++++++++++++++++++++++++++++++--- rtest.xml | 8 +++++++- 3 files changed, 46 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2ea3574a7..fc8111430 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,13 +2,20 @@ Full documentation for rocPRIM is available at [https://rocm.docs.amd.com/projects/rocPRIM/en/latest/](https://rocm.docs.amd.com/projects/rocPRIM/en/latest/). + ## (Unreleased) rocPRIM 3.4.0 for ROCm 6.4.0 ### Added * Added the parallel `find_first_of` device function with autotuned configurations, this function is similar to `std::find_first_of`, it searches for the first occurrence of any of the provided elements. +* Added `--emulation` option added for `rtest.py` +* Unit tests can be ran with `[--emulation|-e|--test|-t]=` ### Changed + * Modified smoke tests to complete in faster run-time and to never exceed 2GB of vram usage + * Old smoke tests can be ran with python3 rtest.py --test/-t smoke_old or python3 rtest.py --emulation/-e smoke_old instead + * `--test|-t` no longer a required flag for `rtest.py`, instead user can use either `--emulation|-e` or `--test|-t` but not both + ### Resolved issues diff --git a/rtest.py b/rtest.py index 777f4cd01..029b5665d 100644 --- a/rtest.py +++ b/rtest.py @@ -30,8 +30,10 @@ def parse_args(): parser = argparse.ArgumentParser(description=""" Checks build arguments """) - parser.add_argument('-t', '--test', required=True, - help='Test set to run from rtest.xml (required, e.g. osdb)') + parser.add_argument('-e', '--emulation', required=False, default="", + help='Test set to run from rtest.xml (optional, eg.smoke). At least one but not both of -e or -t must be set') + parser.add_argument('-t', '--test', required=False, default="", + help='Test set to run from rtest.xml (optional, e.g. osdb). At least one but not both of -e or -t must be set') parser.add_argument('-g', '--debug', required=False, default=False, action='store_true', help='Test Debug build (optional, default: false)') parser.add_argument('-o', '--output', type=str, required=False, default="xml", @@ -247,6 +249,11 @@ def batch(script, xml): for test in xml.getElementsByTagName('test'): sets = test.getAttribute('sets') runset = sets.split(',') + + A, B = args.test != '', args.emulation != '' + if not (A ^ B): + raise ValueError('At least one but not both of -e/--emulation or -t/--test must be set') + if args.test in runset: for run in test.getElementsByTagName('run'): name = run.getAttribute('name') @@ -268,6 +275,28 @@ def batch(script, xml): error = run_cmd(var_cmd, True, timeout) if (error == 2): print( f'***\n*** Timed out when running: {name}\n***') + + if args.emulation in runset: + for run in test.getElementsByTagName('run'): + name = run.getAttribute('name') + vram_limit = run.getAttribute('vram_min') + if vram_limit: + if OS_info["VRAM"] < float(vram_limit): + print( f'***\n*** Skipped: {name} due to VRAM req.\n***') + continue + if name: + print( f'***\n*** Running: {name}\n***') + time_limit = run.getAttribute('time_max') + if time_limit: + timeout = float(time_limit) + else: + timeout = 0 + + raw_cmd = run.firstChild.data + var_cmd = raw_cmd.format_map(var_subs) + error = run_cmd(var_cmd, True, timeout) + if (error == 2): + print( f'***\n*** Timed out when running: {name}\n***') else: error = run_cmd(cmd) fail = fail or error @@ -321,4 +350,4 @@ def main(): sys.exit(status) if __name__ == '__main__': - main() + main() \ No newline at end of file diff --git a/rtest.xml b/rtest.xml index 4f0d34762..39a078e36 100644 --- a/rtest.xml +++ b/rtest.xml @@ -2,7 +2,10 @@ - + + + + {CTEST_FILTER} {CTEST_REGEX} @@ -12,4 +15,7 @@ {SMOKE_TEST} + + {SMOKE_TEST_OLD} + \ No newline at end of file