Skip to content

set CMAKE_FIND_ROOT_PATH_MODE_INCLUDE to BOTH #919

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 11 commits into from
Oct 5, 2022
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
81 changes: 52 additions & 29 deletions .github/workflows/conda-package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ jobs:
run: conda install conda-build
- name: Build conda package
run: |
CHANNELS="-c defaults -c intel --override-channels"
CHANNELS="-c intel -c main --override-channels"
VERSIONS="--python ${{ matrix.python }}"
TEST="--no-test"
conda build \
Expand Down Expand Up @@ -89,7 +89,7 @@ jobs:
- name: Install conda-build
run: conda install conda-build
- name: Build conda package
run: conda build --no-test --python ${{ matrix.python }} -c defaults -c intel --override-channels conda-recipe
run: conda build --no-test --python ${{ matrix.python }} -c intel -c main --override-channels conda-recipe
- name: Upload artifact
uses: actions/upload-artifact@v2
with:
Expand All @@ -107,7 +107,7 @@ jobs:
runner: [ubuntu-latest]
continue-on-error: ${{ matrix.experimental }}
env:
CHANNELS: -c defaults -c intel --override-channels
CHANNELS: -c intel -c main --override-channels

steps:
- name: Download artifact
Expand Down Expand Up @@ -154,7 +154,7 @@ jobs:
export PACKAGE_VERSION=$(python -c "${VER_SCRIPT1} ${VER_SCRIPT2}")
conda create -n test_dpctl $PACKAGE_NAME=${PACKAGE_VERSION} pytest python=${{ matrix.python }} $CHANNELS
# Test installed packages
conda list
conda list -n test_dpctl
- name: Smoke test
run: |
. $CONDA/etc/profile.d/conda.sh
Expand Down Expand Up @@ -183,7 +183,8 @@ jobs:
runner: [windows-latest]
continue-on-error: ${{ matrix.experimental }}
env:
CHANNELS: -c defaults -c intel --override-channels
workdir: '${{ github.workspace }}'
CHANNELS: -c intel -c main --override-channels

