Skip to content
This repository was archived by the owner on Jun 6, 2025. It is now read-only.

Commit 4a5c7a1

Browse files
authored
Merge pull request #26 from IntelPython/merge/gold_into_main
Merge gold into main
2 parents ae0cb7b + 26c6069 commit 4a5c7a1

File tree

8 files changed

+93
-121
lines changed

8 files changed

+93
-121
lines changed

.github/actions/setup-conda-build/action.yml

Lines changed: 0 additions & 9 deletions
This file was deleted.

.github/workflows/conda-package.yml

Lines changed: 20 additions & 80 deletions
Original file line numberDiff line numberDiff line change
@@ -16,108 +16,51 @@ env:
1616
MODULE_NAME: dpcpp_llvm_spirv
1717

1818
jobs:
19-
build_linux:
20-
runs-on: ubuntu-latest
21-
19+
build:
2220
strategy:
2321
matrix:
2422
python: ["3.9", "3.10", "3.11"]
25-
23+
os: ["ubuntu-latest", "windows-latest"]
24+
runs-on: ${{ matrix.os }}
25+
defaults:
26+
run:
27+
shell: ${{ matrix.os == 'windows-latest' && 'cmd /C CALL {0}' || 'bash -l {0}' }}
2628
steps:
2729
- uses: actions/checkout@v3
2830
with:
2931
fetch-depth: 0
3032

3133
- name: Setup conda-build
32-
uses: ./.github/actions/setup-conda-build
33-
34-
- name: Build conda package
35-
env:
36-
CHANNELS: -c intel -c main --override-channels
37-
run: conda build --python ${{ matrix.python }} ${{ env.CHANNELS }} conda-recipe
38-
39-
- name: Upload artifact
40-
uses: actions/upload-artifact@v3
41-
with:
42-
name: ${{ env.PACKAGE_NAME }} ${{ runner.os }} Python ${{ matrix.python }}
43-
path: /usr/share/miniconda/conda-bld/linux-64/${{ env.PACKAGE_NAME }}-*.tar.bz2
44-
45-
build_windows:
46-
runs-on: windows-latest
47-
48-
strategy:
49-
matrix:
50-
python: ["3.9", "3.10", "3.11"]
51-
52-
env:
53-
CHANNELS: -c intel -c main --override-channels
54-
conda-bld: C:\Miniconda\conda-bld\win-64\
55-
56-
steps:
57-
- uses: actions/checkout@v3
58-
with:
59-
fetch-depth: 0
60-
- uses: conda-incubator/setup-miniconda@v2
34+
uses: conda-incubator/setup-miniconda@v3
6135
with:
6236
auto-activate-base: true
6337
activate-environment: ""
6438

65-
- name: Cache conda packages
66-
uses: actions/cache@v3
67-
env:
68-
CACHE_NUMBER: 0 # Increase to reset cache
69-
with:
70-
path: /home/runner/conda_pkgs_dir
71-
key:
72-
${{ runner.os }}-conda-${{ env.CACHE_NUMBER }}-python-${{ matrix.python }}-${{hashFiles('**/meta.yaml') }}
73-
restore-keys: |
74-
${{ runner.os }}-conda-${{ env.CACHE_NUMBER }}-python-${{ matrix.python }}-
75-
${{ runner.os }}-conda-${{ env.CACHE_NUMBER }}-
7639
- name: Install conda-build
7740
run: conda install conda-build
41+
7842
- name: Build conda package
43+
env:
44+
CHANNELS: -c intel -c conda-forge --override-channels
7945
run: conda build --python ${{ matrix.python }} ${{ env.CHANNELS }} conda-recipe
46+
8047
- name: Upload artifact
8148
uses: actions/upload-artifact@v3
82-
with:
83-
name: ${{ env.PACKAGE_NAME }} ${{ runner.os }} Python ${{ matrix.python }} ${{ matrix.artifact_name }}
84-
path: ${{ env.conda-bld }}${{ env.PACKAGE_NAME }}-*.tar.bz2
85-
86-
upload_linux:
87-
needs: build_linux
88-
if: ${{github.ref == 'refs/heads/main' || (startsWith(github.ref, 'refs/heads/release') == true)}}
89-
runs-on: ubuntu-latest
90-
strategy:
91-
matrix:
92-
python: ["3.9", "3.10", "3.11"]
93-
steps:
94-
- name: Download artifact
95-
uses: actions/download-artifact@v3
9649
with:
9750
name: ${{ env.PACKAGE_NAME }} ${{ runner.os }} Python ${{ matrix.python }}
51+
path: /usr/share/miniconda/conda-bld/linux-64/${{ env.PACKAGE_NAME }}-*.tar.bz2
9852

