Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use of system libraries and github workflows #50

Open
wants to merge 18 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
50 changes: 50 additions & 0 deletions .github/workflows/compile.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
name: Sparselizard Compilation

on: [push]

jobs:
Compilation-Actions:
runs-on: ubuntu-latest

env:
CCACHE_COMPRESS: "true"
CCACHE_MAXSIZE: 500M

steps:
- name: Check out repository code
uses: actions/checkout@v2
- run: echo "The ${{ github.repository }} repository has been cloned to the runner."
- run: echo "The workflow is now ready to test the code on the runner."

- name: install ccache
run: sudo apt-get install ccache

- name: identify machine architecture
run: |
gcc -### -E -march=native - &> machine-type.txt
cat machine-type.txt

- name: restore cache
uses: actions/cache@v2
with:
path: ~/.ccache
key: ccache-${{ hashFiles('machine-type.txt') }}-${{ github.sha }}
restore-keys: ccache-${{ hashFiles('machine-type.txt') }}-

- name: Install mandatory packages
run: sudo apt-get install -y libopenblas-dev libmetis-dev libopenmpi-dev libmumps-dev petsc-dev slepc-dev libgmsh-dev

- name: build
run: |
export PATH="/usr/lib/ccache:$PATH"
mkdir build
cmake -B build .
cd build
make -j $(getconf _NPROCESSORS_ONLN)

- name: show ccache stats
run: |
ccache --show-stats
ccache --zero-stats

- run: echo "🍏 This job's status is ${{ job.status }}."
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -36,3 +36,4 @@ build/

# CCLS cache
.ccls-cache/
machine-type.txt
Empty file modified Makefile
100755 → 100644
Empty file.
15 changes: 10 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,17 +1,22 @@
# Build instructions

Run the scripts in the 'install_external_libs' folder then configure and build:
Sparselizard depends on mandatory and optional external libraries.

On debian Linux, run this command to install these libraries globally
```sudo apt-get install -y libopenblas-dev libmetis-dev libopenmpi-dev libmumps-dev petsc-dev slepc-dev libgmsh-dev```
or
run the scripts in the 'install_external_libs' folder to download and install these libraries locally.

Then:
```bash
mkdir build && cd build
cmake ..
cmake --build . -j$(nproc)
mkdir build; cmake -B build .; cd build && make -j $(getconf _NPROCESSORS_ONLN)
```

---

Provide a custom path to the petsc, gmsh (optional) or mpi (optional) folder with:
```bash
cmake .. -DPETSC_PATH=/yourpath/petsc -DGMSH_PATH=/yourpath/gmsh -DMPI_PATH=/yourpath/mpi
cmake -B build . -DPETSC_PATH=/yourpath/petsc -DGMSH_PATH=/yourpath/gmsh -DMPI_PATH=/yourpath/mpi
```

It may be convenient to use the cmake GUI:
Expand Down
14 changes: 5 additions & 9 deletions cMake/SetupBLAS.cmake
Original file line number Diff line number Diff line change
@@ -1,47 +1,43 @@
function(ConfigureBLAS TARGET)


# Find blas headers:
FIND_PATH(BLAS_INCLUDE_PATH
NAMES cblas.h
PATHS
"${PETSC_PATH}/arch-linux-c-opt/include"
"${PETSC_PATH}/arch-linux2-c-opt/include"
"${PETSC_PATH}/arch-darwin-c-opt/include"
NO_DEFAULT_PATH
"/usr/include/x86_64-linux-gnu"
)

if(BLAS_INCLUDE_PATH)
message(STATUS "Blas header cblas.h found at " ${BLAS_INCLUDE_PATH})
else()
message(STATUS "BLAS HEADER CBLAS.H NOT FOUND")
message(STATUS "Blas header cblas.h not found")
endif()


# Find blas library:
FIND_LIBRARY(BLAS_LIBRARIES
NAMES openblas
PATHS
"${PETSC_PATH}/arch-linux-c-opt/lib"
"${PETSC_PATH}/arch-linux2-c-opt/lib"
"${PETSC_PATH}/arch-darwin-c-opt/lib"
NO_DEFAULT_PATH
"/usr/lib/x86_64-linux-gnu"
"/usr/lib/aarch64-linux-gnu"
)

