Skip to content
This repository has been archived by the owner on Mar 21, 2024. It is now read-only.

Kokkos/sv gates

Kokkos/sv gates #253

Workflow file for this run

name: Testing (Windows)
on:
push:
branches:
- master
pull_request:
concurrency:
group: tests_windows-${{ github.ref }}
cancel-in-progress: true
jobs:
cpptests:
name: C++ tests (Windows)
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [windows-latest]
pl_backend: ["lightning_qubit"]
steps:
- name: Checkout PennyLane-Lightning
uses: actions/checkout@v3
with:
fetch-depth: 2
- name: Configure MSVC for amd64 # Use cl.exe as a default compiler
uses: ilammy/msvc-dev-cmd@v1
with:
arch: amd64
- name: Setup OpenCppCoverage and add to PATH
run: |
choco install OpenCppCoverage -y
echo "C:\Program Files\OpenCppCoverage" >> $env:GITHUB_PATH
- name: Build and run unit tests for code coverage
run: |
cmake -BBuild `
-DBUILD_TESTS=ON `
-DENABLE_OPENMP=OFF `
-DENABLE_PYTHON=OFF `
-DENABLE_GATE_DISPATCHER=OFF `
-DPL_BACKEND=${{ matrix.pl_backend }} `
-DENABLE_WARNINGS=OFF
cmake --build .\Build --config Debug
mkdir -p .\Build\tests\results
$test_bins = Get-ChildItem -Include *.exe -Recurse -Path ./Build/Debug
foreach ($file in $test_bins)
{
$filename = $file.ToString() -replace '.{4}$'
$filename = $filename.Substring($filename.LastIndexOf("\")+1)
$test_call = $file.ToString() + " --order lex --reporter junit --out .\Build\tests\results\report_" + $filename + ".xml"
Invoke-Expression $test_call
}
- name: Upload test results
uses: actions/upload-artifact@v3
if: always()
with:
name: windows-test-report-${{ github.job }}-${{ matrix.pl_backend }}
path: .\Build\tests\results\
win-set-matrix-x86:
name: Set builder matrix
runs-on: ubuntu-latest
steps:
- name: Checkout PennyLane-Lightning
uses: actions/checkout@v3
- name: Kokkos execution strategy
id: exec_model
run: echo "exec_model=[\"SERIAL\"]" >> $GITHUB_OUTPUT # We may also adopt [OPENMP, THREADS] in later iterations
- name: Kokkos version
id: kokkos_version
run: echo "kokkos_version=[\"4.0.01\"]" >> $GITHUB_OUTPUT
outputs:
exec_model: ${{ steps.exec_model.outputs.exec_model }}
kokkos_version: ${{ steps.kokkos_version.outputs.kokkos_version }}
build_dependencies:
needs: [win-set-matrix-x86]
strategy:
fail-fast: false
matrix:
os: [windows-2019]
exec_model: ${{ fromJson(needs.win-set-matrix-x86.outputs.exec_model) }}
kokkos_version: ${{ fromJson(needs.win-set-matrix-x86.outputs.kokkos_version) }}
exclude:
- os: windows-2019
name: Kokkos core (${{ matrix.exec_model }})
runs-on: ${{ matrix.os }}
steps:
- name: Cache installation directories
id: kokkos-cache
uses: actions/cache@v3
with:
path: D:\a\install_dir\${{ matrix.exec_model }}
key: ${{ matrix.os }}-kokkos${{ matrix.kokkos_version }}-${{ matrix.exec_model }}-Debug
- name: Clone Kokkos libs
if: steps.kokkos-cache.outputs.cache-hit != 'true'
run: |
cd D:\a
git clone https://github.com/kokkos/kokkos.git
cd D:\a\kokkos
git checkout ${{ matrix.kokkos_version }}
cd ..
- name: Create installation directory
if: steps.kokkos-cache.outputs.cache-hit != 'true'
run: |
Remove-Item -Path D:\a\install_dir\${{ matrix.exec_model }} -Recurse -Force -ErrorAction Ignore
mkdir -p D:\a\install_dir\${{ matrix.exec_model }}
- name: Install dependencies
if: steps.kokkos-cache.outputs.cache-hit != 'true'
run: |
python -m pip install cmake build
- name: Build Kokkos core library
if: steps.kokkos-cache.outputs.cache-hit != 'true'
run: |
cd D:\a\kokkos
cmake -BBuild . -DCMAKE_INSTALL_PREFIX=D:\a\install_dir\${{ matrix.exec_model }} `
-DKokkos_ENABLE_COMPLEX_ALIGN=OFF `
-DKokkos_ENABLE_SERIAL=ON `
-DKokkos_ENABLE_${{ matrix.exec_model }}=ON `
-DKokkos_ENABLE_DEPRECATION_WARNINGS=OFF `
-DCMAKE_CXX_STANDARD=20 `
-DCMAKE_POSITION_INDEPENDENT_CODE=ON `
-DCMAKE_BUILD_TYPE=Debug `
-T clangcl
cmake --build ./Build --config Debug --verbose
cmake --install ./Build --config Debug --verbose
cpptestswithkokkos:
needs: [build_dependencies, win-set-matrix-x86]
strategy:
matrix:
os: [windows-2019]
pl_backend: ["lightning_qubit"]
exec_model: ${{ fromJson(needs.win-set-matrix-x86.outputs.exec_model) }}
kokkos_version: ${{ fromJson(needs.win-set-matrix-x86.outputs.kokkos_version) }}
exclude:
- os: windows-2019
name: C++ tests (Windows, Kokkos)
runs-on: ${{ matrix.os }}
steps:
- name: Restoring cached dependencies
id: kokkos-cache
uses: actions/cache@v3
with:
path: D:\a\install_dir\${{ matrix.exec_model }}
key: ${{ matrix.os }}-kokkos${{ matrix.kokkos_version }}-${{ matrix.exec_model }}-Debug
- name: Checkout PennyLane-Lightning
uses: actions/checkout@v3
- name: Copy cached libraries
if: steps.kokkos-cache.outputs.cache-hit == 'true'
run: |
Copy-Item -Path "D:\a\install_dir\${{ matrix.exec_model }}\" `
-Destination "D:\a\pennylane-lightning\pennylane-lightning\Kokkos" -Recurse -Force
- name: Configure MSVC for amd64 # Use cl.exe as a default compiler
uses: ilammy/msvc-dev-cmd@v1
with:
arch: amd64
- name: Enable long paths
run: |
powershell.exe New-ItemProperty -Path "HKLM:\SYSTEM\CurrentControlSet\Control\FileSystem" -Name "LongPathsEnabled" -Value 1 -PropertyType DWORD -Force
- name: Setup OpenCppCoverage and add to PATH
run: |
choco install OpenCppCoverage -y
echo "C:\Program Files\OpenCppCoverage" >> $env:GITHUB_PATH
- name: Build and run unit tests for code coverage
run: |
Subst Z: (pwd)
Set-Location -Path "Z:\"
cmake -BBuild `
-DBUILD_TESTS=ON `
-DENABLE_PYTHON=OFF `
-DENABLE_GATE_DISPATCHER=OFF `
-DCMAKE_PREFIX_PATH=D:\a\pennylane-lightning\pennylane-lightning\Kokkos `
-DENABLE_OPENMP=OFF `
-DPL_BACKEND=${{ matrix.pl_backend }} `
-DENABLE_WARNINGS=OFF -T clangcl
cmake --build .\Build --config Debug -- /p:UseMultiToolTask=true /p:EnforceProcessCountAcrossBuilds=true /p:MultiProcMaxCount=2
mkdir -p .\Build\tests\results
$test_bins = Get-ChildItem -Include *.exe -Recurse -Path ./Build/Debug
foreach ($file in $test_bins)
{
$filename = $file.ToString() -replace '.{4}$'
$filename = $filename.Substring($filename.LastIndexOf("\")+1)
$test_call = $file.ToString() + " --order lex --reporter junit --out .\Build\tests\results\report_" + $filename + ".xml"
Invoke-Expression $test_call
}
- name: Upload test results
uses: actions/upload-artifact@v3
if: always()
with:
name: windows-test-report-${{ github.job }}-${{ matrix.pl_backend }}
path: .\Build\tests\results\