From 97469b2fd8f93c24d9b2dadb85acaa15364c49c5 Mon Sep 17 00:00:00 2001 From: Di Nguyen Date: Tue, 12 Nov 2024 13:26:21 -0700 Subject: [PATCH] [Smoke Test][hipCUB] Implemented smoketest for emulation work (#419) * added new smoketest for emulation work * updated changelog --- CHANGELOG.md | 7 ++++++- rtest.py | 36 ++++++++++++++++++++++++++++++++---- rtest.xml | 6 +++++- 3 files changed, 43 insertions(+), 6 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4a455f3e..ddf45063 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,11 +7,16 @@ Full documentation for hipCUB is available at [https://rocm.docs.amd.com/project ### Added * Added `ForEach`, `ForEachN`, `ForEachCopy`, `ForEachCopyN` and `Bulk` functions to have parity with CUB. * Added the `hipcub::CubVector` type for CUB parity. +* Added `--emulation` option added for `rtest.py` + +### Changed +* Edited smoke test options, which runs a subset of the unit tests and ensuring that less than 2gb of VRAM will be used + * Smoke tests can be ran with `[--emulation|-e|--test|-t]=smoke` +* `--test|-t` no longer a required flag for `rtest.py`, instead user can use either `--emulation|-e` or `--test|-t` but not both ## hipCUB-3.3.0 for ROCm 6.3.0 ### Fixed - * Not all headers in hipCUB included `config.hpp` which could have resulted in build errors. ### Added diff --git a/rtest.py b/rtest.py index bdb82a87..9b151af8 100644 --- a/rtest.py +++ b/rtest.py @@ -47,8 +47,10 @@ def parse_args(): parser = argparse.ArgumentParser(description=""" Checks build arguments """) - parser.add_argument('-t', '--test', required=True, type=str, action='append', - 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", @@ -245,7 +247,11 @@ def batch(script, xml): global OS_info global args global fail_regex - # + + 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') + cwd = pathlib.os.curdir rtest_cwd_path = os.path.abspath( os.path.join( cwd, 'rtest.xml') ) if os.path.isfile(rtest_cwd_path) and os.path.dirname(rtest_cwd_path).endswith( "staging" ): @@ -306,7 +312,29 @@ def batch(script, xml): for test in xml.getElementsByTagName('test'): sets = test.getAttribute('sets') runset = sets.split(',') - if len([x for x in args.test if x in runset]): + if args.test 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***') + continue + if args.emulation in runset: for run in test.getElementsByTagName('run'): name = run.getAttribute('name') vram_limit = run.getAttribute('vram_min') diff --git a/rtest.xml b/rtest.xml index a12363cb..ab233258 100644 --- a/rtest.xml +++ b/rtest.xml @@ -2,7 +2,8 @@ - + + {CTEST_FILTER} {CTEST_REGEX} @@ -12,4 +13,7 @@ {SMOKE_TEST} + + {SMOKE_TEST_OLD} + \ No newline at end of file