diff --git a/CMakeLists.txt b/CMakeLists.txt index 1bd39f188..c4cad8e17 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -294,8 +294,8 @@ else() endif() if(DEFINED REF_BLAS_ROOT) - find_file(REF_BLAS_LIBNAME NAMES blas.dll libblas.so HINTS ${REF_BLAS_ROOT} PATH_SUFFIXES lib lib64) - find_file(REF_CBLAS_LIBNAME NAMES cblas.dll libcblas.so HINTS ${REF_BLAS_ROOT} PATH_SUFFIXES lib lib64) + find_file(ONEMKL_REF_BLAS_LIBNAME NAMES blas.dll libblas.so HINTS ${REF_BLAS_ROOT} PATH_SUFFIXES lib lib64) + find_file(ONEMKL_REF_CBLAS_LIBNAME NAMES cblas.dll libcblas.so HINTS ${REF_BLAS_ROOT} PATH_SUFFIXES lib lib64) endif() # Add source directory and output to bin/ diff --git a/docs/building_and_running_tests.rst b/docs/building_and_running_tests.rst index 114e4492d..4cf5c9187 100644 --- a/docs/building_and_running_tests.rst +++ b/docs/building_and_running_tests.rst @@ -23,9 +23,9 @@ following: git clone https://github.com/Reference-LAPACK/lapack.git cd lapack; mkdir -p build; cd build - cmake -DCMAKE_INSTALL_PREFIX=~/lapack -DCBLAS=True -DLAPACK=True -DLAPACKE=True -DBUILD_INDEX64=True -DBUILD_SHARED_LIBS=True .. + cmake -DCMAKE_INSTALL_PREFIX=~/lapack -DCBLAS=True -DLAPACK=True -DLAPACKE=True -DBUILD_INDEX64=True -DBUILD_SHARED_LIBS=True .. cmake --build . -j --target install - cmake -DCMAKE_INSTALL_PREFIX=~/lapack -DCBLAS=True -DLAPACK=True -DLAPACKE=True -DBUILD_INDEX64=False -DBUILD_SHARED_LIBS=True .. + cmake -DCMAKE_INSTALL_PREFIX=~/lapack -DCBLAS=True -DLAPACK=True -DLAPACKE=True -DBUILD_INDEX64=False -DBUILD_SHARED_LIBS=True .. cmake --build . -j --target install and then used in oneMKL by setting ``-REF_BLAS_ROOT=/path/to/lapack/install`` diff --git a/docs/building_the_project_with_dpcpp.rst b/docs/building_the_project_with_dpcpp.rst index 0da5f06e9..6076117f7 100644 --- a/docs/building_the_project_with_dpcpp.rst +++ b/docs/building_the_project_with_dpcpp.rst @@ -386,11 +386,11 @@ disabled: cmake $ONEMKL_DIR \ -DCMAKE_CXX_COMPILER=clang++ \ -DCMAKE_C_COMPILER=clang \ - -DENABLE_MKLCPU_BACKEND=False \ + -DENABLE_MKLCPU_BACKEND=False \ -DENABLE_MKLGPU_BACKEND=False \ - -DENABLE_ROCFFT_BACKEND=True \ + -DENABLE_ROCFFT_BACKEND=True \ -DENABLE_ROCBLAS_BACKEND=True \ - -DENABLE_ROCSOLVER_BACKEND=True \ + -DENABLE_ROCSOLVER_BACKEND=True \ -DHIP_TARGETS=gfx90a \ -DBUILD_FUNCTIONAL_TESTS=False diff --git a/docs/create_new_backend.rst b/docs/create_new_backend.rst index 8f25bda33..b22df014d 100644 --- a/docs/create_new_backend.rst +++ b/docs/create_new_backend.rst @@ -157,13 +157,13 @@ To integrate the new third-party library to a oneMKL header-based part, followin { domain::blas, { { device::x86cpu, { - #ifdef ENABLE_MKLCPU_BACKEND + #ifdef ONEMKL_ENABLE_MKLCPU_BACKEND LIB_NAME("blas_mklcpu") #endif } }, + { device::newdevice, + { - + #ifdef ENABLE_NEWLIB_BACKEND + + #ifdef ONEMKL_ENABLE_NEWLIB_BACKEND + LIB_NAME("blas_newlib") + #endif + } }, @@ -427,8 +427,8 @@ Update the following files to enable the new third-party library for unit tests: .. code-block:: diff - #cmakedefine ENABLE_MKLCPU_BACKEND - + #cmakedefine ENABLE_NEWLIB_BACKEND + #cmakedefine ONEMKL_ENABLE_MKLCPU_BACKEND + + #cmakedefine ONEMKL_ENABLE_NEWLIB_BACKEND * ``tests/unit_tests/CMakeLists.txt``: add instructions about how to link tests with the new backend library @@ -464,14 +464,14 @@ Update the following files to enable the new third-party library for unit tests: .. code-block:: diff - #ifdef ENABLE_MKLGPU_BACKEND + #ifdef ONEMKL_ENABLE_MKLGPU_BACKEND #define TEST_RUN_INTELGPU(q, func, args) \ func args #else #define TEST_RUN_INTELGPU(q, func, args) #endif + - + #ifdef ENABLE_NEWLIB_BACKEND + + #ifdef ONEMKL_ENABLE_NEWLIB_BACKEND + #define TEST_RUN_NEWDEVICE(q, func, args) \ + func args + #else @@ -495,7 +495,7 @@ Update the following files to enable the new third-party library for unit tests: } } + - + #ifdef ENABLE_NEWLIB_BACKEND + + #ifdef ONEMKL_ENABLE_NEWLIB_BACKEND + devices.push_back(sycl::device(sycl::host_selector())); + #endif diff --git a/include/oneapi/mkl/blas.hpp b/include/oneapi/mkl/blas.hpp index 05458d9aa..6b8066e69 100644 --- a/include/oneapi/mkl/blas.hpp +++ b/include/oneapi/mkl/blas.hpp @@ -34,22 +34,22 @@ #include "oneapi/mkl/detail/get_device_id.hpp" #include "oneapi/mkl/blas/detail/blas_loader.hpp" -#ifdef ENABLE_CUBLAS_BACKEND +#ifdef ONEMKL_ENABLE_CUBLAS_BACKEND #include "oneapi/mkl/blas/detail/cublas/blas_ct.hpp" #endif -#ifdef ENABLE_ROCBLAS_BACKEND +#ifdef ONEMKL_ENABLE_ROCBLAS_BACKEND #include "oneapi/mkl/blas/detail/rocblas/blas_ct.hpp" #endif -#ifdef ENABLE_MKLCPU_BACKEND +#ifdef ONEMKL_ENABLE_MKLCPU_BACKEND #include "oneapi/mkl/blas/detail/mklcpu/blas_ct.hpp" #endif -#ifdef ENABLE_MKLGPU_BACKEND +#ifdef ONEMKL_ENABLE_MKLGPU_BACKEND #include "oneapi/mkl/blas/detail/mklgpu/blas_ct.hpp" #endif -#ifdef ENABLE_NETLIB_BACKEND +#ifdef ONEMKL_ENABLE_NETLIB_BACKEND #include "oneapi/mkl/blas/detail/netlib/blas_ct.hpp" #endif -#ifdef ENABLE_PORTBLAS_BACKEND +#ifdef ONEMKL_ENABLE_PORTBLAS_BACKEND #include "oneapi/mkl/blas/detail/portblas/blas_ct.hpp" #endif diff --git a/include/oneapi/mkl/detail/backends_table.hpp b/include/oneapi/mkl/detail/backends_table.hpp index eacc99763..731781375 100644 --- a/include/oneapi/mkl/detail/backends_table.hpp +++ b/include/oneapi/mkl/detail/backends_table.hpp @@ -47,40 +47,40 @@ static std::map>> libraries = { domain::blas, { { device::x86cpu, { -#ifdef ENABLE_MKLCPU_BACKEND +#ifdef ONEMKL_ENABLE_MKLCPU_BACKEND LIB_NAME("blas_mklcpu"), #endif -#ifdef ENABLE_NETLIB_BACKEND +#ifdef ONEMKL_ENABLE_NETLIB_BACKEND LIB_NAME("blas_netlib"), #endif -#ifdef ENABLE_PORTBLAS_BACKEND_INTEL_CPU +#ifdef ONEMKL_ENABLE_PORTBLAS_BACKEND_INTEL_CPU LIB_NAME("blas_portblas"), #endif } }, { device::intelgpu, { -#ifdef ENABLE_MKLGPU_BACKEND +#ifdef ONEMKL_ENABLE_MKLGPU_BACKEND LIB_NAME("blas_mklgpu"), #endif -#ifdef ENABLE_PORTBLAS_BACKEND_INTEL_GPU +#ifdef ONEMKL_ENABLE_PORTBLAS_BACKEND_INTEL_GPU LIB_NAME("blas_portblas"), #endif } }, { device::amdgpu, { -#ifdef ENABLE_ROCBLAS_BACKEND +#ifdef ONEMKL_ENABLE_ROCBLAS_BACKEND LIB_NAME("blas_rocblas"), #endif -#ifdef ENABLE_PORTBLAS_BACKEND_AMD_GPU +#ifdef ONEMKL_ENABLE_PORTBLAS_BACKEND_AMD_GPU LIB_NAME("blas_portblas"), #endif } }, { device::nvidiagpu, { -#ifdef ENABLE_CUBLAS_BACKEND +#ifdef ONEMKL_ENABLE_CUBLAS_BACKEND LIB_NAME("blas_cublas"), #endif -#ifdef ENABLE_PORTBLAS_BACKEND_NVIDIA_GPU +#ifdef ONEMKL_ENABLE_PORTBLAS_BACKEND_NVIDIA_GPU LIB_NAME("blas_portblas"), #endif } }, @@ -94,37 +94,37 @@ static std::map>> libraries = { domain::dft, { { device::x86cpu, { -#ifdef ENABLE_MKLCPU_BACKEND +#ifdef ONEMKL_ENABLE_MKLCPU_BACKEND LIB_NAME("dft_mklcpu") #endif -#ifdef ENABLE_PORTFFT_BACKEND +#ifdef ONEMKL_ENABLE_PORTFFT_BACKEND LIB_NAME("dft_portfft") #endif } }, { device::intelgpu, { -#ifdef ENABLE_MKLGPU_BACKEND +#ifdef ONEMKL_ENABLE_MKLGPU_BACKEND LIB_NAME("dft_mklgpu") #endif -#ifdef ENABLE_PORTFFT_BACKEND +#ifdef ONEMKL_ENABLE_PORTFFT_BACKEND LIB_NAME("dft_portfft") #endif } }, { device::amdgpu, { -#ifdef ENABLE_ROCFFT_BACKEND +#ifdef ONEMKL_ENABLE_ROCFFT_BACKEND LIB_NAME("dft_rocfft") #endif -#ifdef ENABLE_PORTFFT_BACKEND +#ifdef ONEMKL_ENABLE_PORTFFT_BACKEND LIB_NAME("dft_portfft") #endif } }, { device::nvidiagpu, { -#ifdef ENABLE_CUFFT_BACKEND +#ifdef ONEMKL_ENABLE_CUFFT_BACKEND LIB_NAME("dft_cufft") #endif -#ifdef ENABLE_PORTFFT_BACKEND +#ifdef ONEMKL_ENABLE_PORTFFT_BACKEND LIB_NAME("dft_portfft") #endif } }, @@ -138,25 +138,25 @@ static std::map>> libraries = { domain::lapack, { { device::x86cpu, { -#ifdef ENABLE_MKLCPU_BACKEND +#ifdef ONEMKL_ENABLE_MKLCPU_BACKEND LIB_NAME("lapack_mklcpu") #endif } }, { device::intelgpu, { -#ifdef ENABLE_MKLGPU_BACKEND +#ifdef ONEMKL_ENABLE_MKLGPU_BACKEND LIB_NAME("lapack_mklgpu") #endif } }, { device::amdgpu, { -#ifdef ENABLE_ROCSOLVER_BACKEND +#ifdef ONEMKL_ENABLE_ROCSOLVER_BACKEND LIB_NAME("lapack_rocsolver") #endif } }, { device::nvidiagpu, { -#ifdef ENABLE_CUSOLVER_BACKEND +#ifdef ONEMKL_ENABLE_CUSOLVER_BACKEND LIB_NAME("lapack_cusolver") #endif } } } }, @@ -164,25 +164,25 @@ static std::map>> libraries = { domain::rng, { { device::x86cpu, { -#ifdef ENABLE_MKLCPU_BACKEND +#ifdef ONEMKL_ENABLE_MKLCPU_BACKEND LIB_NAME("rng_mklcpu") #endif } }, { device::intelgpu, { -#ifdef ENABLE_MKLGPU_BACKEND +#ifdef ONEMKL_ENABLE_MKLGPU_BACKEND LIB_NAME("rng_mklgpu") #endif } }, { device::amdgpu, { -#ifdef ENABLE_ROCRAND_BACKEND +#ifdef ONEMKL_ENABLE_ROCRAND_BACKEND LIB_NAME("rng_rocrand") #endif } }, { device::nvidiagpu, { -#ifdef ENABLE_CURAND_BACKEND +#ifdef ONEMKL_ENABLE_CURAND_BACKEND LIB_NAME("rng_curand") #endif } } } }, @@ -190,13 +190,13 @@ static std::map>> libraries = { domain::sparse_blas, { { device::x86cpu, { -#ifdef ENABLE_MKLCPU_BACKEND +#ifdef ONEMKL_ENABLE_MKLCPU_BACKEND LIB_NAME("sparse_blas_mklcpu") #endif } }, { device::intelgpu, { -#ifdef ENABLE_MKLGPU_BACKEND +#ifdef ONEMKL_ENABLE_MKLGPU_BACKEND LIB_NAME("sparse_blas_mklgpu") #endif } } } }, diff --git a/include/oneapi/mkl/detail/export.hpp b/include/oneapi/mkl/detail/export.hpp index cbdd0d08c..55f6a7b15 100644 --- a/include/oneapi/mkl/detail/export.hpp +++ b/include/oneapi/mkl/detail/export.hpp @@ -22,7 +22,7 @@ #include "oneapi/mkl/detail/config.hpp" -#if !defined(BUILD_SHARED_LIBS) || !defined(_WIN64) +#if !defined(ONEMKL_BUILD_SHARED_LIBS) || !defined(_WIN64) #define ONEMKL_EXPORT #define ONEMKL_NO_EXPORT #else diff --git a/include/oneapi/mkl/dft/detail/descriptor_impl.hpp b/include/oneapi/mkl/dft/detail/descriptor_impl.hpp index a9c3f946c..b2095c49b 100644 --- a/include/oneapi/mkl/dft/detail/descriptor_impl.hpp +++ b/include/oneapi/mkl/dft/detail/descriptor_impl.hpp @@ -71,23 +71,23 @@ class descriptor { void commit(sycl::queue& queue); -#ifdef ENABLE_MKLCPU_BACKEND +#ifdef ONEMKL_ENABLE_MKLCPU_BACKEND void commit(backend_selector selector); #endif -#ifdef ENABLE_MKLGPU_BACKEND +#ifdef ONEMKL_ENABLE_MKLGPU_BACKEND void commit(backend_selector selector); #endif -#ifdef ENABLE_CUFFT_BACKEND +#ifdef ONEMKL_ENABLE_CUFFT_BACKEND void commit(backend_selector selector); #endif -#ifdef ENABLE_ROCFFT_BACKEND +#ifdef ONEMKL_ENABLE_ROCFFT_BACKEND void commit(backend_selector selector); #endif -#ifdef ENABLE_PORTFFT_BACKEND +#ifdef ONEMKL_ENABLE_PORTFFT_BACKEND void commit(backend_selector selector); #endif diff --git a/include/oneapi/mkl/lapack.hpp b/include/oneapi/mkl/lapack.hpp index 2340c16ba..f9d331e42 100644 --- a/include/oneapi/mkl/lapack.hpp +++ b/include/oneapi/mkl/lapack.hpp @@ -21,16 +21,16 @@ #include "oneapi/mkl/detail/config.hpp" -#ifdef ENABLE_MKLCPU_BACKEND +#ifdef ONEMKL_ENABLE_MKLCPU_BACKEND #include "oneapi/mkl/lapack/detail/mklcpu/lapack_ct.hpp" #endif -#ifdef ENABLE_MKLGPU_BACKEND +#ifdef ONEMKL_ENABLE_MKLGPU_BACKEND #include "oneapi/mkl/lapack/detail/mklgpu/lapack_ct.hpp" #endif -#ifdef ENABLE_CUSOLVER_BACKEND +#ifdef ONEMKL_ENABLE_CUSOLVER_BACKEND #include "oneapi/mkl/lapack/detail/cusolver/lapack_ct.hpp" #endif -#ifdef ENABLE_ROCSOLVER_BACKEND +#ifdef ONEMKL_ENABLE_ROCSOLVER_BACKEND #include "oneapi/mkl/lapack/detail/rocsolver/lapack_ct.hpp" #endif diff --git a/include/oneapi/mkl/rng/engines.hpp b/include/oneapi/mkl/rng/engines.hpp index c28ae2b45..610fda70b 100644 --- a/include/oneapi/mkl/rng/engines.hpp +++ b/include/oneapi/mkl/rng/engines.hpp @@ -35,16 +35,16 @@ #include "oneapi/mkl/rng/detail/engine_impl.hpp" #include "oneapi/mkl/rng/detail/rng_loader.hpp" -#ifdef ENABLE_MKLCPU_BACKEND +#ifdef ONEMKL_ENABLE_MKLCPU_BACKEND #include "oneapi/mkl/rng/detail/mklcpu/onemkl_rng_mklcpu.hpp" #endif -#ifdef ENABLE_MKLGPU_BACKEND +#ifdef ONEMKL_ENABLE_MKLGPU_BACKEND #include "oneapi/mkl/rng/detail/mklgpu/onemkl_rng_mklgpu.hpp" #endif -#ifdef ENABLE_CURAND_BACKEND +#ifdef ONEMKL_ENABLE_CURAND_BACKEND #include "oneapi/mkl/rng/detail/curand/onemkl_rng_curand.hpp" #endif -#ifdef ENABLE_ROCRAND_BACKEND +#ifdef ONEMKL_ENABLE_ROCRAND_BACKEND #include "oneapi/mkl/rng/detail/rocrand/onemkl_rng_rocrand.hpp" #endif @@ -68,7 +68,7 @@ class philox4x32x10 { philox4x32x10(sycl::queue queue, std::initializer_list seed) : pimpl_(detail::create_philox4x32x10(get_device_id(queue), queue, seed)) {} -#ifdef ENABLE_MKLCPU_BACKEND +#ifdef ONEMKL_ENABLE_MKLCPU_BACKEND philox4x32x10(backend_selector selector, std::uint64_t seed = default_seed) : pimpl_(mklcpu::create_philox4x32x10(selector.get_queue(), seed)) {} @@ -77,7 +77,7 @@ class philox4x32x10 { : pimpl_(mklcpu::create_philox4x32x10(selector.get_queue(), seed)) {} #endif -#ifdef ENABLE_MKLGPU_BACKEND +#ifdef ONEMKL_ENABLE_MKLGPU_BACKEND philox4x32x10(backend_selector selector, std::uint64_t seed = default_seed) : pimpl_(mklgpu::create_philox4x32x10(selector.get_queue(), seed)) {} @@ -86,7 +86,7 @@ class philox4x32x10 { : pimpl_(mklgpu::create_philox4x32x10(selector.get_queue(), seed)) {} #endif -#ifdef ENABLE_CURAND_BACKEND +#ifdef ONEMKL_ENABLE_CURAND_BACKEND philox4x32x10(backend_selector selector, std::uint64_t seed = default_seed) : pimpl_(curand::create_philox4x32x10(selector.get_queue(), seed)) {} @@ -94,7 +94,7 @@ class philox4x32x10 { std::initializer_list seed) : pimpl_(curand::create_philox4x32x10(selector.get_queue(), seed)) {} #endif -#ifdef ENABLE_ROCRAND_BACKEND +#ifdef ONEMKL_ENABLE_ROCRAND_BACKEND philox4x32x10(backend_selector selector, std::uint64_t seed = default_seed) : pimpl_(rocrand::create_philox4x32x10(selector.get_queue(), seed)) {} @@ -160,7 +160,7 @@ class mrg32k3a { mrg32k3a(sycl::queue queue, std::initializer_list seed) : pimpl_(detail::create_mrg32k3a(get_device_id(queue), queue, seed)) {} -#ifdef ENABLE_MKLCPU_BACKEND +#ifdef ONEMKL_ENABLE_MKLCPU_BACKEND mrg32k3a(backend_selector selector, std::uint32_t seed = default_seed) : pimpl_(mklcpu::create_mrg32k3a(selector.get_queue(), seed)) {} @@ -168,7 +168,7 @@ class mrg32k3a { : pimpl_(mklcpu::create_mrg32k3a(selector.get_queue(), seed)) {} #endif -#ifdef ENABLE_MKLGPU_BACKEND +#ifdef ONEMKL_ENABLE_MKLGPU_BACKEND mrg32k3a(backend_selector selector, std::uint32_t seed = default_seed) : pimpl_(mklgpu::create_mrg32k3a(selector.get_queue(), seed)) {} @@ -176,7 +176,7 @@ class mrg32k3a { : pimpl_(mklgpu::create_mrg32k3a(selector.get_queue(), seed)) {} #endif -#ifdef ENABLE_CURAND_BACKEND +#ifdef ONEMKL_ENABLE_CURAND_BACKEND mrg32k3a(backend_selector selector, std::uint32_t seed = default_seed) : pimpl_(curand::create_mrg32k3a(selector.get_queue(), seed)) {} @@ -184,7 +184,7 @@ class mrg32k3a { : pimpl_(curand::create_mrg32k3a(selector.get_queue(), seed)) {} #endif -#ifdef ENABLE_ROCRAND_BACKEND +#ifdef ONEMKL_ENABLE_ROCRAND_BACKEND mrg32k3a(backend_selector selector, std::uint32_t seed = default_seed) : pimpl_(rocrand::create_mrg32k3a(selector.get_queue(), seed)) {} diff --git a/include/oneapi/mkl/sparse_blas.hpp b/include/oneapi/mkl/sparse_blas.hpp index 912a20eb8..004b79727 100644 --- a/include/oneapi/mkl/sparse_blas.hpp +++ b/include/oneapi/mkl/sparse_blas.hpp @@ -28,10 +28,10 @@ #include "oneapi/mkl/detail/config.hpp" -#ifdef ENABLE_MKLCPU_BACKEND +#ifdef ONEMKL_ENABLE_MKLCPU_BACKEND #include "sparse_blas/detail/mklcpu/sparse_blas_ct.hpp" #endif -#ifdef ENABLE_MKLGPU_BACKEND +#ifdef ONEMKL_ENABLE_MKLGPU_BACKEND #include "sparse_blas/detail/mklgpu/sparse_blas_ct.hpp" #endif diff --git a/scripts/generate_cmake.py b/scripts/generate_cmake.py index 02efedb25..36cac3669 100644 --- a/scripts/generate_cmake.py +++ b/scripts/generate_cmake.py @@ -84,7 +84,7 @@ def usage(err = None): for f in file_list: if re.search('_dyn.c', f): - out_file.write(""" $<$: {filename}> + out_file.write(""" $<$: {filename}> """.format(filename=f)) else: out_file.write(""" {filename} diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 0beadc3ec..6ff8d5d11 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -23,12 +23,6 @@ if(WIN32 AND BUILD_SHARED_LIBS) list(APPEND ONEMKL_BUILD_COPT "-Donemkl_EXPORTS") endif() -# portBLAS backend variables must be accessible here to correctly -# generate the config file. -set(ENABLE_PORTBLAS_BACKEND_INTEL_CPU OFF CACHE INTERNAL "") -set(ENABLE_PORTBLAS_BACKEND_INTEL_GPU OFF CACHE INTERNAL "") -set(ENABLE_PORTBLAS_BACKEND_AMD_GPU OFF CACHE INTERNAL "") -set(ENABLE_PORTBLAS_BACKEND_NVIDIA_GPU OFF CACHE INTERNAL "") # store path to CMAKE_CURRENT_BINARY_DIR to use it later (makes FetchContent_Declare workable) set(ONEMKL_GENERATED_INCLUDE_PATH ${CMAKE_CURRENT_BINARY_DIR}) @@ -46,15 +40,38 @@ foreach(domain ${TARGET_DOMAINS}) endforeach() # Generate header with enabled backends for testing -configure_file(config.hpp.in "${CMAKE_CURRENT_BINARY_DIR}/oneapi/mkl/config.hpp.configured") -file(GENERATE - OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/oneapi/mkl/detail/config.hpp" - INPUT "${CMAKE_CURRENT_BINARY_DIR}/oneapi/mkl/config.hpp.configured" -) -install(FILES "${CMAKE_CURRENT_BINARY_DIR}/oneapi/mkl/detail/config.hpp" - DESTINATION include/oneapi/mkl/detail - COMPONENT Devel -) + +function(generate_header_file) + # Following if-conditions allow to decouple cmake configuration variables with + # the corresponding generated macro. This is done to be conformant with ES.33 + # C++ Core Guidelines + set(ONEMKL_BUILD_SHARED_LIBS ${BUILD_SHARED_LIBS}) + set(ONEMKL_ENABLE_MKLCPU_BACKEND ${ENABLE_MKLCPU_BACKEND}) + set(ONEMKL_ENABLE_MKLGPU_BACKEND ${ENABLE_MKLGPU_BACKEND}) + set(ONEMKL_ENABLE_CUBLAS_BACKEND ${ENABLE_CUBLAS_BACKEND}) + set(ONEMKL_ENABLE_ROCBLAS_BACKEND ${ENABLE_ROCBLAS_BACKEND}) + set(ONEMKL_ENABLE_NETLIB_BACKEND ${ENABLE_NETLIB_BACKEND}) + set(ONEMKL_ENABLE_PORTBLAS_BACKEND ${ENABLE_PORTBLAS_BACKEND}) + set(ONEMKL_ENABLE_CURAND_BACKEND ${ENABLE_CURAND_BACKEND}) + set(ONEMKL_ENABLE_ROCRAND_BACKEND ${ENABLE_ROCRAND_BACKEND}) + set(ONEMKL_ENABLE_CUSOLVER_BACKEND ${ENABLE_CUSOLVER_BACKEND}) + set(ONEMKL_ENABLE_ROCSOLVER_BACKEND ${ENABLE_ROCSOLVER_BACKEND}) + set(ONEMKL_ENABLE_CUFFT_BACKEND ${ENABLE_CUFFT_BACKEND}) + set(ONEMKL_ENABLE_ROCFFT_BACKEND ${ENABLE_ROCFFT_BACKEND}) + set(ONEMKL_ENABLE_PORTFFT_BACKEND ${ENABLE_PORTFFT_BACKEND}) + + configure_file(config.hpp.in "${CMAKE_CURRENT_BINARY_DIR}/oneapi/mkl/config.hpp.configured") + file(GENERATE + OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/oneapi/mkl/detail/config.hpp" + INPUT "${CMAKE_CURRENT_BINARY_DIR}/oneapi/mkl/config.hpp.configured" + ) + install(FILES "${CMAKE_CURRENT_BINARY_DIR}/oneapi/mkl/detail/config.hpp" + DESTINATION include/oneapi/mkl/detail + COMPONENT Devel + ) +endfunction() + +generate_header_file() # Add recipe for onemkl loader library if(BUILD_SHARED_LIBS) diff --git a/src/blas/backends/cublas/cublas_scope_handle.cpp b/src/blas/backends/cublas/cublas_scope_handle.cpp index 1f84de776..dd12552fb 100644 --- a/src/blas/backends/cublas/cublas_scope_handle.cpp +++ b/src/blas/backends/cublas/cublas_scope_handle.cpp @@ -35,7 +35,7 @@ namespace cublas { * takes place if no other element in the container has a key equivalent to * the one being emplaced (keys in a map container are unique). */ -#ifdef ONEAPI_ONEMKL_PI_INTERFACE_REMOVED +#ifdef ONEMKL_PI_INTERFACE_REMOVED thread_local cublas_handle CublasScopedContextHandler::handle_helper = cublas_handle{}; #else @@ -97,7 +97,7 @@ cublasHandle_t CublasScopedContextHandler::get_handle(const sycl::queue &queue) CUresult cuErr; CUcontext desired; CUDA_ERROR_FUNC(cuDevicePrimaryCtxRetain, cuErr, &desired, cudaDevice); -#ifdef ONEAPI_ONEMKL_PI_INTERFACE_REMOVED +#ifdef ONEMKL_PI_INTERFACE_REMOVED auto piPlacedContext_ = reinterpret_cast(desired); #else auto piPlacedContext_ = reinterpret_cast(desired); diff --git a/src/blas/backends/cublas/cublas_scope_handle.hpp b/src/blas/backends/cublas/cublas_scope_handle.hpp index 341316d2f..d88124ac1 100644 --- a/src/blas/backends/cublas/cublas_scope_handle.hpp +++ b/src/blas/backends/cublas/cublas_scope_handle.hpp @@ -36,8 +36,8 @@ // After Plugin Interface removal in DPC++ ur.hpp is the new include #if __has_include() #include -#ifndef ONEAPI_ONEMKL_PI_INTERFACE_REMOVED -#define ONEAPI_ONEMKL_PI_INTERFACE_REMOVED +#ifndef ONEMKL_PI_INTERFACE_REMOVED +#define ONEMKL_PI_INTERFACE_REMOVED #endif #elif __has_include() #include @@ -88,7 +88,7 @@ class CublasScopedContextHandler { sycl::context *placedContext_; bool needToRecover_; sycl::interop_handle &ih; -#ifdef ONEAPI_ONEMKL_PI_INTERFACE_REMOVED +#ifdef ONEMKL_PI_INTERFACE_REMOVED static thread_local cublas_handle handle_helper; #else static thread_local cublas_handle handle_helper; diff --git a/src/blas/backends/cublas/cublas_task.hpp b/src/blas/backends/cublas/cublas_task.hpp index 4fbdfdda2..b3887fcd4 100644 --- a/src/blas/backends/cublas/cublas_task.hpp +++ b/src/blas/backends/cublas/cublas_task.hpp @@ -38,8 +38,8 @@ // After Plugin Interface removal in DPC++ ur.hpp is the new include #if __has_include() #include -#ifndef ONEAPI_ONEMKL_PI_INTERFACE_REMOVED -#define ONEAPI_ONEMKL_PI_INTERFACE_REMOVED +#ifndef ONEMKL_PI_INTERFACE_REMOVED +#define ONEMKL_PI_INTERFACE_REMOVED #endif #elif __has_include() #include diff --git a/src/blas/backends/portblas/CMakeLists.txt b/src/blas/backends/portblas/CMakeLists.txt index 03fddbb38..3256554a3 100644 --- a/src/blas/backends/portblas/CMakeLists.txt +++ b/src/blas/backends/portblas/CMakeLists.txt @@ -50,16 +50,16 @@ if(PORTBLAS_TUNING_TARGET) # Allow the user to manually enable a specific device type # for tuned portBLAS configurations and sets sycl-target. if(PORTBLAS_TUNING_TARGET STREQUAL "INTEL_CPU") - set(ENABLE_PORTBLAS_BACKEND_INTEL_CPU "ON" CACHE INTERNAL "") + set(ONEMKL_ENABLE_PORTBLAS_BACKEND_INTEL_CPU "ON" CACHE INTERNAL "") set(PORTBLAS_TUNING_TARGET "") target_compile_options(ONEMKL::SYCL::SYCL INTERFACE -fsycl-targets=spir64_x86_64 -fsycl-unnamed-lambda) target_link_options(ONEMKL::SYCL::SYCL INTERFACE -fsycl-targets=spir64_x86_64) elseif(PORTBLAS_TUNING_TARGET STREQUAL "INTEL_GPU") - set(ENABLE_PORTBLAS_BACKEND_INTEL_GPU "ON" CACHE INTERNAL "") + set(ONEMKL_ENABLE_PORTBLAS_BACKEND_INTEL_GPU "ON" CACHE INTERNAL "") elseif(PORTBLAS_TUNING_TARGET STREQUAL "AMD_GPU") - set(ENABLE_PORTBLAS_BACKEND_AMD_GPU "ON" CACHE INTERNAL "") + set(ONEMKL_ENABLE_PORTBLAS_BACKEND_AMD_GPU "ON" CACHE INTERNAL "") if (is_dpcpp) target_compile_options(ONEMKL::SYCL::SYCL INTERFACE -fsycl-targets=amdgcn-amd-amdhsa -fsycl-unnamed-lambda @@ -72,7 +72,7 @@ if(PORTBLAS_TUNING_TARGET) " Compilation may fail.") endif() elseif(PORTBLAS_TUNING_TARGET STREQUAL "NVIDIA_GPU") - set(ENABLE_PORTBLAS_BACKEND_NVIDIA_GPU "ON" CACHE INTERNAL "") + set(ONEMKL_ENABLE_PORTBLAS_BACKEND_NVIDIA_GPU "ON" CACHE INTERNAL "") if (is_dpcpp) target_compile_options(ONEMKL::SYCL::SYCL INTERFACE -fsycl-targets=nvptx64-nvidia-cuda -fsycl-unnamed-lambda) @@ -94,27 +94,27 @@ if(PORTBLAS_TUNING_TARGET) endif() elseif(NUM_TARGETS EQUAL 0) # Enable portBLAS backend for all devices types - set(ENABLE_PORTBLAS_BACKEND_INTEL_CPU "ON" CACHE INTERNAL "") - set(ENABLE_PORTBLAS_BACKEND_INTEL_GPU "ON" CACHE INTERNAL "") - set(ENABLE_PORTBLAS_BACKEND_AMD_GPU "ON" CACHE INTERNAL "") - set(ENABLE_PORTBLAS_BACKEND_NVIDIA_GPU "ON" CACHE INTERNAL "") + set(ONEMKL_ENABLE_PORTBLAS_BACKEND_INTEL_CPU "ON" CACHE INTERNAL "") + set(ONEMKL_ENABLE_PORTBLAS_BACKEND_INTEL_GPU "ON" CACHE INTERNAL "") + set(ONEMKL_ENABLE_PORTBLAS_BACKEND_AMD_GPU "ON" CACHE INTERNAL "") + set(ONEMKL_ENABLE_PORTBLAS_BACKEND_NVIDIA_GPU "ON" CACHE INTERNAL "") else() # Try to automatically detect the PORTBLAS_TUNING_TARGET foreach(SYCL_TARGET IN LISTS SYCL_TARGETS) if(SYCL_TARGETS MATCHES "^intel_gpu" OR SYCL_TARGETS MATCHES "^spir64_gen") - set(ENABLE_PORTBLAS_BACKEND_INTEL_GPU "ON" CACHE INTERNAL "") + set(ONEMKL_ENABLE_PORTBLAS_BACKEND_INTEL_GPU "ON" CACHE INTERNAL "") set(PORTBLAS_TUNING_TARGET "INTEL_GPU") elseif(SYCL_TARGETS MATCHES "^spir64_x86_64") - set(ENABLE_PORTBLAS_BACKEND_INTEL_CPU "ON" CACHE INTERNAL "") + set(ONEMKL_ENABLE_PORTBLAS_BACKEND_INTEL_CPU "ON" CACHE INTERNAL "") elseif(SYCL_TARGETS MATCHES "^spir64") - set(ENABLE_PORTBLAS_BACKEND_INTEL_CPU "ON" CACHE INTERNAL "") - set(ENABLE_PORTBLAS_BACKEND_INTEL_GPU "ON" CACHE INTERNAL "") + set(ONEMKL_ENABLE_PORTBLAS_BACKEND_INTEL_CPU "ON" CACHE INTERNAL "") + set(ONEMKL_ENABLE_PORTBLAS_BACKEND_INTEL_GPU "ON" CACHE INTERNAL "") set(PORTBLAS_TUNING_TARGET "INTEL_GPU") elseif(SYCL_TARGETS MATCHES "^amd_gpu" OR SYCL_TARGETS MATCHES "-amd-") - set(ENABLE_PORTBLAS_BACKEND_AMD_GPU "ON" CACHE INTERNAL "") + set(ONEMKL_ENABLE_PORTBLAS_BACKEND_AMD_GPU "ON" CACHE INTERNAL "") set(PORTBLAS_TUNING_TARGET "AMD_GPU") elseif(SYCL_TARGETS MATCHES "^nvidia_gpu" OR SYCL_TARGETS MATCHES "-nvidia-") - set(ENABLE_PORTBLAS_BACKEND_NVIDIA_GPU "ON" CACHE INTERNAL "") + set(ONEMKL_ENABLE_PORTBLAS_BACKEND_NVIDIA_GPU "ON" CACHE INTERNAL "") set(PORTBLAS_TUNING_TARGET "NVIDIA_GPU") endif() endforeach() diff --git a/src/blas/backends/rocblas/rocblas_scope_handle.cpp b/src/blas/backends/rocblas/rocblas_scope_handle.cpp index 5edca96f7..8f48aed3d 100644 --- a/src/blas/backends/rocblas/rocblas_scope_handle.cpp +++ b/src/blas/backends/rocblas/rocblas_scope_handle.cpp @@ -50,7 +50,7 @@ rocblas_handle_container::~rocblas_handle_container() noexcept(false) { * takes place if no other element in the container has a key equivalent to * the one being emplaced (keys in a map container are unique). */ -#ifdef ONEAPI_ONEMKL_PI_INTERFACE_REMOVED +#ifdef ONEMKL_PI_INTERFACE_REMOVED thread_local rocblas_handle_container RocblasScopedContextHandler::handle_helper = rocblas_handle_container{}; #else @@ -113,7 +113,7 @@ rocblas_handle RocblasScopedContextHandler::get_handle(const sycl::queue &queue) hipError_t hipErr; hipCtx_t desired; HIP_ERROR_FUNC(hipDevicePrimaryCtxRetain, hipErr, &desired, hipDevice); -#ifdef ONEAPI_ONEMKL_PI_INTERFACE_REMOVED +#ifdef ONEMKL_PI_INTERFACE_REMOVED auto piPlacedContext_ = reinterpret_cast(desired); #else auto piPlacedContext_ = reinterpret_cast(desired); diff --git a/src/blas/backends/rocblas/rocblas_scope_handle.hpp b/src/blas/backends/rocblas/rocblas_scope_handle.hpp index 734e58fb1..76c849ef8 100644 --- a/src/blas/backends/rocblas/rocblas_scope_handle.hpp +++ b/src/blas/backends/rocblas/rocblas_scope_handle.hpp @@ -29,8 +29,8 @@ // After Plugin Interface removal in DPC++ ur.hpp is the new include #if __has_include() #include -#ifndef ONEAPI_ONEMKL_PI_INTERFACE_REMOVED -#define ONEAPI_ONEMKL_PI_INTERFACE_REMOVED +#ifndef ONEMKL_PI_INTERFACE_REMOVED +#define ONEMKL_PI_INTERFACE_REMOVED #endif #elif __has_include() #include @@ -55,7 +55,7 @@ class RocblasScopedContextHandler { sycl::context *placedContext_; bool needToRecover_; sycl::interop_handle &interop_h; -#ifdef ONEAPI_ONEMKL_PI_INTERFACE_REMOVED +#ifdef ONEMKL_PI_INTERFACE_REMOVED static thread_local rocblas_handle_container handle_helper; #else static thread_local rocblas_handle_container handle_helper; diff --git a/src/blas/backends/rocblas/rocblas_task.hpp b/src/blas/backends/rocblas/rocblas_task.hpp index a33bf2a2c..3b872e536 100644 --- a/src/blas/backends/rocblas/rocblas_task.hpp +++ b/src/blas/backends/rocblas/rocblas_task.hpp @@ -37,8 +37,8 @@ // After Plugin Interface removal in DPC++ ur.hpp is the new include #if __has_include() #include -#ifndef ONEAPI_ONEMKL_PI_INTERFACE_REMOVED -#define ONEAPI_ONEMKL_PI_INTERFACE_REMOVED +#ifndef ONEMKL_PI_INTERFACE_REMOVED +#define ONEMKL_PI_INTERFACE_REMOVED #endif #elif __has_include() #include diff --git a/src/config.hpp.in b/src/config.hpp.in index 16ee5a43f..de44cb16b 100644 --- a/src/config.hpp.in +++ b/src/config.hpp.in @@ -20,23 +20,23 @@ #ifndef ONEMKL_CONFIG_H #define ONEMKL_CONFIG_H -#cmakedefine ENABLE_CUBLAS_BACKEND -#cmakedefine ENABLE_CUFFT_BACKEND -#cmakedefine ENABLE_CURAND_BACKEND -#cmakedefine ENABLE_CUSOLVER_BACKEND -#cmakedefine ENABLE_MKLCPU_BACKEND -#cmakedefine ENABLE_MKLGPU_BACKEND -#cmakedefine ENABLE_NETLIB_BACKEND -#cmakedefine ENABLE_PORTBLAS_BACKEND -#cmakedefine ENABLE_PORTBLAS_BACKEND_AMD_GPU -#cmakedefine ENABLE_PORTBLAS_BACKEND_INTEL_CPU -#cmakedefine ENABLE_PORTBLAS_BACKEND_INTEL_GPU -#cmakedefine ENABLE_PORTBLAS_BACKEND_NVIDIA_GPU -#cmakedefine ENABLE_PORTFFT_BACKEND -#cmakedefine ENABLE_ROCBLAS_BACKEND -#cmakedefine ENABLE_ROCFFT_BACKEND -#cmakedefine ENABLE_ROCRAND_BACKEND -#cmakedefine ENABLE_ROCSOLVER_BACKEND -#cmakedefine BUILD_SHARED_LIBS +#cmakedefine ONEMKL_ENABLE_CUBLAS_BACKEND +#cmakedefine ONEMKL_ENABLE_CUFFT_BACKEND +#cmakedefine ONEMKL_ENABLE_CURAND_BACKEND +#cmakedefine ONEMKL_ENABLE_CUSOLVER_BACKEND +#cmakedefine ONEMKL_ENABLE_MKLCPU_BACKEND +#cmakedefine ONEMKL_ENABLE_MKLGPU_BACKEND +#cmakedefine ONEMKL_ENABLE_NETLIB_BACKEND +#cmakedefine ONEMKL_ENABLE_PORTBLAS_BACKEND +#cmakedefine ONEMKL_ENABLE_PORTBLAS_BACKEND_AMD_GPU +#cmakedefine ONEMKL_ENABLE_PORTBLAS_BACKEND_INTEL_CPU +#cmakedefine ONEMKL_ENABLE_PORTBLAS_BACKEND_INTEL_GPU +#cmakedefine ONEMKL_ENABLE_PORTBLAS_BACKEND_NVIDIA_GPU +#cmakedefine ONEMKL_ENABLE_PORTFFT_BACKEND +#cmakedefine ONEMKL_ENABLE_ROCBLAS_BACKEND +#cmakedefine ONEMKL_ENABLE_ROCFFT_BACKEND +#cmakedefine ONEMKL_ENABLE_ROCRAND_BACKEND +#cmakedefine ONEMKL_ENABLE_ROCSOLVER_BACKEND +#cmakedefine ONEMKL_BUILD_SHARED_LIBS #endif diff --git a/src/lapack/backends/cusolver/cusolver_scope_handle.cpp b/src/lapack/backends/cusolver/cusolver_scope_handle.cpp index a0c9c6b6f..f381336d6 100644 --- a/src/lapack/backends/cusolver/cusolver_scope_handle.cpp +++ b/src/lapack/backends/cusolver/cusolver_scope_handle.cpp @@ -35,7 +35,7 @@ namespace cusolver { * takes place if no other element in the container has a key equivalent to * the one being emplaced (keys in a map container are unique). */ -#ifdef ONEAPI_ONEMKL_PI_INTERFACE_REMOVED +#ifdef ONEMKL_PI_INTERFACE_REMOVED thread_local cusolver_handle CusolverScopedContextHandler::handle_helper = cusolver_handle{}; #else @@ -98,7 +98,7 @@ cusolverDnHandle_t CusolverScopedContextHandler::get_handle(const sycl::queue &q CUresult cuErr; CUcontext desired; CUDA_ERROR_FUNC(cuDevicePrimaryCtxRetain, cuErr, &desired, cudaDevice); -#ifdef ONEAPI_ONEMKL_PI_INTERFACE_REMOVED +#ifdef ONEMKL_PI_INTERFACE_REMOVED auto piPlacedContext_ = reinterpret_cast(desired); #else auto piPlacedContext_ = reinterpret_cast(desired); diff --git a/src/lapack/backends/cusolver/cusolver_scope_handle.hpp b/src/lapack/backends/cusolver/cusolver_scope_handle.hpp index 390f9bb46..1bd916f71 100644 --- a/src/lapack/backends/cusolver/cusolver_scope_handle.hpp +++ b/src/lapack/backends/cusolver/cusolver_scope_handle.hpp @@ -42,8 +42,8 @@ // After Plugin Interface removal in DPC++ ur.hpp is the new include #if __has_include() #include -#ifndef ONEAPI_ONEMKL_PI_INTERFACE_REMOVED -#define ONEAPI_ONEMKL_PI_INTERFACE_REMOVED +#ifndef ONEMKL_PI_INTERFACE_REMOVED +#define ONEMKL_PI_INTERFACE_REMOVED #endif #elif __has_include() #include @@ -92,7 +92,7 @@ class CusolverScopedContextHandler { sycl::context *placedContext_; bool needToRecover_; sycl::interop_handle &ih; -#ifdef ONEAPI_ONEMKL_PI_INTERFACE_REMOVED +#ifdef ONEMKL_PI_INTERFACE_REMOVED static thread_local cusolver_handle handle_helper; #else static thread_local cusolver_handle handle_helper; diff --git a/src/lapack/backends/cusolver/cusolver_task.hpp b/src/lapack/backends/cusolver/cusolver_task.hpp index 6a35dea84..96107f959 100644 --- a/src/lapack/backends/cusolver/cusolver_task.hpp +++ b/src/lapack/backends/cusolver/cusolver_task.hpp @@ -34,8 +34,8 @@ // After Plugin Interface removal in DPC++ ur.hpp is the new include #if __has_include() #include -#ifndef ONEAPI_ONEMKL_PI_INTERFACE_REMOVED -#define ONEAPI_ONEMKL_PI_INTERFACE_REMOVED +#ifndef ONEMKL_PI_INTERFACE_REMOVED +#define ONEMKL_PI_INTERFACE_REMOVED #endif #elif __has_include() #include diff --git a/src/lapack/backends/rocsolver/rocsolver_scope_handle.cpp b/src/lapack/backends/rocsolver/rocsolver_scope_handle.cpp index 480ee9fc3..2a2e7d1ab 100644 --- a/src/lapack/backends/rocsolver/rocsolver_scope_handle.cpp +++ b/src/lapack/backends/rocsolver/rocsolver_scope_handle.cpp @@ -37,7 +37,7 @@ namespace rocsolver { * takes place if no other element in the container has a key equivalent to * the one being emplaced (keys in a map container are unique). */ -#ifdef ONEAPI_ONEMKL_PI_INTERFACE_REMOVED +#ifdef ONEMKL_PI_INTERFACE_REMOVED thread_local rocsolver_handle RocsolverScopedContextHandler::handle_helper = rocsolver_handle{}; #else @@ -100,7 +100,7 @@ rocblas_handle RocsolverScopedContextHandler::get_handle(const sycl::queue &queu hipError_t hipErr; hipCtx_t desired; HIP_ERROR_FUNC(hipDevicePrimaryCtxRetain, hipErr, &desired, hipDevice); -#ifdef ONEAPI_ONEMKL_PI_INTERFACE_REMOVED +#ifdef ONEMKL_PI_INTERFACE_REMOVED auto piPlacedContext_ = reinterpret_cast(desired); #else auto piPlacedContext_ = reinterpret_cast(desired); diff --git a/src/lapack/backends/rocsolver/rocsolver_scope_handle.hpp b/src/lapack/backends/rocsolver/rocsolver_scope_handle.hpp index 1be98a3b9..443a1ca2a 100644 --- a/src/lapack/backends/rocsolver/rocsolver_scope_handle.hpp +++ b/src/lapack/backends/rocsolver/rocsolver_scope_handle.hpp @@ -36,8 +36,8 @@ // After Plugin Interface removal in DPC++ ur.hpp is the new include #if __has_include() #include -#ifndef ONEAPI_ONEMKL_PI_INTERFACE_REMOVED -#define ONEAPI_ONEMKL_PI_INTERFACE_REMOVED +#ifndef ONEMKL_PI_INTERFACE_REMOVED +#define ONEMKL_PI_INTERFACE_REMOVED #endif #elif __has_include() #include @@ -55,7 +55,7 @@ class RocsolverScopedContextHandler { sycl::context *placedContext_; bool needToRecover_; sycl::interop_handle &ih; -#ifdef ONEAPI_ONEMKL_PI_INTERFACE_REMOVED +#ifdef ONEMKL_PI_INTERFACE_REMOVED static thread_local rocsolver_handle handle_helper; #else static thread_local rocsolver_handle handle_helper; diff --git a/src/lapack/backends/rocsolver/rocsolver_task.hpp b/src/lapack/backends/rocsolver/rocsolver_task.hpp index 43be4b543..4842a18e9 100644 --- a/src/lapack/backends/rocsolver/rocsolver_task.hpp +++ b/src/lapack/backends/rocsolver/rocsolver_task.hpp @@ -36,8 +36,8 @@ // After Plugin Interface removal in DPC++ ur.hpp is the new include #if __has_include() #include -#ifndef ONEAPI_ONEMKL_PI_INTERFACE_REMOVED -#define ONEAPI_ONEMKL_PI_INTERFACE_REMOVED +#ifndef ONEMKL_PI_INTERFACE_REMOVED +#define ONEMKL_PI_INTERFACE_REMOVED #endif #elif __has_include() #include diff --git a/tests/unit_tests/blas/CMakeLists.txt b/tests/unit_tests/blas/CMakeLists.txt index 442079833..bd37d55f3 100644 --- a/tests/unit_tests/blas/CMakeLists.txt +++ b/tests/unit_tests/blas/CMakeLists.txt @@ -19,8 +19,8 @@ # Add compile definitions for the reference libraries add_compile_definitions( - REF_BLAS_LIBNAME="${REF_BLAS_LIBNAME}" - REF_CBLAS_LIBNAME="${REF_CBLAS_LIBNAME}") + ONEMKL_REF_BLAS_LIBNAME="${ONEMKL_REF_BLAS_LIBNAME}" + ONEMKL_REF_CBLAS_LIBNAME="${ONEMKL_REF_CBLAS_LIBNAME}") add_subdirectory(level1) add_subdirectory(level2) diff --git a/tests/unit_tests/blas/include/reference_blas_wrappers.hpp b/tests/unit_tests/blas/include/reference_blas_wrappers.hpp index 8c7d0938a..977d14ca4 100644 --- a/tests/unit_tests/blas/include/reference_blas_wrappers.hpp +++ b/tests/unit_tests/blas/include/reference_blas_wrappers.hpp @@ -41,11 +41,11 @@ extern "C" { static LIB_TYPE h_libblas = NULL; static LIB_TYPE blas_library() { if (h_libblas == NULL) { - h_libblas = GET_LIB_HANDLE(REF_BLAS_LIBNAME); + h_libblas = GET_LIB_HANDLE(ONEMKL_REF_BLAS_LIBNAME); if (h_libblas == NULL) { throw oneapi::mkl::library_not_found( "BLAS", "blas_library()", - std::string("failed to load BLAS library ") + REF_BLAS_LIBNAME); + std::string("failed to load BLAS library ") + ONEMKL_REF_BLAS_LIBNAME); } } return h_libblas; @@ -54,11 +54,11 @@ static LIB_TYPE blas_library() { static LIB_TYPE h_libcblas = NULL; static LIB_TYPE cblas_library() { if (h_libcblas == NULL) { - h_libcblas = GET_LIB_HANDLE(REF_CBLAS_LIBNAME); + h_libcblas = GET_LIB_HANDLE(ONEMKL_REF_CBLAS_LIBNAME); if (h_libcblas == NULL) { throw oneapi::mkl::library_not_found( "BLAS", "cblas_library()", - std::string("failed to load CBLAS library ") + REF_CBLAS_LIBNAME); + std::string("failed to load CBLAS library ") + ONEMKL_REF_CBLAS_LIBNAME); } } return h_libcblas; diff --git a/tests/unit_tests/include/test_helper.hpp b/tests/unit_tests/include/test_helper.hpp index ad215761f..d4f79c5ce 100644 --- a/tests/unit_tests/include/test_helper.hpp +++ b/tests/unit_tests/include/test_helper.hpp @@ -73,8 +73,8 @@ if (d->get_info().size() == 0) \ GTEST_SKIP() << "Double precision is not supported on the device" -#if defined(ENABLE_MKLCPU_BACKEND) || defined(ENABLE_NETLIB_BACKEND) -#ifdef ENABLE_MKLCPU_BACKEND +#if defined(ONEMKL_ENABLE_MKLCPU_BACKEND) || defined(ONEMKL_ENABLE_NETLIB_BACKEND) +#ifdef ONEMKL_ENABLE_MKLCPU_BACKEND #define TEST_RUN_INTELCPU_SELECT_NO_ARGS(q, func) \ func(oneapi::mkl::backend_selector{ q }) #define TEST_RUN_INTELCPU_SELECT(q, func, ...) \ @@ -88,7 +88,7 @@ #define TEST_RUN_INTELCPU_SELECT(q, func, ...) #endif -#ifdef ENABLE_MKLGPU_BACKEND +#ifdef ONEMKL_ENABLE_MKLGPU_BACKEND #define TEST_RUN_INTELGPU_SELECT_NO_ARGS(q, func) \ func(oneapi::mkl::backend_selector{ q }) #define TEST_RUN_INTELGPU_SELECT(q, func, ...) \ @@ -98,55 +98,55 @@ #define TEST_RUN_INTELGPU_SELECT(q, func, ...) #endif -#ifdef ENABLE_CUBLAS_BACKEND +#ifdef ONEMKL_ENABLE_CUBLAS_BACKEND #define TEST_RUN_NVIDIAGPU_CUBLAS_SELECT(q, func, ...) \ func(oneapi::mkl::backend_selector{ q }, __VA_ARGS__) #else #define TEST_RUN_NVIDIAGPU_CUBLAS_SELECT(q, func, ...) #endif -#ifdef ENABLE_CUSOLVER_BACKEND +#ifdef ONEMKL_ENABLE_CUSOLVER_BACKEND #define TEST_RUN_NVIDIAGPU_CUSOLVER_SELECT(q, func, ...) \ func(oneapi::mkl::backend_selector{ q }, __VA_ARGS__) #else #define TEST_RUN_NVIDIAGPU_CUSOLVER_SELECT(q, func, ...) #endif -#ifdef ENABLE_ROCBLAS_BACKEND +#ifdef ONEMKL_ENABLE_ROCBLAS_BACKEND #define TEST_RUN_AMDGPU_ROCBLAS_SELECT(q, func, ...) \ func(oneapi::mkl::backend_selector{ q }, __VA_ARGS__) #else #define TEST_RUN_AMDGPU_ROCBLAS_SELECT(q, func, ...) #endif -#ifdef ENABLE_CURAND_BACKEND +#ifdef ONEMKL_ENABLE_CURAND_BACKEND #define TEST_RUN_NVIDIAGPU_CURAND_SELECT(q, func, ...) \ func(oneapi::mkl::backend_selector{ q }, __VA_ARGS__) #else #define TEST_RUN_NVIDIAGPU_CURAND_SELECT(q, func, ...) #endif -#ifdef ENABLE_ROCRAND_BACKEND +#ifdef ONEMKL_ENABLE_ROCRAND_BACKEND #define TEST_RUN_AMDGPU_ROCRAND_SELECT(q, func, ...) \ func(oneapi::mkl::backend_selector{ q }, __VA_ARGS__) #else #define TEST_RUN_AMDGPU_ROCRAND_SELECT(q, func, ...) #endif -#ifdef ENABLE_ROCSOLVER_BACKEND +#ifdef ONEMKL_ENABLE_ROCSOLVER_BACKEND #define TEST_RUN_AMDGPU_ROCSOLVER_SELECT(q, func, ...) \ func(oneapi::mkl::backend_selector{ q }, __VA_ARGS__) #else #define TEST_RUN_AMDGPU_ROCSOLVER_SELECT(q, func, ...) #endif -#ifdef ENABLE_PORTBLAS_BACKEND +#ifdef ONEMKL_ENABLE_PORTBLAS_BACKEND #define TEST_RUN_PORTBLAS_SELECT(q, func, ...) \ func(oneapi::mkl::backend_selector{ q }, __VA_ARGS__) #else #define TEST_RUN_PORTBLAS_SELECT(q, func, ...) #endif -#ifdef ENABLE_CUFFT_BACKEND +#ifdef ONEMKL_ENABLE_CUFFT_BACKEND #define TEST_RUN_NVIDIAGPU_CUFFT_SELECT_NO_ARGS(q, func) \ func(oneapi::mkl::backend_selector{ q }) #define TEST_RUN_NVIDIAGPU_CUFFT_SELECT(q, func, ...) \ @@ -156,7 +156,7 @@ #define TEST_RUN_NVIDIAGPU_CUFFT_SELECT(q, func, ...) #endif -#ifdef ENABLE_ROCFFT_BACKEND +#ifdef ONEMKL_ENABLE_ROCFFT_BACKEND #define TEST_RUN_AMDGPU_ROCFFT_SELECT_NO_ARGS(q, func) \ func(oneapi::mkl::backend_selector{ q }) #define TEST_RUN_AMDGPU_ROCFFT_SELECT(q, func, ...) \ @@ -166,7 +166,7 @@ #define TEST_RUN_AMDGPU_ROCFFT_SELECT(q, func, ...) #endif -#ifdef ENABLE_PORTFFT_BACKEND +#ifdef ONEMKL_ENABLE_PORTFFT_BACKEND #define TEST_RUN_PORTFFT_SELECT_NO_ARGS(q, func) \ func(oneapi::mkl::backend_selector{ q }) #define TEST_RUN_PORTFFT_SELECT(q, func, ...) \ @@ -330,10 +330,10 @@ static inline void *malloc_shared(size_t align, size_t size, sycl::device dev, s #ifdef _WIN64 return sycl::malloc_shared(size, dev, ctx); #else -#if defined(ENABLE_CUBLAS_BACKEND) || defined(ENABLE_ROCBLAS_BACKEND) +#if defined(ONEMKL_ENABLE_CUBLAS_BACKEND) || defined(ONEMKL_ENABLE_ROCBLAS_BACKEND) return sycl::aligned_alloc_shared(align, size, dev, ctx); #endif -#if !defined(ENABLE_CUBLAS_BACKEND) && !defined(ENABLE_ROCBLAS_BACKEND) +#if !defined(ONEMKL_ENABLE_CUBLAS_BACKEND) && !defined(ONEMKL_ENABLE_ROCBLAS_BACKEND) return sycl::malloc_shared(size, dev, ctx); #endif #endif @@ -344,10 +344,10 @@ static inline void *malloc_device(size_t align, size_t size, sycl::device dev, s #ifdef _WIN64 return sycl::malloc_device(size, dev, ctx); #else -#if defined(ENABLE_CUBLAS_BACKEND) || defined(ENABLE_ROCBLAS_BACKEND) +#if defined(ONEMKL_ENABLE_CUBLAS_BACKEND) || defined(ONEMKL_ENABLE_ROCBLAS_BACKEND) return sycl::aligned_alloc_device(align, size, dev, ctx); #endif -#if !defined(ENABLE_CUBLAS_BACKEND) && !defined(ENABLE_ROCBLAS_BACKEND) +#if !defined(ONEMKL_ENABLE_CUBLAS_BACKEND) && !defined(ONEMKL_ENABLE_ROCBLAS_BACKEND) return sycl::malloc_device(size, dev, ctx); #endif #endif diff --git a/tests/unit_tests/main_test.cpp b/tests/unit_tests/main_test.cpp index 7a20e0ed8..25277e4e0 100644 --- a/tests/unit_tests/main_test.cpp +++ b/tests/unit_tests/main_test.cpp @@ -112,25 +112,33 @@ int main(int argc, char** argv) { if (unique_devices.find(dev.get_info()) == unique_devices.end()) { unique_devices.insert(dev.get_info()); -#if !defined(ENABLE_MKLCPU_BACKEND) && !defined(ENABLE_PORTBLAS_BACKEND_INTEL_CPU) && \ - !defined(ENABLE_PORTFFT_BACKEND) && !defined(ENABLE_NETLIB_BACKEND) +#if !defined(ONEMKL_ENABLE_MKLCPU_BACKEND) && \ + !defined(ONEMKL_ENABLE_PORTBLAS_BACKEND_INTEL_CPU) && \ + !defined(ONEMKL_ENABLE_PORTFFT_BACKEND) && \ + !defined(ONEMKL_ENABLE_NETLIB_BACKEND) if (dev.is_cpu()) continue; #endif -#if !defined(ENABLE_MKLGPU_BACKEND) && !defined(ENABLE_PORTBLAS_BACKEND_INTEL_GPU) && \ - !defined(ENABLE_PORTFFT_BACKEND) +#if !defined(ONEMKL_ENABLE_MKLGPU_BACKEND) && \ + !defined(ONEMKL_ENABLE_PORTBLAS_BACKEND_INTEL_GPU) && \ + !defined(ONEMKL_ENABLE_PORTFFT_BACKEND) if (dev.is_gpu() && vendor_id == INTEL_ID) continue; #endif -#if !defined(ENABLE_CUBLAS_BACKEND) && !defined(ENABLE_CURAND_BACKEND) && \ - !defined(ENABLE_CUSOLVER_BACKEND) && !defined(ENABLE_PORTBLAS_BACKEND_NVIDIA_GPU) && \ - !defined(ENABLE_CUFFT_BACKEND) && !defined(ENABLE_PORTFFT_BACKEND) +#if !defined(ONEMKL_ENABLE_CUBLAS_BACKEND) && \ + !defined(ONEMKL_ENABLE_CURAND_BACKEND) && \ + !defined(ONEMKL_ENABLE_CUSOLVER_BACKEND) && \ + !defined(ONEMKL_ENABLE_PORTBLAS_BACKEND_NVIDIA_GPU) && \ + !defined(ONEMKL_ENABLE_CUFFT_BACKEND) && !defined(ONEMKL_ENABLE_PORTFFT_BACKEND) if (dev.is_gpu() && vendor_id == NVIDIA_ID) continue; #endif -#if !defined(ENABLE_ROCBLAS_BACKEND) && !defined(ENABLE_ROCRAND_BACKEND) && \ - !defined(ENABLE_ROCSOLVER_BACKEND) && !defined(ENABLE_PORTBLAS_BACKEND_AMD_GPU) && \ - !defined(ENABLE_ROCFFT_BACKEND) && !defined(ENABLE_PORTFFT_BACKEND) +#if !defined(ONEMKL_ENABLE_ROCBLAS_BACKEND) && \ + !defined(ONEMKL_ENABLE_ROCRAND_BACKEND) && \ + !defined(ONEMKL_ENABLE_ROCSOLVER_BACKEND) && \ + !defined(ONEMKL_ENABLE_PORTBLAS_BACKEND_AMD_GPU) && \ + !defined(ONEMKL_ENABLE_ROCFFT_BACKEND) && \ + !defined(ONEMKL_ENABLE_PORTFFT_BACKEND) if (dev.is_gpu() && vendor_id == AMD_ID) continue; #endif diff --git a/tests/unit_tests/rng/include/rng_test_common.hpp b/tests/unit_tests/rng/include/rng_test_common.hpp index d01b04cce..d2bc4859f 100644 --- a/tests/unit_tests/rng/include/rng_test_common.hpp +++ b/tests/unit_tests/rng/include/rng_test_common.hpp @@ -92,7 +92,7 @@ class rng_test { } }; -#ifdef ENABLE_CURAND_BACKEND // w/a for cuda backend hangs when there are several queues with different contexts +#ifdef ONEMKL_ENABLE_CURAND_BACKEND // w/a for cuda backend hangs when there are several queues with different contexts static sycl::device* previous_device = nullptr; static sycl::context* context = nullptr;