Skip to content

Commit

Permalink
Merge pull request #6 from kanye-quest/master
Browse files Browse the repository at this point in the history
Windows CI
  • Loading branch information
tzanio authored May 18, 2022
2 parents 2b183dc + 7e93080 commit c205ed5
Show file tree
Hide file tree
Showing 2 changed files with 96 additions and 16 deletions.
59 changes: 53 additions & 6 deletions build-hypre/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,33 @@ inputs:
description: 'A key to identify the desired hypre config (int32, int64)'
required: false
default: int32
build-system:
description: 'identify the build system to use (make,cmake)'
required: false
default: make

runs:
using: "composite"
steps:
- name: Install Hypre
- name: Get Hypre (Windows)
if: runner.os == 'Windows'
run: |
$URI_HYPRE = "${{ inputs.url }}/${{ inputs.archive }}"
Invoke-WebRequest -Uri $URI_HYPRE -OutFile ${{ inputs.archive }}
Remove-Item ${{ inputs.dir }} -Force -Recurse -ErrorAction Ignore;
tar -xzf ${{ inputs.archive }};
shell: pwsh

- name: Get Hypre (Linux/macOS)
if: runner.os != 'Windows'
run: |
wget --no-verbose ${{ inputs.url }}/${{ inputs.archive }};
rm -rf ${{ inputs.dir }};
tar -xzf ${{ inputs.archive }};
shell: bash

- name: Install Hypre (make)
if: inputs.build-system == 'make'
run: |
echo "Map target to options"
if [[ "${{ inputs.target }}" == "int32" ]]
Expand All @@ -44,11 +66,36 @@ runs:
exit 1;
fi
echo "Installing Hypre"
wget --no-verbose ${{ inputs.url }}/${{ inputs.archive }};
rm -rf ${{ inputs.dir }};
tar -xzf ${{ inputs.archive }};
cd ${{ inputs.dir }}/src;
./configure ${hypre_options} CC=mpicc CXX=mpic++;
cd ${{ inputs.dir }};
install_prefix="$(pwd)/install";
cd src;
./configure --prefix=${install_prefix} ${hypre_options} CC=mpicc CXX=mpic++;
make -j3;
make install;
cd ../..;
shell: bash

- name: Install Hypre (cmake)
if: inputs.build-system == 'cmake'
run: |
echo "Map target to options"
if [[ "${{ inputs.target }}" == "int32" ]]
then
export hypre_options="";
elif [[ "${{ inputs.target }}" == "int64" ]]
then
export hypre_options="-DHYPRE_ENABLE_BIGINT=ON";
else
echo "Hypre target not recognized";
exit 1;
fi
echo "Installing Hypre"
cd ${{ inputs.dir }};
cmake -Hsrc -Bbuild \
${hypre_options} \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_INSTALL_PREFIX=install
cmake --build build --config Release --parallel 3
cmake --install build --config Release
cd ../..;
shell: bash
53 changes: 43 additions & 10 deletions build-mfem/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,14 @@ inputs:
description: 'identify the build system to use (make,cmake)'
required: false
default: make
library-only:
description: 'only build the mfem library, without examples/tests/miniapps'
required: false
default: 'false'
config-options:
description: 'extra options to pass to build configuration'
required: false
default: ''

runs:
using: "composite"
Expand All @@ -73,10 +81,15 @@ runs:
MPI="NO"
if [[ ${{ inputs.mpi }} == 'par' ]]; then
MPI="YES"
echo "[INFO] Hypre symlink: hypre -> ${{ inputs.hypre-dir }}"
ln -s -f ${{ inputs.hypre-dir }} hypre;
echo "[INFO] Metis symlink: metis -> ${{ inputs.metis-dir }}"
ln -s -f ${{ inputs.metis-dir }} metis-4.0;
# If the directory does not exist, we assume it was installed elsewhere and don’t create the link
if [[ -d ${{ inputs.hypre-dir }} ]]; then
ln -s -f ${{ inputs.hypre-dir }} hypre;
echo "[INFO] Hypre symlink: hypre -> ${{ inputs.hypre-dir }}"
fi
if [[ -d ${{ inputs.metis-dir }} ]]; then
ln -s -f ${{ inputs.metis-dir }} metis-4.0;
echo "[INFO] Metis symlink: metis -> ${{ inputs.metis-dir }}"
fi
fi
echo "[STATUS] MPI: ${MPI}"
CPPFLAGS=""
Expand Down Expand Up @@ -104,30 +117,50 @@ runs:
echo "--- Configure mfem ---"
cd ${{ inputs.mfem-dir }};
if [[ ${{ inputs.build-system }} == 'cmake' ]]; then
if [[ ${{ inputs.os }} == "windows-2022" ]]; then
toolchain_file="${VCPKG_INSTALLATION_ROOT}\\scripts\\buildsystems\\vcpkg.cmake"
vcpkg_triplet="x64-windows-static"
fi
mkdir build && cd build;
cmake \
-D CMAKE_TOOLCHAIN_FILE:STRING=${toolchain_file} \
-D VCPKG_TARGET_TRIPLET=${vcpkg_triplet} \
-D CMAKE_BUILD_TYPE=${BUILD_TYPE} \
-D MFEM_USE_MPI=${MPI} \
-D MFEM_MPI_NP=2 \
-D HYPRE_DIR=../../hypre/src/hypre \
-D HYPRE_DIR=../../hypre/install \
${{ inputs.config-options }} \
..
else
make config MFEM_USE_MPI=${MPI} MFEM_MPI_NP=2 MFEM_DEBUG=${DEBUG} CPPFLAGS="${CPPFLAGS}";
make config \
MFEM_USE_MPI=${MPI} \
MFEM_MPI_NP=2 \
MFEM_DEBUG=${DEBUG} \
CPPFLAGS="${CPPFLAGS}" \
HYPRE_DIR=@MFEM_DIR@/../hypre/install \
${{ inputs.config-options }}
fi
shell: bash

- name: build mfem
run: |
echo "------------------"
echo "--- Build mfem ---"
BUILD_TYPE="Release"
[[ ${{ inputs.target }} == 'dbg' ]] && BUILD_TYPE="Debug";
cd ${{ inputs.mfem-dir }}
if [[ ${{ inputs.build-system }} == 'cmake' ]]; then
CMAKE_TARGET="exec"
[[ ${{ inputs.library-only }} == 'true' ]] && CMAKE_TARGET="mfem";
cd build
make -j3 mfem examples
cd tests/unit
make -j3
cmake --build . --parallel 3 --target ${CMAKE_TARGET} --config "${BUILD_TYPE}"
if [[ ${{ inputs.library-only }} == 'false' ]]; then
cmake --build tests/unit --parallel 3 --config "${BUILD_TYPE}"
fi
else
make all -j3
MAKE_TARGET="all"
[[ ${{ inputs.library-only }} == 'true' ]] && MAKE_TARGET="";
make ${MAKE_TARGET} -j3
fi
shell: bash

0 comments on commit c205ed5

Please sign in to comment.