diff --git a/BUILD b/BUILD index 1e40ec7a410..69959673d50 100644 --- a/BUILD +++ b/BUILD @@ -34,7 +34,6 @@ release( "@onedal//cpp/oneapi/dal:dynamic_dpc", "@onedal//cpp/oneapi/dal:static_parameters_dpc", "@onedal//cpp/oneapi/dal:dynamic_parameters_dpc", - # TODO: Add onedal_sycl ], "//conditions:default": [], }), diff --git a/cmake/templates/oneDALConfig.cmake.in b/cmake/templates/oneDALConfig.cmake.in index 397a7b73669..f6aa42bdc7b 100644 --- a/cmake/templates/oneDALConfig.cmake.in +++ b/cmake/templates/oneDALConfig.cmake.in @@ -28,7 +28,11 @@ endif() # ONEDAL_LINK: static | dynamic. Default is dynamic # ONEDAL_USE_DPCPP: yes | no. Default is yes # ONEDAL_INTERFACE: yes | no. Default is no + +# Internal variables: # ONEDAL_SET_TBB_MANUALLY: yes | no. Default is no +# MKL_DEPENDENCY: yes | no. Default is no +# MATH_BACKEND: mkl | ref. Default is mkl unset(DAL_LIBS) # default CMAKE_BUILD_TYPE to Release @@ -61,8 +65,24 @@ if(NOT DEFINED ONEDAL_SET_TBB_MANUALLY AND DEFINED SET_TBB_MANUALLY) set(ONEDAL_SET_TBB_MANUALLY ${SET_TBB_MANUALLY}) endif() -if ("${ONEDAL_LINK}" STREQUAL "") +if ("${REF_BACKEND}" STREQUAL "" OR "${REF_BACKEND}" STREQUAL "OFF") + set(MATH_BACKEND "mkl") +elseif ("${REF_BACKEND}" STREQUAL "ON") + set(MATH_BACKEND "ref") +elseif (NOT "${REF_BACKEND}" STREQUAL "OFF" AND NOT "${REF_BACKEND}" STREQUAL "ON") + message(FATAL_ERROR "REF_BACKEND must be 'ON' or 'OFF'") +endif() + +if ("${ONEDAL_LINK}" STREQUAL "" OR "${ONEDAL_LINK}" STREQUAL "dynamic") set(ONEDAL_LINK "dynamic") + set(MKL_DEPENDENCY "no") +elseif ("${ONEDAL_LINK}" STREQUAL "static") + set(ONEDAL_LINK "static") + if("${MATH_BACKEND}" STREQUAL "mkl") + set(MKL_DEPENDENCY "yes") + elseif("${MATH_BACKEND}" STREQUAL "ref") + set(MKL_DEPENDENCY "no") + endif() elseif (NOT "${ONEDAL_LINK}" STREQUAL "static" AND NOT "${ONEDAL_LINK}" STREQUAL "dynamic") message(FATAL_ERROR "ONEDAL_LINK must be 'static' or 'dynamic'") endif() @@ -92,6 +112,9 @@ message(STATUS "ONEDAL_LINK: ${ONEDAL_LINK}") message(STATUS "ONEDAL_USE_DPCPP: ${ONEDAL_USE_DPCPP}") message(STATUS "ONEDAL_INTERFACE: ${ONEDAL_INTERFACE}") message(STATUS "ONEDAL_SET_TBB_MANUALLY: ${ONEDAL_SET_TBB_MANUALLY}") +message(STATUS "MATH_BACKEND: ${MATH_BACKEND}") +message(STATUS "REF_BACKEND: ${REF_BACKEND}") +message(STATUS "MKL_DEPENDENCY: ${MKL_DEPENDENCY}") message(STATUS "ONEDAL_USE_DPCPP: ${ONEDAL_USE_DPCPP}") if (NOT DAL_LIBRARIES) @@ -116,15 +139,29 @@ elseif (@VERSIONS_SET@ STREQUAL "FALSE") string(REGEX REPLACE ".*#define __INTEL_DAAL_MINOR_BINARY__ ([0-9]+).*" "\\1" _dal_ver_minor_bin "${DAL_VERSION_INFO}") endif() +if(MKL_DEPENDENCY STREQUAL "yes") + set(MKL_THREADING "tbb_thread") + set(MKL_SYCL_LINK "static") + set(MKL_LINK "static") + set(MKL_SYCL_INTERFACE_FULL "intel_ilp64") + set(MKL_INTERFACE_FULL "intel_ilp64") + find_package(MKL REQUIRED MKL::MKL_SYCL) +endif() + if (ONEDAL_USE_DPCPP STREQUAL "yes" AND ONEDAL_INTERFACE STREQUAL "no") - list(APPEND DAL_LIBS onedal_sycl${DAL_DEBUG_SUFFIX}) + if(MKL_DEPENDENCY STREQUAL "yes") + list(APPEND oneDAL_IMPORTED_TARGETS MKL::mkl_sycl${DAL_DEBUG_SUFFIX}) + endif() elseif (ONEDAL_USE_DPCPP STREQUAL "no" AND ONEDAL_INTERFACE STREQUAL "yes") list(APPEND DAL_LIBS onedal${DAL_DEBUG_SUFFIX}) if(ONEDAL_USE_PARAMETERS_LIBRARY) list(APPEND DAL_LIBS onedal_parameters${DAL_DEBUG_SUFFIX}) endif() elseif (ONEDAL_USE_DPCPP STREQUAL "yes" AND ONEDAL_INTERFACE STREQUAL "yes") - list(APPEND DAL_LIBS onedal_dpc${DAL_DEBUG_SUFFIX} onedal_sycl${DAL_DEBUG_SUFFIX}) + list(APPEND DAL_LIBS onedal_dpc${DAL_DEBUG_SUFFIX}) + if(MKL_DEPENDENCY STREQUAL "yes") + list(APPEND oneDAL_IMPORTED_TARGETS MKL::mkl_sycl${DAL_DEBUG_SUFFIX}) + endif() if(ONEDAL_USE_PARAMETERS_LIBRARY) list(APPEND DAL_LIBS onedal_parameters_dpc${DAL_DEBUG_SUFFIX}) endif() @@ -212,7 +249,7 @@ foreach (_dal_component ${DAL_LIBS}) set(oneDAL_${_dal_component}_FOUND 0) - if (${ONEDAL_LINK} STREQUAL "static" OR ${_dal_component} STREQUAL "onedal_sycl") + if (${ONEDAL_LINK} STREQUAL "static") add_library(oneDAL::${_dal_component} STATIC IMPORTED) find_library( _dal_lib @@ -233,7 +270,7 @@ foreach (_dal_component ${DAL_LIBS}) INTERFACE_INCLUDE_DIRECTORIES "${_dal_include_dir}") unset(_dal_include_dir) - if (WIN32 AND ${ONEDAL_LINK} STREQUAL "dynamic" AND NOT ${_dal_component} STREQUAL "onedal_sycl") + if (WIN32 AND ${ONEDAL_LINK} STREQUAL "dynamic") find_file(${_dal_component}_dll ${_dal_component}.${_dal_ver_major_bin}.dll PATHS "${_dal_root}/@DLL_REL_PATH@") set_target_properties(oneDAL::${_dal_component} PROPERTIES IMPORTED_LOCATION "${${_dal_component}_dll}" diff --git a/dev/bazel/deps/onedal.bzl b/dev/bazel/deps/onedal.bzl index f8ea37776fc..807ee94b5d5 100644 --- a/dev/bazel/deps/onedal.bzl +++ b/dev/bazel/deps/onedal.bzl @@ -26,7 +26,6 @@ onedal_repo = repos.prebuilt_libs_repo_rule( "lib/intel64/libonedal_thread.a", "lib/intel64/libonedal.a", "lib/intel64/libonedal_dpc.a", - "lib/intel64/libonedal_sycl.a", "lib/intel64/libonedal_parameters.a", "lib/intel64/libonedal_parameters_dpc.a", diff --git a/dev/bazel/deps/onedal.tpl.BUILD b/dev/bazel/deps/onedal.tpl.BUILD index 94632276eb6..439cf78be00 100644 --- a/dev/bazel/deps/onedal.tpl.BUILD +++ b/dev/bazel/deps/onedal.tpl.BUILD @@ -34,16 +34,6 @@ cc_library( ], ) -cc_library( - name = "onedal_sycl", - srcs = [ - "lib/intel64/libonedal_sycl.a", - ], - deps = [ - ":headers", - ], -) - cc_library( name = "parameters_static", srcs = [ @@ -82,7 +72,7 @@ cc_library( ], deps = [ ":headers", - ":onedal_sycl", + "@mkl//:mkl_dpc", ":parameters_static_dpc", ], ) @@ -150,7 +140,7 @@ cc_library( ], deps = [ ":headers", - ":onedal_sycl", + "@mkl//:mkl_dpc", ":parameters_dynamic_dpc", ], ) diff --git a/docs/source/get-started/build-and-run-examples.rst b/docs/source/get-started/build-and-run-examples.rst index aef14141ea9..ba4d40fb78b 100644 --- a/docs/source/get-started/build-and-run-examples.rst +++ b/docs/source/get-started/build-and-run-examples.rst @@ -76,6 +76,12 @@ basic usage scenarios of |short_name| with DPCPP. Go to #. Set up the compiler environment for |dpcpp|. See |dpcpp_gsg|_ for details. +#. Set up oneMKL environment in case of static linking: + + .. code-block:: bash + + source mkl/latest/env/vars.sh + #. Build and run examples: .. note:: diff --git a/docs/source/onedal/build_app/build-application.rst b/docs/source/onedal/build_app/build-application.rst index 4092a3256ad..b774e56743a 100644 --- a/docs/source/onedal/build_app/build-application.rst +++ b/docs/source/onedal/build_app/build-application.rst @@ -68,7 +68,7 @@ Applications on Linux* OS .. code-block:: text - /dal/latest/lib/libonedal_sycl.a + /mkl/latest/lib/libmkl_sycl.a .. _app_on_win: diff --git a/makefile b/makefile index 91922e98f0b..50c0d1cc740 100644 --- a/makefile +++ b/makefile @@ -990,19 +990,6 @@ $(foreach x,$(release.PARAMETERS.LIBS_Y.dpc),$(eval $(call .release.y_win,$x,$(R endif endif -ifneq ($(MKLGPUDIR),) -# Copies the file to the destination directory and renames daal -> onedal -# $1: Path to the file to be copied -# $2: Destination directory -define .release.sycl.old -_release_common: $2/$(subst mkl_sycl$d.$a,onedal_sycl$d.$a,$(notdir $1)) -$2/$(subst mkl_sycl$d.$a,onedal_sycl$d.$a,$(notdir $1)): $(call frompf1,$1) | $2/. ; $(value cpy) -endef - -$(foreach t,$(mklgpu.HEADERS),$(eval $(call .release.sycl.old,$t,$(RELEASEDIR.include.mklgpu)))) -$(foreach t,$(daaldep.math_backend.sycl), $(eval $(call .release.sycl.old,$t,$(RELEASEDIR.libia)))) -endif - _release_c: ./deploy/pkg-config/pkg-config.tpl python ./deploy/pkg-config/generate_pkgconfig.py --output_dir $(RELEASEDIR.pkgconfig) --template_name ./deploy/pkg-config/pkg-config.tpl diff --git a/samples/oneapi/dpc/ccl/CMakeLists.txt b/samples/oneapi/dpc/ccl/CMakeLists.txt index 8836a9cc69e..6a519e5b8d7 100644 --- a/samples/oneapi/dpc/ccl/CMakeLists.txt +++ b/samples/oneapi/dpc/ccl/CMakeLists.txt @@ -23,12 +23,14 @@ set(ONEDAL_USE_CCL yes) set(MPIEXEC_MAX_NUMPROCS "1" CACHE STRING "Number of processes") set(MPIEXEC_NUMPROCS_PER_NODE "1" CACHE STRING "Number of processes per node") - -set(CMAKE_C_COMPILER "mpiicx") +set(MPI_C_COMPILER "mpiicx") +set(CMAKE_C_COMPILER "icx") if(WIN32) - set(CMAKE_CXX_COMPILER "mpiicx") + set(MPI_CXX_COMPILER "mpiicx") + set(CMAKE_CXX_COMPILER "icx") elseif(UNIX) - set(CMAKE_CXX_COMPILER "mpiicpx") + set(MPI_CXX_COMPILER "mpiicpx") + set(CMAKE_CXX_COMPILER "icpx") endif() # Add cmake scripts and modules to CMake search path diff --git a/samples/oneapi/dpc/ccl/makefile_lnx b/samples/oneapi/dpc/ccl/makefile_lnx index 41066086b5c..4e14b4c6ff4 100644 --- a/samples/oneapi/dpc/ccl/makefile_lnx +++ b/samples/oneapi/dpc/ccl/makefile_lnx @@ -82,6 +82,8 @@ endif MPI_PATH = $(I_MPI_ROOT) CCL_PATH = $(CCL_ROOT) +# This file uses an outdated build system that is no longer supported. +# Please use CMake for building, as dependencies for this file are not updated. ifeq ($(RES_EXT),so) ONEDAL_LIBS := -lonedal_dpc \ -lonedal_core \ diff --git a/samples/oneapi/dpc/mpi/CMakeLists.txt b/samples/oneapi/dpc/mpi/CMakeLists.txt index 3846bda92f6..007bc97b1e2 100644 --- a/samples/oneapi/dpc/mpi/CMakeLists.txt +++ b/samples/oneapi/dpc/mpi/CMakeLists.txt @@ -23,11 +23,14 @@ set(ONEDAL_USE_CCL no) set(MPIEXEC_MAX_NUMPROCS "4" CACHE STRING "Number of processes") set(MPIEXEC_NUMPROCS_PER_NODE "4" CACHE STRING "Number of processes per node") -set(CMAKE_C_COMPILER "mpiicx") +set(MPI_C_COMPILER "mpiicx") +set(CMAKE_C_COMPILER "icx") if(WIN32) - set(CMAKE_CXX_COMPILER "mpiicx") + set(MPI_CXX_COMPILER "mpiicx") + set(CMAKE_CXX_COMPILER "icx") elseif(UNIX) - set(CMAKE_CXX_COMPILER "mpiicpx") + set(MPI_CXX_COMPILER "mpiicpx") + set(CMAKE_CXX_COMPILER "icpx") endif() # Add cmake scripts and modules to CMake search path diff --git a/samples/oneapi/dpc/mpi/makefile_lnx b/samples/oneapi/dpc/mpi/makefile_lnx index e22e9e9872f..a06f67889f2 100644 --- a/samples/oneapi/dpc/mpi/makefile_lnx +++ b/samples/oneapi/dpc/mpi/makefile_lnx @@ -75,6 +75,8 @@ endif MPI_PATH = $(I_MPI_ROOT) +# This file uses an outdated build system that is no longer supported. +# Please use CMake for building, as dependencies for this file are not updated. ifeq ($(RES_EXT),so) ONEDAL_LIBS := -lonedal_dpc \ -lonedal_core \