Skip to content

Commit 12e7bd5

Browse files
authored
Set minimum required versions & fix debug building (#1270)
* Set minimum required versions & fix debug building * Fix typo
1 parent 938a0a6 commit 12e7bd5

11 files changed

+47
-41
lines changed

0.build.sh

+8
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,14 @@ THEDIR=$(dirname $(readlink -e ${BASH_SOURCE[0]}))
44
# . ${THEDIR}/0.env.sh
55
cd ${THEDIR}
66

7+
# Assign $TMP env variable to a directory where the script locates.
8+
# The env variable is used by compiler as a path to temporary folder,
9+
# where it can store a temporary files generated during compilation and linkage phases.
10+
# By default the compiler uses /tmp folder, but it is limited by the size and
11+
# there might be not enough space to temporary keep all generated data.
12+
export TMP=${THEDIR}
13+
14+
715
export DPNP_DEBUG=1
816

917
python setup.py clean

dpnp/backend/CMakeLists.txt

+13-7
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# *****************************************************************************
2-
# Copyright (c) 2016-2022, Intel Corporation
2+
# Copyright (c) 2016-2023, Intel Corporation
33
# All rights reserved.
44
#
55
# Redistribution and use in source and binary forms, with or without
@@ -111,7 +111,7 @@ elseif(WIN32)
111111
# set(CMAKE_RANLIB "llvm-ranlib")
112112
# set(CMAKE_CXX_FLAGS "/EHsc")
113113

114-
string(APPEND COMMON_COMPILER_FLAGS
114+
string(APPEND COMMON_COMPILE_FLAGS
115115
"/EHsc "
116116
# "/Ox "
117117
# "/W3 "
@@ -133,23 +133,29 @@ string(CONCAT DPNP_WARNING_FLAGS
133133
"-Wextra "
134134
"-Wshadow "
135135
"-Wall "
136-
"-Wstring-prototypes "
136+
"-Wstrict-prototypes "
137137
"-Wformat "
138138
"-Wformat-security "
139139
)
140-
string(APPEND COMMON_COMPILER_FLAGS
140+
string(APPEND COMMON_COMPILE_FLAGS
141141
"${DPNP_WARNING_FLAGS}"
142142
)
143143

144144
# debug/release compile definitions
145145
if(DPNP_DEBUG_ENABLE)
146146
set(CMAKE_BUILD_TYPE "Debug")
147-
string(APPEND COMMON_COMPILER_FLAGS
147+
string(APPEND COMMON_COMPILE_FLAGS
148148
"-O0 "
149+
"-ggdb3 "
150+
)
151+
string(APPEND COMMON_LINK_FLAGS
152+
"-O0 "
153+
"-ggdb3 "
154+
"-fsycl-link-huge-device-code "
149155
)
150156
else()
151157
set(CMAKE_BUILD_TYPE "Release")
152-
string(APPEND COMMON_COMPILER_FLAGS
158+
string(APPEND COMMON_COMPILE_FLAGS
153159
"-O3 "
154160
)
155161
endif()
@@ -162,7 +168,7 @@ string(CONCAT DPNP_DEFS
162168
"-D_FORTIFY_SOURCE=2 "
163169
)
164170
if(NOT WIN32)
165-
string(APPEND COMMON_COMPILER_FLAGS
171+
string(APPEND COMMON_COMPILE_FLAGS
166172
"-fno-delete-null-pointer-checks "
167173
"-fstack-protector-strong "
168174
"-fno-strict-overflow "

dpnp/backend/include/dpnp_iface.hpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
//*****************************************************************************
2-
// Copyright (c) 2016-2020, Intel Corporation
2+
// Copyright (c) 2016-2023, Intel Corporation
33
// All rights reserved.
44
//
55
// Redistribution and use in source and binary forms, with or without
@@ -95,7 +95,7 @@ INP_DLLEXPORT void dpnp_queue_initialize_c(QueueOptions selector = QueueOptions:
9595
* @ingroup BACKEND_API
9696
* @brief SYCL queue device status.
9797
*
98-
* Return 1 if current @ref queue is related to cpu or host device. return 0 otherwise.
98+
* Return 1 if current @ref queue is related to cpu device. return 0 otherwise.
9999
*/
100100
INP_DLLEXPORT size_t dpnp_queue_is_cpu_c();
101101

dpnp/backend/kernels/dpnp_krnl_fft.cpp

+7-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
//*****************************************************************************
2-
// Copyright (c) 2016-2022, Intel Corporation
2+
// Copyright (c) 2016-2023, Intel Corporation
33
// All rights reserved.
44
//
55
// Redistribution and use in source and binary forms, with or without
@@ -182,7 +182,10 @@ static void dpnp_fft_fft_mathlib_cmplx_to_cmplx_c(DPCTLSyclQueueRef q_ref,
182182
size_t inverse,
183183
const size_t norm)
184184
{
185+
// avoid warning unused variable
185186
(void)result_shape;
187+
(void)input_size;
188+
(void)result_size;
186189

187190
if (!shape_size) {
188191
return;
@@ -253,6 +256,9 @@ static DPCTLSyclEventRef dpnp_fft_fft_mathlib_real_to_cmplx_c(DPCTLSyclQueueRef
253256
const size_t norm,
254257
const size_t real)
255258
{
259+
// avoid warning unused variable
260+
(void)input_size;
261+
256262
DPCTLSyclEventRef event_ref = nullptr;
257263
if (!shape_size) {
258264
return event_ref;

dpnp/backend/kernels/dpnp_krnl_indexing.cpp

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
//*****************************************************************************
2-
// Copyright (c) 2016-2020, Intel Corporation
2+
// Copyright (c) 2016-2023, Intel Corporation
33
// All rights reserved.
44
//
55
// Redistribution and use in source and binary forms, with or without
@@ -896,6 +896,7 @@ DPCTLSyclEventRef dpnp_take_c(DPCTLSyclQueueRef q_ref,
896896
const DPCTLEventVectorRef dep_event_vec_ref)
897897
{
898898
// avoid warning unused variable
899+
(void)array1_size;
899900
(void)dep_event_vec_ref;
900901

901902
DPCTLSyclEventRef event_ref = nullptr;

dpnp/backend/kernels/dpnp_krnl_random.cpp

+4-10
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
//*****************************************************************************
2-
// Copyright (c) 2016-2022, Intel Corporation
2+
// Copyright (c) 2016-2023, Intel Corporation
33
// All rights reserved.
44
//
55
// Redistribution and use in source and binary forms, with or without
@@ -37,6 +37,9 @@
3737
#include "queue_sycl.hpp"
3838
#include "dpnp_random_state.hpp"
3939

40+
static_assert(INTEL_MKL_VERSION >= __INTEL_MKL_2023_VERSION_REQUIRED,
41+
"MKL does not meet minimum version requirement");
42+
4043
namespace mkl_blas = oneapi::mkl::blas;
4144
namespace mkl_rng = oneapi::mkl::rng;
4245
namespace mkl_vm = oneapi::mkl::vm;
@@ -990,11 +993,7 @@ DPCTLSyclEventRef dpnp_rng_multinomial_c(DPCTLSyclQueueRef q_ref,
990993
DPNPC_ptr_adapter<_DataType> result_ptr(q_ref, result, size, true, true);
991994
_DataType* result1 = result_ptr.get_ptr();
992995

993-
#if (INTEL_MKL_VERSION < __INTEL_MKL_2023_SWITCHOVER)
994-
std::vector<double> p(p_data, p_data + p_size);
995-
#else
996996
auto p = sycl::span<double>{p_data, p_size};
997-
#endif
998997
mkl_rng::multinomial<_DataType> distribution(ntrial, p);
999998

1000999
// perform generation
@@ -1082,13 +1081,8 @@ DPCTLSyclEventRef dpnp_rng_multivariate_normal_c(DPCTLSyclQueueRef q_ref,
10821081

10831082
_DataType* result1 = static_cast<_DataType *>(result);
10841083

1085-
#if (INTEL_MKL_VERSION < __INTEL_MKL_2023_SWITCHOVER)
1086-
std::vector<double> mean(mean_data, mean_data + mean_size);
1087-
std::vector<double> cov(cov_data, cov_data + cov_size);
1088-
#else
10891084
auto mean = sycl::span<double>{mean_data, mean_size};
10901085
auto cov = sycl::span<double>{cov_data, cov_size};
1091-
#endif
10921086

10931087
// `result` is a array for random numbers
10941088
// `size` is a `result`'s len.

dpnp/backend/src/dpnp_utils.hpp

+5-5
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
//*****************************************************************************
2-
// Copyright (c) 2016-2022, Intel Corporation
2+
// Copyright (c) 2016-2023, Intel Corporation
33
// All rights reserved.
44
//
55
// Redistribution and use in source and binary forms, with or without
@@ -45,15 +45,15 @@
4545
* Intel(R) oneAPI DPC++ 2022.2.1 compiler has version 20221020L on Linux and
4646
* 20221101L on Windows.
4747
*/
48-
#ifndef __SYCL_COMPILER_2023_SWITCHOVER
49-
#define __SYCL_COMPILER_2023_SWITCHOVER 20221102L
48+
#ifndef __SYCL_COMPILER_VERSION_REQUIRED
49+
#define __SYCL_COMPILER_VERSION_REQUIRED 20221102L
5050
#endif
5151

5252
/**
5353
* Version of Intel MKL at which transition to OneMKL release 2023.0.0 occurs.
5454
*/
55-
#ifndef __INTEL_MKL_2023_SWITCHOVER
56-
#define __INTEL_MKL_2023_SWITCHOVER 20230000
55+
#ifndef __INTEL_MKL_2023_VERSION_REQUIRED
56+
#define __INTEL_MKL_2023_VERSION_REQUIRED 20230000
5757
#endif
5858

5959
/**

dpnp/backend/src/dpnpc_memory_adapter.hpp

+1-5
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
//*****************************************************************************
2-
// Copyright (c) 2016-2022, Intel Corporation
2+
// Copyright (c) 2016-2023, Intel Corporation
33
// All rights reserved.
44
//
55
// Redistribution and use in source and binary forms, with or without
@@ -85,10 +85,6 @@ class DPNPC_ptr_adapter final
8585
std::cerr << "\n\t size_in_bytes=" << size_in_bytes;
8686
std::cerr << "\n\t pointer type=" << (long)src_ptr_type;
8787
std::cerr << "\n\t queue inorder=" << queue.is_in_order();
88-
#if (__SYCL_COMPILER_VERSION < __SYCL_COMPILER_2023_SWITCHOVER)
89-
std::cerr << "\n\t queue is_host=" << queue.is_host();
90-
std::cerr << "\n\t queue device is_host=" << queue.get_device().is_host();
91-
#endif
9288
std::cerr << "\n\t queue device is_cpu=" << queue.get_device().is_cpu();
9389
std::cerr << "\n\t queue device is_gpu=" << queue.get_device().is_gpu();
9490
std::cerr << "\n\t queue device is_accelerator=" << queue.get_device().is_accelerator();

dpnp/backend/src/queue_sycl.cpp

+1-6
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
//*****************************************************************************
2-
// Copyright (c) 2016-2020, Intel Corporation
2+
// Copyright (c) 2016-2023, Intel Corporation
33
// All rights reserved.
44
//
55
// Redistribution and use in source and binary forms, with or without
@@ -215,11 +215,6 @@ bool backend_sycl::backend_sycl_is_cpu()
215215
if (qptr.get_device().is_cpu()) {
216216
return true;
217217
}
218-
#if (__SYCL_COMPILER_VERSION < __SYCL_COMPILER_2023_SWITCHOVER)
219-
else if (qptr.is_host() || qptr.get_device().is_host()) {
220-
return true;
221-
}
222-
#endif
223218

224219
return false;
225220
}

dpnp/backend/src/queue_sycl.hpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
//*****************************************************************************
2-
// Copyright (c) 2016-2020, Intel Corporation
2+
// Copyright (c) 2016-2023, Intel Corporation
33
// All rights reserved.
44
//
55
// Redistribution and use in source and binary forms, with or without
@@ -113,7 +113,7 @@ class backend_sycl
113113
static void backend_sycl_queue_init(QueueOptions selector = QueueOptions::CPU_SELECTOR);
114114

115115
/**
116-
* Return True if current @ref queue is related to cpu or host device
116+
* Return True if current @ref queue is related to cpu device
117117
*/
118118
static bool backend_sycl_is_cpu();
119119

dpnp/dpnp_algo/dpnp_algo.pyx

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# cython: language_level=3
22
# -*- coding: utf-8 -*-
33
# *****************************************************************************
4-
# Copyright (c) 2016-2022, Intel Corporation
4+
# Copyright (c) 2016-2023, Intel Corporation
55
# All rights reserved.
66
#
77
# Redistribution and use in source and binary forms, with or without
@@ -221,7 +221,7 @@ cpdef dpnp_queue_initialize():
221221

222222

223223
cpdef dpnp_queue_is_cpu():
224-
"""Return 1 if current queue is CPU or HOST. Return 0 otherwise.
224+
"""Return 1 if current queue is CPU. Return 0 otherwise.
225225
226226
"""
227227
return dpnp_queue_is_cpu_c()

0 commit comments

Comments
 (0)