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

fix: remove libonedal_sycl.a from makefile #2970

Open
wants to merge 25 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 14 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
49 changes: 43 additions & 6 deletions cmake/templates/oneDALConfig.cmake.in
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ endif()
# ONEDAL_USE_DPCPP: yes | no. Default is yes
# ONEDAL_INTERFACE: yes | no. Default is no
# ONEDAL_SET_TBB_MANUALLY: yes | no. Default is no
# MKL_DEPENDENCY: yes | no. Default is no
Alexandr-Solovev marked this conversation as resolved.
Show resolved Hide resolved
# MATH_BACKEND: mkl | ref. Default is mkl
unset(DAL_LIBS)

# default CMAKE_BUILD_TYPE to Release
Expand Down Expand Up @@ -61,8 +63,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" CACHE STRING "Backend math library" FORCE)
elseif ("${REF_BACKEND}" STREQUAL "ON")
set(MATH_BACKEND "ref" CACHE STRING "Backend math library" FORCE)
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" CACHE STRING "MKL_DEPENDENCY math library" FORCE)
elseif ("${ONEDAL_LINK}" STREQUAL "static")
set(ONEDAL_LINK "static")
if("${MATH_BACKEND}" STREQUAL "mkl")
set(MKL_DEPENDENCY "yes" CACHE STRING "MKL_DEPENDENCY math library" FORCE)
elseif("${MATH_BACKEND}" STREQUAL "ref")
set(MKL_DEPENDENCY "no" CACHE STRING "MKL_DEPENDENCY math library" FORCE)
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 +110,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 +137,31 @@ 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" CACHE STRING "Threading type for MKL" FORCE)
set(MKL_SYCL_LINK "static" CACHE STRING "SYCL Link type for MKL" FORCE)
set(MKL_LINK "static" CACHE STRING "Link type for MKL" FORCE)
find_package(MKL REQUIRED MKL::MKL_SYCL)
message(STATUS "MKL dependencies are enabled")
message(STATUS "MKL_THREADING: ${MKL_THREADING}")
message(STATUS "MKL_SYCL_LINK: ${MKL_SYCL_LINK}")
message(STATUS "MKL_LINK: ${MKL_LINK}")
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 All @@ -134,7 +171,7 @@ list(APPEND DAL_LIBS onedal_core${DAL_DEBUG_SUFFIX})

set(THREADING_TYPE "parallel")
set(DAL_THREAD_LIBRARY_NAME onedal_thread${DAL_DEBUG_SUFFIX})

Alexandr-Solovev marked this conversation as resolved.
Show resolved Hide resolved
if (ONEDAL_SET_TBB_MANUALLY STREQUAL "no")
find_package(TBB REQUIRED tbb tbbmalloc)
if (NOT TBB_IMPORTED_TARGETS)
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",
],
)
2 changes: 2 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,8 @@ basic usage scenarios of |short_name| with DPCPP. Go to
#. Set up the compiler environment for |dpcpp|.
See |dpcpp_gsg|_ for details.

#. Draft:For static applications and examples is necesasry to source oneMKL.
Alexandr-Solovev marked this conversation as resolved.
Show resolved Hide resolved

#. 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
4 changes: 2 additions & 2 deletions samples/cmake/setup_samples.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -101,9 +101,9 @@ function(add_samples samples_paths)
endif()

if(UNIX AND NOT APPLE)
target_link_libraries(${sample} PRIVATE -Wl,--start-group ${oneDAL_IMPORTED_TARGETS} ${MPI_DEPENDENCIES} -Wl,--end-group)
target_link_libraries(${sample} PRIVATE -Wl,--start-group ${oneDAL_IMPORTED_TARGETS} ${MPI_DEPENDENCIES} MKL::MKL_SYCL -Wl,--end-group)
else()
target_link_libraries(${sample} PRIVATE ${oneDAL_IMPORTED_TARGETS} ${MPI_DEPENDENCIES})
target_link_libraries(${sample} PRIVATE ${oneDAL_IMPORTED_TARGETS} ${MPI_DEPENDENCIES} MKL::MKL_SYCL)
endif()

target_compile_options(${sample} PRIVATE ${ONEDAL_CUSTOM_COMPILE_OPTIONS})
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
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.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should we just remove this one? not in this PR though. @Alexandr-Solovev @homksei

# 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
Loading