if(BLAS_LIBRARIES)
message(STATUS "Blas library found at " ${BLAS_LIBRARIES})
else()
message(STATUS "BLAS LIBRARY NOT FOUND")
message(STATUS "Blas library not found")
endif()


if(BLAS_INCLUDE_PATH AND BLAS_LIBRARIES)
SET(BLAS_FOUND YES PARENT_SCOPE)

TARGET_INCLUDE_DIRECTORIES(${TARGET} PUBLIC ${BLAS_INCLUDE_PATH})
TARGET_LINK_LIBRARIES(${TARGET} PUBLIC ${BLAS_LIBRARIES})
endif()


endfunction(ConfigureBLAS)

11 changes: 2 additions & 9 deletions cMake/SetupGMSH.cmake
Original file line number Diff line number Diff line change
@@ -1,43 +1,36 @@
function(ConfigureGMSH TARGET)


# Find gmsh headers:
FIND_PATH(GMSH_INCLUDE_PATH
NAMES gmsh.h
PATHS
"${GMSH_PATH}/include"
NO_DEFAULT_PATH
)

if(GMSH_INCLUDE_PATH)
message(STATUS "Gmsh headers found at " ${GMSH_INCLUDE_PATH})
else()
message(STATUS "GMSH HEADERS NOT FOUND (OPTIONAL)")
message(STATUS "Gmsh headers not found (optional)")
endif()


# Find gmsh library:
FIND_LIBRARY(GMSH_LIBRARIES
NAMES gmsh
PATHS
"${GMSH_PATH}/lib"
NO_DEFAULT_PATH
)

if(GMSH_LIBRARIES)
message(STATUS "Gmsh library found at " ${GMSH_LIBRARIES})
else()
message(STATUS "GMSH LIBRARY NOT FOUND (OPTIONAL)")
message(STATUS "Gmsh library not found (optional)")
endif()


if(GMSH_INCLUDE_PATH AND GMSH_LIBRARIES)
SET(GMSH_FOUND YES PARENT_SCOPE)

TARGET_INCLUDE_DIRECTORIES(${TARGET} PUBLIC ${GMSH_INCLUDE_PATH})
TARGET_LINK_LIBRARIES(${TARGET} PUBLIC ${GMSH_LIBRARIES})
endif()


endfunction(ConfigureGMSH)

14 changes: 5 additions & 9 deletions cMake/SetupMETIS.cmake
Original file line number Diff line number Diff line change
@@ -1,47 +1,43 @@
function(ConfigureMETIS TARGET)


# Find metis headers:
FIND_PATH(METIS_INCLUDE_PATH
NAMES metis.h
PATHS
"${PETSC_PATH}/arch-linux-c-opt/include"
"${PETSC_PATH}/arch-linux2-c-opt/include"
"${PETSC_PATH}/arch-darwin-c-opt/include"
NO_DEFAULT_PATH
"/usr/include"
)

if(METIS_INCLUDE_PATH)
message(STATUS "Metis headers found at " ${METIS_INCLUDE_PATH})
else()
message(STATUS "METIS HEADERS NOT FOUND")
message(STATUS "Metis headers not found")
endif()


# Find metis library:
FIND_LIBRARY(METIS_LIBRARIES
NAMES metis
PATHS
"${PETSC_PATH}/arch-linux-c-opt/lib"
"${PETSC_PATH}/arch-linux2-c-opt/lib"
"${PETSC_PATH}/arch-darwin-c-opt/lib"
NO_DEFAULT_PATH
"/usr/lib/x86_64-linux-gnu"
"/usr/lib/aarch64-linux-gnu"
)

if(METIS_LIBRARIES)
message(STATUS "Metis library found at " ${METIS_LIBRARIES})
else()
message(STATUS "METIS LIBRARY NOT FOUND")
message(STATUS "Metis library not found")
endif()


if(METIS_INCLUDE_PATH AND METIS_LIBRARIES)
SET(METIS_FOUND YES PARENT_SCOPE)

