From de2fd3545c58e5606efd3a9ff2935a137edf83a5 Mon Sep 17 00:00:00 2001 From: Oleksandr Pavlyk Date: Fri, 13 Dec 2024 08:18:33 -0600 Subject: [PATCH 1/9] Add conda list of build environment --- .github/workflows/conda-package.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/conda-package.yml b/.github/workflows/conda-package.yml index 87fceb1830..f651095ea2 100644 --- a/.github/workflows/conda-package.yml +++ b/.github/workflows/conda-package.yml @@ -569,6 +569,7 @@ jobs: ${{ env.DPCPP_CMPLR }} "${DPCTL_DEPENDS}" \ "sysroot_linux-64>=2.28" echo "Compiler installed" + conda list -n ${{ env.BUILD_ENV_NAME }} - name: Install dpctl shell: bash -l {0} run: | From aee0a79abc1e29ac60ce20ac76a2f380cd90d4cc Mon Sep 17 00:00:00 2001 From: Oleksandr Pavlyk Date: Fri, 13 Dec 2024 09:59:03 -0600 Subject: [PATCH 2/9] Set CC and CXX variable when building Cython examples --- .github/workflows/conda-package.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/conda-package.yml b/.github/workflows/conda-package.yml index f651095ea2..408e58f6e7 100644 --- a/.github/workflows/conda-package.yml +++ b/.github/workflows/conda-package.yml @@ -615,7 +615,7 @@ jobs: do pushd $d conda activate --stack ${{ env.BUILD_ENV_NAME }} - python setup.py build_ext --inplace || exit 1 + CC=icx CXX=icpx python setup.py build_ext --inplace || exit 1 conda deactivate python -m pytest tests || exit 1 popd From 65d74fde880dad1ee428ccfc861d243bc6984ac4 Mon Sep 17 00:00:00 2001 From: Oleksandr Pavlyk Date: Fri, 13 Dec 2024 16:55:28 -0800 Subject: [PATCH 3/9] Use scikit-build to build cython/usm_memory --- examples/cython/usm_memory/CMakeLists.txt | 56 +++++++++++++++++ ...blackscholes.pyx => _blackscholes_usm.pyx} | 0 examples/cython/usm_memory/setup.py | 63 +------------------ 3 files changed, 58 insertions(+), 61 deletions(-) create mode 100644 examples/cython/usm_memory/CMakeLists.txt rename examples/cython/usm_memory/blackscholes/{blackscholes.pyx => _blackscholes_usm.pyx} (100%) diff --git a/examples/cython/usm_memory/CMakeLists.txt b/examples/cython/usm_memory/CMakeLists.txt new file mode 100644 index 0000000000..0a422d26d1 --- /dev/null +++ b/examples/cython/usm_memory/CMakeLists.txt @@ -0,0 +1,56 @@ +cmake_minimum_required(VERSION 3.22...3.27 FATAL_ERROR) + +project(example_cython_blackscholes_usm VERSION 0.1 LANGUAGES CXX + DESCRIPTION "Example of Cython extension calling SYCL routines") +set(DPCTL_CMAKE_MODULES_PATH "${CMAKE_SOURCE_DIR}/../../../cmake") +set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${DPCTL_CMAKE_MODULES_PATH}) + +find_package(IntelSYCL REQUIRED PATHS ${DPCTL_CMAKE_MODULES_PATH} NO_DEFAULT_PATH) + + +set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}") +set(CMAKE_CXX_STANDARD 17) +set(CMAKE_CXX_STANDARD_REQUIRED True) + +# Define CMAKE_INSTALL_xxx: LIBDIR, INCLUDEDIR +include(GNUInstallDirs) + +find_package(Python REQUIRED COMPONENTS Development.Module NumPy) +find_package(Dpctl REQUIRED) + +# -t is to only Cythonize sources with timestamps newer than existing CXX files (if present) +# -w is to set working directory (and correctly set __pyx_f[] array of filenames) +set(CYTHON_FLAGS "-t -w \"${CMAKE_SOURCE_DIR}\"") +find_package(Cython REQUIRED) + +find_package(TBB REQUIRED) + +set(MKL_ARCH "intel64") +set(MKL_LINK "dynamic") +set(MKL_THREADING "tbb_thread") +set(MKL_INTERFACE "ilp64") +find_package(MKL REQUIRED) + +set(py_module_name _blackscholes_usm) + +set(_cy_source blackscholes/_blackscholes_usm.pyx) +add_cython_target(${py_module_name} ${_cy_source} CXX OUTPUT_VAR _generated_cy_src) +Python_add_library(${py_module_name} MODULE WITH_SOABI ${_generated_cy_src}) +add_sycl_to_target(TARGET ${py_module_name} SOURCES ${_generated_cy_src}) +target_compile_definitions(${py_module_name} PRIVATE -DMKL_ILP64) +target_include_directories(${py_module_name} PUBLIC src ${Dpctl_INCLUDE_DIRS}) +target_link_libraries(${py_module_name} PRIVATE MKL::MKL_SYCL Python::NumPy) + +install(TARGETS ${py_module_name} DESTINATION blackscholes) + +foreach(_src_fn ${_sources}) + get_source_file_property(_compile_options ${_src_fn} COMPILE_OPTIONS) + set(_combined_options ${_compile_options} "-O3") + set_source_files_properties(${_src_fn} + PROPERTIES + COMPILE_OPTIONS "${_combined_options}" + ) +endforeach() +target_link_options(${py_module_name} PRIVATE -fsycl-device-code-split=per_kernel) + +set(ignoreMe "${SKBUILD}") diff --git a/examples/cython/usm_memory/blackscholes/blackscholes.pyx b/examples/cython/usm_memory/blackscholes/_blackscholes_usm.pyx similarity index 100% rename from examples/cython/usm_memory/blackscholes/blackscholes.pyx rename to examples/cython/usm_memory/blackscholes/_blackscholes_usm.pyx diff --git a/examples/cython/usm_memory/setup.py b/examples/cython/usm_memory/setup.py index ae3c7b85c5..f09d146c73 100644 --- a/examples/cython/usm_memory/setup.py +++ b/examples/cython/usm_memory/setup.py @@ -14,65 +14,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -import os.path -import sysconfig - -import numpy as np -from setuptools import Extension, setup -from setuptools.command.build_ext import build_ext - -import dpctl - - -class custom_build_ext(build_ext): - def build_extensions(self): - self.compiler.set_executable("compiler_so", "icpx -fsycl -fPIC") - self.compiler.set_executable("compiler_cxx", "icpx -fsycl -fPIC") - self.compiler.set_executable( - "linker_so", - "icpx -fsycl -shared -fpic -fsycl-device-code-split=per_kernel", - ) - build_ext.build_extensions(self) - - -ext_modules = [ - Extension( - name="blackscholes._blackscholes_usm", - sources=[ - "blackscholes/blackscholes.pyx", - ], - depends=[ - "src/sycl_black_scholes.hpp", - ], - include_dirs=[ - "./src", - np.get_include(), - dpctl.get_include(), - os.path.join(sysconfig.get_paths()["include"], ".."), - ], - library_dirs=[ - os.path.join(sysconfig.get_paths()["stdlib"], ".."), - ], - libraries=["sycl"] - + [ - "mkl_sycl", - "mkl_intel_ilp64", - "mkl_tbb_thread", - "mkl_core", - "tbb", - ], - runtime_library_dirs=[], - extra_compile_args=[ - "-Wall", - "-Wextra", - "-fsycl", - "-fno-fast-math", - ], - extra_link_args=["-fPIC"], - language="c++", - ) -] - +from skbuild import setup setup( name="blackscholes_usm", @@ -86,6 +28,5 @@ def build_extensions(self): license="Apache 2.0", author="Intel Corporation", url="https://github.com/IntelPython/dpctl", - ext_modules=ext_modules, - cmdclass={"build_ext": custom_build_ext}, + packages=["blackscholes"], ) From 2a59532d098aa1cb0e90ba03b49db070f06b7b63 Mon Sep 17 00:00:00 2001 From: Oleksandr Pavlyk Date: Fri, 13 Dec 2024 17:20:03 -0800 Subject: [PATCH 4/9] Use skbuild to build cython/sycl_buffer example --- examples/cython/sycl_buffer/CMakeLists.txt | 46 ++++++++++++++++++++++ examples/cython/sycl_buffer/setup.py | 44 +-------------------- 2 files changed, 48 insertions(+), 42 deletions(-) create mode 100644 examples/cython/sycl_buffer/CMakeLists.txt diff --git a/examples/cython/sycl_buffer/CMakeLists.txt b/examples/cython/sycl_buffer/CMakeLists.txt new file mode 100644 index 0000000000..5d7c1c964d --- /dev/null +++ b/examples/cython/sycl_buffer/CMakeLists.txt @@ -0,0 +1,46 @@ +cmake_minimum_required(VERSION 3.22...3.27 FATAL_ERROR) + +project(example_cython_syclbuffer VERSION 0.1 LANGUAGES CXX + DESCRIPTION "Example of Cython extension to work on host allocated NumPy array using SYCL buffers and SYCL functions.") +set(DPCTL_CMAKE_MODULES_PATH "${CMAKE_SOURCE_DIR}/../../../cmake") +set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${DPCTL_CMAKE_MODULES_PATH}) + +find_package(IntelSYCL REQUIRED PATHS ${DPCTL_CMAKE_MODULES_PATH} NO_DEFAULT_PATH) + + +set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}") +set(CMAKE_CXX_STANDARD 17) +set(CMAKE_CXX_STANDARD_REQUIRED True) + +# Define CMAKE_INSTALL_xxx: LIBDIR, INCLUDEDIR +include(GNUInstallDirs) + +find_package(Python REQUIRED COMPONENTS Development.Module NumPy) +find_package(Dpctl REQUIRED) + +# -w is to set working directory (and correctly set __pyx_f[] array of filenames) +set(CYTHON_FLAGS "-w \"${CMAKE_SOURCE_DIR}\" --module-name _syclbuffer") +find_package(Cython REQUIRED) + +set(py_module_name _syclbuffer) + +set(_cy_source syclbuffer/_buffer_example.pyx) +add_cython_target(${py_module_name} ${_cy_source} CXX OUTPUT_VAR _generated_cy_src) +Python_add_library(${py_module_name} MODULE WITH_SOABI ${_generated_cy_src}) +add_sycl_to_target(TARGET ${py_module_name} SOURCES ${_generated_cy_src}) +target_include_directories(${py_module_name} PUBLIC src ${Dpctl_INCLUDE_DIRS}) +target_link_libraries(${py_module_name} PRIVATE Python::NumPy) + +install(TARGETS ${py_module_name} DESTINATION syclbuffer) + +foreach(_src_fn ${_sources}) + get_source_file_property(_compile_options ${_src_fn} COMPILE_OPTIONS) + set(_combined_options ${_compile_options} "-O3") + set_source_files_properties(${_src_fn} + PROPERTIES + COMPILE_OPTIONS "${_combined_options}" + ) +endforeach() +target_link_options(${py_module_name} PRIVATE -fsycl-device-code-split=per_kernel) + +set(ignoreMe "${SKBUILD}") diff --git a/examples/cython/sycl_buffer/setup.py b/examples/cython/sycl_buffer/setup.py index e7d64bab4e..00e556063f 100644 --- a/examples/cython/sycl_buffer/setup.py +++ b/examples/cython/sycl_buffer/setup.py @@ -14,46 +14,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -from setuptools import Extension, setup -from setuptools.command.build_ext import build_ext - -import dpctl - - -class custom_build_ext(build_ext): - def build_extensions(self): - self.compiler.set_executable("compiler_so", "icpx -fsycl -fPIC") - self.compiler.set_executable("compiler_cxx", "icpx -fsycl -fPIC") - self.compiler.set_executable( - "linker_so", - "icpx -fsycl -shared -fpic -fsycl-device-code-split=per_kernel", - ) - build_ext.build_extensions(self) - - -ext_modules = [ - Extension( - name="syclbuffer._syclbuffer", - sources=[ - "syclbuffer/_buffer_example.pyx", - ], - depends=[ - "src/use_sycl_buffer.hpp", - ], - include_dirs=[ - ".", - "./src", - dpctl.get_include(), - ], - extra_compile_args=[ - "-Wall", - "-Wextra", - "-fsycl", - ], - extra_link_args=["-fPIC"], - language="c++", - ) -] +from skbuild import setup setup( name="syclbuffer", @@ -68,6 +29,5 @@ def build_extensions(self): license="Apache 2.0", author="Intel Corporation", url="https://github.com/IntelPython/dpctl", - ext_modules=ext_modules, - cmdclass={"build_ext": custom_build_ext}, + packages=["syclbuffer"], ) From 3f60607b0ffab4ab3128fb1ff0185e06c303b940 Mon Sep 17 00:00:00 2001 From: Oleksandr Pavlyk Date: Sat, 14 Dec 2024 09:10:09 -0800 Subject: [PATCH 5/9] Change use_dpctl_sycl to use skbuild --- examples/cython/use_dpctl_sycl/CMakeLists.txt | 46 +++++++++++++++++++ .../{use_dpctl_sycl => include}/utils.hpp | 0 examples/cython/use_dpctl_sycl/setup.py | 46 ++++++------------- 3 files changed, 59 insertions(+), 33 deletions(-) create mode 100644 examples/cython/use_dpctl_sycl/CMakeLists.txt rename examples/cython/use_dpctl_sycl/{use_dpctl_sycl => include}/utils.hpp (100%) diff --git a/examples/cython/use_dpctl_sycl/CMakeLists.txt b/examples/cython/use_dpctl_sycl/CMakeLists.txt new file mode 100644 index 0000000000..9445ae08f3 --- /dev/null +++ b/examples/cython/use_dpctl_sycl/CMakeLists.txt @@ -0,0 +1,46 @@ +cmake_minimum_required(VERSION 3.22...3.27 FATAL_ERROR) + +project(example_cython_use_dpctl_sycl VERSION 0.1 LANGUAGES CXX + DESCRIPTION "Example of Cython extension to use Cython API to SYCL objects.") +set(DPCTL_CMAKE_MODULES_PATH "${CMAKE_SOURCE_DIR}/../../../cmake") +set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${DPCTL_CMAKE_MODULES_PATH}) + +find_package(IntelSYCL REQUIRED PATHS ${DPCTL_CMAKE_MODULES_PATH} NO_DEFAULT_PATH) + + +set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}") +set(CMAKE_CXX_STANDARD 17) +set(CMAKE_CXX_STANDARD_REQUIRED True) + +# Define CMAKE_INSTALL_xxx: LIBDIR, INCLUDEDIR +include(GNUInstallDirs) + +find_package(Python REQUIRED COMPONENTS Development.Module NumPy) +find_package(Dpctl REQUIRED) + +# -w is to set working directory (and correctly set __pyx_f[] array of filenames) +set(CYTHON_FLAGS "-t -w \"${CMAKE_SOURCE_DIR}\"") +find_package(Cython REQUIRED) + +set(py_module_name _cython_api) + +set(_cy_source use_dpctl_sycl/_cython_api.pyx) +add_cython_target(${py_module_name} ${_cy_source} CXX OUTPUT_VAR _generated_cy_src) +Python_add_library(${py_module_name} MODULE WITH_SOABI ${_generated_cy_src}) +add_sycl_to_target(TARGET ${py_module_name} SOURCES ${_generated_cy_src}) +target_include_directories(${py_module_name} PUBLIC include ${Dpctl_INCLUDE_DIRS}) +target_link_libraries(${py_module_name} PRIVATE Python::NumPy) + +install(TARGETS ${py_module_name} DESTINATION use_dpctl_sycl) + +foreach(_src_fn ${_sources}) + get_source_file_property(_compile_options ${_src_fn} COMPILE_OPTIONS) + set(_combined_options ${_compile_options} "-O3") + set_source_files_properties(${_src_fn} + PROPERTIES + COMPILE_OPTIONS "${_combined_options}" + ) +endforeach() +target_link_options(${py_module_name} PRIVATE -fsycl-device-code-split=per_kernel) + +set(ignoreMe "${SKBUILD}") diff --git a/examples/cython/use_dpctl_sycl/use_dpctl_sycl/utils.hpp b/examples/cython/use_dpctl_sycl/include/utils.hpp similarity index 100% rename from examples/cython/use_dpctl_sycl/use_dpctl_sycl/utils.hpp rename to examples/cython/use_dpctl_sycl/include/utils.hpp diff --git a/examples/cython/use_dpctl_sycl/setup.py b/examples/cython/use_dpctl_sycl/setup.py index 863590d856..4a3bbf79d4 100644 --- a/examples/cython/use_dpctl_sycl/setup.py +++ b/examples/cython/use_dpctl_sycl/setup.py @@ -14,40 +14,20 @@ # See the License for the specific language governing permissions and # limitations under the License. -import Cython.Build -import setuptools -from setuptools.command.build_ext import build_ext as build_ext_base +from skbuild import setup -import dpctl - - -class custom_build_ext(build_ext_base): - def build_extensions(self): - self.compiler.set_executable("compiler_so", "icx -fsycl -fPIC") - self.compiler.set_executable("compiler_cxx", "icpx -fsycl -fPIC") - self.compiler.set_executable( - "linker_so", - "icpx -fsycl -shared -fpic -fsycl-device-code-split=per_kernel", - ) - super().build_extensions() - - -ext = setuptools.Extension( - "use_dpctl_sycl._cython_api", - ["./use_dpctl_sycl/_cython_api.pyx"], - include_dirs=[dpctl.get_include(), "./use_dpctl_sycl"], - language="c++", -) - -(cythonized_ext,) = Cython.Build.cythonize( - [ - ext, - ] -) - -setuptools.setup( +setup( name="use_dpctl_sycl", version="0.0.0", - ext_modules=[cythonized_ext], - cmdclass={"build_ext": custom_build_ext}, + description="An example of Cython extension calling SYCL Cython API", + long_description=""" + Example of using SYCL to work on host allocated NumPy array using + SYCL buffers and SYCL functions. + + See README.md for more details. + """, + license="Apache 2.0", + author="Intel Corporation", + url="https://github.com/IntelPython/dpctl", + packages=["use_dpctl_sycl"], ) From 05f2b22c7eef0d98e11406b5958937944e816c74 Mon Sep 17 00:00:00 2001 From: Oleksandr Pavlyk Date: Sat, 14 Dec 2024 09:12:45 -0800 Subject: [PATCH 6/9] Renamed syclbuffer/_buffer_example.pyx to syclbuffer/_syclbuffer.pyx to align with the expected name of native extension --- .flake8 | 2 +- examples/cython/sycl_buffer/CMakeLists.txt | 4 ++-- .../syclbuffer/{_buffer_example.pyx => _syclbuffer.pyx} | 0 3 files changed, 3 insertions(+), 3 deletions(-) rename examples/cython/sycl_buffer/syclbuffer/{_buffer_example.pyx => _syclbuffer.pyx} (100%) diff --git a/.flake8 b/.flake8 index 485dd3020b..b4f0914dfb 100644 --- a/.flake8 +++ b/.flake8 @@ -31,6 +31,6 @@ per-file-ignores = dpctl/utils/_compute_follows_data.pyx: E999, E225, E227 dpctl/utils/_onetrace_context.py: E501, W505 dpctl/tensor/_array_api.py: E501, W505 - examples/cython/sycl_buffer/syclbuffer/_buffer_example.pyx: E999, E225, E402 + examples/cython/sycl_buffer/syclbuffer/_syclbuffer.pyx: E999, E225, E402 examples/cython/usm_memory/blackscholes/blackscholes.pyx: E999, E225, E226, E402 examples/cython/use_dpctl_sycl/use_dpctl_sycl/_cython_api.pyx: E999, E225, E226, E402 diff --git a/examples/cython/sycl_buffer/CMakeLists.txt b/examples/cython/sycl_buffer/CMakeLists.txt index 5d7c1c964d..a30fbb2f35 100644 --- a/examples/cython/sycl_buffer/CMakeLists.txt +++ b/examples/cython/sycl_buffer/CMakeLists.txt @@ -19,12 +19,12 @@ find_package(Python REQUIRED COMPONENTS Development.Module NumPy) find_package(Dpctl REQUIRED) # -w is to set working directory (and correctly set __pyx_f[] array of filenames) -set(CYTHON_FLAGS "-w \"${CMAKE_SOURCE_DIR}\" --module-name _syclbuffer") +set(CYTHON_FLAGS "-t -w \"${CMAKE_SOURCE_DIR}\"") find_package(Cython REQUIRED) set(py_module_name _syclbuffer) -set(_cy_source syclbuffer/_buffer_example.pyx) +set(_cy_source syclbuffer/_syclbuffer.pyx) add_cython_target(${py_module_name} ${_cy_source} CXX OUTPUT_VAR _generated_cy_src) Python_add_library(${py_module_name} MODULE WITH_SOABI ${_generated_cy_src}) add_sycl_to_target(TARGET ${py_module_name} SOURCES ${_generated_cy_src}) diff --git a/examples/cython/sycl_buffer/syclbuffer/_buffer_example.pyx b/examples/cython/sycl_buffer/syclbuffer/_syclbuffer.pyx similarity index 100% rename from examples/cython/sycl_buffer/syclbuffer/_buffer_example.pyx rename to examples/cython/sycl_buffer/syclbuffer/_syclbuffer.pyx From 0885ba65ac4c81673fa1141c30dc3f12f5f15b37 Mon Sep 17 00:00:00 2001 From: Oleksandr Pavlyk Date: Sat, 14 Dec 2024 09:18:33 -0800 Subject: [PATCH 7/9] Cahnge required compiler to 2025.0 for examples --- .github/workflows/conda-package.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/conda-package.yml b/.github/workflows/conda-package.yml index 408e58f6e7..c00b156d47 100644 --- a/.github/workflows/conda-package.yml +++ b/.github/workflows/conda-package.yml @@ -549,7 +549,7 @@ jobs: - name: Install example requirements shell: bash -ex -l {0} env: - DPCPP_CMPLR: "dpcpp_linux-64>=2024.2" + DPCPP_CMPLR: "dpcpp_linux-64>=2025.0" run: | CHANNELS="${{ env.CHANNELS }}" . $CONDA/etc/profile.d/conda.sh @@ -615,7 +615,7 @@ jobs: do pushd $d conda activate --stack ${{ env.BUILD_ENV_NAME }} - CC=icx CXX=icpx python setup.py build_ext --inplace || exit 1 + CC=icx CXX=icpx python setup.py develop -G Ninja || exit 1 conda deactivate python -m pytest tests || exit 1 popd From 7c903b6a939fc2b5c01df87bdb3a4cab05c7b2aa Mon Sep 17 00:00:00 2001 From: Oleksandr Pavlyk Date: Sat, 14 Dec 2024 09:23:23 -0800 Subject: [PATCH 8/9] Simplified building of pybind11 example with MKL --- .github/workflows/conda-package.yml | 8 +---- examples/pybind11/onemkl_gemv/CMakeLists.txt | 35 +++++++------------- 2 files changed, 13 insertions(+), 30 deletions(-) diff --git a/.github/workflows/conda-package.yml b/.github/workflows/conda-package.yml index c00b156d47..55e90d8062 100644 --- a/.github/workflows/conda-package.yml +++ b/.github/workflows/conda-package.yml @@ -587,14 +587,8 @@ jobs: for d in $(find . -maxdepth 1 -type d -not -path ".") do pushd $d - export MKLROOT=${CONDA_PREFIX} - export TBBROOT=${CONDA_PREFIX} conda activate --stack build_env - CC=icx CXX=icpx python setup.py build_ext --inplace -G Ninja -- \ - -DTBB_LIBRARY_DIR=${TBBROOT}/lib \ - -DMKL_LIBRARY_DIR=${MKLROOT}/lib \ - -DMKL_INCLUDE_DIR=${MKLROOT}/include \ - -DTBB_INCLUDE_DIR=${TBBROOT}/include || exit 1 + CC=icx CXX=icpx python setup.py build_ext --inplace -G Ninja || exit 1 conda deactivate if [ -e tests ] then diff --git a/examples/pybind11/onemkl_gemv/CMakeLists.txt b/examples/pybind11/onemkl_gemv/CMakeLists.txt index 46709840fb..08dda0b288 100644 --- a/examples/pybind11/onemkl_gemv/CMakeLists.txt +++ b/examples/pybind11/onemkl_gemv/CMakeLists.txt @@ -27,28 +27,21 @@ FetchContent_MakeAvailable(pybind11) find_package(Python REQUIRED COMPONENTS Development.Module NumPy) find_package(Dpctl REQUIRED) -find_library(mkl_core NAMES mkl_core PATHS ${MKL_LIBRARY_DIR} REQUIRED) -find_library(mkl_sycl NAMES mkl_sycl PATHS ${MKL_LIBRARY_DIR} REQUIRED) -find_library(mkl_intel_ilp64 NAMES mkl_intel_ilp64 PATHS ${MKL_LIBRARY_DIR} REQUIRED) -find_library(mkl_tbb_thread NAMES mkl_tbb_thread PATHS ${MKL_LIBRARY_DIR} REQUIRED) -find_library(tbb NAMES tbb PATHS ${TBB_LIBRARY_DIR} REQUIRED) -find_library(OpenCL NAMES OpenCL REQUIRED) +find_package(TBB REQUIRED) + +set(MKL_ARCH "intel64") +set(MKL_LINK "dynamic") +set(MKL_THREADING "tbb_thread") +set(MKL_INTERFACE "ilp64") +find_package(MKL REQUIRED) set(py_module_name _onemkl) set(_sources sycl_gemm/_onemkl.cpp) -pybind11_add_module(${py_module_name} - MODULE - ${_sources} -) +pybind11_add_module(${py_module_name} MODULE ${_sources}) add_sycl_to_target(TARGET ${py_module_name} SOURCES ${_sources}) -target_compile_definitions(${py_module_name} PRIVATE -DMKL_ILP64) -target_include_directories(${py_module_name} - PUBLIC ${MKL_INCLUDE_DIR} sycl_gemm -) -target_link_libraries(${py_module_name} - PRIVATE ${mkl_sycl} ${mkl_intel_ilp64} ${mkl_tbb_thread} ${mkl_core} ${tbb} -) +target_include_directories(${py_module_name} PUBLIC sycl_gemm) +target_link_libraries(${py_module_name} PRIVATE MKL::MKL_SYCL) install(TARGETS ${py_module_name} DESTINATION sycl_gemm) target_include_directories(${py_module_name} PUBLIC ${Dpctl_INCLUDE_DIRS}) @@ -70,11 +63,7 @@ add_executable(standalone_cpp target_compile_options(standalone_cpp PRIVATE -O3 -Wno-deprecated-declarations ) -target_include_directories(standalone_cpp - PUBLIC ${MKL_INCLUDE_DIR} ${TBB_INCLUDE_DIR} sycl_gemm - ) -target_link_libraries(standalone_cpp - PRIVATE ${mkl_sycl} ${mkl_intel_ilp64} ${mkl_tbb_thread} ${mkl_core} ${tbb} ${OpenCL} -) +target_include_directories(standalone_cpp PUBLIC sycl_gemm) +target_link_libraries(standalone_cpp PRIVATE MKL::MKL_SYCL) set(ignoreMe "${SKBUILD}") From ac978f10eb5935728248a25dbe7effa8f7cc6114 Mon Sep 17 00:00:00 2001 From: Oleksandr Pavlyk Date: Sat, 14 Dec 2024 12:09:00 -0800 Subject: [PATCH 9/9] Updated name of filename in list of exceptions after renamings --- .flake8 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.flake8 b/.flake8 index b4f0914dfb..276ee08645 100644 --- a/.flake8 +++ b/.flake8 @@ -32,5 +32,5 @@ per-file-ignores = dpctl/utils/_onetrace_context.py: E501, W505 dpctl/tensor/_array_api.py: E501, W505 examples/cython/sycl_buffer/syclbuffer/_syclbuffer.pyx: E999, E225, E402 - examples/cython/usm_memory/blackscholes/blackscholes.pyx: E999, E225, E226, E402 + examples/cython/usm_memory/blackscholes/_blackscholes_usm.pyx: E999, E225, E226, E402 examples/cython/use_dpctl_sycl/use_dpctl_sycl/_cython_api.pyx: E999, E225, E226, E402