99-
- uses: conda-incubator/setup-miniconda@v2
100-
with:
101-
auto-activate-base: true
102-
activate-environment: ""
103-
- name: Install anaconda-client
104-
run: conda install anaconda-client
105-
106-
- name: Upload
107-
env:
108-
ANACONDA_TOKEN: ${{ secrets.ANACONDA_TOKEN }}
109-
run: |
110-
source /usr/share/miniconda/etc/profile.d/conda.sh
111-
conda activate
112-
anaconda --token $ANACONDA_TOKEN upload --user dppy --label dev ${PACKAGE_NAME}-*.tar.bz2
113-
114-
upload_windows:
115-
needs: build_windows
53+
upload:
54+
needs: build
11655
if: ${{github.ref == 'refs/heads/main' || (startsWith(github.ref, 'refs/heads/release') == true)}}
117-
runs-on: windows-latest
11856
strategy:
11957
matrix:
12058
python: ["3.9", "3.10", "3.11"]
59+
os: ["ubuntu-latest", "windows-latest"]
60+
runs-on: ${{ matrix.os }}
61+
defaults:
62+
run:
63+
shell: ${{ matrix.os == 'windows-latest' && 'cmd /C CALL {0}' || 'bash -l {0}' }}
12164
steps:
12265
- name: Download artifact
12366
uses: actions/download-artifact@v3
@@ -132,7 +75,4 @@ jobs:
13275
run: conda install anaconda-client
13376

13477
- name: Upload
135-
env:
136-
ANACONDA_TOKEN: ${{ secrets.ANACONDA_TOKEN }}
137-
run: |
138-
anaconda --token ${{ env.ANACONDA_TOKEN }} upload --user dppy --label dev ${{ env.PACKAGE_NAME }}-*.tar.bz2
78+
run: anaconda --token ${{ secrets.ANACONDA_TOKEN }} upload --user dppy --label dev ${{ env.PACKAGE_NAME }}-*.tar.bz2

conda-recipe/meta.yaml

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
{% set version = "2023.0.0" %}
2-
{% set intel_build_number = "25370" %} # [linux]
3-
{% set intel_build_number = "25922" %} # [win]
1+
{% set version = "2024.0.0" %}
2+
{% set intel_build_number = "49819" %} # [linux]
3+
{% set intel_build_number = "49840" %} # [win]
44
{% set target_platform = "linux-64" %} # [linux64]
55
{% set target_platform = "win-64" %} # [win64]
66

@@ -15,10 +15,6 @@ package:
1515
source:
1616
- path: ../pkg
1717
folder: package
18-
- url: https://anaconda.org/intel/dpcpp_impl_{{ target_platform }}/{{ version }}/download/{{ target_platform }}/dpcpp_impl_{{ target_platform }}-{{ version }}-intel_{{ intel_build_number }}.tar.bz2 # [linux64 or win64]
19-
md5: 0acd44eea158cf828f7f1058f6fc85da # [win64]
20-
md5: 5217aa49f13b313a0e357aef6a182264 # [linux64]
21-
folder: compiler
2218
- path: ..
2319

