Skip to content
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

Backports from master to release_29 #3643

Merged
merged 9 commits into from
May 30, 2023
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
692 changes: 692 additions & 0 deletions .gitlab/config/SpackCIBridge.py

Large diffs are not rendered by default.

61 changes: 61 additions & 0 deletions .gitlab/config/ccache.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
##============================================================================
## Copyright (c) Kitware, Inc.
## All rights reserved.
## See LICENSE.txt for details.
##
## This software is distributed WITHOUT ANY WARRANTY; without even
## the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
## PURPOSE. See the above copyright notice for more information.
##============================================================================

cmake_minimum_required(VERSION 3.0 FATAL_ERROR)

set(version 4.6.1)
set(arch x86_64)

if(CMAKE_HOST_SYSTEM_NAME STREQUAL "Linux")
set(sha256sum da1e1781bc1c4b019216fa16391af3e1daaee7e7f49a8ec9b0cdc8a1d05c50e2)
set(base_url https://github.com/ccache/ccache/releases/download)
set(platform linux)
set(extension tar.xz)
elseif(CMAKE_HOST_SYSTEM_NAME STREQUAL "Darwin")
set(sha256sum 3e36ba8c80fbf7f2b95fe0227b9dd1ca6143d721aab052caf0d5729769138059)
set(full_url https://gitlab.kitware.com/utils/ci-utilities/-/package_files/534/download)
set(filename ccache)
set(extension tar.gz)
elseif(CMAKE_HOST_SYSTEM_NAME STREQUAL "Windows")
set(sha256sum a6c6311973aa3d2aae22424895f2f968e5d661be003b25f1bd854a5c0cd57563)
set(base_url https://github.com/ccache/ccache/releases/download)
set(platform windows)
set(extension zip)
else()
message(FATAL_ERROR "Unrecognized platform ${CMAKE_HOST_SYSTEM_NAME}")
endif()

if(NOT DEFINED filename)
set(filename "ccache-${version}-${platform}-${arch}")
endif()

set(tarball "${filename}.${extension}")

if(NOT DEFINED full_url)
set(full_url "${base_url}/v${version}/${tarball}")
endif()

file(DOWNLOAD
"${full_url}" $ENV{CCACHE_INSTALL_DIR}/${tarball}
EXPECTED_HASH SHA256=${sha256sum}
SHOW_PROGRESS
)

execute_process(
COMMAND ${CMAKE_COMMAND} -E tar xf ${tarball}
WORKING_DIRECTORY $ENV{CCACHE_INSTALL_DIR}
RESULT_VARIABLE extract_results
)

if(extract_results)
message(FATAL_ERROR "Extracting `${tarball}` failed: ${extract_results}.")
endif()

file(RENAME $ENV{CCACHE_INSTALL_DIR}/${filename} $ENV{CCACHE_INSTALL_DIR}/ccache)
9 changes: 9 additions & 0 deletions .gitlab/config/dynamic_pipeline.yml.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
child_pipeline_{branch}:
variables:
DOWNSTREAM_COMMIT_SHA: '{commit}'
DOWNSTREAM_BRANCH_REF: '{branch}'
trigger:
include:
- project: 'ci/csc303_crusher/dev/adios2'
ref: '{branch}'
file: '.gitlab/gitlab-ci-crusher.yml'
90 changes: 90 additions & 0 deletions .gitlab/config/generate_pipelines.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
#!/usr/bin/env python3

# Distributed under the OSI-approved Apache License, Version 2.0. See
# accompanying file Copyright.txt for details.
#
# generate_pipeline.py
#
# Created: May 19, 2023
# Author: Vicente Adolfo Bolea Sanchez <[email protected]>

from datetime import datetime
import argparse
import requests
import time
import re
import urllib3
# Remove annoying warning about insecure connection (self-signed cert).
urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning)


def is_date_after(date, days):
deadline_sec = int(time.time()) - (days * 86400)
utc_dt = datetime.strptime(date, '%Y-%m-%dT%H:%M:%SZ')
timestamp_sec = (utc_dt - datetime(1970, 1, 1)).total_seconds()
return timestamp_sec > deadline_sec


def request_dict(url):
r = requests.get(url + '?per_page=100', verify=False)
return r.json()


parser = argparse.ArgumentParser(
prog='generate_pipeline.py',
description='Generate Dynamic pipelines for Gitlab')
parser.add_argument(
'-u', '--gl-url', required=True,
help='Base URL for Gitlab remote. Ex: https://code.olcf.ornl.gov/')
parser.add_argument(
'-n', '--gh-name', required=True,
help='Full name of the GitHub project. Ex: ornladios/ADIOS2')
parser.add_argument(
'-c', '--gh-context', default='OLCF Crusher (Frontier)',
help='Name of the status in GitHub (A.K.A context)')
parser.add_argument(
'-p', '--project_id', required=True,
help='Gitlab internal project ID of the project.')
parser.add_argument(
'-d', '--days', type=int, default=1,
help='How many days back to search for commits')
parser.add_argument(
'-m', '--max', type=int, default=2,
help='Maximum amount of pipelines computed')
parser.add_argument(
'-f', '--template_file', required=True,
help='Template file of the pipeline `{branch}` will be substituted')
args = parser.parse_args()


with open(args.template_file, "r") as fd:
template_str = fd.read()
gl_url = args.gl_url + "/api/v4/projects/" + str(args.project_id)
gh_url = 'https://api.github.com/repos/' + args.gh_name
branches = request_dict(gl_url + "/repository/branches")
num_pipeline = 0
for branch in branches:
# Convert to ISO 8601 date format.
date_stamp = branch['commit']['committed_date'].split('.')[0] + "Z"
if num_pipeline < args.max and is_date_after(date_stamp, args.days):
commit_sha = branch['commit']['id']
# Backported branches use the merge head
gh_commit_sha = commit_sha
if re.fullmatch(r'^pr\d+_.*$', branch['name']):
gh_commit_sha = branch['commit']['parent_ids'][1]

# Quit if GitHub does not have the commit
if 'sha' not in request_dict(gh_url + "/commits/" + gh_commit_sha):
continue

# Query GitHub for the status of this commit
commit = request_dict(gh_url + "/commits/" +
gh_commit_sha + "/status")
status_found = False
for status in commit['statuses']:
if status['context'] == args.gh_context:
status_found = True
if not status_found:
num_pipeline += 1
print(template_str.format(
branch=branch['name'], commit=commit_sha))
29 changes: 29 additions & 0 deletions .gitlab/config/kokkos.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
#!/usr/bin/env bash
set -x

WORKDIR="$1"
VERSION="$2"

shift 2

if [ ! -d "$WORKDIR" ] || [ -z "$VERSION" ]
then
echo "[E] missing args: Invoke as .gitlab/ci/config/kokkos.sh <WORKDIR> <VERSION> [extra_args]"
exit 1
fi

# Build and install Kokkos
curl -L "https://github.com/kokkos/kokkos/archive/refs/tags/$VERSION.tar.gz" \
| tar -C "$WORKDIR" -xzf -

cmake -S "$WORKDIR/kokkos-$VERSION" -B "$WORKDIR/kokkos_build" \
"-DBUILD_SHARED_LIBS=ON" \
"-DCMAKE_BUILD_TYPE:STRING=release" \
"-DCMAKE_CXX_COMPILER_LAUNCHER=ccache" \
"-DCMAKE_CXX_STANDARD:STRING=17" \
"-DCMAKE_CXX_EXTENSIONS:BOOL=OFF" \
"-DCMAKE_POSITION_INDEPENDENT_CODE:BOOL=ON" \
$*

cmake --build "$WORKDIR/kokkos_build"
cmake --install "$WORKDIR/kokkos_build"
134 changes: 134 additions & 0 deletions .gitlab/gitlab-ci-ascent.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,134 @@
# Ad-hoc build that runs in the ECP Hardware, concretely in OLCF Ascent.
.setup_env_ecpci: &setup_env_ecpci |
module purge
module load ${JOB_MODULES}
module list
export PATH="/gpfs/wolf/csc303/scratch/vbolea/ci/utils:$PATH"

.ascent-common:
except:
- schedules
tags:
- batch
interruptible: true
variables:
CCACHE_BASEDIR: "/gpfs/wolf/"
CCACHE_DIR: "/gpfs/wolf/csc303/scratch/vbolea/ci/ccache"
# -isystem= is not affected by CCACHE_BASEDIR, thus we must ignore it
CCACHE_IGNOREOPTIONS: "-isystem=*"
CCACHE_NOHASHDIR: "true"

CUDAHOSTCXX: "g++"
CUSTOM_CI_BUILDS_DIR: "/gpfs/wolf/csc303/scratch/vbolea/ci/adios2"
GITLAB_SITE: "OLCF Ascent"
CI_BIN_DIR: "$CI_PROJECT_DIR/build"
SCHEDULER_PARAMETERS: -P CSC303 -W 1:00 -nnodes 1 -alloc_flags gpudefault
before_script:
- *setup_env_ecpci
- ccache -z
script:
- bash scripts/ci/gitlab-ci/run.sh update
- bash scripts/ci/gitlab-ci/run.sh configure
- jsrun -n1 -a1 -g1 -c40 -bpacked:40 bash scripts/ci/gitlab-ci/run.sh build
- jsrun -n1 -a1 -g1 -c2 bash scripts/ci/gitlab-ci/run.sh test
after_script:
- *setup_env_ecpci
- bash scripts/ci/gitlab-ci/run.sh submit
- ccache -s

ascent-cuda:
variables:
# Order matters
JOB_MODULES: >-
DefApps
zstd
cuda/11.4.2
git
gcc/10.2.0
ninja
spectrum-mpi
lsf-tools
libffi
hdf5
cmake
extends:
- .ascent-common

ascent-kokkos-cuda:
variables:
# Order matters
JOB_MODULES: >-
DefApps
zstd
cuda/11.4.2
git
gcc/10.2.0
ninja
spectrum-mpi
lsf-tools
libffi
hdf5
cmake
KOKKOS_VER: 3.7.01
Kokkos_DIR: "$CI_PROJECT_DIR/deps/kokkos_install"
# Cmake would not install a RPATH inside the source dir
LD_LIBRARY_PATH: "$Kokkos_DIR/lib64/:$LD_LIBRARY_PATH"
KOKKOS_OPTS: >-
-DKokkos_ARCH_POWER9=ON
-DKokkos_ARCH_VOLTA70=ON
-DKokkos_ENABLE_CUDA=ON
-DKokkos_ENABLE_CUDA_LAMBDA=ON
-DCMAKE_INSTALL_PREFIX:PATH=$Kokkos_DIR
-DCMAKE_CXX_COMPILER:STRING=$CI_PROJECT_DIR/deps/kokkos-$KOKKOS_VER/bin/nvcc_wrapper
before_script:
- *setup_env_ecpci
- mkdir -p "$CI_PROJECT_DIR/deps"
- ccache -z
- .gitlab/config/kokkos.sh "$CI_PROJECT_DIR/deps" "$KOKKOS_VER" $KOKKOS_OPTS
extends:
- .ascent-common

ascent-nvhpc:
variables:
# Order matters
JOB_MODULES: >-
DefApps
zstd
nvhpc
git
spectrum-mpi
lsf-tools
libffi
hdf5
cmake
extends:
- .ascent-common

ascent-xl:
variables:
# Order matters
JOB_MODULES: >-
DefApps
zstd
cuda/11.4.2
git
xl
ninja
spectrum-mpi
lsf-tools
libffi
hdf5
cmake
extends:
- .ascent-common

sync-github-prs:
tags:
- nobatch
only:
- schedules
variables:
CUSTOM_CI_BUILDS_DIR: "/gpfs/wolf/csc303/scratch/vbolea/ci/adios2"
script:
- export PATH="/gpfs/wolf/csc303/scratch/vbolea/ci/utils:$PATH"
- .gitlab/config/SpackCIBridge.py ornladios/ADIOS2 [email protected]:ecpcitest/adios2.git https://code.ornl.gov/ ecpcitest/adios2 --prereq-check=format --prereq-check=git_checks
Loading