-
Notifications
You must be signed in to change notification settings - Fork 18
add BLAS test #268
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
add BLAS test #268
Changes from 16 commits
Commits
Show all changes
43 commits
Select commit
Hold shift + click to select a range
c92b8b8
add BLAS test
a0c85d6
update Makefile to not include common.mk
7caae27
add MKL; add more tags
328741c
add 2023b
df66259
add test docstring
3ea8724
add BLIS tests
5a12683
simplify perf variables
c7dcd98
add more docstrings
869a747
typos in docstring
d2baddf
various improvements
5ffa89c
docstring
489ce3f
module_name(s) fixes
d172ee0
update variable name
581c552
add sanitycheck to ensure BLAS backend is found
d7d9c0b
Merge branch 'main' into blas
92585e1
add __init__.py files + minor style changes
cb44619
don't use predefined module lists
89a44b7
update docstring
8995cb2
various small code improvements
c34f1d9
refactor
97e096c
add type check for module_name
47a8540
Merge branch 'main' into blas
57c46f8
also load matching buildenv module (required for EESSI)
c6288bf
merge main
d4bc0b5
fix?
d14dbfc
minor order change
cc51207
don't fail, just skip
a803d02
use generic select_matching_modules function
92c9e09
remove unused import
9089a16
fix type hints
3bbd80e
prepend global vars with underscore
4c92d69
update get_blas_modules
d07ca75
update get_blas_modules again
a5b4e97
fix split_module function
c1df749
add index parameter to add_buildenv_module function
cf39ca1
set compact thread binding
e603086
reorder list of modules to have BLIS always last
56aeed7
merge main
feea17e
add thread binding variables to eessi_mixin
bb06255
fix hooks order in metalwalls test
8a948e4
use a single thread_binding variable
8c234f2
remove single-threaded tests
4618d49
remove old line
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,2 @@ | ||
| # WARNING: do not remove this file. | ||
| # It is needed to autogenerate documentation from this repo. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,272 @@ | ||
| """ | ||
| This test is adapted from the BLAS test included in the BLIS v1.1 sources at | ||
| https://github.com/flame/blis/tree/1.1/test/3 | ||
|
|
||
| Customizations to the original BLAS test: | ||
| - adapted and simplified Makefile for FlexiBLAS support | ||
| - custom simplified run.sh script | ||
|
|
||
| Supported tags in this ReFrame test (in addition to the common tags): | ||
| - threading: `st`, `mt` | ||
| - BLAS implementation: `openblas`, `blis`, `aocl-blas`, `mkl` | ||
| - toolchain: `2023a`, `2023b`, `2024a`, ... | ||
| - `CI` tag: runs only openblas st + mt | ||
| """ | ||
|
|
||
|
|
||
| import reframe as rfm | ||
| from reframe.core.backends import getlauncher | ||
| from reframe.core.builtins import parameter, run_after, run_before, sanity_function | ||
| import reframe.utility.sanity as sn | ||
|
|
||
| from eessi.testsuite.constants import COMPUTE_UNITS, DEVICE_TYPES, SCALES | ||
| from eessi.testsuite.eessi_mixin import EESSI_Mixin | ||
| from eessi.testsuite.utils import check_modules_avail, log | ||
|
|
||
| BLAS_MODULES = { | ||
| '2023a': { | ||
| 'FlexiBLAS': 'FlexiBLAS/3.3.1-GCC-12.3.0', | ||
|
smoors marked this conversation as resolved.
Outdated
|
||
| 'BLIS': 'BLIS/0.9.0-GCC-12.3.0', | ||
| 'imkl': 'imkl/2023.1.0', | ||
| }, | ||
| '2023b': { | ||
| 'FlexiBLAS': 'FlexiBLAS/3.3.1-GCC-13.2.0', | ||
| 'BLIS': 'BLIS/1.0-GCC-13.2.0', | ||
| 'imkl': 'imkl/2023.2.0', | ||
| }, | ||
| '2024a': { | ||
| 'FlexiBLAS': 'FlexiBLAS/3.4.4-GCC-13.3.0', | ||
| 'BLIS': 'BLIS/1.0-GCC-13.3.0', | ||
| 'AOCL-BLAS': 'AOCL-BLAS/5.0-GCC-13.3.0', | ||
| 'imkl': 'imkl/2024.2.0', | ||
| }, | ||
| '2025a': { | ||
| 'FlexiBLAS': 'FlexiBLAS/3.4.5-GCC-14.2.0', | ||
| 'BLIS': 'BLIS/1.1-GCC-14.2.0', | ||
| 'AOCL-BLAS': 'AOCL-BLAS/5.0-GCC-14.2.0', | ||
| 'imkl': 'imkl/2025.1.0', | ||
| }, | ||
| } | ||
|
|
||
| # FlexiBLAS and BLIS must always be loaded, even if BLIS is not used | ||
| BASE_BLAS_MODULES = ['FlexiBLAS', 'BLIS'] | ||
|
|
||
|
|
||
| def single_thread_scales(): | ||
| """Scales for the single-threaded tests""" | ||
| return parameter(['1_core', '1_node']) | ||
|
|
||
|
|
||
| def multi_thread_scales(): | ||
| """Scales for the multi-threaded tests""" | ||
| return parameter([ | ||
| k for (k, v) in SCALES.items() | ||
| if v['num_nodes'] == 1 | ||
|
casparvl marked this conversation as resolved.
|
||
| ]) | ||
|
|
||
|
|
||
| def get_module_lists(req_modules): | ||
| """Get a list of lists of full module names that are required for the test and available on the system""" | ||
| req_modules = set(req_modules) | ||
| ml_lists = [ | ||
| [x[y] for y in req_modules] | ||
| for x in BLAS_MODULES.values() | ||
| if req_modules.issubset(x.keys()) | ||
| ] | ||
| return [x for x in ml_lists if check_modules_avail(x)] | ||
|
|
||
|
|
||
| class EESSI_BLAS_base(rfm.RunOnlyRegressionTest): | ||
| "base BLAS test" | ||
| device_type = DEVICE_TYPES.CPU | ||
| compute_unit = COMPUTE_UNITS.NODE | ||
| time_limit = '10m' | ||
| readonly_files = ['Makefile', 'run.sh', 'test_gemm.c', 'test_hemm.c', 'test_herk.c', 'test_trmm.c', 'test_trsm.c', | ||
| 'test_utils.c', 'test_utils.h'] | ||
| env_vars = { | ||
| 'CFLAGS': '"-O2 -ftree-vectorize -march=native -fno-math-errno -g"', # default EB CFLAGS | ||
| } | ||
| executable = './run.sh' | ||
| nrepeats = '3' | ||
| dts = ['s', 'd', 'c', 'z'] | ||
| ops = ['gemm_nn', 'hemm_ll', 'herk_ln', 'trmm_llnn', 'trsm_runn'] | ||
| sizes = { | ||
| 'st': ['100', '1000', '100'], | ||
| 'mt': ['200', '2000', '200'], | ||
| } | ||
|
|
||
| def required_mem_per_node(self): | ||
| return self.num_cpus_per_task * 100 + 250 | ||
|
|
||
| @run_after('init') | ||
| def set_prerun_cmds(self): | ||
| """Set prerun_cmds""" | ||
| self.prerun_cmds = [f'make flexiblas-{self.threading}'] | ||
|
|
||
| @run_after('init') | ||
| def _tags(self): | ||
| """Add tags for toolchain (e.g. 2024a) and threading (st or mt)""" | ||
| blas_modules = {x: set(y.values()) for x, y in BLAS_MODULES.items()} | ||
| module_names = set(self.module_name) | ||
| toolchain = [x for x, y in blas_modules.items() if (module_names & y == module_names)][0] | ||
| self.tags.add(toolchain) | ||
|
|
||
| self.tags.add(self.threading) | ||
| log(f'tags set to {self.tags}') | ||
|
|
||
| @run_after('init') | ||
| def set_executable_opts(self): | ||
| """Set executable_opts""" | ||
| self.size = self.sizes[self.threading] | ||
| self.executable_opts = [ | ||
| self.threading, | ||
| self.nrepeats, | ||
| '"{}"'.format(' '.join(self.size)), | ||
| '"{}"'.format(' '.join(self.dts)), | ||
| '"{}"'.format(' '.join(self.ops)), | ||
| ] | ||
|
|
||
| @run_after('init') | ||
| def set_flexiblas_blas_lib(self): | ||
| """Set FLEXIBLAS environment variable to selected BLAS lib""" | ||
| self.env_vars.update({ | ||
| 'FLEXIBLAS': self.flexiblas_blas_lib, | ||
| }) | ||
|
|
||
| @run_after('setup') | ||
|
casparvl marked this conversation as resolved.
|
||
| def set_launcher(self): | ||
| """Select local launcher""" | ||
| self.job.launcher = getlauncher('local')() | ||
|
|
||
| @sanity_function | ||
| def assert_sanity(self): | ||
| assert_backend = sn.assert_not_found( | ||
| r'BLAS backend\s+\S+\s+not found', | ||
| self.stderr, | ||
| f'FlexiBLAS BLAS backend not found ({self.flexiblas_blas_lib})' | ||
| ) | ||
| asserts_result = [ | ||
| sn.assert_found(r"data\S+_flexiblas", f'output/{x}{y}_flexiblas.m', f'output/{x}{y}_flexiblas.m') | ||
| for x in self.dts for y in self.ops | ||
| ] | ||
| return sn.all([assert_backend] + asserts_result) | ||
|
|
||
| def _extract_perf(self, dt, op): | ||
| return sn.extractsingle( | ||
| rf'^data\S+_flexiblas.*{self.size[1]}\s+(?P<perf>\S+)\s+\];', | ||
| f'output/{dt}{op}_flexiblas.m', | ||
| 1, float | ||
| ) | ||
|
|
||
| @run_before('performance') | ||
| def set_perf_vars(self): | ||
| """Set performance variables""" | ||
| self.perf_variables.update({ | ||
| f'{x}{y.split("_")[0]}': sn.make_performance_function(self._extract_perf(x, y), 'GFLOPS') | ||
| for x in self.dts for y in self.ops | ||
| }) | ||
|
|
||
|
|
||
| class EESSI_BLAS_OpenBLAS_base(EESSI_BLAS_base): | ||
| "base OpenBLAS test" | ||
|
|
||
| module_lists = get_module_lists(BASE_BLAS_MODULES) | ||
| module_name = parameter(module_lists) | ||
|
|
||
| flexiblas_blas_lib = 'openblas' | ||
| tags = {'openblas'} | ||
|
|
||
|
|
||
| @rfm.simple_test | ||
| class EESSI_BLAS_OpenBLAS_st(EESSI_BLAS_OpenBLAS_base, EESSI_Mixin): | ||
| "single-threaded OpenBLAS test" | ||
|
|
||
| scale = single_thread_scales() | ||
|
|
||
| bench_name = bench_name_ci = 'OpenBLAS_st' | ||
| threading = 'st' | ||
|
|
||
|
|
||
| @rfm.simple_test | ||
| class EESSI_BLAS_OpenBLAS_mt(EESSI_BLAS_OpenBLAS_base, EESSI_Mixin): | ||
| "multi-threaded OpenBLAS test" | ||
|
|
||
| scale = multi_thread_scales() | ||
|
|
||
| bench_name = bench_name_ci = 'OpenBLAS_mt' | ||
| threading = 'mt' | ||
|
|
||
|
|
||
| class EESSI_BLAS_AOCLBLAS_base(EESSI_BLAS_base): | ||
| "base AOCL-BLAS test" | ||
|
|
||
| module_lists = get_module_lists(BASE_BLAS_MODULES + ['AOCL-BLAS']) | ||
| module_name = parameter(module_lists) | ||
|
|
||
| flexiblas_blas_lib = 'aocl_mt' | ||
| tags = {'aocl-blas'} | ||
|
|
||
|
|
||
| @rfm.simple_test | ||
| class EESSI_BLAS_AOCLBLAS_st(EESSI_BLAS_AOCLBLAS_base, EESSI_Mixin): | ||
| "single-threaded AOCL-BLAS test" | ||
|
|
||
| scale = single_thread_scales() | ||
| threading = 'st' | ||
|
|
||
|
|
||
| @rfm.simple_test | ||
| class EESSI_BLAS_AOCLBLAS_mt(EESSI_BLAS_AOCLBLAS_base, EESSI_Mixin): | ||
| "multi-threaded AOCL-BLAS test" | ||
|
|
||
| scale = multi_thread_scales() | ||
| threading = 'mt' | ||
|
|
||
|
|
||
| class EESSI_BLAS_MKL_base(EESSI_BLAS_base): | ||
| "base MKL test" | ||
|
|
||
| module_lists = get_module_lists(BASE_BLAS_MODULES + ['imkl']) | ||
| module_name = parameter(module_lists) | ||
|
|
||
| flexiblas_blas_lib = 'imkl' | ||
| tags = {'mkl'} | ||
|
|
||
|
|
||
| @rfm.simple_test | ||
| class EESSI_BLAS_MKL_st(EESSI_BLAS_MKL_base, EESSI_Mixin): | ||
| "single-threaded MKL test" | ||
|
|
||
| scale = single_thread_scales() | ||
| threading = 'st' | ||
|
|
||
|
|
||
| @rfm.simple_test | ||
| class EESSI_BLAS_MKL_mt(EESSI_BLAS_MKL_base, EESSI_Mixin): | ||
| "multi-threaded MKL test" | ||
|
|
||
| scale = multi_thread_scales() | ||
| threading = 'mt' | ||
|
|
||
|
|
||
| class EESSI_BLAS_BLIS_base(EESSI_BLAS_OpenBLAS_base): | ||
| "base BLIS test" | ||
|
|
||
| flexiblas_blas_lib = 'blis' | ||
| tags = {'blis'} | ||
|
|
||
|
|
||
| @rfm.simple_test | ||
| class EESSI_BLAS_BLIS_st(EESSI_BLAS_BLIS_base, EESSI_Mixin): | ||
| "single-threaded BLIS test" | ||
|
|
||
| scale = single_thread_scales() | ||
| threading = 'st' | ||
|
|
||
|
|
||
| @rfm.simple_test | ||
| class EESSI_BLAS_BLIS_mt(EESSI_BLAS_BLIS_base, EESSI_Mixin): | ||
| "multi-threaded BLIS test" | ||
|
|
||
| scale = multi_thread_scales() | ||
| threading = 'mt' | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.