iprbench/test/test_iprbench.py

28 lines
1.1 KiB
Python

import unittest
import logging
import subprocess
# import importlib.resources
class IprBenchTestCase(unittest.TestCase):
logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s')
def setUp(self) -> None: # pylint: disable=useless-parent-delegation
return super().setUp()
def test_iprbench_run(self):
logging.info('test_iprbench_run')
# with importlib.resources.path('iprbench.resources', 'mamul1') as src_dir:
# with open(src_dir / 'mamul1.F90', encoding='utf8') as f:
# print(f.readlines())
# with open(src_dir / 'CMakeLists.txt', encoding='utf8') as f:
# print(f.readlines())
# subprocess.run(f'cat {src_dir / "CMakeLists.txt"}', check=True)
command = 'iprbench-run --benchmark-id \'mamul1\' --config \'{"compiler_id": "gfortran", "matrix_size": 1024, "num_loops":10, "num_cores":2}\' --results-dir /tmp/mamul1_out'
subprocess.run(command, shell=True, check=True, executable='/bin/bash')
if __name__ == '__main__':
unittest.main()