TARGET_INCLUDE_DIRECTORIES(${TARGET} PUBLIC ${METIS_INCLUDE_PATH})
TARGET_LINK_LIBRARIES(${TARGET} PUBLIC ${METIS_LIBRARIES})
endif()


endfunction(ConfigureMETIS)

16 changes: 6 additions & 10 deletions cMake/SetupMPI.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -6,44 +6,40 @@

function(ConfigureMPI TARGET)


# Find mpi headers:
FIND_PATH(MPI_INCLUDE_PATH
NAMES mpi.h
PATHS
"${MPI_PATH}/include"
NO_DEFAULT_PATH
"/usr/include/x86_64-linux-gnu/mpi"
"/usr/include/aarch64-linux-gnu/mpi"
)

if(MPI_INCLUDE_PATH)
message(STATUS "MPI headers found at " ${MPI_INCLUDE_PATH})
else()
message(STATUS "MPI HEADERS NOT FOUND (OPTIONAL)")
message(STATUS "MPI headers not found (optional)")
endif()


# Find mpi library:
FIND_LIBRARY(MPI_LIBRARIES
NAMES mpi
PATHS
"${MPI_PATH}/lib"
NO_DEFAULT_PATH
"/usr/lib/x86_64-linux-gnu/openmpi/lib"
"/usr/lib/aarch64-linux-gnu/openmpi/lib"
)

if(MPI_LIBRARIES)
message(STATUS "MPI library found at " ${MPI_LIBRARIES})
else()
message(STATUS "MPI LIBRARY NOT FOUND (OPTIONAL)")
message(STATUS "MPI library not found (optional)")
endif()


if(MPI_INCLUDE_PATH AND MPI_LIBRARIES)
SET(MPI_FOUND YES PARENT_SCOPE)

TARGET_INCLUDE_DIRECTORIES(${TARGET} PUBLIC ${MPI_INCLUDE_PATH})
TARGET_LINK_LIBRARIES(${TARGET} PUBLIC ${MPI_LIBRARIES})
endif()


endfunction(ConfigureMPI)

14 changes: 5 additions & 9 deletions cMake/SetupMUMPS.cmake
Original file line number Diff line number Diff line change
@@ -1,47 +1,43 @@
function(ConfigureMUMPS TARGET)


# Find mumps headers:
FIND_PATH(MUMPS_INCLUDE_PATH
NAMES cmumps_c.h
PATHS
"${PETSC_PATH}/arch-linux-c-opt/include"
"${PETSC_PATH}/arch-linux2-c-opt/include"
"${PETSC_PATH}/arch-darwin-c-opt/include"
NO_DEFAULT_PATH
"/usr/include"
)

if(MUMPS_INCLUDE_PATH)
message(STATUS "Mumps headers found at " ${MUMPS_INCLUDE_PATH})
else()
message(STATUS "MUMPS HEADERS NOT FOUND")
message(STATUS "Mumps headers not found")
endif()


# Find mumps library:
FIND_LIBRARY(MUMPS_LIBRARIES
NAMES cmumps
PATHS
"${PETSC_PATH}/arch-linux-c-opt/lib"
"${PETSC_PATH}/arch-linux2-c-opt/lib"
"${PETSC_PATH}/arch-darwin-c-opt/lib"
NO_DEFAULT_PATH
"/usr/lib/x86_64-linux-gnu"
"/usr/lib/aarch64-linux-gnu"
)

if(MUMPS_LIBRARIES)
message(STATUS "Mumps library found at " ${MUMPS_LIBRARIES})
else()
message(STATUS "MUMPS LIBRARY NOT FOUND")
message(STATUS "Mumps library not found")
endif()


if(MUMPS_INCLUDE_PATH AND MUMPS_LIBRARIES)
SET(MUMPS_FOUND YES PARENT_SCOPE)

TARGET_INCLUDE_DIRECTORIES(${TARGET} PUBLIC ${MUMPS_INCLUDE_PATH})
TARGET_LINK_LIBRARIES(${TARGET} PUBLIC ${MUMPS_LIBRARIES})
endif()


endfunction(ConfigureMUMPS)

Loading