Skip to content

Commit f451f71

Browse files
Merge branch 'oneapi-src:develop' into linux-ci
2 parents 8d28a70 + 8900fa4 commit f451f71

File tree

520 files changed

+47346
-11698
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

520 files changed

+47346
-11698
lines changed

.github/scripts/domain-check.js

Lines changed: 156 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,156 @@
1+
//
2+
// This script is used by pr.yml to determine if a domain must be tested based
3+
// on the files modified in the pull request.
4+
//
5+
6+
// Given a domain name and set of files, return true if the domain should be
7+
// tested
8+
function matchesPattern(domain, filePaths) {
9+
// filter files that end in .md
10+
filePaths = filePaths.filter(
11+
(filePath) =>
12+
!filePath.endsWith(".md") &&
13+
!filePath.startsWith("docs/") &&
14+
!filePath.startsWith("third-party-programs/"),
15+
);
16+
// These directories contain domain specific code
17+
const dirs = "(tests/unit_tests|examples|src|include/oneapi/mkl)";
18+
const domains = "(blas|lapack|rng|dft)";
19+
// matches changes to the domain of interest or non domain-specific code
20+
const re = new RegExp(`^(${dirs}/${domain}|(?!${dirs}/${domains}))`);
21+
const match = filePaths.some((filePath) => re.test(filePath));
22+
return match;
23+
}
24+
25+
// Return the list of files modified in the pull request
26+
async function prFiles(github, context) {
27+
let allFiles = [];
28+
let page = 0;
29+
let filesPerPage = 100; // GitHub's maximum per page
30+
31+
while (true) {
32+
page++;
33+
const response = await github.rest.pulls.listFiles({
34+
owner: context.repo.owner,
35+
repo: context.repo.repo,
36+
pull_number: context.payload.pull_request.number,
37+
per_page: filesPerPage,
38+
page: page,
39+
});
40+
41+
if (response.data.length === 0) {
42+
break; // Exit the loop if no more files are returned
43+
}
44+
45+
allFiles = allFiles.concat(response.data.map((file) => file.filename));
46+
47+
if (response.data.length < filesPerPage) {
48+
break; // Exit the loop if last page
49+
}
50+
}
51+
52+
return allFiles;
53+
}
54+
55+
// Called by pr.yml. See:
56+
// https://github.com/actions/github-script/blob/main/README.md for more
57+
// information on the github and context parameters
58+
module.exports = async ({ github, context, domain }) => {
59+
if (!context.payload.pull_request) {
60+
console.log("Not a pull request. Testing all domains.");
61+
return true;
62+
}
63+
const files = await prFiles(github, context);
64+
const match = matchesPattern(domain, files);
65+
console.log("Domain: ", domain);
66+
console.log("PR files: ", files);
67+
console.log("Match: ", match);
68+
return match;
69+
};
70+
71+
//
72+
// Test the matchesPattern function
73+
//
74+
// Run this script with `node domain-check.js` It should exit with code 0 if
75+
// all tests pass.
76+
//
77+
// If you need to change the set of files that are ignored, add a test pattern
78+
// below with positive and negative examples. It is also possible to test by
79+
// setting up a fork and then submitting pull requests that modify files, but
80+
// it requires a lot of manual work.
81+
//
82+
test_patterns = [
83+
{
84+
domain: "blas",
85+
files: ["tests/unit_tests/blas/test_blas.cpp"],
86+
expected: true,
87+
},
88+
{
89+
domain: "rng",
90+
files: ["examples/rng/example_rng.cpp"],
91+
expected: true,
92+
},
93+
{
94+
domain: "lapack",
95+
files: ["include/oneapi/mkl/lapack/lapack.hpp"],
96+
expected: true,
97+
},
98+
{
99+
domain: "dft",
100+
files: ["src/dft/lapack.hpp"],
101+
expected: true,
102+
},
103+
{
104+
domain: "dft",
105+
files: ["src/dft/lapack.md"],
106+
expected: false,
107+
},
108+
{
109+
domain: "blas",
110+
files: ["tests/unit_tests/dft/test_blas.cpp"],
111+
expected: false,
112+
},
113+
{
114+
domain: "rng",
115+
files: ["examples/blas/example_rng.cpp"],
116+
expected: false,
117+
},
118+
{
119+
domain: "lapack",
120+
files: ["include/oneapi/mkl/rng/lapack.hpp"],
121+
expected: false,
122+
},
123+
{
124+
domain: "dft",
125+
files: ["src/lapack/lapack.hpp"],
126+
expected: false,
127+
},
128+
{
129+
domain: "dft",
130+
files: ["docs/dft/dft.rst"],
131+
expected: false,
132+
},
133+
{
134+
domain: "dft",
135+
files: ["third-party-programs/dft/dft.rst"],
136+
expected: false,
137+
},
138+
];
139+
140+
function testPattern(test) {
141+
const result = matchesPattern(test.domain, test.files);
142+
if (result !== test.expected) {
143+
console.log("Fail:");
144+
console.log(" domain:", test.domain);
145+
console.log(" files:", test.files);
146+
console.log(" expected:", test.expected);
147+
console.log(" result:", result);
148+
process.exit(1);
149+
}
150+
}
151+
152+
if (require.main === module) {
153+
// invoke test for each test pattern
154+
test_patterns.forEach(testPattern);
155+
console.log("All tests pass");
156+
}
Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
name: Documentation
2+
permissions: read-all
3+
4+
# Trigger for PR or merge to develop branch
5+
on:
6+
push:
7+
branches: develop
8+
paths:
9+
- 'docs/**'
10+
pull_request:
11+
paths:
12+
- 'docs/**'
13+
workflow_dispatch:
14+
15+
jobs:
16+
build:
17+
runs-on: ubuntu-latest
18+
steps:
19+
- uses: actions/checkout@44c2b7a8a4ea60a981eaca3cf939b5f4305c123b # v4.1.5
20+
- uses: actions/setup-python@82c7e631bb3cdc910f68e0081d67478d79c6982d # v5.1.0
21+
with:
22+
python-version: '3.11'
23+
cache: 'pip'
24+
- name: Install Dependencies
25+
run: pip install -r docs/requirements.txt
26+
- name: Configure & Build
27+
run: |
28+
cmake -DCMAKE_VERBOSE_MAKEFILE=on -B build docs
29+
cmake --build build
30+
- uses: actions/upload-artifact@65462800fd760344b1a7b4382951275a0abb4808 # v4.3.3
31+
with:
32+
name: docs
33+
path: build/Documentation/html
34+
35+
publish:
36+
needs: build
37+
if: github.event_name == 'workflow_dispatch' || github.event_name == 'push' && github.ref == 'refs/heads/develop'
38+
runs-on: ubuntu-latest
39+
permissions:
40+
contents: write
41+
steps:
42+
- uses: actions/checkout@44c2b7a8a4ea60a981eaca3cf939b5f4305c123b # v4.1.5
43+
with:
44+
ref: gh-pages
45+
path: gh-pages
46+
- name: Remove old site
47+
run: rm -rf gh-pages/*
48+
- uses: actions/download-artifact@65a9edc5881444af0b9093a5e628f2fe47ea3b2e # v4.1.7
49+
with:
50+
name: docs
51+
path: gh-pages
52+
- name: Push to GitHub Pages
53+
run: |
54+
cd gh-pages
55+
touch .nojekyll
56+
git add .
57+
git config --global user.name "GitHub Actions"
58+
git config --global user.email [email protected]
59+
git commit -m "Update documentation"
60+
git push --force origin gh-pages

.github/workflows/pr.yml

Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
name: "PR Tests"
2+
permissions: read-all
3+
4+
# Trigger for PR and merge to develop branch
5+
on:
6+
push:
7+
branches: develop
8+
pull_request:
9+
workflow_dispatch:
10+
11+
env:
12+
CTEST_OUTPUT_ON_FAILURE: 1
13+
LAPACK_VERSION: 3.12.0
14+
PARALLEL: -j 2
15+
16+
jobs:
17+
unit-tests:
18+
runs-on: ubuntu-latest
19+
# One runner for each domain
20+
strategy:
21+
matrix:
22+
include:
23+
- config: portBLAS
24+
domain: blas
25+
build_options: -DREF_BLAS_ROOT=${PWD}/lapack/install -DENABLE_PORTBLAS_BACKEND=ON -DENABLE_MKLCPU_BACKEND=OFF -DPORTBLAS_TUNING_TARGET=INTEL_CPU
26+
- config: portFFT
27+
domain: dft
28+
build_options: -DENABLE_PORTFFT_BACKEND=ON -DENABLE_MKLCPU_BACKEND=OFF
29+
test_options: -R 'DFT/CT/.*ComputeTests_in_place_COMPLEX.COMPLEX_SINGLE_in_place_buffer.sizes_8_batches_1*'
30+
- config: MKL BLAS
31+
domain: blas
32+
build_options: -DREF_BLAS_ROOT=${PWD}/lapack/install
33+
- config: MKL DFT
34+
domain: dft
35+
- config: MKL LAPACK
36+
domain: lapack
37+
build_options: -DREF_LAPACK_ROOT=${PWD}/lapack/install
38+
- config: MKL RNG
39+
domain: rng
40+
name: unit tests ${{ matrix.config }} CPU
41+
steps:
42+
- uses: actions/checkout@44c2b7a8a4ea60a981eaca3cf939b5f4305c123b # v4.1.5
43+
- name: Check if the changes affect this domain
44+
id: domain_check
45+
uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1
46+
with:
47+
script: |
48+
const domainCheck = require('.github/scripts/domain-check.js')
49+
return domainCheck({github, context, domain: "${{ matrix.domain }}"})
50+
- name: Restore netlib from cache
51+
id: cache-lapack
52+
uses: actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v4.0.2
53+
with:
54+
path: lapack/install
55+
key: lapack-${{ env.LAPACK_VERSION }}
56+
- name: Install netlib
57+
if: steps.domain_check.outputs.result == 'true' && steps.cache-lapack.outputs.cache-hit != 'true'
58+
run: |
59+
curl -sL https://github.com/Reference-LAPACK/lapack/archive/refs/tags/v${LAPACK_VERSION}.tar.gz | tar zx
60+
SHARED_OPT="lapack-${LAPACK_VERSION} -DBUILD_SHARED_LIBS=on -DCBLAS=on -DLAPACKE=on -DCMAKE_INSTALL_PREFIX=${PWD}/lapack/install"
61+
# 32 bit int
62+
cmake ${SHARED_OPT} -B lapack/build32
63+
cmake --build lapack/build32 ${PARALLEL} --target install
64+
# 64 bit int
65+
cmake ${SHARED_OPT} -DBUILD_INDEX64=on -B lapack/build64
66+
cmake --build lapack/build64 ${PARALLEL} --target install
67+
- name: Install oneapi
68+
if: steps.domain_check.outputs.result == 'true'
69+
uses: rscohn2/setup-oneapi@2ad0cf6b74bc2426bdcee825cf88f9db719dd727 # v0.1.0
70+
with:
71+
components: |
72+
73+
74+
- name: Configure/Build for a domain
75+
if: steps.domain_check.outputs.result == 'true'
76+
run: |
77+
source /opt/intel/oneapi/setvars.sh
78+
cmake -DTARGET_DOMAINS=${{ matrix.domain }} -DENABLE_MKLGPU_BACKEND=off -DCMAKE_VERBOSE_MAKEFILE=on ${{ matrix.build_options }} -B build
79+
cmake --build build ${PARALLEL}
80+
- name: Run tests
81+
if: steps.domain_check.outputs.result == 'true'
82+
run: |
83+
source /opt/intel/oneapi/setvars.sh
84+
ctest --test-dir build ${{ matrix.test_options }}

.github/workflows/slack-pr.yaml

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
#===============================================================================
2+
# Copyright 2024 Intel Corporation
3+
#
4+
# Licensed under the Apache License, Version 2.0 (the "License");
5+
# you may not use this file except in compliance with the License.
6+
# You may obtain a copy of the License at
7+
#
8+
# http://www.apache.org/licenses/LICENSE-2.0
9+
#
10+
# Unless required by applicable law or agreed to in writing, software
11+
# distributed under the License is distributed on an "AS IS" BASIS,
12+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
# See the License for the specific language governing permissions and
14+
# limitations under the License.
15+
#===============================================================================
16+
17+
name: Slack PR Notification
18+
on:
19+
# use pull_request_target to run on PRs from forks and have access to secrets
20+
pull_request_target:
21+
types: [labeled]
22+
23+
env:
24+
SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }}
25+
channel: "onemkl"
26+
27+
permissions:
28+
pull-requests: read
29+
30+
jobs:
31+
rfc:
32+
name: RFC Notification
33+
runs-on: ubuntu-latest
34+
# Trigger when labeling a PR with "RFC"
35+
if: |
36+
github.event.action == 'labeled' &&
37+
contains(toJson(github.event.pull_request.labels.*.name), '"RFC"')
38+
steps:
39+
- name: Notify Slack
40+
uses: slackapi/slack-github-action@70cd7be8e40a46e8b0eced40b0de447bdb42f68e # v1.26.0
41+
with:
42+
channel-id: ${{ env.channel }}
43+
slack-message: "${{ github.actor }} posted a RFC: ${{ github.event.pull_request.title }}. URL: ${{ github.event.pull_request.html_url }}"

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,4 @@
1616
.git/
1717

1818
# Build
19-
build/
19+
build*/

0 commit comments

Comments
 (0)