Skip to content

Commit

Permalink
ci,olcf,crusher: enable Crusher CI
Browse files Browse the repository at this point in the history
  • Loading branch information
vicentebolea committed May 25, 2023
1 parent 2aace5f commit e095189
Show file tree
Hide file tree
Showing 12 changed files with 1,197 additions and 29 deletions.
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 <vicente.bolea@kitware.com>

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=3,
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))
1 change: 0 additions & 1 deletion .gitlab/kokkos.sh → .gitlab/config/kokkos.sh
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ cmake -S "$WORKDIR/kokkos-$VERSION" -B "$WORKDIR/kokkos_build" \
"-DCMAKE_CXX_STANDARD:STRING=17" \
"-DCMAKE_CXX_EXTENSIONS:BOOL=OFF" \
"-DCMAKE_POSITION_INDEPENDENT_CODE:BOOL=ON" \
"-DCMAKE_CXX_COMPILER:STRING=$WORKDIR/kokkos-$VERSION/bin/nvcc_wrapper" \
$*

cmake --build "$WORKDIR/kokkos_build"
Expand Down
15 changes: 10 additions & 5 deletions .gitlab/gitlab-ci-ascent.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
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
Expand Down Expand Up @@ -68,18 +69,22 @@ ascent-kokkos-cuda:
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=$CI_BUILDS_DIR/kokkos_install
Kokkos_DIR: $CI_BUILDS_DIR/kokkos_install
-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/kokkos.sh "$CI_BUILDS_DIR" "3.7.01" $KOKKOS_OPTS
- .gitlab/config/kokkos.sh "$CI_PROJECT_DIR/deps" "$KOKKOS_VER" $KOKKOS_OPTS
extends:
- .ascent-common

Expand Down Expand Up @@ -127,4 +132,4 @@ sync-github-prs:
CUSTOM_CI_BUILDS_DIR: "/gpfs/wolf/csc303/scratch/vbolea/ci/adios2"
script:
- export PATH="/gpfs/wolf/csc303/scratch/vbolea/ci/utils:$PATH"
- SpackCIBridge.py ornladios/ADIOS2 git@code.ornl.gov:ecpcitest/adios2.git https://code.ornl.gov/ ecpcitest/adios2 --prereq-check=format --prereq-check=git_checks
- .gitlab/config/SpackCIBridge.py ornladios/ADIOS2 git@code.ornl.gov:ecpcitest/adios2.git https://code.ornl.gov/ ecpcitest/adios2 --prereq-check=format --prereq-check=git_checks
Loading

0 comments on commit e095189

Please sign in to comment.