diff --git a/0.build.sh b/0.build.sh index 380214e6802c..59df4dc85719 100755 --- a/0.build.sh +++ b/0.build.sh @@ -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 diff --git a/dpnp/backend/CMakeLists.txt b/dpnp/backend/CMakeLists.txt index 1714124cf85a..f66aa4be1ae5 100644 --- a/dpnp/backend/CMakeLists.txt +++ b/dpnp/backend/CMakeLists.txt @@ -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 @@ -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 " @@ -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() @@ -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 " diff --git a/dpnp/backend/include/dpnp_iface.hpp b/dpnp/backend/include/dpnp_iface.hpp index 42c05f0fd61d..756c70825985 100644 --- a/dpnp/backend/include/dpnp_iface.hpp +++ b/dpnp/backend/include/dpnp_iface.hpp @@ -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 @@ -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(); diff --git a/dpnp/backend/kernels/dpnp_krnl_fft.cpp b/dpnp/backend/kernels/dpnp_krnl_fft.cpp index 3d39f2f373c7..b3f9716d73f1 100644 --- a/dpnp/backend/kernels/dpnp_krnl_fft.cpp +++ b/dpnp/backend/kernels/dpnp_krnl_fft.cpp @@ -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 @@ -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; @@ -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; diff --git a/dpnp/backend/kernels/dpnp_krnl_indexing.cpp b/dpnp/backend/kernels/dpnp_krnl_indexing.cpp index 5cde013b69f8..0b80ac678d34 100644 --- a/dpnp/backend/kernels/dpnp_krnl_indexing.cpp +++ b/dpnp/backend/kernels/dpnp_krnl_indexing.cpp @@ -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 @@ -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; diff --git a/dpnp/backend/kernels/dpnp_krnl_random.cpp b/dpnp/backend/kernels/dpnp_krnl_random.cpp index 4411e207003d..568db448d966 100644 --- a/dpnp/backend/kernels/dpnp_krnl_random.cpp +++ b/dpnp/backend/kernels/dpnp_krnl_random.cpp @@ -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 @@ -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; @@ -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 p(p_data, p_data + p_size); -#else auto p = sycl::span{p_data, p_size}; -#endif mkl_rng::multinomial<_DataType> distribution(ntrial, p); // perform generation @@ -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 mean(mean_data, mean_data + mean_size); - std::vector cov(cov_data, cov_data + cov_size); -#else auto mean = sycl::span{mean_data, mean_size}; auto cov = sycl::span{cov_data, cov_size}; -#endif // `result` is a array for random numbers // `size` is a `result`'s len. diff --git a/dpnp/backend/src/dpnp_utils.hpp b/dpnp/backend/src/dpnp_utils.hpp index 33f4d750067f..985d5a61494e 100644 --- a/dpnp/backend/src/dpnp_utils.hpp +++ b/dpnp/backend/src/dpnp_utils.hpp @@ -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 @@ -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 /** diff --git a/dpnp/backend/src/dpnpc_memory_adapter.hpp b/dpnp/backend/src/dpnpc_memory_adapter.hpp index dab09622a698..6c81f5267787 100644 --- a/dpnp/backend/src/dpnpc_memory_adapter.hpp +++ b/dpnp/backend/src/dpnpc_memory_adapter.hpp @@ -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 @@ -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(); diff --git a/dpnp/backend/src/queue_sycl.cpp b/dpnp/backend/src/queue_sycl.cpp index 0810ed0aaba8..55f78230d64e 100644 --- a/dpnp/backend/src/queue_sycl.cpp +++ b/dpnp/backend/src/queue_sycl.cpp @@ -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 @@ -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; } diff --git a/dpnp/backend/src/queue_sycl.hpp b/dpnp/backend/src/queue_sycl.hpp index af03e1b6f121..63dc01c1dab1 100644 --- a/dpnp/backend/src/queue_sycl.hpp +++ b/dpnp/backend/src/queue_sycl.hpp @@ -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 @@ -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(); diff --git a/dpnp/dpnp_algo/dpnp_algo.pyx b/dpnp/dpnp_algo/dpnp_algo.pyx index 41f0c0c01026..a41be19b6062 100644 --- a/dpnp/dpnp_algo/dpnp_algo.pyx +++ b/dpnp/dpnp_algo/dpnp_algo.pyx @@ -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 @@ -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()