Skip to content

Commit b467748

Browse files
authored
PR87. first step (#107)
1 parent 2e7010e commit b467748

File tree

3 files changed

+32
-9
lines changed

3 files changed

+32
-9
lines changed

dpnp/backend/backend_pstl.hpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,8 @@
4343
#pragma clang diagnostic ignored "-Wunknown-pragmas"
4444
#pragma clang diagnostic ignored "-Wsign-compare"
4545
#pragma clang diagnostic ignored "-Wunused-variable"
46+
#pragma clang diagnostic ignored "-Wunused-parameter"
47+
#pragma clang diagnostic ignored "-Wshadow"
4648

4749
#include <oneapi/dpl/algorithm>
4850
#include <oneapi/dpl/execution>

setup.py

Lines changed: 20 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -116,8 +116,11 @@
116116
_project_linker = "clang++"
117117
_project_cmplr_flag_sycl_devel = ["-fsycl-device-code-split=per_kernel"]
118118
_project_cmplr_flag_sycl = ["-fsycl"]
119-
_project_cmplr_flag_compatibility = ["-Wl,--enable-new-dtags", "-fPIC"]
120-
_project_cmplr_flag_lib = []
119+
_project_cmplr_flag_compatibility = ["-Wl,--enable-new-dtags"]
120+
_project_cmplr_flag_lib = ["-shared"]
121+
_project_cmplr_flag_release_build = ["-O3", "-DNDEBUG", "-fPIC"]
122+
_project_cmplr_flag_debug_build = ["-g", "-O1", "-W", "-Wextra", "-Wshadow", "-Wall", "-Wstrict-prototypes", "-fPIC"]
123+
_project_cmplr_flag_default_build = []
121124
_project_cmplr_macro = []
122125
_project_force_build = False
123126
_project_sycl_queue_control_macro = [("DPNP_LOCAL_QUEUE", "1")]
@@ -178,7 +181,16 @@
178181
"""
179182
__dpnp_debug__ = os.environ.get('DPNP_DEBUG', None)
180183
if __dpnp_debug__ is not None:
184+
"""
185+
Debug configuration
186+
"""
181187
_project_cmplr_flag_sycl += _project_cmplr_flag_sycl_devel
188+
_project_cmplr_flag_default_build = _project_cmplr_flag_debug_build
189+
else:
190+
"""
191+
Release configuration
192+
"""
193+
_project_cmplr_flag_default_build = _project_cmplr_flag_release_build
182194

183195

184196
"""
@@ -266,12 +278,15 @@
266278
],
267279
"include_dirs": _mkl_include + _project_backend_dir + _dpctrl_include,
268280
"library_dirs": _mkl_libpath + _omp_libpath + _dpctrl_libpath,
269-
"runtime_library_dirs": [], # _project_rpath + _mkl_rpath + _cmplr_rpath + _omp_rpath + _dpctrl_libpath,
270-
"extra_preargs": _project_cmplr_flag_sycl,
271-
"extra_link_postargs": _project_cmplr_flag_compatibility + _project_cmplr_flag_lib,
281+
"runtime_library_dirs": _project_rpath + _mkl_rpath + _cmplr_rpath + _omp_rpath + _dpctrl_libpath,
282+
"extra_preargs": _project_cmplr_flag_sycl + _project_cmplr_flag_compatibility,
283+
"extra_link_postargs": [],
272284
"libraries": _mkl_libs + _dpctrl_lib,
273285
"macros": _project_cmplr_macro,
274286
"force_build": _project_force_build,
287+
"compiler": [_project_compiler],
288+
"linker": [_project_linker] + _project_cmplr_flag_lib,
289+
"default_flags": _project_cmplr_flag_default_build,
275290
"language": "c++"
276291
}
277292
]

utils/command_build_clib.py

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,9 @@
3535
- extra option 'extra_preargs'
3636
- extra option 'extra_link_postargs'
3737
- extra option 'force_build'
38+
- extra option 'compiler'
39+
- extra option 'linker'
40+
- extra option 'default_flags'
3841
- extra option 'language'
3942
- a check if source needs to be rebuilt based on time stamp
4043
- a check if librayr needs to be rebuilt based on time stamp
@@ -70,10 +73,6 @@ def build_libraries(self, libraries):
7073

7174
log.info("DPNP: building '%s' library", lib_name)
7275

73-
# set compiler and options
74-
# -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC
75-
# self.compiler.compiler_so = ["clang++", "-fPIC"]
76-
7776
macros = build_info.get('macros')
7877
include_dirs = build_info.get('include_dirs')
7978
libraries = build_info.get("libraries")
@@ -82,8 +81,15 @@ def build_libraries(self, libraries):
8281
extra_preargs = build_info.get("extra_preargs")
8382
extra_link_postargs = build_info.get("extra_link_postargs")
8483
force_build = build_info.get("force_build")
84+
compiler = build_info.get("compiler")
85+
linker = build_info.get("linker")
86+
default_flags = build_info.get("default_flags")
8587
language = build_info.get("language")
8688

89+
# set compiler and options
90+
self.compiler.compiler_so = compiler + default_flags
91+
self.compiler.linker_so = linker + default_flags
92+
8793
objects = []
8894
"""
8995
Build object files from sources

0 commit comments

Comments
 (0)