- added blas_library parameter to hibench benchmark, thus allowing the user to choose the blas library to use

work related to [https://bugzilla.ipr.univ-rennes.fr/show_bug.cgi?id=3958]
This commit is contained in:
Guillaume Raffy 2024-11-21 17:04:55 +01:00
parent f7d1946eb7
commit 33133d6828
4 changed files with 28 additions and 24 deletions

View File

@ -3,6 +3,7 @@ from pathlib import Path
import subprocess import subprocess
import shutil import shutil
from ..core import IBenchmark, BenchParam, BenchmarkConfig, BenchmarkMeasurements, ITargetHost from ..core import IBenchmark, BenchParam, BenchmarkConfig, BenchmarkMeasurements, ITargetHost
from ..cmakeutils import get_bla_vendor
from ..util import get_proxy_env_vars from ..util import get_proxy_env_vars
@ -15,9 +16,7 @@ class HiBench(IBenchmark):
bench_params.append(BenchParam('num_cores', BenchParam.Type.PARAM_TYPE_INT, 'the number of cores to use by this benchmark')) bench_params.append(BenchParam('num_cores', BenchParam.Type.PARAM_TYPE_INT, 'the number of cores to use by this benchmark'))
bench_params.append(BenchParam('hibridon_version', BenchParam.Type.PARAM_TYPE_STRING, 'the version of hibridon, in the form of a commit id')) bench_params.append(BenchParam('hibridon_version', BenchParam.Type.PARAM_TYPE_STRING, 'the version of hibridon, in the form of a commit id'))
bench_params.append(BenchParam('fortran_compiler', BenchParam.Type.PARAM_TYPE_PACKAGE, 'the compiler used in the benchmark')) bench_params.append(BenchParam('fortran_compiler', BenchParam.Type.PARAM_TYPE_PACKAGE, 'the compiler used in the benchmark'))
# bench_params.append(BenchParam('compiler_version', BenchParam.Type.PARAM_TYPE_STRING, 'the version of the used compiler')) bench_params.append(BenchParam('blas_library', BenchParam.Type.PARAM_TYPE_PACKAGE, 'the blas compatible linear algebra library used in the benchmark'))
# bench_params.append(BenchParam('blas_id', BenchParam.Type.PARAM_TYPE_STRING, 'the id of the blas library used in the benchmark'))
# bench_params.append(BenchParam('blas_version', BenchParam.Type.PARAM_TYPE_STRING, 'the version of the blas library used in the benchmark'))
bench_params.append(BenchParam('test_id', BenchParam.Type.PARAM_TYPE_STRING, 'the name of the test to run (eg arch4_quick (about 2s on a core i5 8th generation) or nh3h2_qma_long (about 10min on a core i5 8th generation))')) bench_params.append(BenchParam('test_id', BenchParam.Type.PARAM_TYPE_STRING, 'the name of the test to run (eg arch4_quick (about 2s on a core i5 8th generation) or nh3h2_qma_long (about 10min on a core i5 8th generation))'))
bench_params.append(BenchParam('cmake_path', BenchParam.Type.PARAM_TYPE_STRING, 'the location of the cmake executable to use (eg "/opt/cmake/cmake-3.23.0/bin/cmake", or simply "cmake" for the one in the path)')) bench_params.append(BenchParam('cmake_path', BenchParam.Type.PARAM_TYPE_STRING, 'the location of the cmake executable to use (eg "/opt/cmake/cmake-3.23.0/bin/cmake", or simply "cmake" for the one in the path)'))
@ -44,6 +43,7 @@ class HiBench(IBenchmark):
hibridon_version = config['hibridon_version'] hibridon_version = config['hibridon_version']
test_id = config['test_id'] # eg arch4_quick or nh3h2_qma_long test_id = config['test_id'] # eg arch4_quick or nh3h2_qma_long
fortran_compiler = config['fortran_compiler'] fortran_compiler = config['fortran_compiler']
blas_library = config['blas_library']
cmake_path = config['cmake_path'] cmake_path = config['cmake_path']
num_cores = config['num_cores'] num_cores = config['num_cores']
@ -62,14 +62,16 @@ class HiBench(IBenchmark):
'-DBUILD_TESTING=ON' # enable hibridon tests '-DBUILD_TESTING=ON' # enable hibridon tests
] ]
env_vars_bash_commands = target_host.get_package_activation_command(fortran_compiler.package_id, fortran_compiler.package_version) package_activation_commands = []
for param in [fortran_compiler, blas_library]:
env_command = target_host.get_package_activation_command(param.package_id, param.package_version)
if env_command != '':
package_activation_commands.append(env_command)
env_vars_bash_commands = ' && '.join(package_activation_commands)
bla_vendor = get_bla_vendor(blas_library.package_id)
cmake_options.append(f'-DCMAKE_Fortran_COMPILER={fortran_compiler.package_id}') cmake_options.append(f'-DCMAKE_Fortran_COMPILER={fortran_compiler.package_id}')
if fortran_compiler.package_id == 'ifort': cmake_options.append(f'-DBLA_VENDOR={bla_vendor}')
cmake_options.append('-DBLA_VENDOR=Intel10_64lp') # use 64 bits intel mkl with multithreading
elif fortran_compiler.package_id == 'gfortran':
pass
else:
assert f'unhandled compiler_id : {fortran_compiler.package_id}'
output_measurements_file_path = output_dir / "measurements.tsv" output_measurements_file_path = output_dir / "measurements.tsv"

View File

@ -1,20 +1,10 @@
from ..core import IBenchmark, BenchParam, BenchmarkConfig, BenchmarkMeasurements, ITargetHost, PackageId
from pathlib import Path from pathlib import Path
import pandas as pd import pandas as pd
import subprocess import subprocess
from iprbench.util import extract_resource_dir
import logging import logging
from ..core import IBenchmark, BenchParam, BenchmarkConfig, BenchmarkMeasurements, ITargetHost
from ..cmakeutils import get_bla_vendor
def get_bla_vendor(package_id: PackageId) -> str: from iprbench.util import extract_resource_dir
"""returns the bla vendor used by cmake's FindBLAS module
see https://cmake.org/cmake/help/latest/module/FindBLAS.html
"""
bla_vendor = {
'libopenblas-pthread': 'OpenBLAS',
'intelmkl': 'Intel10_64lp', # use 64 bits intel mkl with multithreading
}[package_id]
return bla_vendor
class MaMul1(IBenchmark): class MaMul1(IBenchmark):

12
iprbench/cmakeutils.py Normal file
View File

@ -0,0 +1,12 @@
from .core import PackageId
def get_bla_vendor(package_id: PackageId) -> str:
"""returns the bla vendor used by cmake's FindBLAS module
see https://cmake.org/cmake/help/latest/module/FindBLAS.html
"""
bla_vendor = {
'libopenblas-pthread': 'OpenBLAS',
'intelmkl': 'Intel10_64lp', # use 64 bits intel mkl with multithreading
}[package_id]
return bla_vendor

View File

@ -1 +1 @@
__version__ = '0.0.6' __version__ = '0.0.7'