Skip to content
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

Add prefixes to macros #571

Merged
merged 10 commits into from
Oct 15, 2024
4 changes: 2 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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/
Expand Down
4 changes: 2 additions & 2 deletions docs/building_and_running_tests.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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``
Expand Down
6 changes: 3 additions & 3 deletions docs/building_the_project_with_dpcpp.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
14 changes: 7 additions & 7 deletions docs/create_new_backend.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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
+ } },
Expand Down Expand Up @@ -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

Expand Down Expand Up @@ -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<oneapi::mkl::backend::mklgpu> 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<oneapi::mkl::backend::newbackend> args
+ #else
Expand All @@ -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

Expand Down
12 changes: 6 additions & 6 deletions include/oneapi/mkl/blas.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
54 changes: 27 additions & 27 deletions include/oneapi/mkl/detail/backends_table.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,40 +47,40 @@ static std::map<domain, std::map<device, std::vector<const char*>>> 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
} },
Expand All @@ -94,37 +94,37 @@ static std::map<domain, std::map<device, std::vector<const char*>>> 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
} },
Expand All @@ -138,65 +138,65 @@ static std::map<domain, std::map<device, std::vector<const char*>>> 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
} } } },

{ 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
} } } },

{ 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
} } } },
Expand Down
2 changes: 1 addition & 1 deletion include/oneapi/mkl/detail/export.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@

#include "oneapi/mkl/detail/config.hpp"

#if !defined(BUILD_SHARED_LIBS) || !defined(_WIN64)
mkrainiuk marked this conversation as resolved.
Show resolved Hide resolved
#if !defined(ONEMKL_BUILD_SHARED_LIBS) || !defined(_WIN64)
#define ONEMKL_EXPORT
#define ONEMKL_NO_EXPORT
#else
Expand Down
10 changes: 5 additions & 5 deletions include/oneapi/mkl/dft/detail/descriptor_impl.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -71,23 +71,23 @@ class descriptor {

void commit(sycl::queue& queue);

#ifdef ENABLE_MKLCPU_BACKEND
#ifdef ONEMKL_ENABLE_MKLCPU_BACKEND
void commit(backend_selector<backend::mklcpu> selector);
#endif

#ifdef ENABLE_MKLGPU_BACKEND
#ifdef ONEMKL_ENABLE_MKLGPU_BACKEND
void commit(backend_selector<backend::mklgpu> selector);
#endif

#ifdef ENABLE_CUFFT_BACKEND
#ifdef ONEMKL_ENABLE_CUFFT_BACKEND
void commit(backend_selector<backend::cufft> selector);
#endif

#ifdef ENABLE_ROCFFT_BACKEND
#ifdef ONEMKL_ENABLE_ROCFFT_BACKEND
void commit(backend_selector<backend::rocfft> selector);
#endif

#ifdef ENABLE_PORTFFT_BACKEND
#ifdef ONEMKL_ENABLE_PORTFFT_BACKEND
void commit(backend_selector<backend::portfft> selector);
#endif

Expand Down
8 changes: 4 additions & 4 deletions include/oneapi/mkl/lapack.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
Loading