forked from uxlfoundation/oneMath
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'oneapi-src:develop' into linux-ci
- Loading branch information
Showing
520 changed files
with
47,346 additions
and
11,698 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,156 @@ | ||
// | ||
// This script is used by pr.yml to determine if a domain must be tested based | ||
// on the files modified in the pull request. | ||
// | ||
|
||
// Given a domain name and set of files, return true if the domain should be | ||
// tested | ||
function matchesPattern(domain, filePaths) { | ||
// filter files that end in .md | ||
filePaths = filePaths.filter( | ||
(filePath) => | ||
!filePath.endsWith(".md") && | ||
!filePath.startsWith("docs/") && | ||
!filePath.startsWith("third-party-programs/"), | ||
); | ||
// These directories contain domain specific code | ||
const dirs = "(tests/unit_tests|examples|src|include/oneapi/mkl)"; | ||
const domains = "(blas|lapack|rng|dft)"; | ||
// matches changes to the domain of interest or non domain-specific code | ||
const re = new RegExp(`^(${dirs}/${domain}|(?!${dirs}/${domains}))`); | ||
const match = filePaths.some((filePath) => re.test(filePath)); | ||
return match; | ||
} | ||
|
||
// Return the list of files modified in the pull request | ||
async function prFiles(github, context) { | ||
let allFiles = []; | ||
let page = 0; | ||
let filesPerPage = 100; // GitHub's maximum per page | ||
|
||
while (true) { | ||
page++; | ||
const response = await github.rest.pulls.listFiles({ | ||
owner: context.repo.owner, | ||
repo: context.repo.repo, | ||
pull_number: context.payload.pull_request.number, | ||
per_page: filesPerPage, | ||
page: page, | ||
}); | ||
|
||
if (response.data.length === 0) { | ||
break; // Exit the loop if no more files are returned | ||
} | ||
|
||
allFiles = allFiles.concat(response.data.map((file) => file.filename)); | ||
|
||
if (response.data.length < filesPerPage) { | ||
break; // Exit the loop if last page | ||
} | ||
} | ||
|
||
return allFiles; | ||
} | ||
|
||
// Called by pr.yml. See: | ||
// https://github.com/actions/github-script/blob/main/README.md for more | ||
// information on the github and context parameters | ||
module.exports = async ({ github, context, domain }) => { | ||
if (!context.payload.pull_request) { | ||
console.log("Not a pull request. Testing all domains."); | ||
return true; | ||
} | ||
const files = await prFiles(github, context); | ||
const match = matchesPattern(domain, files); | ||
console.log("Domain: ", domain); | ||
console.log("PR files: ", files); | ||
console.log("Match: ", match); | ||
return match; | ||
}; | ||
|
||
// | ||
// Test the matchesPattern function | ||
// | ||
// Run this script with `node domain-check.js` It should exit with code 0 if | ||
// all tests pass. | ||
// | ||
// If you need to change the set of files that are ignored, add a test pattern | ||
// below with positive and negative examples. It is also possible to test by | ||
// setting up a fork and then submitting pull requests that modify files, but | ||
// it requires a lot of manual work. | ||
// | ||
test_patterns = [ | ||
{ | ||
domain: "blas", | ||
files: ["tests/unit_tests/blas/test_blas.cpp"], | ||
expected: true, | ||
}, | ||
{ | ||
domain: "rng", | ||
files: ["examples/rng/example_rng.cpp"], | ||
expected: true, | ||
}, | ||
{ | ||
domain: "lapack", | ||
files: ["include/oneapi/mkl/lapack/lapack.hpp"], | ||
expected: true, | ||
}, | ||
{ | ||
domain: "dft", | ||
files: ["src/dft/lapack.hpp"], | ||
expected: true, | ||
}, | ||
{ | ||
domain: "dft", | ||
files: ["src/dft/lapack.md"], | ||
expected: false, | ||
}, | ||
{ | ||
domain: "blas", | ||
files: ["tests/unit_tests/dft/test_blas.cpp"], | ||
expected: false, | ||
}, | ||
{ | ||
domain: "rng", | ||
files: ["examples/blas/example_rng.cpp"], | ||
expected: false, | ||
}, | ||
{ | ||
domain: "lapack", | ||
files: ["include/oneapi/mkl/rng/lapack.hpp"], | ||
expected: false, | ||
}, | ||
{ | ||
domain: "dft", | ||
files: ["src/lapack/lapack.hpp"], | ||
expected: false, | ||
}, | ||
{ | ||
domain: "dft", | ||
files: ["docs/dft/dft.rst"], | ||
expected: false, | ||
}, | ||
{ | ||
domain: "dft", | ||
files: ["third-party-programs/dft/dft.rst"], | ||
expected: false, | ||
}, | ||
]; | ||
|
||
function testPattern(test) { | ||
const result = matchesPattern(test.domain, test.files); | ||
if (result !== test.expected) { | ||
console.log("Fail:"); | ||
console.log(" domain:", test.domain); | ||
console.log(" files:", test.files); | ||
console.log(" expected:", test.expected); | ||
console.log(" result:", result); | ||
process.exit(1); | ||
} | ||
} | ||
|
||
if (require.main === module) { | ||
// invoke test for each test pattern | ||
test_patterns.forEach(testPattern); | ||
console.log("All tests pass"); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
name: Documentation | ||
permissions: read-all | ||
|
||
# Trigger for PR or merge to develop branch | ||
on: | ||
push: | ||
branches: develop | ||
paths: | ||
- 'docs/**' | ||
pull_request: | ||
paths: | ||
- 'docs/**' | ||
workflow_dispatch: | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@44c2b7a8a4ea60a981eaca3cf939b5f4305c123b # v4.1.5 | ||
- uses: actions/setup-python@82c7e631bb3cdc910f68e0081d67478d79c6982d # v5.1.0 | ||
with: | ||
python-version: '3.11' | ||
cache: 'pip' | ||
- name: Install Dependencies | ||
run: pip install -r docs/requirements.txt | ||
- name: Configure & Build | ||
run: | | ||
cmake -DCMAKE_VERBOSE_MAKEFILE=on -B build docs | ||
cmake --build build | ||
- uses: actions/upload-artifact@65462800fd760344b1a7b4382951275a0abb4808 # v4.3.3 | ||
with: | ||
name: docs | ||
path: build/Documentation/html | ||
|
||
publish: | ||
needs: build | ||
if: github.event_name == 'workflow_dispatch' || github.event_name == 'push' && github.ref == 'refs/heads/develop' | ||
runs-on: ubuntu-latest | ||
permissions: | ||
contents: write | ||
steps: | ||
- uses: actions/checkout@44c2b7a8a4ea60a981eaca3cf939b5f4305c123b # v4.1.5 | ||
with: | ||
ref: gh-pages | ||
path: gh-pages | ||
- name: Remove old site | ||
run: rm -rf gh-pages/* | ||
- uses: actions/download-artifact@65a9edc5881444af0b9093a5e628f2fe47ea3b2e # v4.1.7 | ||
with: | ||
name: docs | ||
path: gh-pages | ||
- name: Push to GitHub Pages | ||
run: | | ||
cd gh-pages | ||
touch .nojekyll | ||
git add . | ||
git config --global user.name "GitHub Actions" | ||
git config --global user.email [email protected] | ||
git commit -m "Update documentation" | ||
git push --force origin gh-pages |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
name: "PR Tests" | ||
permissions: read-all | ||
|
||
# Trigger for PR and merge to develop branch | ||
on: | ||
push: | ||
branches: develop | ||
pull_request: | ||
workflow_dispatch: | ||
|
||
env: | ||
CTEST_OUTPUT_ON_FAILURE: 1 | ||
LAPACK_VERSION: 3.12.0 | ||
PARALLEL: -j 2 | ||
|
||
jobs: | ||
unit-tests: | ||
runs-on: ubuntu-latest | ||
# One runner for each domain | ||
strategy: | ||
matrix: | ||
include: | ||
- config: portBLAS | ||
domain: blas | ||
build_options: -DREF_BLAS_ROOT=${PWD}/lapack/install -DENABLE_PORTBLAS_BACKEND=ON -DENABLE_MKLCPU_BACKEND=OFF -DPORTBLAS_TUNING_TARGET=INTEL_CPU | ||
- config: portFFT | ||
domain: dft | ||
build_options: -DENABLE_PORTFFT_BACKEND=ON -DENABLE_MKLCPU_BACKEND=OFF | ||
test_options: -R 'DFT/CT/.*ComputeTests_in_place_COMPLEX.COMPLEX_SINGLE_in_place_buffer.sizes_8_batches_1*' | ||
- config: MKL BLAS | ||
domain: blas | ||
build_options: -DREF_BLAS_ROOT=${PWD}/lapack/install | ||
- config: MKL DFT | ||
domain: dft | ||
- config: MKL LAPACK | ||
domain: lapack | ||
build_options: -DREF_LAPACK_ROOT=${PWD}/lapack/install | ||
- config: MKL RNG | ||
domain: rng | ||
name: unit tests ${{ matrix.config }} CPU | ||
steps: | ||
- uses: actions/checkout@44c2b7a8a4ea60a981eaca3cf939b5f4305c123b # v4.1.5 | ||
- name: Check if the changes affect this domain | ||
id: domain_check | ||
uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1 | ||
with: | ||
script: | | ||
const domainCheck = require('.github/scripts/domain-check.js') | ||
return domainCheck({github, context, domain: "${{ matrix.domain }}"}) | ||
- name: Restore netlib from cache | ||
id: cache-lapack | ||
uses: actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v4.0.2 | ||
with: | ||
path: lapack/install | ||
key: lapack-${{ env.LAPACK_VERSION }} | ||
- name: Install netlib | ||
if: steps.domain_check.outputs.result == 'true' && steps.cache-lapack.outputs.cache-hit != 'true' | ||
run: | | ||
curl -sL https://github.com/Reference-LAPACK/lapack/archive/refs/tags/v${LAPACK_VERSION}.tar.gz | tar zx | ||
SHARED_OPT="lapack-${LAPACK_VERSION} -DBUILD_SHARED_LIBS=on -DCBLAS=on -DLAPACKE=on -DCMAKE_INSTALL_PREFIX=${PWD}/lapack/install" | ||
# 32 bit int | ||
cmake ${SHARED_OPT} -B lapack/build32 | ||
cmake --build lapack/build32 ${PARALLEL} --target install | ||
# 64 bit int | ||
cmake ${SHARED_OPT} -DBUILD_INDEX64=on -B lapack/build64 | ||
cmake --build lapack/build64 ${PARALLEL} --target install | ||
- name: Install oneapi | ||
if: steps.domain_check.outputs.result == 'true' | ||
uses: rscohn2/setup-oneapi@2ad0cf6b74bc2426bdcee825cf88f9db719dd727 # v0.1.0 | ||
with: | ||
components: | | ||
[email protected] | ||
[email protected] | ||
- name: Configure/Build for a domain | ||
if: steps.domain_check.outputs.result == 'true' | ||
run: | | ||
source /opt/intel/oneapi/setvars.sh | ||
cmake -DTARGET_DOMAINS=${{ matrix.domain }} -DENABLE_MKLGPU_BACKEND=off -DCMAKE_VERBOSE_MAKEFILE=on ${{ matrix.build_options }} -B build | ||
cmake --build build ${PARALLEL} | ||
- name: Run tests | ||
if: steps.domain_check.outputs.result == 'true' | ||
run: | | ||
source /opt/intel/oneapi/setvars.sh | ||
ctest --test-dir build ${{ matrix.test_options }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
#=============================================================================== | ||
# Copyright 2024 Intel Corporation | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
#=============================================================================== | ||
|
||
name: Slack PR Notification | ||
on: | ||
# use pull_request_target to run on PRs from forks and have access to secrets | ||
pull_request_target: | ||
types: [labeled] | ||
|
||
env: | ||
SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }} | ||
channel: "onemkl" | ||
|
||
permissions: | ||
pull-requests: read | ||
|
||
jobs: | ||
rfc: | ||
name: RFC Notification | ||
runs-on: ubuntu-latest | ||
# Trigger when labeling a PR with "RFC" | ||
if: | | ||
github.event.action == 'labeled' && | ||
contains(toJson(github.event.pull_request.labels.*.name), '"RFC"') | ||
steps: | ||
- name: Notify Slack | ||
uses: slackapi/slack-github-action@70cd7be8e40a46e8b0eced40b0de447bdb42f68e # v1.26.0 | ||
with: | ||
channel-id: ${{ env.channel }} | ||
slack-message: "${{ github.actor }} posted a RFC: ${{ github.event.pull_request.title }}. URL: ${{ github.event.pull_request.html_url }}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,4 +16,4 @@ | |
.git/ | ||
|
||
# Build | ||
build/ | ||
build*/ |
Oops, something went wrong.