Skip to content

Set minimum required versions & fix debug building #1270

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

Merged
merged 2 commits into from
Jan 16, 2023
Merged
Show file tree
Hide file tree
Changes from all 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
8 changes: 8 additions & 0 deletions 0.build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,14 @@ THEDIR=$(dirname $(readlink -e ${BASH_SOURCE[0]}))
# . ${THEDIR}/0.env.sh
cd ${THEDIR}

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


export DPNP_DEBUG=1

python setup.py clean
Expand Down
20 changes: 13 additions & 7 deletions dpnp/backend/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# *****************************************************************************
# Copyright (c) 2016-2022, Intel Corporation
# Copyright (c) 2016-2023, Intel Corporation
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
Expand Down Expand Up @@ -111,7 +111,7 @@ elseif(WIN32)
# set(CMAKE_RANLIB "llvm-ranlib")
# set(CMAKE_CXX_FLAGS "/EHsc")

string(APPEND COMMON_COMPILER_FLAGS
string(APPEND COMMON_COMPILE_FLAGS
"/EHsc "
# "/Ox "
# "/W3 "
Expand All @@ -133,23 +133,29 @@ string(CONCAT DPNP_WARNING_FLAGS
"-Wextra "
"-Wshadow "
"-Wall "
"-Wstring-prototypes "
"-Wstrict-prototypes "
"-Wformat "
"-Wformat-security "
)
string(APPEND COMMON_COMPILER_FLAGS
string(APPEND COMMON_COMPILE_FLAGS
"${DPNP_WARNING_FLAGS}"
)

# debug/release compile definitions
if(DPNP_DEBUG_ENABLE)
set(CMAKE_BUILD_TYPE "Debug")
string(APPEND COMMON_COMPILER_FLAGS
string(APPEND COMMON_COMPILE_FLAGS
"-O0 "
"-ggdb3 "
)
string(APPEND COMMON_LINK_FLAGS
"-O0 "
"-ggdb3 "
"-fsycl-link-huge-device-code "
)
else()
set(CMAKE_BUILD_TYPE "Release")
string(APPEND COMMON_COMPILER_FLAGS
string(APPEND COMMON_COMPILE_FLAGS
"-O3 "
)
endif()
Expand All @@ -162,7 +168,7 @@ string(CONCAT DPNP_DEFS
"-D_FORTIFY_SOURCE=2 "
)
if(NOT WIN32)
string(APPEND COMMON_COMPILER_FLAGS
string(APPEND COMMON_COMPILE_FLAGS
"-fno-delete-null-pointer-checks "
"-fstack-protector-strong "
"-fno-strict-overflow "
Expand Down
4 changes: 2 additions & 2 deletions dpnp/backend/include/dpnp_iface.hpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//*****************************************************************************
// Copyright (c) 2016-2020, Intel Corporation
// Copyright (c) 2016-2023, Intel Corporation
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
Expand Down Expand Up @@ -95,7 +95,7 @@ INP_DLLEXPORT void dpnp_queue_initialize_c(QueueOptions selector = QueueOptions:
* @ingroup BACKEND_API
* @brief SYCL queue device status.
*
* Return 1 if current @ref queue is related to cpu or host device. return 0 otherwise.
* Return 1 if current @ref queue is related to cpu device. return 0 otherwise.
*/
INP_DLLEXPORT size_t dpnp_queue_is_cpu_c();

Expand Down
8 changes: 7 additions & 1 deletion dpnp/backend/kernels/dpnp_krnl_fft.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//*****************************************************************************
// Copyright (c) 2016-2022, Intel Corporation
// Copyright (c) 2016-2023, Intel Corporation
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
Expand Down Expand Up @@ -182,7 +182,10 @@ static void dpnp_fft_fft_mathlib_cmplx_to_cmplx_c(DPCTLSyclQueueRef q_ref,
size_t inverse,
const size_t norm)
{
// avoid warning unused variable
(void)result_shape;
(void)input_size;
(void)result_size;

if (!shape_size) {
return;
Expand Down Expand Up @@ -253,6 +256,9 @@ static DPCTLSyclEventRef dpnp_fft_fft_mathlib_real_to_cmplx_c(DPCTLSyclQueueRef
const size_t norm,
const size_t real)
{
// avoid warning unused variable
(void)input_size;

DPCTLSyclEventRef event_ref = nullptr;
if (!shape_size) {
return event_ref;
Expand Down
3 changes: 2 additions & 1 deletion dpnp/backend/kernels/dpnp_krnl_indexing.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//*****************************************************************************
// Copyright (c) 2016-2020, Intel Corporation
// Copyright (c) 2016-2023, Intel Corporation
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
Expand Down Expand Up @@ -896,6 +896,7 @@ DPCTLSyclEventRef dpnp_take_c(DPCTLSyclQueueRef q_ref,
const DPCTLEventVectorRef dep_event_vec_ref)
{
// avoid warning unused variable
(void)array1_size;
(void)dep_event_vec_ref;

DPCTLSyclEventRef event_ref = nullptr;
Expand Down
14 changes: 4 additions & 10 deletions dpnp/backend/kernels/dpnp_krnl_random.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//*****************************************************************************
// Copyright (c) 2016-2022, Intel Corporation
// Copyright (c) 2016-2023, Intel Corporation
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
Expand Down Expand Up @@ -37,6 +37,9 @@
#include "queue_sycl.hpp"
#include "dpnp_random_state.hpp"

static_assert(INTEL_MKL_VERSION >= __INTEL_MKL_2023_VERSION_REQUIRED,
"MKL does not meet minimum version requirement");

namespace mkl_blas = oneapi::mkl::blas;
namespace mkl_rng = oneapi::mkl::rng;
namespace mkl_vm = oneapi::mkl::vm;
Expand Down Expand Up @@ -990,11 +993,7 @@ DPCTLSyclEventRef dpnp_rng_multinomial_c(DPCTLSyclQueueRef q_ref,
DPNPC_ptr_adapter<_DataType> result_ptr(q_ref, result, size, true, true);
_DataType* result1 = result_ptr.get_ptr();

#if (INTEL_MKL_VERSION < __INTEL_MKL_2023_SWITCHOVER)
std::vector<double> p(p_data, p_data + p_size);
#else
auto p = sycl::span<double>{p_data, p_size};
#endif
mkl_rng::multinomial<_DataType> distribution(ntrial, p);

// perform generation
Expand Down Expand Up @@ -1082,13 +1081,8 @@ DPCTLSyclEventRef dpnp_rng_multivariate_normal_c(DPCTLSyclQueueRef q_ref,

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

#if (INTEL_MKL_VERSION < __INTEL_MKL_2023_SWITCHOVER)
std::vector<double> mean(mean_data, mean_data + mean_size);
std::vector<double> cov(cov_data, cov_data + cov_size);
#else
auto mean = sycl::span<double>{mean_data, mean_size};
auto cov = sycl::span<double>{cov_data, cov_size};
#endif

// `result` is a array for random numbers
// `size` is a `result`'s len.
Expand Down
10 changes: 5 additions & 5 deletions dpnp/backend/src/dpnp_utils.hpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//*****************************************************************************
// Copyright (c) 2016-2022, Intel Corporation
// Copyright (c) 2016-2023, Intel Corporation
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
Expand Down Expand Up @@ -45,15 +45,15 @@
* Intel(R) oneAPI DPC++ 2022.2.1 compiler has version 20221020L on Linux and
* 20221101L on Windows.
*/
#ifndef __SYCL_COMPILER_2023_SWITCHOVER
#define __SYCL_COMPILER_2023_SWITCHOVER 20221102L
#ifndef __SYCL_COMPILER_VERSION_REQUIRED
#define __SYCL_COMPILER_VERSION_REQUIRED 20221102L
#endif

/**
* Version of Intel MKL at which transition to OneMKL release 2023.0.0 occurs.
*/
#ifndef __INTEL_MKL_2023_SWITCHOVER
#define __INTEL_MKL_2023_SWITCHOVER 20230000
#ifndef __INTEL_MKL_2023_VERSION_REQUIRED
#define __INTEL_MKL_2023_VERSION_REQUIRED 20230000
#endif

/**
Expand Down
6 changes: 1 addition & 5 deletions dpnp/backend/src/dpnpc_memory_adapter.hpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//*****************************************************************************
// Copyright (c) 2016-2022, Intel Corporation
// Copyright (c) 2016-2023, Intel Corporation
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
Expand Down Expand Up @@ -85,10 +85,6 @@ class DPNPC_ptr_adapter final
std::cerr << "\n\t size_in_bytes=" << size_in_bytes;
std::cerr << "\n\t pointer type=" << (long)src_ptr_type;
std::cerr << "\n\t queue inorder=" << queue.is_in_order();
#if (__SYCL_COMPILER_VERSION < __SYCL_COMPILER_2023_SWITCHOVER)
std::cerr << "\n\t queue is_host=" << queue.is_host();
std::cerr << "\n\t queue device is_host=" << queue.get_device().is_host();
#endif
std::cerr << "\n\t queue device is_cpu=" << queue.get_device().is_cpu();
std::cerr << "\n\t queue device is_gpu=" << queue.get_device().is_gpu();
std::cerr << "\n\t queue device is_accelerator=" << queue.get_device().is_accelerator();
Expand Down
7 changes: 1 addition & 6 deletions dpnp/backend/src/queue_sycl.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//*****************************************************************************
// Copyright (c) 2016-2020, Intel Corporation
// Copyright (c) 2016-2023, Intel Corporation
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
Expand Down Expand Up @@ -215,11 +215,6 @@ bool backend_sycl::backend_sycl_is_cpu()
if (qptr.get_device().is_cpu()) {
return true;
}
#if (__SYCL_COMPILER_VERSION < __SYCL_COMPILER_2023_SWITCHOVER)
else if (qptr.is_host() || qptr.get_device().is_host()) {
return true;
}
#endif

return false;
}
Expand Down
4 changes: 2 additions & 2 deletions dpnp/backend/src/queue_sycl.hpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//*****************************************************************************
// Copyright (c) 2016-2020, Intel Corporation
// Copyright (c) 2016-2023, Intel Corporation
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
Expand Down Expand Up @@ -113,7 +113,7 @@ class backend_sycl
static void backend_sycl_queue_init(QueueOptions selector = QueueOptions::CPU_SELECTOR);

/**
* Return True if current @ref queue is related to cpu or host device
* Return True if current @ref queue is related to cpu device
*/
static bool backend_sycl_is_cpu();

Expand Down
4 changes: 2 additions & 2 deletions dpnp/dpnp_algo/dpnp_algo.pyx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# cython: language_level=3
# -*- coding: utf-8 -*-
# *****************************************************************************
# Copyright (c) 2016-2022, Intel Corporation
# Copyright (c) 2016-2023, Intel Corporation
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
Expand Down Expand Up @@ -221,7 +221,7 @@ cpdef dpnp_queue_initialize():


cpdef dpnp_queue_is_cpu():
"""Return 1 if current queue is CPU or HOST. Return 0 otherwise.
"""Return 1 if current queue is CPU. Return 0 otherwise.

"""
return dpnp_queue_is_cpu_c()
Expand Down