AVX512 as CMake Option
This commit is contained in:
parent
45ff460f4a
commit
17f187669d
@ -5,10 +5,15 @@ include(CheckCXXCompilerFlag)
|
|||||||
set(CMAKE_CXX_STANDARD 17)
|
set(CMAKE_CXX_STANDARD 17)
|
||||||
option(OPTIMIZE_FOR_NATIVE "Build with -march=native" ON)
|
option(OPTIMIZE_FOR_NATIVE "Build with -march=native" ON)
|
||||||
option(USE_CLANG "Build with clang instead of gcc" ON)
|
option(USE_CLANG "Build with clang instead of gcc" ON)
|
||||||
|
option(WITH_AVX512 "Enable AVX512" OFF)
|
||||||
set(DEFAULT_TEST_FUNCTION_NAME "native_reordered" CACHE STRING "default function to run")
|
set(DEFAULT_TEST_FUNCTION_NAME "native_reordered" CACHE STRING "default function to run")
|
||||||
|
|
||||||
add_compile_definitions(DEFAULT_TEST_FUNCTION_NAME="${DEFAULT_TEST_FUNCTION_NAME}")
|
add_compile_definitions(DEFAULT_TEST_FUNCTION_NAME="${DEFAULT_TEST_FUNCTION_NAME}")
|
||||||
|
|
||||||
|
if(WITH_AVX512)
|
||||||
|
add_compile_definitions(WITH_AVX512)
|
||||||
|
endif()
|
||||||
|
|
||||||
if(USE_CLANG)
|
if(USE_CLANG)
|
||||||
set(CMAKE_CXX_COMPILER "clang++")
|
set(CMAKE_CXX_COMPILER "clang++")
|
||||||
else()
|
else()
|
||||||
|
@ -21,12 +21,13 @@ def check_call_quiet(*args, **kwargs):
|
|||||||
exit(0)
|
exit(0)
|
||||||
|
|
||||||
|
|
||||||
def compile_and_run(source_path, build_path_prefix, target, native, use_clang, args):
|
def compile_and_run(source_path, build_path_prefix, target, native, use_clang, avx512, args):
|
||||||
flags = [
|
flags = [
|
||||||
"-DOPTIMIZE_FOR_NATIVE=" + ("ON" if native else "OFF"),
|
"-DOPTIMIZE_FOR_NATIVE=" + ("ON" if native else "OFF"),
|
||||||
"-DCMAKE_BUILD_TYPE=RelWithDebInfo",
|
"-DCMAKE_BUILD_TYPE=RelWithDebInfo",
|
||||||
"-DUSE_CLANG=" + ("ON" if use_clang else "OFF"),
|
"-DUSE_CLANG=" + ("ON" if use_clang else "OFF"),
|
||||||
"-DNDEBUG=ON", "-DBOOST_UBLAS_NDEBUG=ON"
|
"-DNDEBUG=ON", "-DBOOST_UBLAS_NDEBUG=ON",
|
||||||
|
"-DWITH_AVX512=" + ("ON" if avx512 else "OFF"),
|
||||||
]
|
]
|
||||||
build_path = os.path.join(build_path_prefix, " ".join(flags))
|
build_path = os.path.join(build_path_prefix, " ".join(flags))
|
||||||
if not os.path.exists(build_path):
|
if not os.path.exists(build_path):
|
||||||
@ -103,13 +104,13 @@ if __name__ == '__main__':
|
|||||||
for clang in [True]:
|
for clang in [True]:
|
||||||
for sizes in matrix_combinations:
|
for sizes in matrix_combinations:
|
||||||
args = list(sizes)
|
args = list(sizes)
|
||||||
compile_and_run("..", "builds", "generate_random", True, True, args)
|
compile_and_run("..", "builds", "generate_random", True, True, options.avx512, args)
|
||||||
folder = "x".join(sizes)
|
folder = "x".join(sizes)
|
||||||
for fidx, function in enumerate(functions):
|
for fidx, function in enumerate(functions):
|
||||||
arguments = [folder, "--algorithm", function]
|
arguments = [folder, "--algorithm", function]
|
||||||
if with_double:
|
if with_double:
|
||||||
arguments.append("--double")
|
arguments.append("--double")
|
||||||
output = compile_and_run("..", "builds", "simd_multiply", True, clang, arguments + extra_args)
|
output = compile_and_run("..", "builds", "simd_multiply", True, clang, options.avx512, arguments + extra_args)
|
||||||
ms = output.decode()[output.decode().find("multiply:") + 10:]
|
ms = output.decode()[output.decode().find("multiply:") + 10:]
|
||||||
if "ms\n" in ms:
|
if "ms\n" in ms:
|
||||||
ms = float(ms.split("ms\n")[0])
|
ms = float(ms.split("ms\n")[0])
|
||||||
|
Loading…
x
Reference in New Issue
Block a user