Skip to content

Update .gitignore

Update .gitignore #64

Workflow file for this run

name: CI
on:
push:
branches:
- master
pull_request:
jobs:
build:
strategy:
fail-fast: false
matrix:
cfg:
- label: L-Gnu
runs-on: ubuntu-latest
python-version: "3.10"
blas: MKL
build_type: Release
cmargs: >
-D BUILD_SHARED_LIBS=ON
-D LIBEFP_ENABLE_OPENMP=ON
pytest-marker-expr: "test" # i.e., all
- label: L-Gnu
runs-on: ubuntu-latest
python-version: "3.10"
blas: OBL
build_type: Release
cmargs: >
-D BUILD_SHARED_LIBS=ON
-D LIBEFP_ENABLE_OPENMP=ON
pytest-marker-expr: "test"
- label: L-Intel
runs-on: ubuntu-latest
python-version: "3.10"
blas: MKL
build_type: Release
cmargs: >
-D CMAKE_C_COMPILER=icx
-D CMAKE_CXX_COMPILER=icpx
-D CMAKE_C_FLAGS="--gcc-toolchain=${CONDA_PREFIX} --sysroot=${CONDA_PREFIX}/${HOST}/sysroot -target ${HOST}"
-D CMAKE_CXX_FLAGS="--gcc-toolchain=${CONDA_PREFIX} --sysroot=${CONDA_PREFIX}/${HOST}/sysroot -target ${HOST}"
-D BUILD_SHARED_LIBS=ON
-D LIBEFP_ENABLE_OPENMP=OFF
pytest-marker-expr: "not dict_5" # the forced fail fails?
- label: M-Clang
# NaNs in tests on macos-latest (macos-12)
runs-on: macos-13
python-version: "3.10"
blas: OBL
build_type: Release
cmargs: >
-D BUILD_SHARED_LIBS=ON
-D LIBEFP_ENABLE_OPENMP=ON
pytest-marker-expr: "test"
- label: M-Clang
# NaNs in tests on macos-latest (macos-12)
runs-on: macos-13
python-version: "3.10"
blas: ACC
build_type: Release
cmargs: >
-D BUILD_SHARED_LIBS=ON
-D LIBEFP_ENABLE_OPENMP=ON
pytest-marker-expr: "test"
- label: W-MinGW
runs-on: windows-latest
python-version: "3.10"
blas: MKL
build_type: Release
cmargs: >
-D CMAKE_C_COMPILER="gcc.exe"
-D CMAKE_CXX_COMPILER="g++.exe"
-D CMAKE_Fortran_COMPILER="gfortran.exe"
-D BUILD_SHARED_LIBS=OFF
-D LIBEFP_ENABLE_OPENMP=ON
# using gnu, not clang-cl, for consistent compiler stack incl. Fortran
pytest-marker-expr: "test"
name: "Build • 🐍 ${{ matrix.cfg.python-version }} • ${{ matrix.cfg.label }} • ${{ matrix.cfg.blas }}"
runs-on: ${{ matrix.cfg.runs-on }}
defaults:
run:
shell: bash -el {0}
steps:
- uses: actions/checkout@v4
- name: Write a Conda Env File
run: |
cat > export.yaml <<EOF
name: libefp-dev
dependencies:
- cmake
- ninja
- c-compiler
- fortran-compiler
#- dpcpp_linux-64
- blas-devel
#MKL- libblas=*=*mkl
#ACC- libblas=*=*accelerate
#OBL- libblas=*=*openblas
#OBL- openblas=*=*openmp*
# pylibefp
- cxx-compiler
- pybind11
- qcelemental
#- libpython
- pytest
EOF
if [[ "${{ runner.os }}" == "Linux" ]]; then
:
sed -i "s;#${{ matrix.cfg.blas }};;g" export.yaml
if [[ "${{ matrix.cfg.label }}" == "L-Intel" ]]; then
sed -i "s/#- dpcpp_linux-64/- dpcpp_linux-64/g" export.yaml
fi
fi
if [[ "${{ runner.os }}" == "macOS" ]]; then
:
sed -E -i.bak "s;#${{ matrix.cfg.blas }};;g" export.yaml
fi
if [[ "${{ runner.os }}" == "Windows" ]]; then
:
sed -i "s;fortran-compiler;m2w64-gcc-fortran;g" export.yaml
sed -i "s;#${{ matrix.cfg.blas }};;g" export.yaml
sed -i "s;openmp;pthreads;g" export.yaml # W openblas is pthreads
sed -i "s;#- libpython;- libpython;g" export.yaml
fi
# model sed for L/W
# sed -i "s;;;g" export.yaml
# model sed for M
# sed -E -i.bak "s;;;g" export.yaml
cat export.yaml
- name: Install dependencies
uses: conda-incubator/setup-miniconda@v3
with:
activate-environment: libefp-dev
environment-file: export.yaml
python-version: ${{ matrix.cfg.python-version }}
miniforge-variant: Mambaforge
use-mamba: true
channels: conda-forge,nodefaults
- name: Environment Information
run: |
mamba info
mamba list
- name: Configure CMake
run: |
cmake \
-S . \
-B "${{ github.workspace }}/build" \
-G Ninja \
-D CMAKE_INSTALL_PREFIX="${{ github.workspace }}/installed" \
-D CMAKE_PREFIX_PATH="${CONDA_PREFIX}" \
${{ matrix.cfg.cmargs }}
- name: Build & Install
run: cmake --build "${{ github.workspace }}/build" --config ${{ matrix.cfg.build_type }} --target install
- name: Inspect linkage
run: |
if [[ "${{ runner.os }}" == "Linux" ]]; then
ldd "${{ github.workspace }}/installed/lib/libefp.so"
ldd "${{ github.workspace }}/installed/bin/efpmd"
fi
if [[ "${{ runner.os }}" == "macOS" ]]; then
otool -L "${{ github.workspace }}/installed/lib/libefp.dylib"
otool -L "${{ github.workspace }}/installed/bin/efpmd"
fi
if [[ "${{ runner.os }}" == "Windows" ]]; then
# library is static
objdump.exe -p "${{ github.workspace }}\\installed\\bin\\efpmd.exe" | grep "dll"
fi
- name: Test (CTest) - unit tests
run: ctest --output-on-failure --test-dir "${{ github.workspace }}/build"
- name: Test (find_package) - consume installation
run: |
mkdir test_installed_library && cd test_installed_library
cat > CMakeLists.txt <<EOF
cmake_minimum_required(VERSION 3.16)
project(sample)
find_package(libefp REQUIRED)
include(CMakePrintHelpers)
cmake_print_properties(
TARGETS
libefp::efp
libefp::efpmd
tgt::lapack
OpenMP::OpenMP_C
PROPERTIES
IMPORTED_LINK_DEPENDENT_LIBRARIES
IMPORTED_LOCATION
INTERFACE_LOCATION
INTERFACE_LINK_LIBRARIES
INTERFACE_INCLUDE_DIRECTORIES
INTERFACE_COMPILE_DEFINITIONS
INTERFACE_COMPILE_OPTIONS
INTERFACE_SYSTEM_INCLUDE_DIRECTORIES
)
add_executable(hello "hello.c")
target_link_libraries(hello libefp::efp)
EOF
cat > hello.c <<EOF
#include <stdio.h>
#include <efp.h>
int main() {
printf("Hello World");
return 0;
}
EOF
cmake -S . -B build -G Ninja --log-level verbose -DCMAKE_BUILD_TYPE=Release -DCMAKE_PREFIX_PATH="${CONDA_PREFIX};${{ github.workspace }}/installed"
cmake --build build
./build/hello
# Step is unnecessary; remove for debugging.
- name: Confound Environment - test fetched pybind11
if: ${{ matrix.cfg.blas == 'OBL' }}
run: mamba remove pybind11
- name: Build & Install Python bindings
run: |
cd python
cmake \
-S . \
-B build \
-G Ninja \
-D CMAKE_PREFIX_PATH="${CONDA_PREFIX};${{ github.workspace }}/installed" \
-D CMAKE_INSTALL_PREFIX="${{ github.workspace }}/installed" \
${{ matrix.cfg.cmargs }}
cmake --build build --target install
# psi4 with MKL avail for qmefp test
- name: Install Psi4 for QM/EFP testing
if: ${{ matrix.cfg.blas == 'MKL' }}
run: conda install psi4 -c conda-forge
- name: Test (pytest) -- unit tests Python bindings
run: |
PYTHONPATH="${{ github.workspace }}/installed/lib" \
pytest --cache-clear -v -rws --color=yes \
--durations=50 --durations-min=1 --strict-markers \
-k "${{ matrix.cfg.pytest-marker-expr }}" \
"${{ github.workspace }}/installed/"