-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
hello(world): initial action and CMakeLists
- Loading branch information
1 parent
6b38969
commit 57365e6
Showing
11 changed files
with
295 additions
and
1 deletion.
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,9 @@ | ||
{ | ||
"image" : "ghcr.io/uliegecsm/kokkos-utils/kokkos-utils:latest", | ||
"extensions" : [ | ||
"ms-vscode.cmake-tools", | ||
"mhutchie.git-graph", | ||
"ms-azuretools.vscode-docker" | ||
], | ||
"onCreateCommand": "git config --global --add safe.directory $PWD" | ||
} |
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,11 @@ | ||
## Summary | ||
|
||
(Summarize the content of the PR concisely) | ||
|
||
## Description | ||
|
||
(A longer description of the PR) | ||
|
||
## Related to | ||
|
||
(A list of issues, PRs, links) |
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,87 @@ | ||
name: Build | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
pull_request: | ||
branches: | ||
- main | ||
|
||
env: | ||
REGISTRY: ghcr.io | ||
|
||
jobs: | ||
|
||
set-env: | ||
runs-on: [ubuntu-22.04] | ||
outputs: | ||
CI_IMAGE : ${{ steps.common.outputs.CI_IMAGE }} | ||
steps: | ||
- name: Export common variables. | ||
id : common | ||
run : | | ||
echo "CI_IMAGE=${{ env.REGISTRY }}/${{ github.repository }}/kokkos-utils:latest" >> $GITHUB_OUTPUT | ||
build-image: | ||
needs: [set-env] | ||
runs-on: [ubuntu-22.04] | ||
container: | ||
image: docker:latest | ||
permissions: | ||
packages: write | ||
steps: | ||
- name: Checkout code. | ||
uses: actions/checkout@v4 | ||
|
||
- name: Log in to Docker registry. | ||
run : | | ||
docker login -u ${{ github.actor}} -p ${{ secrets.GITHUB_TOKEN }} ${{ env.REGISTRY }} | ||
- name: Build Docker image. | ||
run : | | ||
apk add jq | ||
GOOGLETEST_VERSION=$(jq .dependencies.googletest.value version.json -j) | ||
KOKKOS_VERSION=$(jq .dependencies.kokkos.value version.json -j) | ||
docker buildx build \ | ||
--pull \ | ||
--push \ | ||
--file dockerfile \ | ||
--platform linux/amd64 \ | ||
--tag ${{ needs.set-env.outputs.CI_IMAGE }} \ | ||
--cache-from ${{ needs.set-env.outputs.CI_IMAGE }} \ | ||
--build-arg BUILDKIT_INLINE_CACHE=1 \ | ||
--build-arg GOOGLETEST_VERSION=${GOOGLETEST_VERSION} \ | ||
--build-arg KOKKOS_VERSION=${KOKKOS_VERSION} \ | ||
--build-arg KOKKOS_PRESET=OpenMP \ | ||
. | ||
build-library: | ||
needs: [set-env, build-image] | ||
runs-on: [ubuntu-22.04] | ||
container: | ||
image: ${{ needs.set-env.outputs.CI_IMAGE }} | ||
steps: | ||
- name: Checkout code. | ||
uses: actions/checkout@v4 | ||
|
||
- name: Configure and build. | ||
run : | | ||
cmake -S . --preset=OpenMP | ||
cmake --build --preset=OpenMP | ||
build-documentation: | ||
needs: [build-library] | ||
runs-on: [ubuntu-22.04] | ||
steps: | ||
- name: Checkout code. | ||
uses: actions/checkout@v4 | ||
|
||
- name: Upload Pages artifacts. | ||
uses: actions/upload-pages-artifact@v3 | ||
path: README.md | ||
|
||
- name: Deploy to GitHub Pages. | ||
uses: actions/deploy-pages@v4 |
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,2 @@ | ||
# Ignore CMake build directory | ||
build*/* |
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,33 @@ | ||
cmake_minimum_required(VERSION 3.12) | ||
|
||
#---- Read the version file. | ||
file(READ version.json VERSION_JSON) | ||
string(JSON KOKKOS_UTILS_VERSION GET "${VERSION_JSON}" "kokkos-utils" "value") | ||
string(JSON KOKKOS_VERSION GET "${VERSION_JSON}" "dependencies" "kokkos" "value") | ||
string(JSON GOOGLETEST_VERSION GET "${VERSION_JSON}" "dependencies" "googletest" "value") | ||
|
||
#---- Define the project. It uses C++ only. | ||
project( | ||
kokkos-utils | ||
VERSION ${KOKKOS_UTILS_VERSION} | ||
LANGUAGES CXX | ||
) | ||
|
||
#---- C++ standard that we need (at least). | ||
set(CMAKE_CXX_STANDARD 20 CACHE BOOL "" FORCE) | ||
set(CMAKE_CXX_STANDARD_REQUIRED True CACHE BOOL "" FORCE) | ||
|
||
#---- Find Kokkos. | ||
find_package( | ||
Kokkos | ||
REQUIRED | ||
${KOKKOS_VERSION} | ||
) | ||
|
||
#---- Find google Test. | ||
find_package( | ||
GTest | ||
CONFIG | ||
REQUIRED | ||
${GOOGLETEST_VERSION} | ||
) |
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,23 @@ | ||
{ | ||
"version" : 3, | ||
"configurePresets" : [ | ||
{ | ||
"name" : "default", | ||
"binaryDir" : "${sourceDir}/build-with-${presetName}", | ||
"cacheVariables" : { | ||
"CMAKE_BUILD_TYPE" : "Release", | ||
"CMAKE_CXX_EXTENSIONS" : "OFF" | ||
} | ||
}, | ||
{ | ||
"name" : "OpenMP", | ||
"inherits" : "default" | ||
} | ||
], | ||
"buildPresets" : [ | ||
{ | ||
"name" : "OpenMP", | ||
"configurePreset" : "OpenMP" | ||
} | ||
] | ||
} |
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 |
---|---|---|
@@ -1,2 +1,3 @@ | ||
# kokkos-utils | ||
This repository contains utilities related to `Kokkos`. | ||
|
||
This repository contains utilities related to [`Kokkos`](https://kokkos.org/). |
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,74 @@ | ||
FROM ubuntu:24.04 as apt-requirements | ||
|
||
# Install APT requirements. | ||
RUN --mount=target=/requirements,type=bind,source=requirements <<EOF | ||
|
||
set -ex | ||
|
||
apt update | ||
|
||
apt --yes --no-install-recommends install $(grep -vE "^\s*#" /requirements/requirements.system.txt | tr "\n" " ") | ||
|
||
apt clean && rm -rf /var/lib/apt/lists/* | ||
|
||
EOF | ||
|
||
# Compile Google Test. | ||
FROM apt-requirements as compile-google-test | ||
|
||
ARG GOOGLETEST_VERSION | ||
|
||
RUN <<EOF | ||
|
||
set -ex | ||
|
||
git clone --depth=1 --branch=v${GOOGLETEST_VERSION} https://github.com/google/googletest googletest | ||
|
||
cd googletest | ||
|
||
cmake -S . -B build -DCMAKE_INSTALL_PREFIX=/opt/google-test-${GOOGLETEST_VERSION} | ||
|
||
cmake --build build | ||
|
||
cmake --build build --target install | ||
|
||
EOF | ||
|
||
# Compile Kokkos. | ||
FROM apt-requirements as compile-kokkos | ||
|
||
ARG KOKKOS_VERSION | ||
ARG KOKKOS_PRESET | ||
|
||
COPY kokkos.cmake.presets.json /kokkos.cmake.presets.json | ||
|
||
RUN <<EOF | ||
|
||
set -ex | ||
|
||
git clone --depth=1 --branch=${KOKKOS_VERSION} https://github.com/kokkos/kokkos kokkos | ||
|
||
cd kokkos | ||
|
||
cp /kokkos.cmake.presets.json CMakePresets.json | ||
|
||
cmake -S . --preset=${KOKKOS_PRESET} -DCMAKE_INSTALL_PREFIX=/opt/kokkos-${KOKKOS_VERSION}/${KOKKOS_PRESET} | ||
|
||
cmake --build --preset=${KOKKOS_PRESET} | ||
|
||
cmake --build --preset=${KOKKOS_PRESET} --target=install | ||
|
||
EOF | ||
|
||
# Build the final image from previous stages. | ||
FROM apt-requirements as final | ||
|
||
ARG GOOGLETEST_VERSION | ||
ARG KOKKOS_VERSION | ||
ARG KOKKOS_PRESET | ||
|
||
COPY --from=compile-google-test /opt/google-test-${GOOGLETEST_VERSION} /opt/google-test-${GOOGLETEST_VERSION} | ||
COPY --from=compile-kokkos /opt/kokkos-${KOKKOS_VERSION}/${KOKKOS_PRESET} /opt/kokkos-${KOKKOS_VERSION}/${KOKKOS_PRESET} | ||
|
||
ENV GTest_ROOT=/opt/google-test-${GOOGLETEST_VERSION} | ||
ENV Kokkos_ROOT=/opt/kokkos-${KOKKOS_VERSION}/${KOKKOS_PRESET} |
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,28 @@ | ||
{ | ||
"version" : 3, | ||
"configurePresets" : [ | ||
{ | ||
"name" : "default", | ||
"binaryDir" : "${sourceDir}/build-with-${presetName}", | ||
"cacheVariables" : { | ||
"CMAKE_BUILD_TYPE" : "Release", | ||
"CMAKE_CXX_STANDARD" : "17", | ||
"CMAKE_CXX_EXTENSIONS" : "OFF", | ||
"BUILD_SHARED_LIBS" : "ON" | ||
} | ||
}, | ||
{ | ||
"name" : "OpenMP", | ||
"inherits" : "default", | ||
"cacheVariables" : { | ||
"Kokkos_ENABLE_OPENMP" : "ON" | ||
} | ||
} | ||
], | ||
"buildPresets" : [ | ||
{ | ||
"name" : "OpenMP", | ||
"configurePreset" : "OpenMP" | ||
} | ||
] | ||
} |
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,13 @@ | ||
# Utilities | ||
wget | ||
|
||
# Source control | ||
ca-certificates | ||
git | ||
|
||
# Builders | ||
cmake | ||
make | ||
|
||
# Compilers | ||
g++ |
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,13 @@ | ||
{ | ||
"kokkos-utils" : { | ||
"value" : "0.0.1" | ||
}, | ||
"dependencies" : { | ||
"kokkos" : { | ||
"value" : "4.3.00" | ||
}, | ||
"googletest" : { | ||
"value" : "1.14.0" | ||
} | ||
} | ||
} |