2420
build:
@@ -31,10 +27,19 @@ outputs:
3127
- name: dpcpp-llvm-spirv
3228
script: repack.sh # [linux]
3329
script: repack.bat # [win]
30+
build:
31+
include_recipe: False
32+
script_env:
33+
- WHEELS_OUTPUT_FOLDER
3434
requirements:
35+
build:
36+
- dpcpp_linux-64 =={{ version }}=intel_{{ intel_build_number }} #[linux]
37+
- dpcpp_win-64 =={{ version }}=intel_{{ intel_build_number }} #[win]
3538
host:
3639
- python
37-
- setuptools >=63
40+
- setuptools
41+
- patchelf # [linux]
42+
- wheel
3843
run:
3944
- python
4045
test:
@@ -59,5 +64,5 @@ outputs:
5964
disclaimers or license terms for third party or open source software
6065
included in or with the software.</strong>
6166
<br/><br/>
62-
EULA: <a href="https://software.intel.com/content/dam/develop/external/us/en/documents/pdf/intel-developer-tools-eula-09-03-19.pdf" target="_blank">LicenseRef-Proprietary-Intel-End-User-License-Agreement-for-Developer-Tools</a>
67+
EULA: <a href="https://www.intel.com/content/dam/develop/external/us/en/documents/pdf/intel-developer-tools-eula-09-03-19.pdf" target="_blank">LicenseRef-Proprietary-Intel-End-User-License-Agreement-for-Developer-Tools</a>
6368
<br/><br/>

conda-recipe/repack.bat

Lines changed: 25 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,31 @@
11

2-
set /P DPCPP_LLVM_SPIRV_VERSION < %PYTHON% get_icpx_version.py
2+
set "DPCPP_LLVM_SPIRV_VERSION=%PKG_VERSION%"
33
echo "Inferred DPCPP_LLVM_SPIRV_VERSION=%DPCPP_LLVM_SPIRV_VERSION%"
44

5+
set "BUILD_ARGS=--single-version-externally-managed --record=llvm_spirv_record.txt"
6+
7+
if not exist %BUILD_PREFIX%\Library\bin\compiler\llvm-spirv.exe (exit 1)
8+
59
pushd %SRC_DIR%\package
6-
%PYTHON% setup.py install --single-version-externally-managed --record=llvm_spirv_record.txt
7-
type llvm_spirv_record.txt
8-
popd
10+
if not exist %SRC_DIR%\package\dpcpp_llvm_spirv\bin mkdir %SRC_DIR%\package\dpcpp_llvm_spirv\bin
11+
copy %BUILD_PREFIX%\Library\bin\compiler\llvm-spirv.exe %SRC_DIR%\package\dpcpp_llvm_spirv\bin\
12+
13+
for /f %%a in (
14+
"%BUILD_PREFIX%\Library\bin\onnxruntime.*"
15+
) do copy %%~fa %SRC_DIR%\package\dpcpp_llvm_spirv\bin\
16+
17+
rem Workaround to remove spaces from the env value
18+
set WHEELS_OUTPUT_FOLDER=%WHEELS_OUTPUT_FOLDER: =%
19+
if NOT "%WHEELS_OUTPUT_FOLDER%"=="" (
20+
21+
%PYTHON% setup.py install %BUILD_ARGS% bdist_wheel -p win_amd64 --python-tag py%PY_VER:.=%
22+
if errorlevel 1 exit 1
23+
copy dist\dpcpp_llvm_spirv*.whl %WHEELS_OUTPUT_FOLDER%
24+
if errorlevel 1 exit 1
25+
) ELSE (
26+
%PYTHON% setup.py install %BUILD_ARGS%
27+
if errorlevel 1 exit 1
28+
type llvm_spirv_record.txt
29+
)
930

10-
pushd %SRC_DIR%\compiler
11-
%PYTHON% -c "import dpcpp_llvm_spirv as p; print(p.get_llvm_spirv_path())" > Output
12-
set /p DIRSTR= < Output
13-
if not exist Library\bin-llvm\llvm-spirv.exe (exit 1)
14-
copy Library\bin-llvm\llvm-spirv.exe %DIRSTR%
15-
del Output
1631
popd

conda-recipe/repack.sh

Lines changed: 23 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,36 @@
11
#!/bin/bash
2+
3+
set -ex
4+
25
echo -e "Start building dpcpp-llvm-spirv package \n"
36
src="${SRC_DIR}"
47

58
echo "Python: ${PYTHON}"
69
[ -z "${PYTHON}" ] && exit 1
710

8-
export DPCPP_LLVM_SPIRV_VERSION=$(${PYTHON} get_icpx_version.py)
11+
export DPCPP_LLVM_SPIRV_VERSION="${PKG_VERSION}"
912
echo -e "Inferred DPCPP_LLVM_SPIRV_VERSION=${DPCPP_LLVM_SPIRV_VERSION}"
1013

