Skip to content

Commit

Permalink
update the action
Browse files Browse the repository at this point in the history
  • Loading branch information
pdziekan committed Nov 5, 2021
1 parent d64ceeb commit f2731a4
Showing 1 changed file with 68 additions and 35 deletions.
103 changes: 68 additions & 35 deletions action.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
name: 'build libcloudph++'
description: 'builds libcloudph++, libcloudph++ code needs to be check out before running this action'
description: 'builds libcloudph++, loads UWLCM Singularity image for dependencies'
inputs:
disable_cuda:
description: 'disable CUDA build?'
required: true
default: false
default: "false"
build_type:
description: 'CMake build type: Release, Debug, ...'
required: true
Expand All @@ -13,54 +13,87 @@ inputs:
description: "number of threads used by make"
required: true
default: 1
path:
description: "path to the dir with libcloudphxx code"
required: true
install_prefix:
description: "CMake install prefix"
required: true
default: "/usr/local"
tag:
description: 'Singularity image tag'
required: true
default: 'ubuntu_20_04_cuda_11_4'
cxx:
description: 'C++ compiler'
required: true
default: 'g++'

runs:
using: "composite"
steps:
- name: Install Nvidia driver
shell: bash
if: ${{!inputs.disable_cuda}}
run: sudo apt install --no-install-recommends nvidia-driver-470

- name: Install Singularity
#when installed from this action, .SIF is always converted to sandbox (could be related to: https://githubmemory.com/repo/hpcng/singularity/issues/6065)
uses: eWaterCycle/setup-singularity@v6
with:
singularity-version: 3.7.1
#apt installation following https://sylabs.io/guides/3.0/user-guide/installation.html, but this is a too old version and uninstalls python-is-python3
# run: |
# wget -O- http://neuro.debian.net/lists/focal.de-fzj.libre | sudo tee /etc/apt/sources.list.d/neurodebian.sources.list
# sudo apt-key adv --recv-keys --keyserver hkps://keyserver.ubuntu.com 0xA5D32F012649A5A9
# sudo apt-get update
# sudo apt-get install -y singularity-container

- name: Cache UWLCM Singularity image
id: cache_singularity
uses: actions/cache@v2
with:
path: '${{ github.workspace }}/singularity_images/uwlcm_ubuntu_20_04_cuda_11_4.sif'
key: 'sng_ubuntu_20_04_cuda_11_4'

- name: Download UWLCM Singularity image
shell: bash
if: steps.cache_singularity.outputs.cache-hit != 'true'
run: |
mkdir '${{ github.workspace }}/singularity_images'
singularity pull --disable-cache --dir '${{ github.workspace }}/singularity_images' library://pdziekan/default/uwlcm:ubuntu_20_04_cuda_11_4
# disable Singularity cache, we cache manually
[ "${{inputs.disable_cuda}}" = "false" ] && sudo apt install --no-install-recommends nvidia-driver-470 || true
# if: ${{!inputs.disable_cuda}}

- name: Set friendly Singularity image name
uses: allenevans/[email protected]
- name: load UWLCM Singularity image
uses: ./.github/actions/load_UWLCM_singularity_image
with:
SI: '${{ github.workspace }}/singularity_images/uwlcm_ubuntu_20_04_cuda_11_4.sif'
path: ${{ inputs.path }}/singularity_images
tag: ${{ inputs.tag }}

# - name: Install Singularity
# #when installed from this action, .SIF is always converted to sandbox (could be related to: https://githubmemory.com/repo/hpcng/singularity/issues/6065)
# uses: eWaterCycle/setup-singularity@v6
# with:
# singularity-version: 3.7.1
# #apt installation following https://sylabs.io/guides/3.0/user-guide/installation.html, but this is a too old version and uninstalls python-is-python3
## run: |
## wget -O- http://neuro.debian.net/lists/focal.de-fzj.libre | sudo tee /etc/apt/sources.list.d/neurodebian.sources.list
## sudo apt-key adv --recv-keys --keyserver hkps://keyserver.ubuntu.com 0xA5D32F012649A5A9
## sudo apt-get update
## sudo apt-get install -y singularity-container
#
# - name: Cache UWLCM Singularity image
# id: cache_singularity
# uses: actions/cache@v2
# with:
# path: '${{ github.workspace }}/singularity_images/uwlcm_ubuntu_20_04_cuda_11_4.sif'
# key: 'sng_ubuntu_20_04_cuda_11_4'
#
# - name: Download UWLCM Singularity image
# shell: bash
## if: steps.cache_singularity.outputs.cache-hit != 'true'
# run: |
# [ "${{steps.cache_singularity.outputs.cache-hit}}" != "true" ] && \
# {
# mkdir '${{ github.workspace }}/singularity_images';
# singularity pull --disable-cache --dir '${{ github.workspace }}/singularity_images' library://pdziekan/default/uwlcm:ubuntu_20_04_cuda_11_4;
# } \
# || \
# true
# # disable Singularity cache, we cache manually
#
# - name: Set friendly Singularity image name
# uses: allenevans/[email protected]
# with:
# SI: '${{ github.workspace }}/singularity_images/uwlcm_ubuntu_20_04_cuda_11_4.sif'


# Debugging with a ssh session
# - name: Setup tmate session
# uses: mxschmitt/action-tmate@v3


- name: Configure CMake
shell: bash
# Configure CMake in a 'build' subdirectory. `CMAKE_BUILD_TYPE` is only required if you are using a single-configuration generator such as make.
# See https://cmake.org/cmake/help/latest/variable/CMAKE_BUILD_TYPE.html?highlight=cmake_build_type
run: singularity exec $SI cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{inputs.build_type}} -DLIBCLOUDPHXX_FORCE_MULTI_CUDA=True -DLIBCLOUDPHXX_DISABLE_CUDA=${{inputs.disable_cuda}}
run: singularity exec $SI cmake -B ${{inputs.path}}/build -DCMAKE_BUILD_TYPE=${{inputs.build_type}} -DLIBCLOUDPHXX_FORCE_MULTI_CUDA=True -DLIBCLOUDPHXX_DISABLE_CUDA=${{inputs.disable_cuda}} -DCMAKE_INSTALL_PREFIX=${{inputs.install_prefix}} -DCMAKE_CXX_COMPILER=${{inputs.cxx}}
#
- name: Build libcloudph++
shell: bash
# Build your program with the given configuration
run: VERBOSE=1 singularity exec $SI cmake --build ${{github.workspace}}/build --config ${{inputs.build_type}} -j${{inputs.threads}}
run: VERBOSE=1 singularity exec $SI cmake --build ${{inputs.path}}/build --config ${{inputs.build_type}} -j${{inputs.threads}}

0 comments on commit f2731a4

Please sign in to comment.