Skip to content

Commit

Permalink
Merge pull request #3 from worc4021/feature/ci
Browse files Browse the repository at this point in the history
A build
  • Loading branch information
worc4021 authored Dec 20, 2024
2 parents d6f3a38 + e277697 commit 3325189
Show file tree
Hide file tree
Showing 12 changed files with 957 additions and 249 deletions.
142 changes: 108 additions & 34 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ run-name: ${{ github.actor }} is testing out GitHub Actions 🚀
on:
push:
branches:
- master
- main
pull_request:
branches:
- master
- main
workflow_dispatch:

permissions:
Expand All @@ -16,41 +16,115 @@ permissions:

jobs:
linux-build:
runs-on: ubuntu-latest
strategy:
matrix:
toolchain:
- gcc
- intel
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v4
- uses: worc4021/oneApi@v8
with:
icx: ${{ matrix.toolchain == 'intel' }}
ifx: ${{ matrix.toolchain == 'intel' }}
mkl: true
- name: Pull MUMPS
run: |
curl --output ${{ runner.temp }}/MUMPS_5.7.3.tar.gz ${{ secrets.MUMPS_URL }}/MUMPS_5.7.3.tar.gz
tar -xzf ${{ runner.temp }}/MUMPS_5.7.3.tar.gz
cp -r MUMPS_5.7.3 ${{ github.workspace }}
ls -lAh ${{ github.workspace }}
tar -xzf ${{ runner.temp }}/MUMPS_5.7.3.tar.gz -C ${{ runner.temp }}
cp -r ${{ runner.temp }}/MUMPS_5.7.3/* ${{ github.workspace }}
ls -lAh ${{ github.workspace }}/src
shell: bash
# - name: Setup Ninja
# uses: seanmiddleditch/gha-setup-ninja@master
# - name: Setup cmake
# uses: jwlawson/actions-setup-cmake@v2
# with:
# cmake-version: '3.29.x'
# - name: Configure
# run: |
# cmake --preset linux-gcc-release-config -DBQPD_BUILD_MATLAB:BOOL=OFF
# working-directory: ${{ github.workspace }}
# - name: Build
# run: |
# cmake --build --preset linux-gcc-release-build --target install
# working-directory: ${{ github.workspace }}
# - name: Test
# run: |
# ctest --preset linux-gcc-release-test --output-junit ${{ github.workspace }}/test-results.xml
# working-directory: ${{ github.workspace }}
# - name: Upload library
# uses: actions/upload-artifact@v4
# with:
# name: bqpd-linux-gcc
# path: ${{ github.workspace }}/out/install/linux-gcc-release-config
# - name: Publish Test Report
# uses: mikepenz/action-junit-report@v5
# if: success() || failure()
# with:
# report_paths: ${{ github.workspace }}/test-results.xml
- name: Prepare pulling cmake installed libraries
run: |
echo "CMAKE_INSTALL_PREFIX=${{ runner.TEMP }}" >> $GITHUB_ENV
- name: Download GKlib
uses: dawidd6/action-download-artifact@v6
with:
name: gklib-linux-${{ matrix.toolchain }}
repo: worc4021/GKlib
path: ${{ runner.TEMP }}
workflow: ci.yml
- name: Download METIS
uses: dawidd6/action-download-artifact@v6
with:
name: metis-linux-${{ matrix.toolchain }}
repo: worc4021/METIS
path: ${{ runner.TEMP }}
workflow: ci.yml
- name: Setup Ninja
uses: seanmiddleditch/gha-setup-ninja@master
- name: Setup cmake
uses: jwlawson/actions-setup-cmake@v2
with:
cmake-version: '3.29.x'
- name: Configure
run: |
cmake --preset linux-${{ matrix.toolchain }}-release-config -DBUILD_MEX:BOOL=OFF
working-directory: ${{ github.workspace }}
- name: Build
run: |
cmake --build --preset linux-${{ matrix.toolchain }}-release-build --target install
working-directory: ${{ github.workspace }}
- name: Upload library
uses: actions/upload-artifact@v4
with:
name: mumps-linux-${{ matrix.toolchain}}
path: ${{ github.workspace }}/out/install/linux-${{ matrix.toolchain }}-release-config

windows-build:
runs-on: windows-latest
steps:
- uses: actions/checkout@v4
- uses: worc4021/oneApi@v8
with:
icx: true
ifx: true
mkl: true
- name: Pull MUMPS
run: |
curl --output ${{ runner.temp }}/MUMPS_5.7.3.tar.gz ${{ secrets.MUMPS_URL }}/MUMPS_5.7.3.tar.gz
tar -xzf ${{ runner.temp }}/MUMPS_5.7.3.tar.gz -C ${{ runner.temp }}
cp -r ${{ runner.temp }}/MUMPS_5.7.3/* ${{ github.workspace }}
ls -lAh ${{ github.workspace }}/src
shell: cmd
- name: Download GKlib
uses: dawidd6/action-download-artifact@v6
with:
name: gklib-windows-intel
repo: worc4021/GKlib
path: ${{ runner.TEMP }}
workflow: ci.yml
- name: Download METIS
uses: dawidd6/action-download-artifact@v6
with:
name: metis-windows-intel
repo: worc4021/METIS
path: ${{ runner.TEMP }}
workflow: ci.yml
- name: Setup Ninja
uses: seanmiddleditch/gha-setup-ninja@master
- name: Setup cmake
uses: jwlawson/actions-setup-cmake@v2
with:
cmake-version: '3.29.x'
- name: Configure
run: |
cmake --preset windows-intel-release-config -DBUILD_MEX:BOOL=OFF
working-directory: ${{ github.workspace }}
shell: cmd
env:
CMAKE_INSTALL_PREFIX: ${{ runner.TEMP }}
- name: Build
run: |
cmake --build --preset windows-intel-release-build --target install
working-directory: ${{ github.workspace }}
shell: cmd
- name: Upload library
uses: actions/upload-artifact@v4
with:
name: mumps-windows-intel
path: ${{ github.workspace }}/out/install/windows-intel-release-config


66 changes: 45 additions & 21 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -19,26 +19,48 @@ find_package(MKL REQUIRED)
include(FortranCInterface)
FortranCInterface_VERIFY()
if (FortranCInterface_GLOBAL_CASE STREQUAL "UPPER")
set(F_SYMBOL "#define F_SYMBOL(lower_case,upper_case) ${FortranCInterface_GLOBAL_PREFIX}##MUMPS_##upper_case##${FortranCInterface_GLOBAL_SUFFIX}")
set(F_SYM_ARITH_D "#define F_SYM_ARITH(lower_case,upper_case) ${FortranCInterface_GLOBAL_PREFIX}##DMUMPS_##upper_case##${FortranCInterface_GLOBAL_SUFFIX}")
set(F_SYM_ARITH_S "#define F_SYM_ARITH(lower_case,upper_case) ${FortranCInterface_GLOBAL_PREFIX}##SMUMPS_##upper_case##${FortranCInterface_GLOBAL_SUFFIX}")
set(F_SYM_ARITH_C "#define F_SYM_ARITH(lower_case,upper_case) ${FortranCInterface_GLOBAL_PREFIX}##CMUMPS_##upper_case##${FortranCInterface_GLOBAL_SUFFIX}")
set(F_SYM_ARITH_Z "#define F_SYM_ARITH(lower_case,upper_case) ${FortranCInterface_GLOBAL_PREFIX}##ZMUMPS_##upper_case##${FortranCInterface_GLOBAL_SUFFIX}")
set(F_SYMBOL "MUMPS_##upper_case")
set(F_SYM_ARITH_S "SMUMPS_##upper_case")
set(F_SYM_ARITH_D "DMUMPS_##upper_case")
set(F_SYM_ARITH_Z "ZMUMPS_##upper_case")
set(F_SYM_ARITH_C "CMUMPS_##upper_case")
else()
set(F_SYMBOL "#define F_SYMBOL(lower_case,upper_case) ${FortranCInterface_GLOBAL_PREFIX}##mumps_##lower_case##${FortranCInterface_GLOBAL_SUFFIX}")
set(F_SYM_ARITH_D "#define F_SYM_ARITH(lower_case,upper_case) ${FortranCInterface_GLOBAL_PREFIX}##dmumps_##lower_case##${FortranCInterface_GLOBAL_SUFFIX}")
set(F_SYM_ARITH_S "#define F_SYM_ARITH(lower_case,upper_case) ${FortranCInterface_GLOBAL_PREFIX}##smumps_##lower_case##${FortranCInterface_GLOBAL_SUFFIX}")
set(F_SYM_ARITH_C "#define F_SYM_ARITH(lower_case,upper_case) ${FortranCInterface_GLOBAL_PREFIX}##cmumps_##lower_case##${FortranCInterface_GLOBAL_SUFFIX}")
set(F_SYM_ARITH_Z "#define F_SYM_ARITH(lower_case,upper_case) ${FortranCInterface_GLOBAL_PREFIX}##zmumps_##lower_case##${FortranCInterface_GLOBAL_SUFFIX}")
set(F_SYMBOL "mumps_##lower_case")
set(F_SYM_ARITH_D "dmumps_##lower_case")
set(F_SYM_ARITH_S "smumps_##lower_case")
set(F_SYM_ARITH_C "cmumps_##lower_case")
set(F_SYM_ARITH_Z "zmumps_##lower_case")
endif(FortranCInterface_GLOBAL_CASE STREQUAL "UPPER")

message(STATUS "Add to src/mumps_common.h: ")
message(STATUS "${F_SYMBOL}")
message(STATUS "Add to src/mumps_c.c: ")
message(STATUS "${F_SYM_ARITH_D}")
message(STATUS "${F_SYM_ARITH_S}")
message(STATUS "${F_SYM_ARITH_C}")
message(STATUS "${F_SYM_ARITH_Z}")
if (NOT FortranCInterface_GLOBAL_SUFFIX STREQUAL "")
set(F_SYMBOL "mumps_##lower_case##${FortranCInterface_GLOBAL_SUFFIX}")
set(F_SYM_ARITH_S "smumps_##lower_case##${FortranCInterface_GLOBAL_SUFFIX}")
set(F_SYM_ARITH_D "dmumps_##lower_case##${FortranCInterface_GLOBAL_SUFFIX}")
set(F_SYM_ARITH_Z "zmumps_##lower_case##${FortranCInterface_GLOBAL_SUFFIX}")
set(F_SYM_ARITH_C "cmumps_##lower_case##${FortranCInterface_GLOBAL_SUFFIX}")
endif()

if (NOT FortranCInterface_GLOBAL_PREFIX STREQUAL "")
set(F_SYMBOL "#define F_SYMBOL(lower_case,upper_case) ${FortranCInterface_GLOBAL_PREFIX}##${F_SYMBOL}")
set(F_SYM_ARITH_S "#define F_SYM_ARITH(lower_case,upper_case) ${FortranCInterface_GLOBAL_PREFIX}##${F_SYM_ARITH_S}")
set(F_SYM_ARITH_D "#define F_SYM_ARITH(lower_case,upper_case) ${FortranCInterface_GLOBAL_PREFIX}##${F_SYM_ARITH_D}")
set(F_SYM_ARITH_Z "#define F_SYM_ARITH(lower_case,upper_case) ${FortranCInterface_GLOBAL_PREFIX}##${F_SYM_ARITH_Z}")
set(F_SYM_ARITH_C "#define F_SYM_ARITH(lower_case,upper_case) ${FortranCInterface_GLOBAL_PREFIX}##${F_SYM_ARITH_C}")
else()
set(F_SYMBOL "#define F_SYMBOL(lower_case,upper_case) ${F_SYMBOL}")
set(F_SYM_ARITH_S "#define F_SYM_ARITH(lower_case,upper_case) ${F_SYM_ARITH_S}")
set(F_SYM_ARITH_D "#define F_SYM_ARITH(lower_case,upper_case) ${F_SYM_ARITH_D}")
set(F_SYM_ARITH_Z "#define F_SYM_ARITH(lower_case,upper_case) ${F_SYM_ARITH_Z}")
set(F_SYM_ARITH_C "#define F_SYM_ARITH(lower_case,upper_case) ${F_SYM_ARITH_C}")
endif()

configure_file(${CMAKE_CURRENT_SOURCE_DIR}/src/mumps_c.c.patch.in ${CMAKE_CURRENT_SOURCE_DIR}/src/mumps_c.c.patch)
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/src/mumps_common.h.patch.in ${CMAKE_CURRENT_SOURCE_DIR}/src/mumps_common.h.patch)
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/libseq/elapse.h.patch.in ${CMAKE_CURRENT_SOURCE_DIR}/libseq/elapse.h.patch)

execute_process(COMMAND patch --no-backup-if-mismatch --input=src/mumps_c.c.patch src/mumps_c.c WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR})
execute_process(COMMAND patch --no-backup-if-mismatch --input=src/mumps_common.h.patch src/mumps_common.h WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR})
execute_process(COMMAND patch --no-backup-if-mismatch --input=libseq/elapse.h.patch libseq/elapse.h WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR})

if (USE_INT64)
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/src/mumps_int_def64_h.in ${CMAKE_CURRENT_SOURCE_DIR}/include/mumps_int_def.h COPYONLY)
Expand All @@ -63,15 +85,17 @@ add_subdirectory(PORD)
add_subdirectory(libseq)
add_subdirectory(src)
add_subdirectory(examples)
if (BUILD_MEX)
add_subdirectory(MATLAB)
endif()
# if (BUILD_MEX)
# add_subdirectory(MATLAB)
# endif()

install(TARGETS libdmumps libcmumps libsmumps libzmumps pord mpiseq libmumps_common
EXPORT mumpsTargets
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}/${CMAKE_BUILD_TYPE}
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}/${CMAKE_BUILD_TYPE}
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}/${CMAKE_BUILD_TYPE})
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}/${CMAKE_BUILD_TYPE}
FILE_SET HEADERS)

file(GLOB HEADER_FILES "include/*.h")
install(FILES ${HEADER_FILES} DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/mumps)
install(EXPORT mumpsTargets
Expand Down
Loading

0 comments on commit 3325189

Please sign in to comment.