14+
BUILD_ARGS="--single-version-externally-managed --record=llvm_spirv_record.txt"
15+
WHEELS_BUILD_ARGS="-p manylinux2014_x86_64 --python-tag py${PY_VER//./}"
16+
1117
pushd $src/package
12-
${PYTHON} setup.py install --single-version-externally-managed --record=llvm_spirv_record.txt
13-
cat llvm_spirv_record.txt
14-
popd
18+
echo -e "Start vendoring of llvm-spirv executable \n"
19+
mkdir -p $src/package/dpcpp_llvm_spirv/bin
20+
mkdir -p $src/package/dpcpp_llvm_spirv/lib
21+
cp ${BUILD_PREFIX}/bin/compiler/llvm-spirv $src/package/dpcpp_llvm_spirv/bin/
22+
cp ${BUILD_PREFIX}/lib/libonnxruntime.* $src/package/dpcpp_llvm_spirv/lib/
23+
patchelf --force-rpath --set-rpath '$ORIGIN/../lib' $src/package/dpcpp_llvm_spirv/bin/llvm-spirv
1524

16-
echo -e "Done building the Python package. Start vendoring of llvm-spirv executable \n"
25+
if [ -n "${WHEELS_OUTPUT_FOLDER}" ]; then
26+
# Build wheel package
27+
$PYTHON setup.py install ${BUILD_ARGS} bdist_wheel ${WHEELS_BUILD_ARGS}
28+
cp dist/dpcpp_llvm_spirv*.whl ${WHEELS_OUTPUT_FOLDER}
29+
else
30+
pushd $src/package
31+
${PYTHON} setup.py install ${BUILD_ARGS}
32+
cat llvm_spirv_record.txt
33+
fi
34+
echo "done. \n"
1735

18-
pushd ${src}/compiler
19-
cp bin-llvm/llvm-spirv $(${PYTHON} -c "import dpcpp_llvm_spirv as p; print(p.get_llvm_spirv_path())")
20-
echo "copy llvm-spirv to: $(${PYTHON} -c "import dpcpp_llvm_spirv as p; print(p.get_llvm_spirv_path())")"
2136
popd
22-
echo "done. \n"

license.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -242,7 +242,7 @@ to items referenced therein, at any time without notice, but is not obligated to
242242
support, update or provide training for the Materials under the terms of this
243243
Agreement. Intel offers free community and paid priority support options. More
244244
information on these support options can be found at:
245-
https://software.intel.com/content/www/us/en/develop/support/priority-support.html.
245+
https://www.intel.com/content/www/us/en/developer/get-help/priority-support.html.
246246

247247
7. LIMITATION OF LIABILITY.
248248

pkg/dpcpp_llvm_spirv/_helper.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ def get_llvm_spirv_path():
1111
vendored in this package.
1212
"""
1313

14-
result = os.path.dirname(__file__)
14+
result = os.path.join(os.path.dirname(__file__), "bin")
1515

1616
if platform.system() is "Windows":
1717
result += "\llvm-spirv.exe"

pkg/setup.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,16 +6,16 @@
66
import os.path
77

88
from setuptools import setup
9+
from setuptools.command.install import install
910

1011
pkg_version = os.getenv("DPCPP_LLVM_SPIRV_VERSION", "0.0.0+dev")
1112

1213
with open(os.path.join("dpcpp_llvm_spirv", "_version.py"), "w") as fh:
1314
fh.write(f"__version__ = '{pkg_version}'")
1415
fh.write("\n")
1516

16-
1717
setup(
18-
name="dpcpp_llvm_spirv",
18+
name="dpcpp-llvm-spirv",
1919
packages=[
2020
"dpcpp_llvm_spirv",
2121
],
@@ -32,4 +32,11 @@
3232
"Programming Language :: Python :: 3.11",
3333
],
3434
license="Intel End User License Agreement for Developer Tools",
35+
package_data={
36+
"dpcpp_llvm_spirv": [
37+
"bin/llvm-spirv*",
38+
"lib/libonnxruntime.*", # linux
39+
"bin/onnxruntime.*", # windows
40+
]
41+
},
3542
)

0 commit comments

Comments
 (0)