steps:
- name: Download artifact
Expand All @@ -192,30 +193,41 @@ jobs:
name: ${{ env.PACKAGE_NAME }} ${{ runner.os }} Python ${{ matrix.python }}
- uses: conda-incubator/setup-miniconda@v2
with:
auto-activate-base: true
activate-environment: ""
use-only-tar-bz2: true
auto-update-conda: true
miniconda-version: 'latest'
activate-environment: "dpctl_test"
- name: Install conda-build
shell: cmd /C CALL {0}
# Needed to be able to run conda index
run: conda install conda-build
- name: Create conda channel
shell: cmd /C CALL {0}
run: |
mkdir ${{ env.GITHUB_WORKSPACE }}\channel\win-64
move ${{ env.PACKAGE_NAME }}-*.tar.bz2 ${{ env.GITHUB_WORKSPACE }}\channel\win-64
conda index ${{ env.GITHUB_WORKSPACE }}/channel
echo ${{ env.workdir }}
mkdir ${{ env.workdir }}\channel\win-64
move ${{ env.PACKAGE_NAME }}-*.tar.bz2 ${{ env.workdir }}\channel\win-64
conda index ${{ env.workdir }}/channel
# Test channel
conda search ${{ env.PACKAGE_NAME }} -c ${{ env.GITHUB_WORKSPACE }}/channel --override-channels --info --json > ${{ env.GITHUB_WORKSPACE }}\ver.json
more ${{ env.GITHUB_WORKSPACE }}\ver.json
conda search ${{ env.PACKAGE_NAME }} -c ${{ env.workdir }}/channel --override-channels --info --json > ${{ env.workdir }}\ver.json
type ${{ env.workdir }}\ver.json
- name: Collect dependencies
shell: cmd
shell: cmd /C CALL {0}
run: |
@ECHO ON
copy /Y ${{ env.GITHUB_WORKSPACE }}\ver.json .
if not exist ver.json (
copy /Y ${{ env.workdir }}\ver.json .
)
set "SCRIPT=%VER_SCRIPT1% %VER_SCRIPT2%"
FOR /F "tokens=* USEBACKQ" %%F IN (`python -c "%SCRIPT%"`) DO (
SET PACKAGE_VERSION=%%F
)
conda install ${{ env.PACKAGE_NAME }}=%PACKAGE_VERSION% python=${{ matrix.python }} -c ${{ env.GITHUB_WORKSPACE }}/channel ${{ env.CHANNELS }} --only-deps --dry-run > lockfile
more lockfile
conda install ${{ env.PACKAGE_NAME }}=%PACKAGE_VERSION% python=${{ matrix.python }} -c ${{ env.workdir }}/channel ${{ env.CHANNELS }} --only-deps --dry-run > lockfile
- name: Display lockfile content
shell: cmd /C CALL {0}
run: |
echo "Outputting content of lockfile:"
type lockfile
- name: Cache conda packages
uses: actions/cache@v3
env:
Expand All @@ -228,22 +240,28 @@ jobs:
${{ runner.os }}-conda-${{ env.CACHE_NUMBER }}-python-${{ matrix.python }}-
${{ runner.os }}-conda-${{ env.CACHE_NUMBER }}-
- name: Install opencl_rt
shell: cmd /C CALL {0}
run: conda install opencl_rt -c intel --override-channels
- name: Install dpctl
shell: cmd
shell: cmd /C CALL {0}
run: |
@ECHO ON
copy /Y ${{ env.GITHUB_WORKSPACE }}\ver.json .
copy /Y ${{ env.workdir }}\ver.json .
set "SCRIPT=%VER_SCRIPT1% %VER_SCRIPT2%"
FOR /F "tokens=* USEBACKQ" %%F IN (`python -c "%SCRIPT%"`) DO (
SET PACKAGE_VERSION=%%F
)
conda install ${{ env.PACKAGE_NAME }}=%PACKAGE_VERSION% pytest python=${{ matrix.python }} -c ${{ env.GITHUB_WORKSPACE }}/channel ${{ env.CHANNELS }}
# Test installed packages
conda install ${{ env.PACKAGE_NAME }}=%PACKAGE_VERSION% pytest python=${{ matrix.python }} -c ${{ env.workdir }}/channel ${{ env.CHANNELS }}
- name: Report content of test environemtn
shell: cmd /C CALL {0}
run: |
echo "Value of CONDA enviroment variable was: " %CONDA%
conda list
- name: Add library
shell: pwsh
run: |
echo "OCL_ICD_FILENAMES=C:\Miniconda\Library\lib\intelocl64.dll" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
$conda_env_library = "$env:CONDA_PREFIX\Library"
echo "OCL_ICD_FILENAMES=$conda_env_library\lib\intelocl64.dll" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
try {$list = Get-Item -Path HKLM:\SOFTWARE\Khronos\OpenCL\Vendors | Select-Object -ExpandProperty Property } catch {$list=@()}
if ($list.count -eq 0) {
if (-not (Test-Path -Path HKLM:\SOFTWARE\Khronos)) {
Expand All @@ -255,12 +273,12 @@ jobs:
if (-not (Test-Path -Path HKLM:\SOFTWARE\Khronos\OpenCL\Vendors)) {
New-Item -Path HKLM:\SOFTWARE\Khronos\OpenCL\Vendors
}
New-ItemProperty -Path HKLM:\SOFTWARE\Khronos\OpenCL\Vendors -Name C:\Miniconda\Library\lib\intelocl64.dll -Value 0
New-ItemProperty -Path HKLM:\SOFTWARE\Khronos\OpenCL\Vendors -Name $conda_env_library\lib\intelocl64.dll -Value 0
try {$list = Get-Item -Path HKLM:\SOFTWARE\Khronos\OpenCL\Vendors | Select-Object -ExpandProperty Property } catch {$list=@()}
Write-Output $(Get-Item -Path HKLM:\SOFTWARE\Khronos\OpenCL\Vendors)
# Now copy OpenCL.dll into system folder
$system_ocl_icd_loader="C:\Windows\System32\OpenCL.dll"
$python_ocl_icd_loader="C:\Miniconda\Library\bin\OpenCL.dll"
$python_ocl_icd_loader="$conda_env_library\bin\OpenCL.dll"
Copy-Item -Path $python_ocl_icd_loader -Destination $system_ocl_icd_loader
if (Test-Path -Path $system_ocl_icd_loader) {
Write-Output "$system_ocl_icd_loader has been copied"
Expand All @@ -270,19 +288,24 @@ jobs:
Write-Output "OCL-ICD-Loader was not copied"
}
# Variable assisting OpenCL CPU driver to find TBB DLLs which are not located where it expects them by default
echo "TBB_DLL_PATH=C:\Miniconda\Library\bin" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
$cl_cfg="$conda_env_library\lib\cl.cfg"
Write-Output $cl_cfg
(Get-Content $cl_cfg) -replace '^CL_CONFIG_TBB_DLL_PATH =', "CL_CONFIG_TBB_DLL_PATH = $conda_env_library\bin" | Set-Content $cl_cfg
Get-Content -Tail 5 -Path $cl_cfg
}
- name: Smoke test
shell: cmd /C CALL {0}
run: |
python -c "import sys; print(sys.executable)"
set SYCL_ENABLE_HOST_DEVICE=1
& { [Environment]::SetEnvironmentVariable("Path", $env:Path + ";C:\Miniconda\Library\bin\", [EnvironmentVariableTarget]::Machine) }
python -c "import dpctl; dpctl.lsplatform()"
python -c "import dpctl; print(dpctl.get_devices(backend='opencl', device_type='gpu'))"
python -c "import dpctl; print(dpctl.get_num_devices(backend='opencl', device_type='gpu'))"
- name: Run tests
shell: cmd /C CALL {0}
run: |
set SYCL_ENABLE_HOST_DEVICE=1
& { [Environment]::SetEnvironmentVariable("Path", $env:Path + ";C:\Miniconda\Library\bin\", [EnvironmentVariableTarget]::Machine) }
python -c "import sys; print(sys.executable)"
python -m pytest -p no:faulthandler --pyargs ${{ env.MODULE_NAME }}

upload_linux:
Expand Down Expand Up @@ -346,7 +369,7 @@ jobs:
runner: [ubuntu-latest]
continue-on-error: ${{ matrix.experimental }}
env:
CHANNELS: -c defaults -c intel --override-channels
CHANNELS: -c intel -c main --override-channels

steps:
- name: Install conda-build
Expand Down Expand Up @@ -404,7 +427,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 defaults --override-channels"
CHANNELS="-c $GITHUB_WORKSPACE/channel -c dppy/label/dev -c intel -c main --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 with native extensions
Expand Down Expand Up @@ -488,7 +511,7 @@ jobs:
runner: [ubuntu-latest]
continue-on-error: ${{ matrix.experimental }}
env:
CHANNELS: -c intel -c defaults --override-channels
CHANNELS: -c intel -c main --override-channels
steps:
- name: Cache array API tests
id: cache-array-api-tests
Expand Down
2 changes: 2 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ project(dpctl

set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED True)
set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE BOTH)
set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY BOTH)

# Option to generate code coverage report using llvm-cov and lcov.
option(DPCTL_GENERATE_COVERAGE
Expand Down
3 changes: 2 additions & 1 deletion examples/pybind11/onemkl_gemv/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ 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)

set(py_module_name _onemkl)

Expand Down Expand Up @@ -64,7 +65,7 @@ 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}
PRIVATE ${mkl_sycl} ${mkl_intel_ilp64} ${mkl_tbb_thread} ${mkl_core} ${tbb} ${OpenCL}
)

set(ignoreMe "${SKBUILD}")
8 changes: 7 additions & 1 deletion libsyclinterface/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,10 @@ if(DPCTL_ENABLE_L0_PROGRAM_CREATION)
OUTPUT_VARIABLE LIBZE_LOADER_FILENAME
OUTPUT_STRIP_TRAILING_WHITESPACE
ERROR_STRIP_TRAILING_WHITESPACE
)
)
set(LIBZE_LOADER_FILENAME ${LIBZE_LOADER_FILENAME} PARENT_SCOPE)
endif()
set(LIBZE_LOADER_FILENAME ${LIBZE_LOADER_FILENAME} PARENT_SCOPE)
endif()

