Skip to content

Commit 498a97d

Browse files
Build of backend library with custom math lib and dpl (#987)
* Build of backend library with custom math lib and dpl * conda-recipe modification, using of ONEAPI_ROOT
1 parent 6a6b97d commit 498a97d

File tree

8 files changed

+41
-49
lines changed

8 files changed

+41
-49
lines changed

0.build.sh

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
11
#!/bin/bash
22
THEDIR=$(dirname $(readlink -e ${BASH_SOURCE[0]}))
33

4-
. ${THEDIR}/0.env.sh
4+
# . ${THEDIR}/0.env.sh
55
cd ${THEDIR}
66

77
export DPNP_DEBUG=1
88

99
python setup.py clean
10-
python setup.py build_clib
10+
DPLROOT=/opt/intel/oneapi/dpl/latest python setup.py build_clib
1111

1212
# inplace build
13-
python setup.py build_ext --inplace
13+
CC=dpcpp python setup.py build_ext --inplace
1414

1515
# development build. Root privileges needed
1616
# python setup.py develop

conda-recipe/activate_env.sh

-7
This file was deleted.

conda-recipe/build.sh

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@
33
# if ONEAPI_ROOT is specified (use all from it)
44
if [ -n "${ONEAPI_ROOT}" ]; then
55
export DPCPPROOT=${ONEAPI_ROOT}/compiler/latest
6-
# TODO uncomment when CI will be changed
7-
# export MKLROOT=${ONEAPI_ROOT}/mkl/latest
6+
export MKLROOT=${ONEAPI_ROOT}/mkl/latest
87
export TBBROOT=${ONEAPI_ROOT}/tbb/latest
8+
export DPLROOT=${ONEAPI_ROOT}/dpl/latest
99
fi
1010

1111
# if DPCPPROOT is specified (work with custom DPCPP)

conda-recipe/meta.yaml

+3-2
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,11 @@ build:
3030
number: {{ GIT_DESCRIBE_NUMBER }}
3131
include_recipe: False
3232
script_env:
33-
- _ONEAPI_ROOT # renamed for ignore in CI
34-
- _DPCPPROOT # renamed for ignore in CI
33+
- ONEAPI_ROOT
34+
- DPCPPROOT
3535
- MKLROOT
3636
- TBBROOT
37+
- DPLROOT
3738
- WHEELS_OUTPUT_FOLDER
3839

3940
test:

conda-recipe/run_test.sh

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@
33
# if ONEAPI_ROOT is specified (use all from it)
44
if [ -n "${ONEAPI_ROOT}" ]; then
55
export DPCPPROOT=${ONEAPI_ROOT}/compiler/latest
6-
# TODO uncomment when CI will be changed
7-
# export MKLROOT=${ONEAPI_ROOT}/mkl/latest
6+
export MKLROOT=${ONEAPI_ROOT}/mkl/latest
87
export TBBROOT=${ONEAPI_ROOT}/tbb/latest
8+
export DPLROOT=${ONEAPI_ROOT}/dpl/latest
99
fi
1010

1111
# if DPCPPROOT is specified (work with custom DPCPP)

dpnp/backend/CMakeLists.txt

+2-10
Original file line numberDiff line numberDiff line change
@@ -38,14 +38,6 @@ set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake/Modules")
3838
# -----------------------------------------------------------------------------------------------
3939
if(DEFINED ENV{ONEAPI_ROOT})
4040
set(DPNP_ONEAPI_ROOT "$ENV{ONEAPI_ROOT}" CACHE PATH "Folder contains oneapi tool set")
41-
else()
42-
if(UNIX)
43-
set(DPNP_ONEAPI_ROOT "/opt/intel/oneapi" CACHE PATH "Folder contains oneapi tool set")
44-
elseif(WIN32)
45-
set(DPNP_ONEAPI_ROOT "C:/Program Files (x86)/Intel/oneAPI" CACHE PATH "Folder contains oneapi tool set")
46-
else()
47-
message(FATAL_ERROR "Unsupported system ${CMAKE_SYSTEM}")
48-
endif()
4941
endif()
5042

5143
option(DPNP_STATIC_LIB_ENABLE "Enable build DPNP static library" FALSE)
@@ -253,8 +245,8 @@ target_link_libraries(dpnp_backend_c PUBLIC ${DPNP_MATHLIB_DEP_LIBS})
253245

254246
# Parallel STL from DPC++
255247
if(NOT WIN32)
256-
find_package(PSTL REQUIRED)
257-
target_include_directories(dpnp_backend_c PUBLIC ${PSTL_INCLUDE_DIR})
248+
find_package(DPL REQUIRED)
249+
target_include_directories(dpnp_backend_c PUBLIC ${DPL_INCLUDE_DIR})
258250
endif()
259251

260252
# SYCL queue manager

dpnp/backend/cmake/Modules/FindPSTL.cmake renamed to dpnp/backend/cmake/Modules/FindDPL.cmake

+17-14
Original file line numberDiff line numberDiff line change
@@ -24,27 +24,30 @@
2424
# *****************************************************************************
2525

2626
# The following variables are optionally searched for defaults
27-
# PSTL_ROOT_DIR: Base directory where all components are found
27+
# DPLROOT: Environment variable to specify custom search place
28+
# ONEAPI_ROOT: Environment variable to specify search place from oneAPI
2829
#
2930
# The following are set after configuration is done:
30-
# PSTL_FOUND
31-
# PSTL_INCLUDE_DIR
31+
# DPL_FOUND
32+
# DPL_INCLUDE_DIR
3233

3334
include(FindPackageHandleStandardArgs)
3435

35-
set(PSTL_ROOT_DIR
36-
"${DPNP_ONEAPI_ROOT}/dpl"
37-
CACHE PATH "Folder contains PSTL headers")
36+
set(DPNP_ONEAPI_DPL "$ENV{DPNP_ONEAPI_ROOT}/dpl/latest" CACHE PATH "Folder contains DPL files from ONEAPI_ROOT")
37+
38+
if(DEFINED ENV{DPLROOT})
39+
set(DPNP_DPLROOT "$ENV{DPLROOT}" CACHE PATH "Folder contains DPL files from DPLROOT")
40+
endif()
3841

3942
find_path(
40-
PSTL_INCLUDE_DIR oneapi/dpl/algorithm
41-
HINTS ENV CONDA_PREFIX ${PSTL_ROOT_DIR} # search order is important
42-
PATH_SUFFIXES include latest/linux/include
43-
DOC "Path to PSTL include files")
43+
DPL_INCLUDE_DIR oneapi/dpl/algorithm
44+
HINTS ${DPNP_DPLROOT} ${DPNP_ONEAPI_DPL} ENV CONDA_PREFIX ENV PREFIX # search order is important
45+
PATH_SUFFIXES include linux/include
46+
DOC "Path to DPL include files")
4447

