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

Commit 05c5d5a

Browse files
Enable CI for Numba PyOMP (#32)
* Add Github CI for Numba PyOMP * Fix target execution for host device(1) * Add LLNL gitlab ci
1 parent 1b34204 commit 05c5d5a

File tree

11 files changed

+540
-19
lines changed

11 files changed

+540
-19
lines changed

.github/workflows/pyomp-ci.yml

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
name: Test Numba PyOMP
2+
3+
on:
4+
push:
5+
pull_request:
6+
workflow_dispatch:
7+
8+
jobs:
9+
build-and-test:
10+
strategy:
11+
matrix:
12+
os: [ubuntu-latest]
13+
#os: [ubuntu-latest, macOS-latest]
14+
name: Build Numba PyOMP for platform ${{ matrix.os }}
15+
runs-on: ${{ matrix.os }}
16+
defaults:
17+
run:
18+
shell: bash -el {0}
19+
steps:
20+
- uses: actions/checkout@v4
21+
- name: Create conda environment
22+
uses: conda-incubator/setup-miniconda@v3
23+
with:
24+
auto-update-conda: false
25+
auto-activate-base: false
26+
show-channel-urls: true
27+
- name: Build Numba PyOMP
28+
run: |
29+
conda create -c python-for-hpc -c conda-forge --override-channels -n test-numba-pyomp \
30+
llvmdev llvmlite numpy=1.24 lark-parser cffi python=3.10
31+
conda init
32+
conda activate test-numba-pyomp
33+
pushd ${GITHUB_WORKSPACE}
34+
MACOSX_DEPLOYMENT_TARGET=10.10 python setup.py build_static build_ext build install --single-version-externally-managed --record=record.txt
35+
mkdir -p ${GITHUB_WORKSPACE}/bin
36+
mkdir -p ${GITHUB_WORKSPACE}/lib
37+
cp ${CONDA_PREFIX}/bin/clang ${GITHUB_WORKSPACE}/bin
38+
cp ${CONDA_PREFIX}/bin/opt ${GITHUB_WORKSPACE}/bin
39+
cp ${CONDA_PREFIX}/bin/llc ${GITHUB_WORKSPACE}/bin
40+
cp ${CONDA_PREFIX}/bin/llvm-link ${GITHUB_WORKSPACE}/bin
41+
cp ${CONDA_PREFIX}/lib/lib*omp* ${GITHUB_WORKSPACE}/lib
42+
popd
43+
- name: Test Numba PyOMP Host
44+
env:
45+
TEST_DEVICES: 1
46+
RUN_TARGET: 0
47+
run: |
48+
# Must be in a different directory to run tests.
49+
pushd ${RUNNER_WORKSPACE}
50+
conda init
51+
conda activate test-numba-pyomp
52+
numba -h
53+
numba -s
54+
python -m numba.runtests -v -- numba.tests.test_openmp
55+
popd
56+
- name: Test Numba PyOMP Device target host device(1)
57+
env:
58+
TEST_DEVICES: 1
59+
RUN_TARGET: 1
60+
run: |
61+
# Must be in a different directory to run tests.
62+
pushd ${RUNNER_WORKSPACE}
63+
conda init
64+
conda activate test-numba-pyomp
65+
numba -h
66+
numba -s
67+
python -m numba.runtests -v -- numba.tests.test_openmp.TestOpenmpTarget
68+
popd

.gitlab-ci.yml

Lines changed: 98 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,98 @@
1+
###############################################################################
2+
# Copyright (c) 2022-23, Lawrence Livermore National Security, LLC and RADIUSS
3+
# project contributors. See the COPYRIGHT file for details.
4+
#
5+
# SPDX-License-Identifier: (MIT)
6+
###############################################################################
7+
8+
# DESCRIPTION:
9+
###############################################################################
10+
# General GitLab pipelines configurations for supercomputers and Linux clusters
11+
# at Lawrence Livermore National Laboratory (LLNL).
12+
# This entire pipeline is LLNL-specific
13+
#
14+
# Important note: This file is a template provided by llnl/radiuss-shared-ci.
15+
# Remains to set variable values, change the reference to the radiuss-shared-ci
16+
# repo, opt-in and out optional features. The project can then extend it with
17+
# additional stages.
18+
#
19+
# In addition, each project should copy over and complete:
20+
# - .gitlab/custom-jobs-and-variables.yml
21+
# - .gitlab/subscribed-pipelines.yml
22+
#
23+
# The jobs should be specified in a file local to the project,
24+
# - .gitlab/jobs/${CI_MACHINE}.yml
25+
# or generated (see LLNL/Umpire for an example).
26+
###############################################################################
27+
28+
# We define the following GitLab pipeline variables:
29+
variables:
30+
##### LC GITLAB CONFIGURATION
31+
# Use an LLNL service user to run CI. This prevents from running pipelines as
32+
# an actual user.
33+
LLNL_SERVICE_USER: ""
34+
# Use the service user workspace. Solves permission issues, stores everything
35+
# at the same location whoever triggers a pipeline.
36+
CUSTOM_CI_BUILDS_DIR: "/usr/workspace/ggeorgak/projects/pyomp/gitlab-runner"
37+
# Tells Gitlab to recursively update the submodules when cloning the project.
38+
# GIT_SUBMODULE_STRATEGY: recursive
39+
40+
##### PROJECT VARIABLES
41+
# We build the projects in the CI clone directory.
42+
# Used in script/gitlab/build_and_test.sh script.
43+
# TODO: add a clean-up mechanism.
44+
BUILD_ROOT: ${CI_PROJECT_DIR}
45+
46+
##### SHARED_CI CONFIGURATION
47+
# Required information about GitHub repository
48+
GITHUB_PROJECT_NAME: "numbaWithOpenmp"
49+
GITHUB_PROJECT_ORG: "Python-for-HPC"
50+
# Set the build-and-test command.
51+
# Nested variables are allowed and useful to customize the job command. We
52+
# prevent variable expansion so that you can define them at job level.
53+
JOB_CMD:
54+
value: "buildscripts/gitlab/ci-build-test.sh"
55+
expand: false
56+
# Override the pattern describing branches that will skip the "draft PR filter
57+
# test". Add protected branches here. See default value in
58+
# preliminary-ignore-draft-pr.yml.
59+
# ALWAYS_RUN_PATTERN: ""
60+
61+
# We organize the build-and-test stage with sub-pipelines. Each sub-pipeline
62+
# corresponds to a test batch on a given machine.
63+
64+
# High level stages
65+
stages:
66+
- prerequisites
67+
- build-and-test
68+
69+
# Template for jobs triggering a build-and-test sub-pipeline:
70+
.build-and-test:
71+
stage: build-and-test
72+
trigger:
73+
include:
74+
- local: '.gitlab/custom-jobs-and-variables.yml'
75+
- project: 'radiuss/radiuss-shared-ci'
76+
ref: 'v2024.07.0'
77+
file: 'pipelines/${CI_MACHINE}.yml'
78+
# Add your jobs
79+
# you can use a local file
80+
- local: '.gitlab/jobs/${CI_MACHINE}.yml'
81+
# or a file generated in the previous steps
82+
# - artifact: '${CI_MACHINE}-jobs.yml'
83+
# job: 'generate-job-file'
84+
# (See Umpire CI setup for an example).
85+
strategy: depend
86+
forward:
87+
pipeline_variables: true
88+
89+
include:
90+
# Sets ID tokens for every job using `default:`
91+
- project: 'lc-templates/id_tokens'
92+
file: 'id_tokens.yml'
93+
# [Optional] checks preliminary to running the actual CI test
94+
- project: 'radiuss/radiuss-shared-ci'
95+
ref: 'v2024.07.0'
96+
file: 'utilities/preliminary-ignore-draft-pr.yml'
97+
# pipelines subscribed by the project
98+
- local: '.gitlab/subscribed-pipelines.yml'

.gitlab/custom-jobs-and-variables.yml

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
###############################################################################
2+
# Copyright (c) 2022-23, Lawrence Livermore National Security, LLC and RADIUSS
3+
# project contributors. See the COPYRIGHT file for details.
4+
#
5+
# SPDX-License-Identifier: (MIT)
6+
###############################################################################
7+
8+
# We define the following GitLab pipeline variables:
9+
variables:
10+
# In some pipelines we create only one allocation shared among jobs in
11+
# order to save time and resources. This allocation has to be uniquely
12+
# named so that we are sure to retrieve it and avoid collisions.
13+
ALLOC_NAME: ${CI_PROJECT_NAME}_ci_${CI_PIPELINE_ID}
14+
15+
# Ruby
16+
# Arguments for top level allocation
17+
RUBY_SHARED_ALLOC: "--mpi=none --exclusive --reservation=ci --time=20 --nodes=1"
18+
# Arguments for job level allocation
19+
RUBY_JOB_ALLOC: "--mpi=none --reservation=ci --nodes=1"
20+
# Add variables that should apply to all the jobs on a machine:
21+
# RUBY_MY_VAR: "..."
22+
23+
# Poodle
24+
# Arguments for top level allocation
25+
POODLE_SHARED_ALLOC: "--exclusive --partition=pdebug --time=10 --nodes=1"
26+
# Arguments for job level allocation
27+
POODLE_JOB_ALLOC: "--nodes=1"
28+
# Add variables that should apply to all the jobs on a machine:
29+
# POODLE_MY_VAR: "..."
30+
31+
# Corona
32+
# Arguments for top level allocation
33+
# OPTIONAL: "-o per-resource.count=2" allows to get 2 jobs running on each node.
34+
CORONA_SHARED_ALLOC: "--exclusive --time-limit=15m --nodes=1"
35+
# Arguments for job level allocation
36+
CORONA_JOB_ALLOC: "--nodes=1 --begin-time=+5s"
37+
# Add variables that should apply to all the jobs on a machine:
38+
# CORONA_MY_VAR: "..."
39+
40+
# Tioga
41+
# Arguments for top level allocation
42+
# OPTIONAL: "-o per-resource.count=2" allows to get 2 jobs running on each node.
43+
TIOGA_SHARED_ALLOC: "--queue=pci --exclusive --time-limit=15m --nodes=1"
44+
# Arguments for job level allocation
45+
TIOGA_JOB_ALLOC: "--nodes=1 --begin-time=+5s"
46+
# Add variables that should apply to all the jobs on a machine:
47+
# TIOGA_MY_VAR: "..."
48+
49+
# Lassen uses a different job scheduler (spectrum lsf) that does not allow
50+
# pre-allocation the same way slurm does. Arguments for job level allocation
51+
LASSEN_JOB_ALLOC: "1 -W 30 -q pci"
52+
# Add variables that should apply to all the jobs on a machine:
53+
# LASSEN_MY_VAR: "..."
54+
55+
56+
# Configuration shared by build and test jobs specific to this project.
57+
# Not all configuration can be shared. Here projects can fine tune the
58+
# CI behavior.
59+
# See Umpire for an example (export junit test reports).
60+
.custom_job:
61+
variables:
62+
JOB_TEMPLATE_CANNOT_BE_EMPTY: "True"

.gitlab/jobs/lassen.yml

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
###############################################################################
2+
# Copyright (c) 2022-23, Lawrence Livermore National Security, LLC and RADIUSS
3+
# project contributors. See the COPYRIGHT file for details.
4+
#
5+
# SPDX-License-Identifier: (MIT)
6+
###############################################################################
7+
8+
# We require project to define their job command using a variable (JOB_CMD).
9+
# In customization/gitlab-ci.yml, we encourage to define this variable as
10+
# non-expandable, so that project can use nested variables to configure the job
11+
# command. The caveat is that the reproducer here cannot capture the
12+
# definition of these variables in a generic fashion. By overriding the
13+
# following section, projects can specify the variables to define in the
14+
# reproducer to exactly reproduce the CI build.
15+
.lassen_reproducer_vars:
16+
script:
17+
- echo -e "Running on Lassen\n"
18+
19+
# With GitLab CI, included files cannot be empty.
20+
# TODO: remove when you have at least on job defined.
21+
variables:
22+
INCLUDED_FILE_CANNOT_BE_EMPTY: "True"
23+
24+
###############
25+
# Explanations:
26+
###############
27+
# RADIUSS Shared CI provides a pipeline for each machine, where a template job
28+
# is provided. Each of your jobs must extend this template to be added to the
29+
# list of jobs running on the associated machine.
30+
#
31+
# The job template then expects you to define the "JOB_CMD" variable with the
32+
# one line command used to trigger the build and test of your project.
33+
#
34+
# We suggest that you set your command in such a way that you can then
35+
# customize it per job with variables. E.g.:
36+
# "./path/to/my_ci_script ${A_VARIABLE}"
37+
38+
## Adding jobs defined by the project.
39+
## Note: placing the extends section first allows you to override part of the
40+
## shared implementation if needed (and if you know what you are doing).
41+
#<job-name (typically build target description)>:
42+
# extends: .job_on_lassen
43+
# variables:
44+
# <A_VARIABLE>: "<with job specific value>"
45+
46+
build-run-lassen:
47+
extends: .job_on_lassen
48+
after_script:
49+
- rm -rf ${CI_BUILDS_DIR}
50+
- rm -rf ${CI_PROJET_DIR}
51+
variables:
52+

.gitlab/jobs/ruby.yml

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
###############################################################################
2+
# Copyright (c) 2022-23, Lawrence Livermore National Security, LLC and RADIUSS
3+
# project contributors. See the COPYRIGHT file for details.
4+
#
5+
# SPDX-License-Identifier: (MIT)
6+
###############################################################################
7+
8+
# We require project to define their job command using a variable (JOB_CMD).
9+
# In customization/gitlab-ci.yml, we encourage to define this variable as
10+
# non-expandable, so that project can use nested variables to configure the job
11+
# command. The caveat is that the reproducer here cannot capture the
12+
# definition of these variables in a generic fashion. By overriding the
13+
# following section, projects can specify the variables to define in the
14+
# reproducer to exactly reproduce the CI build.
15+
.ruby_reproducer_vars:
16+
script:
17+
- export WITH_CUDA="Off"
18+
19+
# With GitLab CI, included files cannot be empty.
20+
# TODO: remove when you have at least on job defined.
21+
variables:
22+
INCLUDED_FILE_CANNOT_BE_EMPTY: "True"
23+
24+
###############
25+
# Explanations:
26+
###############
27+
# RADIUSS Shared CI provides a pipeline for each machine, where a template job
28+
# is provided. Each of your jobs must extend this template to be added to the
29+
# list of jobs running on the associated machine.
30+
#
31+
# The job template then expects you to define the "JOB_CMD" variable with the
32+
# one line command used to trigger the build and test of your project.
33+
#
34+
# We suggest that you set your command in such a way that you can then
35+
# customize it per job with variables. E.g.:
36+
# "./path/to/my_ci_script ${A_VARIABLE}"
37+
38+
## Adding jobs defined by the project.
39+
## Note: placing the extends section first allows you to override part of the
40+
## shared implementation if needed (and if you know what you are doing).
41+
#<job-name (typically build target description)>:
42+
# extends: .job_on_ruby
43+
# variables:
44+
# <A_VARIABLE>: "<with job specific value>"
45+
46+
build-run-ruby:
47+
extends: .job_on_ruby
48+
after_script:
49+
- rm -rf ${CI_BUILDS_DIR}
50+
- rm -rf ${CI_PROJET_DIR}
51+
variables:
52+

0 commit comments

Comments
 (0)