Skip to content

Commit

Permalink
fix: remove libonedal_sycl.a from makefile (#2970)
Browse files Browse the repository at this point in the history
  • Loading branch information
Alexandr-Solovev authored Nov 15, 2024
1 parent a25cb07 commit f58b8f4
Show file tree
Hide file tree
Showing 11 changed files with 67 additions and 40 deletions.
1 change: 0 additions & 1 deletion BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -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": [],
}),
Expand Down
47 changes: 42 additions & 5 deletions cmake/templates/oneDALConfig.cmake.in
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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()
Expand Down Expand Up @@ -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)
Expand All @@ -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()
Expand Down Expand Up @@ -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
Expand All @@ -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}"
Expand Down
1 change: 0 additions & 1 deletion dev/bazel/deps/onedal.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -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",

Expand Down
14 changes: 2 additions & 12 deletions dev/bazel/deps/onedal.tpl.BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -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 = [
Expand Down Expand Up @@ -82,7 +72,7 @@ cc_library(
],
deps = [
":headers",
":onedal_sycl",
"@mkl//:mkl_dpc",
":parameters_static_dpc",
],
)
Expand Down Expand Up @@ -150,7 +140,7 @@ cc_library(
],
deps = [
":headers",
":onedal_sycl",
"@mkl//:mkl_dpc",
":parameters_dynamic_dpc",
],
)
6 changes: 6 additions & 0 deletions docs/source/get-started/build-and-run-examples.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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::
Expand Down
2 changes: 1 addition & 1 deletion docs/source/onedal/build_app/build-application.rst
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ Applications on Linux* OS

.. code-block:: text
<install dir>/dal/latest/lib/libonedal_sycl.a
<install dir>/mkl/latest/lib/libmkl_sycl.a
.. _app_on_win:

Expand Down
13 changes: 0 additions & 13 deletions makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
10 changes: 6 additions & 4 deletions samples/oneapi/dpc/ccl/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 2 additions & 0 deletions samples/oneapi/dpc/ccl/makefile_lnx
Original file line number Diff line number Diff line change
Expand Up @@ -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 \
Expand Down
9 changes: 6 additions & 3 deletions samples/oneapi/dpc/mpi/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 2 additions & 0 deletions samples/oneapi/dpc/mpi/makefile_lnx
Original file line number Diff line number Diff line change
Expand Up @@ -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 \
Expand Down

0 comments on commit f58b8f4

Please sign in to comment.