45-
find_package_handle_standard_args(PSTL DEFAULT_MSG PSTL_INCLUDE_DIR)
48+
find_package_handle_standard_args(DPL DEFAULT_MSG DPL_INCLUDE_DIR)
4649

47-
if(PSTL_FOUND)
48-
message(STATUS "Found PSTL: (include: ${PSTL_INCLUDE_DIR})")
49-
# mark_as_advanced(PSTL_ROOT_DIR PSTL_INCLUDE_DIR)
50+
if(DPL_FOUND)
51+
message(STATUS "Found DPL: (include: ${DPL_INCLUDE_DIR})")
52+
# mark_as_advanced(DPNP_DPLROOT DPL_INCLUDE_DIR)
5053
endif()

dpnp/backend/cmake/Modules/FindMathLib.cmake

+12-9
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,8 @@
2424
# *****************************************************************************
2525

2626
# The following variables are optionally searched for defaults
27-
# MATHLIB_ROOT_DIR: Base directory where all components are found
27+
# MKLROOT: Environment variable to specify custom search place
28+
# ONEAPI_ROOT: Environment variable to specify search place from oneAPI
2829
#
2930
# The following are set after configuration is done:
3031
# MATHLIB_FOUND
@@ -33,9 +34,11 @@
3334

3435
include(FindPackageHandleStandardArgs)
3536

36-
set(MATHLIB_ROOT_DIR
37-
"${DPNP_ONEAPI_ROOT}/mkl"
38-
CACHE PATH "Folder contains mathlib")
37+
set(DPNP_ONEAPI_MKL "$ENV{DPNP_ONEAPI_ROOT}/mkl/latest" CACHE PATH "Folder contains Math Lib files from ONEAPI_ROOT")
38+
39+
if(DEFINED ENV{MKLROOT})
40+
set(DPNP_MKLROOT "$ENV{MKLROOT}" CACHE PATH "Folder contains Math Lib files from MKLROOT")
41+
endif()
3942

4043
if(UNIX)
4144
set(MATHLIB_SYCL_LIB
@@ -51,14 +54,14 @@ endif()
5154

5255
find_path(
5356
MATHLIB_INCLUDE_DIR oneapi/mkl.hpp
54-
HINTS ENV CONDA_PREFIX ENV PREFIX ${MATHLIB_ROOT_DIR} # search order is important
55-
PATH_SUFFIXES include latest/include
57+
HINTS ${DPNP_MKLROOT} ${DPNP_ONEAPI_MKL} ENV CONDA_PREFIX ENV PREFIX # search order is important
58+
PATH_SUFFIXES include include
5659
DOC "Path to mathlib include files")
5760

5861
find_path(
5962
MATHLIB_LIBRARY_DIR ${MATHLIB_SYCL_LIB}
60-
HINTS ENV CONDA_PREFIX ENV PREFIX ${MATHLIB_ROOT_DIR} # search order is important
61-
PATH_SUFFIXES lib latest/lib/intel64
63+
HINTS ${DPNP_MKLROOT} ${DPNP_ONEAPI_MKL} ENV CONDA_PREFIX ENV PREFIX # search order is important
64+
PATH_SUFFIXES lib lib/intel64
6265
DOC "Path to mathlib library files")
6366

6467
# TODO implement recurcive searching file (GLOB_RECURSE MY_PATH "/opt/intel/*/mkl.hpp")
@@ -68,5 +71,5 @@ find_package_handle_standard_args(MathLib DEFAULT_MSG MATHLIB_INCLUDE_DIR MATHLI
6871

6972
if(MathLib_FOUND)
7073
message(STATUS "Found MathLib: (include: ${MATHLIB_INCLUDE_DIR}, library: ${MATHLIB_LIBRARY_DIR})")
71-
mark_as_advanced(MATHLIB_ROOT_DIR MATHLIB_INCLUDE_DIR MATHLIB_LIBRARY_DIR)
74+
# mark_as_advanced(DPNP_MKLROOT MATHLIB_INCLUDE_DIR MATHLIB_LIBRARY_DIR)
7275
endif()

0 commit comments

Comments
 (0)