From e48948e89358d10d7df643a598aac8cf1a07366f Mon Sep 17 00:00:00 2001 From: Oleksandr Pavlyk Date: Tue, 23 May 2023 17:00:20 -0500 Subject: [PATCH 1/5] Use conda-forge channel instead of main channel as source of dependencies --- .github/workflows/conda-package.yml | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/.github/workflows/conda-package.yml b/.github/workflows/conda-package.yml index 8f74ad0feb..d037edd2cd 100644 --- a/.github/workflows/conda-package.yml +++ b/.github/workflows/conda-package.yml @@ -44,7 +44,7 @@ jobs: run: conda install conda-build - name: Build conda package run: | - CHANNELS="-c dppy/label/tools -c intel -c main --override-channels" + CHANNELS="-c intel -c conda-forge --override-channels" VERSIONS="--python ${{ matrix.python }}" TEST="--no-test" conda build \ @@ -90,7 +90,7 @@ jobs: ${{ runner.os }}-conda-${{ env.CACHE_NUMBER }}-python-${{ matrix.python }}- ${{ runner.os }}-conda-${{ env.CACHE_NUMBER }}- - name: Build conda package - run: conda build --no-test --python ${{ matrix.python }} -c intel -c main --override-channels conda-recipe + run: conda build --no-test --python ${{ matrix.python }} -c intel -c conda-forge --override-channels conda-recipe - name: Upload artifact uses: actions/upload-artifact@v3 with: @@ -108,7 +108,7 @@ jobs: runner: [ubuntu-20.04] continue-on-error: ${{ matrix.experimental }} env: - CHANNELS: -c intel -c main --override-channels + CHANNELS: -c intel -c conda-forge --override-channels steps: - name: Download artifact @@ -192,7 +192,7 @@ jobs: continue-on-error: ${{ matrix.experimental }} env: workdir: '${{ github.workspace }}' - CHANNELS: -c intel -c main --override-channels + CHANNELS: -c intel -c conda-forge --override-channels steps: - name: Download artifact @@ -355,7 +355,7 @@ jobs: runner: [ubuntu-20.04] continue-on-error: ${{ matrix.experimental }} env: - CHANNELS: -c intel -c main --override-channels + CHANNELS: -c intel -c conda-forge --override-channels steps: - name: Install conda-build @@ -413,7 +413,7 @@ jobs: shell: bash -l {0} run: | source $CONDA/etc/profile.d/conda.sh - CHANNELS="-c $GITHUB_WORKSPACE/channel -c dppy/label/dev -c intel -c main --override-channels" + CHANNELS="-c $GITHUB_WORKSPACE/channel -c dppy/label/dev -c intel -c conda-forge --override-channels" export PACKAGE_VERSION=$(python -c "${VER_SCRIPT1} ${VER_SCRIPT2}") conda install -n examples -y ${CHANNELS} dpctl=${PACKAGE_VERSION} dpnp">=0.10.1" || exit 1 - name: Build and run examples of pybind11 extensions @@ -498,7 +498,7 @@ jobs: runner: [ubuntu-20.04] continue-on-error: ${{ matrix.experimental }} env: - CHANNELS: -c intel -c main --override-channels + CHANNELS: -c intel -c conda-forge --override-channels steps: - name: Cache array API tests id: cache-array-api-tests From 90d58c2ec874fd6423b1acd398a6a3f1169de623 Mon Sep 17 00:00:00 2001 From: Oleksandr Pavlyk Date: Tue, 23 May 2023 17:52:23 -0500 Subject: [PATCH 2/5] Add level-zero as run-time dependency --- conda-recipe/meta.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/conda-recipe/meta.yaml b/conda-recipe/meta.yaml index 0bcfe56c18..56958d3355 100644 --- a/conda-recipe/meta.yaml +++ b/conda-recipe/meta.yaml @@ -30,6 +30,7 @@ requirements: - {{ pin_compatible('numpy', min_pin='x.x', max_pin='x') }} - {{ pin_compatible('dpcpp-cpp-rt', min_pin='x.x', max_pin='x') }} # [py<=39] - dpcpp-cpp-rt >=2023.1 # [py>39] + - level-zero # [linux] test: requires: From 075c77ddfce57a97956bc49499091903637607a5 Mon Sep 17 00:00:00 2001 From: Oleksandr Pavlyk Date: Wed, 24 May 2023 09:06:48 -0500 Subject: [PATCH 3/5] Do not use use-only-tar-bz2 to allow latest cmake to be pulled on Windows --- .github/workflows/conda-package.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.github/workflows/conda-package.yml b/.github/workflows/conda-package.yml index d037edd2cd..a4de902daf 100644 --- a/.github/workflows/conda-package.yml +++ b/.github/workflows/conda-package.yml @@ -72,7 +72,6 @@ jobs: fetch-depth: 0 - uses: conda-incubator/setup-miniconda@v2 with: - use-only-tar-bz2: true auto-activate-base: true conda-build-version: "*" activate-environment: true @@ -201,7 +200,6 @@ jobs: name: ${{ env.PACKAGE_NAME }} ${{ runner.os }} Python ${{ matrix.python }} - uses: conda-incubator/setup-miniconda@v2 with: - use-only-tar-bz2: true auto-update-conda: true conda-build-version: '*' miniconda-version: 'latest' From 628f859298254123922f8aef733eb4abb5053ebf Mon Sep 17 00:00:00 2001 From: Oleksandr Pavlyk Date: Wed, 24 May 2023 12:13:24 -0500 Subject: [PATCH 4/5] Modify the code to patch Windows-IntelLLVM.cmake for different cmake versions --- ...LVM.cmake => Windows-IntelLLVM_3.22.cmake} | 0 .../workflows/Windows-IntelLLVM_3.26.cmake | 66 +++++++++++++++++++ conda-recipe/bld.bat | 9 +-- 3 files changed, 71 insertions(+), 4 deletions(-) rename .github/workflows/{Windows-IntelLLVM.cmake => Windows-IntelLLVM_3.22.cmake} (100%) mode change 100755 => 100644 create mode 100644 .github/workflows/Windows-IntelLLVM_3.26.cmake diff --git a/.github/workflows/Windows-IntelLLVM.cmake b/.github/workflows/Windows-IntelLLVM_3.22.cmake old mode 100755 new mode 100644 similarity index 100% rename from .github/workflows/Windows-IntelLLVM.cmake rename to .github/workflows/Windows-IntelLLVM_3.22.cmake diff --git a/.github/workflows/Windows-IntelLLVM_3.26.cmake b/.github/workflows/Windows-IntelLLVM_3.26.cmake new file mode 100644 index 0000000000..eac3f0a9a8 --- /dev/null +++ b/.github/workflows/Windows-IntelLLVM_3.26.cmake @@ -0,0 +1,66 @@ +# Distributed under the OSI-approved BSD 3-Clause License. See accompanying +# file Copyright.txt or https://cmake.org/licensing for details. + + +# This module is shared by multiple languages; use include blocker. +if(__WINDOWS_INTEL_LLVM) + return() +endif() +set(__WINDOWS_INTEL_LLVM 1) + +# Platform/Windows-MSVC adds some linking options icx/ifx do not understand, +# but that need to be passed to the linker. Wrap all the linking options from +# Platform/Windows-MSVC so that the compiler will hand them off to the linker +# without interpreting them. + +# Save original CMAKE_${t}_LINKER_FLAGS_INIT +foreach(t EXE SHARED MODULE STATIC) + set(_saved_cmake_${t}_linker_flags_init ${CMAKE_${t}_LINKER_FLAGS_INIT}) + set(CMAKE_${t}_LINKER_FLAGS_INIT "") +endforeach() +include(Platform/Windows-MSVC) +# Wrap linker flags from Windows-MSVC +set(_IntelLLVM_LINKER_WRAPPER_FLAG "/Qoption,link,") +set(_IntelLLVM_LINKER_WRAPPER_FLAG_SEP ",") +foreach(t EXE SHARED MODULE STATIC) + set(_wrapped_linker_flags "") + foreach(flag ${CMAKE_${t}_LINKER_FLAGS_INIT}) + string(STRIP ${flag} flag) + list(APPEND _wrapped_linker_flags "${_IntelLLVM_LINKER_WRAPPER_FLAG}${flag}") + endforeach() + set(CMAKE_${t}_LINKER_FLAGS_INIT "") + list(APPEND CMAKE_${t}_LINKER_FLAGS_INIT + ${_saved_cmake_${t}_linker_flags_init} ${_wrapped_linker_flags}) +endforeach() + +macro(__windows_compiler_intel lang) + __windows_compiler_msvc(${lang}) + + set(CMAKE_${lang}_LINKER_WRAPPER_FLAG "${_IntelLLVM_LINKER_WRAPPER_FLAG}") + set(CMAKE_${lang}_LINKER_WRAPPER_FLAG_SEP "${_IntelLLVM_LINKER_WRAPPER_FLAG_SEP}") + set(CMAKE_${lang}_CREATE_WIN32_EXE "${CMAKE_${lang}_LINKER_WRAPPER_FLAG}/subsystem:windows") + set(CMAKE_${lang}_CREATE_CONSOLE_EXE "${CMAKE_${lang}_LINKER_WRAPPER_FLAG}/subsystem:console") + set(CMAKE_LINK_DEF_FILE_FLAG "${CMAKE_${lang}_LINKER_WRAPPER_FLAG}/DEF:") + set(CMAKE_LIBRARY_PATH_FLAG "${CMAKE_${lang}_LINKER_WRAPPER_FLAG}/LIBPATH:") + + # Features for LINK_LIBRARY generator expression + if(MSVC_VERSION GREATER "1900") + ## WHOLE_ARCHIVE: Force loading all members of an archive + set(CMAKE_LINK_LIBRARY_USING_WHOLE_ARCHIVE "LINKER:/WHOLEARCHIVE:") + set(CMAKE_LINK_LIBRARY_USING_WHOLE_ARCHIVE_SUPPORTED TRUE) + endif() + + set(CMAKE_${lang}_LINK_EXECUTABLE + "${_CMAKE_VS_LINK_EXE} ${CMAKE_CL_NOLOGO} ${CMAKE_START_TEMP_FILE} /link /out: /implib: /pdb: /version:.${_PLATFORM_LINK_FLAGS} ${CMAKE_END_TEMP_FILE}") + set(CMAKE_${lang}_CREATE_SHARED_LIBRARY + "${_CMAKE_VS_LINK_DLL} ${CMAKE_CL_NOLOGO} ${CMAKE_START_TEMP_FILE} -LD -link /out: /implib: /pdb: /version:.${_PLATFORM_LINK_FLAGS} ${CMAKE_END_TEMP_FILE}") + set(CMAKE_${lang}_CREATE_SHARED_MODULE ${CMAKE_${lang}_CREATE_SHARED_LIBRARY}) + if (NOT "${lang}" STREQUAL "Fortran" OR CMAKE_${lang}_COMPILER_VERSION VERSION_GREATER_EQUAL 2022.1) + # The Fortran driver does not support -fuse-ld=llvm-lib before compiler version 2022.1 + set(CMAKE_${lang}_CREATE_STATIC_LIBRARY + " ${CMAKE_CL_NOLOGO} ${CMAKE_START_TEMP_FILE} -fuse-ld=llvm-lib -o ${CMAKE_END_TEMP_FILE}") + endif() + + set(CMAKE_DEPFILE_FLAGS_${lang} "-QMD -QMT -QMF ") + set(CMAKE_${lang}_DEPFILE_FORMAT gcc) +endmacro() diff --git a/conda-recipe/bld.bat b/conda-recipe/bld.bat index 5e68cf4ecc..07fa580bb4 100644 --- a/conda-recipe/bld.bat +++ b/conda-recipe/bld.bat @@ -6,14 +6,15 @@ set "INCLUDE=%BUILD_PREFIX%\include;%INCLUDE%" "%PYTHON%" setup.py clean --all set "SKBUILD_ARGS=-G Ninja -- -DCMAKE_C_COMPILER:PATH=icx -DCMAKE_CXX_COMPILER:PATH=icx -DCMAKE_VERBOSE_MAKEFILE:BOOL=ON" -FOR %%V IN (14.0.0 14 15.0.0 15 16.0.0 16) DO @( +FOR %%V IN (14.0.0 14 15.0.0 15 16.0.0 16 17.0.0 17) DO @( REM set DIR_HINT if directory exists IF EXIST "%BUILD_PREFIX%\Library\lib\clang\%%V\" ( SET "SYCL_INCLUDE_DIR_HINT=%BUILD_PREFIX%\Library\lib\clang\%%V" ) ) -set "PLATFORM_DIR=%PREFIX%\Library\share\cmake-3.22\Modules\Platform" +set "PATCHED_CMAKE_VERSION=3.26" +set "PLATFORM_DIR=%PREFIX%\Library\share\cmake-%PATCHED_CMAKE_VERSION%\Modules\Platform" set "FN=Windows-IntelLLVM.cmake" rem Save the original file, and copy patched file to @@ -22,7 +23,7 @@ if EXIST "%PLATFORM_DIR%" ( dir "%PLATFORM_DIR%\%FN%" copy /Y "%PLATFORM_DIR%\%FN%" . if errorlevel 1 exit 1 - copy /Y .github\workflows\Windows-IntelLLVM.cmake "%PLATFORM_DIR%" + copy /Y ".github\workflows\Windows-IntelLLVM_%PATCHED_CMAKE_VERSION%.cmake" "%PLATFORM_DIR%\%FN%" if errorlevel 1 exit 1 ) @@ -40,6 +41,6 @@ if NOT "%WHEELS_OUTPUT_FOLDER%"=="" ( if EXIST "%PLATFORM_DIR%" ( rem copy back - copy /Y "%FN%" "%PLATFORM_DIR%" + copy /Y "%FN%" "%PLATFORM_DIR%\%FN%" if errorlevel 1 exit 1 ) From 39d6a971dfc1d74089057492963134665a2d4973 Mon Sep 17 00:00:00 2001 From: Oleksandr Pavlyk Date: Wed, 24 May 2023 14:02:07 -0500 Subject: [PATCH 5/5] Install sysroot_linux-64=2.28 to build examples Use CHANNELS to pull sysroot_linux --- .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 a4de902daf..887ad4a9fa 100644 --- a/.github/workflows/conda-package.yml +++ b/.github/workflows/conda-package.yml @@ -406,7 +406,7 @@ jobs: conda install -n examples -y ninja $CHANNELS || exit 1 conda install -n examples -y pybind11 cython scikit-build $CHANNELS || exit 1 conda install -n examples -y mkl-dpcpp mkl-devel-dpcpp dpcpp_cpp_rt $CHANNELS || exit 1 - conda create -y -n build_env -c intel gcc_linux-64 gxx_linux-64 dpcpp_linux-64 + conda create -y -n build_env $CHANNELS gcc_linux-64 gxx_linux-64 dpcpp_linux-64 sysroot_linux-64">=2.28" - name: Install dpctl shell: bash -l {0} run: |