if (UNIX)
Expand All @@ -86,8 +88,12 @@ if (UNIX)
OUTPUT_STRIP_TRAILING_WHITESPACE
ERROR_STRIP_TRAILING_WHITESPACE
)
set(LIBCL_LOADER_FILENAME ${LIBCL_LOADER_FILENAME} PARENT_SCOPE)
endif()

message(STATUS "LIB_ZE: ${LIBZE_LOADER_FILENAME}")
message(STATUS "LIB_CL: ${LIBCL_LOADER_FILENAME}")

configure_file(
${CMAKE_CURRENT_SOURCE_DIR}/include/Config/dpctl_config.h.in
${CMAKE_CURRENT_SOURCE_DIR}/include/Config/dpctl_config.h
Expand Down
2 changes: 1 addition & 1 deletion libsyclinterface/include/Config/dpctl_config.h.in
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@

/* Defined when dpctl was built with level zero program creation enabled. */
#cmakedefine DPCTL_ENABLE_L0_PROGRAM_CREATION \
@DPCTL_ENABLE_L0_PROGRAM_CREATION @
@DPCTL_ENABLE_L0_PROGRAM_CREATION@

/* The DPCPP version used to build dpctl */
#define DPCTL_DPCPP_VERSION "@IntelSycl_VERSION@"
Expand Down