Skip to content

Commit ed1db89

Browse files
committed
Reverted w/a for OneDPL since not working yet
1 parent 0132c09 commit ed1db89

File tree

3 files changed

+202
-1
lines changed

3 files changed

+202
-1
lines changed

CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ set(MKL_INTERFACE "ilp64")
3737
find_package(MKL REQUIRED)
3838

3939
set(ONEDPL_PAR_BACKEND tbb)
40-
find_package(oneDPL REQUIRED)
40+
find_package(oneDPL REQUIRED PATHS ${CMAKE_SOURCE_DIR}/dpnp/backend/cmake/Modules NO_DEFAULT_PATH)
4141

4242
include(GNUInstallDirs)
4343

dpnp/backend/cmake/Modules/README.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# oneAPI CMake scripts vendored from Intel oneAPI BaseKit 2023.0.0
2+
3+
This is done to work around absence of this script in onedpl-devel conda
4+
package. Once it is added, expected 2023.2.0, this vendored package is
5+
to be removed.
6+
7+
tbb-devel script has been modified to allow it to work correctly in conda
8+
environment.
Lines changed: 193 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,193 @@
1+
# Copyright (c) 2017-2023 Intel Corporation
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
# It defines the following variables:
16+
# TBB_<component>_FOUND
17+
# TBB_IMPORTED_TARGETS
18+
#
19+
# TBBConfigVersion.cmake defines TBB_VERSION
20+
#
21+
# Initialize to default values
22+
if (NOT TBB_IMPORTED_TARGETS)
23+
set(TBB_IMPORTED_TARGETS "")
24+
endif()
25+
26+
if (NOT TBB_FIND_COMPONENTS)
27+
set(TBB_FIND_COMPONENTS "tbb;tbbmalloc;tbbmalloc_proxy")
28+
foreach (_tbb_component ${TBB_FIND_COMPONENTS})
29+
set(TBB_FIND_REQUIRED_${_tbb_component} 1)
30+
endforeach()
31+
endif()
32+
33+
get_filename_component(_tbb_root "${CMAKE_CURRENT_LIST_DIR}" REALPATH)
34+
get_filename_component(_tbb_root "${_tbb_root}/../../.." ABSOLUTE)
35+
36+
set(TBB_INTERFACE_VERSION )
37+
38+
set(_tbb_bin_version 12)
39+
set(_tbbmalloc_bin_version 2)
40+
set(_tbbmalloc_proxy_bin_version 2)
41+
set(_tbbbind_bin_version 3)
42+
43+
# Add components with internal dependencies: tbbmalloc_proxy -> tbbmalloc
44+
list(FIND TBB_FIND_COMPONENTS tbbmalloc_proxy _tbbmalloc_proxy_ix)
45+
if (NOT _tbbmalloc_proxy_ix EQUAL -1)
46+
list(APPEND TBB_FIND_COMPONENTS tbbmalloc)
47+
list(REMOVE_DUPLICATES TBB_FIND_COMPONENTS)
48+
set(TBB_FIND_REQUIRED_tbbmalloc ${TBB_FIND_REQUIRED_tbbmalloc_proxy})
49+
endif()
50+
unset(_tbbmalloc_proxy_ix)
51+
52+
if (CMAKE_SIZEOF_VOID_P STREQUAL "8")
53+
set(_tbb_subdir intel64/gcc4.8)
54+
else ()
55+
set(_tbb_subdir ia32/gcc4.8)
56+
endif()
57+
58+
if (UNIX)
59+
set(_tbb_lib_ext ".so")
60+
set(_tbb_lib_prefix "lib")
61+
set(_tbb_lib_dir_conda "lib")
62+
set(_bin_version "")
63+
elseif (WIN32)
64+
set(_bin_version "")
65+
set(_tbb_lib_prefix "")
66+
set(_tbb_lib_ext ".dll")
67+
set(_tbb_impllib_ext ".lib")
68+
set(_tbb_lib_dir_conda "bin")
69+
set(_tbb_impllib_dir_conda "lib")
70+
else()
71+
message(FATAL_ERROR "Unsupported platform. Only Unix and Windows are supported.")
72+
endif()
73+
74+
foreach (_tbb_component ${TBB_FIND_COMPONENTS})
75+
set(TBB_${_tbb_component}_FOUND 0)
76+
77+
if(WIN32)
78+
unset(_bin_version)
79+
if (_tbb_component STREQUAL tbb)
80+
set(_bin_version ${_tbb_bin_version})
81+
endif()
82+
endif()
83+
84+
if(UNIX)
85+
find_library(_tbb_release_lib
86+
NAMES ${_tbb_lib_prefix}${_tbb_component}${_bin_version}${_tbb_lib_ext}
87+
PATHS ${_tbb_root}
88+
HINTS ENV TBB_ROOT_HINT
89+
PATH_SUFFIXES "${_tbb_lib_dir_conda}" "lib/${_tbb_subdir}")
90+
91+
else()
92+
find_file(_tbb_release_lib
93+
NAMES ${_tbb_lib_prefix}${_tbb_component}${_bin_version}${_tbb_lib_ext}
94+
PATHS ${_tbb_root}
95+
HINTS ENV TBB_ROOT_HINT
96+
PATH_SUFFIXES "${_tbb_lib_dir_conda}" "lib/${_tbb_subdir}")
97+
98+
if (EXISTS "${_tbb_release_lib}")
99+
find_library(_tbb_release_impllib
100+
NAMES ${_tbb_lib_prefix}${_tbb_component}${_bin_version}${_tbb_impllib_ext}
101+
PATHS ${_tbb_root}
102+
HINTS ENV TBB_ROOT_HINT
103+
PATH_SUFFIXES "${_tbb_impllib_dir_conda}" "lib/${_tbb_subdir}")
104+
endif()
105+
endif()
106+
107+
if (NOT TBB_FIND_RELEASE_ONLY)
108+
find_library(_tbb_debug_lib
109+
NAMES ${_tbb_lib_prefix}${_tbb_component}${_bin_version}_debug.${_tbb_lib_ext}
110+
PATHS ${_tbb_root}
111+
HINTS ENV TBB_ROOT_HINT
112+
PATH_SUFFIXES "${_tbb_lib_dir_conda}" "lib/${_tbb_subdir}")
113+
if(WIN32 AND EXISTS "${_tbb_debug_lib}")
114+
find_library(_tbb_debug_impllib
115+
NAMES ${_tbb_lib_prefix}${_tbb_component}${_bin_version}_debug.${_tbb_impllib_ext}
116+
PATHS ${_tbb_root}
117+
HINTS ENV TBB_ROOT_HINT
118+
PATH_SUFFIXES "${_tbb_impllib_dir_conda}" "lib/${_tbb_subdir}")
119+
endif()
120+
endif()
121+
122+
if (EXISTS "${_tbb_release_lib}" OR EXISTS "${_tbb_debug_lib}")
123+
if (NOT TARGET TBB::${_tbb_component})
124+
add_library(TBB::${_tbb_component} SHARED IMPORTED)
125+
126+
find_path(_tbb_include_dir
127+
oneapi/tbb.h
128+
PATHS ${_tbb_root}
129+
PATH_SUFFIXES include
130+
HINTS ENV TBB_ROOT_HINT
131+
)
132+
133+
if(WIN32)
134+
set_target_properties(
135+
TBB::${_tbb_component} PROPERTIES
136+
INTERFACE_INCLUDE_DIRECTORIES "${_tbb_include_dir}"
137+
INTERFACE_COMPILE_DEFINITIONS "__TBB_NO_IMPLICIT_LINKAGE=1"
138+
)
139+
else()
140+
set_target_properties(
141+
TBB::${_tbb_component} PROPERTIES
142+
INTERFACE_INCLUDE_DIRECTORIES "${_tbb_include_dir}"
143+
)
144+
endif()
145+
unset(_tbb_current_realpath)
146+
unset(_tbb_include_dir)
147+
148+
if (EXISTS "${_tbb_release_lib}")
149+
if(WIN32)
150+
set_target_properties(TBB::${_tbb_component} PROPERTIES
151+
IMPORTED_LOCATION_RELEASE "${_tbb_release_lib}"
152+
IMPORTED_IMPLIB_RELEASE "${_tbb_release_impllib}")
153+
else()
154+
set_target_properties(TBB::${_tbb_component} PROPERTIES
155+
IMPORTED_LOCATION_RELEASE "${_tbb_release_lib}")
156+
endif()
157+
set_property(TARGET TBB::${_tbb_component} APPEND PROPERTY IMPORTED_CONFIGURATIONS RELEASE)
158+
endif()
159+
160+
if (EXISTS "${_tbb_debug_lib}")
161+
if(WIN32)
162+
set_target_properties(TBB::${_tbb_component} PROPERTIES
163+
IMPORTED_LOCATION_DEBUG "${_tbb_debug_lib}"
164+
IMPORTED_IMPLIB_DEBUG "${_tbb_debug_impllib}"
165+
)
166+
else()
167+
set_target_properties(TBB::${_tbb_component} PROPERTIES
168+
IMPORTED_LOCATION_DEBUG "${_tbb_debug_lib}")
169+
endif()
170+
set_property(TARGET TBB::${_tbb_component} APPEND PROPERTY IMPORTED_CONFIGURATIONS DEBUG)
171+
endif()
172+
173+
# Add internal dependencies for imported targets: TBB::tbbmalloc_proxy -> TBB::tbbmalloc
174+
if (_tbb_component STREQUAL tbbmalloc_proxy)
175+
set_target_properties(TBB::tbbmalloc_proxy PROPERTIES INTERFACE_LINK_LIBRARIES TBB::tbbmalloc)
176+
endif()
177+
endif()
178+
list(APPEND TBB_IMPORTED_TARGETS TBB::${_tbb_component})
179+
set(TBB_${_tbb_component}_FOUND 1)
180+
elseif (TBB_FIND_REQUIRED AND TBB_FIND_REQUIRED_${_tbb_component})
181+
message(STATUS "Missed required oneTBB component: ${_tbb_component}")
182+
if (TBB_FIND_RELEASE_ONLY)
183+
message(STATUS " ${_tbb_release_lib} must exist.")
184+
else()
185+
message(STATUS " one or both of:\n ${_tbb_release_lib}\n ${_tbb_debug_lib}\n files must exist.")
186+
endif()
187+
set(TBB_FOUND FALSE)
188+
endif()
189+
endforeach()
190+
list(REMOVE_DUPLICATES TBB_IMPORTED_TARGETS)
191+
unset(_tbb_release_lib)
192+
unset(_tbb_debug_lib)
193+
unset(_tbb_root)

0 commit comments

Comments
 (0)