Skip to content

Commit

Permalink
add subproject, c++ ho, fortran, python, c++ compiled
Browse files Browse the repository at this point in the history
take 2

take 3

c++ ho testing

take 2

try 3

take 4

take 5

take 6

take 7

take 8

take 8

take 9

fortran

try 2

try 3

try 4

try 5

python

try 2

try 3

try 4

try 5

try 6

try 7

try 8

try 9

try 10

try 11

try 12

try 13

try 14

try 15

try 16

try 17

helps to spell var correctly

try 18

try 19

try 20

try 21

try 22

try 22

try 24
  • Loading branch information
loriab committed Jan 16, 2024
1 parent ee93781 commit 0961899
Show file tree
Hide file tree
Showing 18 changed files with 1,468 additions and 303 deletions.
145 changes: 90 additions & 55 deletions .github/workflows/ci_cmake.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,19 +13,35 @@ jobs:
matrix:
build_type : [ Release, Debug ]
os : [ macos-latest, ubuntu-20.04 ]
subproject : [ ON, OFF ]
exclude:
- build_type: Release
subproject: ON
include:
- os: ubuntu-20.04
cxx: g++-10
cc: gcc-10
compressor: gzip
- os: macos-latest
cxx: clang++
cc: clang
- build_type: Release
build_shared_libs: ON
compressor: bzip2
- build_type: Debug
build_shared_libs: OFF
do_fortran: ON
- build_type: Release
build_shared_libs: ON
os: ubuntu-20.04
do_fortran: ON
- build_type: Release
build_shared_libs: ON
os: macos-latest
do_fortran: OFF
# someday when mac+fortran+shared is fixed (plus universal do_fortran: ON)
#- build_type: Release
# build_shared_libs: ON

name: "Repo • ${{ matrix.os }}: ${{ matrix.cxx }} ${{ matrix.build_type }}"
name: "Repo • ${{ matrix.os }}: ${{ matrix.cxx }} ${{ matrix.build_type }} shared=${{ matrix.build_shared_libs }} fetch=${{ matrix.subproject }}"
runs-on: ${{ matrix.os }}
env:
CC: ${{ matrix.cc }}
Expand All @@ -35,19 +51,23 @@ jobs:
CCACHE_COMPRESSLEVEL : 6
BUILD_CONFIG : >
-G Ninja
-DCMAKE_BUILD_TYPE=${{ matrix.build_type }}
-DBUILD_SHARED_LIBS=${{ matrix.build_shared_libs }}
-DMPIEXEC_PREFLAGS='--bind-to;none;--allow-run-as-root'
-DCMAKE_INSTALL_PREFIX=${{github.workspace}}/build/library
-DWITH_MAX_AM=2;2
-DWITH_ERI_MAX_AM=2;2
-DWITH_ERI3_MAX_AM=3;2
-DENABLE_ERI=1
-DENABLE_ERI3=1
-DENABLE_ONEBODY=1
-DDISABLE_ONEBODY_PROPERTY_DERIVS=ON
-DMULTIPOLE_MAX_ORDER=2
-DLIBINT2_ENABLE_PYTHON=ON
-D CMAKE_BUILD_TYPE=${{ matrix.build_type }}
-D BUILD_SHARED_LIBS=${{ matrix.build_shared_libs }}
-D LIBINT_BUILD_LIBRARY_AS_SUBPROJECT=${{ matrix.subproject }}
-D CMAKE_INSTALL_PREFIX=${{github.workspace}}/build/library
-D WITH_MAX_AM=2;2
-D WITH_ERI_MAX_AM=2;2
-D WITH_ERI3_MAX_AM=3;2
-D ENABLE_ERI=1
-D ENABLE_ERI3=1
-D ENABLE_ONEBODY=1
-D DISABLE_ONEBODY_PROPERTY_DERIVS=ON
-D MULTIPOLE_MAX_ORDER=2
-D LIBINT2_REQUIRE_CXX_API_COMPILED=ON
-D LIBINT2_ENABLE_FORTRAN=${{ matrix.do_fortran }}
-D LIBINT2_ENABLE_PYTHON=ON
-D Python_EXECUTABLE=${{ matrix.os == 'macos-latest' && '/usr/local/Frameworks/Python.framework/Versions/3.11/bin/python3.11' || '/usr/bin/python3.8' }}
-D EXPORT_COMPRESSOR=${{ matrix.compressor }}
outputs:
should_skip: ${{ steps.skip_check.outputs.should_skip }}
Expand All @@ -66,8 +86,6 @@ jobs:

- name: Create Build Environment
if: ${{ steps.skip_check.outputs.should_skip != 'true' }}
# Some projects don't allow in-source building, so create a separate build directory
# We'll use this as our working directory for all subsequent commands
run: |
cmake -E make_directory ${{github.workspace}}/build/compiler
cmake -E make_directory ${{github.workspace}}/build/library
Expand Down Expand Up @@ -105,7 +123,7 @@ jobs:
restore-keys: |
${{ matrix.config.name }}-ccache-
- name: Generate Libint generator
- name: Build Libint generator
if: ${{ steps.skip_check.outputs.should_skip != 'true' }}
# Use a bash shell so we can use the same syntax for environment variable
# access regardless of the host operating system
Expand All @@ -116,34 +134,45 @@ jobs:
cmake -S ../.. -B build $BUILD_CONFIG --log-level=DEBUG
cmake --build build --target check-libint2compiler
- name: Generate Libint export
- name: Generate Libint library tarball
if: ${{ steps.skip_check.outputs.should_skip != 'true' }}
shell: bash
working-directory: ${{github.workspace}}/build/compiler
run: |
cmake --build build --target export
cd build && echo "ARTIFACT=`ls -1 libint*tgz`" >> $GITHUB_ENV
cd build && echo "ARTIFACT=`ls -1 libint*z*`" >> $GITHUB_ENV
- name: Archive Library Tarball
if: ${{ steps.skip_check.outputs.should_skip != 'true' && matrix.build_type == 'Release'}}
- name: Archive Libint library tarball
if: ${{ steps.skip_check.outputs.should_skip != 'true' && matrix.build_type == 'Release' }}
uses: actions/upload-artifact@v3
with:
if-no-files-found: error
name: ${{ runner.os }}-${{ matrix.cxx }}
path: ${{github.workspace}}/build/compiler/build/${{ env.ARTIFACT }}
retention-days: 1

- name: Generate Libint library
- name: Build Libint library (FetchContent=${{ matrix.subproject }})
if: ${{ steps.skip_check.outputs.should_skip }}
shell: bash
working-directory: ${{github.workspace}}/build/compiler
run: cmake --build build

- name: Test Libint library - unit tests
if: ${{ steps.skip_check.outputs.should_skip != 'true' }}
shell: bash
working-directory: ${{github.workspace}}/build/compiler
run: |
cmake --build build --target library check-libint2
cd build && echo "ARTIFACT=`ls -1 libint*tgz`" >> $GITHUB_ENV
run: CTEST_PARALLEL_LEVEL=2 cmake --build build --target check-libint2

#rm -rf buildcm/ && cmake -S. -Bbuildcm -GNinja -DEXPORT_COMPRESSOR=bzip2 -DWITH_MAX_AM="2;2" -DWITH_ERI_MAX_AM="2;2" -DWITH_ERI3_MAX_AM="3;2" -DENABLE_ERI=1 -DENABLE_ERI3=1 -DMULTIPOLE_MAX_ORDER=2 -DBUILD_SHARED_LIBS=ON && time cmake --build buildcm --target check-libint2
- name: Build & Test Python bindings
if: ${{ steps.skip_check.outputs.should_skip != 'true' }}
shell: bash
working-directory: ${{github.workspace}}/build/compiler
run: cmake --build build --target check-python

build_export:
# to debug the second stage, it is handy to short-circuit the first stage:
# * suppress steps beyond "Archive Library Tarball" with "if: false"
# * for further reduction, run mostly Linux lanes with "os : [ ubuntu-20.04 ]"
needs: build_repo
if: always() && (needs.build_repo.outputs.should_skip != 'true')
strategy:
Expand All @@ -153,44 +182,51 @@ jobs:
- runs-on: ubuntu-latest
lane: ubuntu-gnu
libargs: >
-DBUILD_SHARED_LIBS=ON
-D BUILD_SHARED_LIBS=ON
-D LIBINT2_ENABLE_FORTRAN=ON
testargs: ""

- runs-on: windows-latest
lane: windows-clang-cl
libargs: >
-GNinja
-DCMAKE_BUILD_TYPE=Release
-DBUILD_SHARED_LIBS=OFF
-DCMAKE_CXX_COMPILER=clang-cl
-DCMAKE_C_COMPILER=clang-cl
-G Ninja
-D CMAKE_BUILD_TYPE=Release
-D BUILD_SHARED_LIBS=OFF
-D CMAKE_CXX_COMPILER=clang-cl
-D CMAKE_C_COMPILER=clang-cl
testargs: >
-GNinja
-DCMAKE_BUILD_TYPE=Release
-DCMAKE_CXX_COMPILER=clang-cl
-DCMAKE_C_COMPILER=clang-cl
-G Ninja
-D CMAKE_BUILD_TYPE=Release
-D CMAKE_CXX_COMPILER=clang-cl
-D CMAKE_C_COMPILER=clang-cl
- runs-on: macos-latest
lane: macos-clang
libargs: >
-DBUILD_SHARED_LIBS=ON
-D BUILD_SHARED_LIBS=OFF
-D LIBINT2_ENABLE_FORTRAN=ON
# return to shared when mac+fortran+shared is fixed
testargs: ""

- runs-on: ubuntu-latest
lane: ubuntu-intel
libargs: >
-DCMAKE_CXX_COMPILER=icpx
-DCMAKE_CXX_FLAGS="--gcc-toolchain=${CONDA_PREFIX} --sysroot=${CONDA_PREFIX}/${HOST}/sysroot -target ${HOST}"
-D CMAKE_CXX_COMPILER=icpx
-D CMAKE_CXX_FLAGS="--gcc-toolchain=${CONDA_PREFIX} --sysroot=${CONDA_PREFIX}/${HOST}/sysroot -target ${HOST}"
testargs: >
-DCMAKE_CXX_COMPILER=icpx
-DCMAKE_CXX_FLAGS="--gcc-toolchain=${CONDA_PREFIX} --sysroot=${CONDA_PREFIX}/${HOST}/sysroot -target ${HOST}"
-D CMAKE_CXX_COMPILER=icpx
-D CMAKE_CXX_FLAGS="--gcc-toolchain=${CONDA_PREFIX} --sysroot=${CONDA_PREFIX}/${HOST}/sysroot -target ${HOST}"
name: "Export • ${{ matrix.cfg.lane }}"
runs-on: ${{ matrix.cfg.runs-on }}

steps:
# Note we're not checking out the repo. All src from Linux tarball generated above.

- uses: actions/download-artifact@v3
with:
name: Linux-g++-10

- name: Write a Conda Env File
shell: bash -l {0}
run: |
Expand All @@ -202,6 +238,7 @@ jobs:
- cmake
- ninja
- cxx-compiler
- fortran-compiler
- python
- boost
- eigen
Expand All @@ -212,6 +249,7 @@ jobs:
EOF
if [[ "${{ runner.os }}" == "Windows" ]]; then
sed -i "s/- cxx/#- cxx/g" export.yaml
sed -i "s/- fortran/#- fortran/g" export.yaml
fi
if [[ "${{ matrix.cfg.lane }}" == "ubuntu-intel" ]]; then
sed -i "s/#- dpcpp_linux-64/- dpcpp_linux-64/g" export.yaml
Expand Down Expand Up @@ -241,25 +279,22 @@ jobs:
with:
arch: x64

- uses: actions/download-artifact@v3
with:
name: Linux-g++-10

- name: Extract, Build, Install Libint Library
shell: bash -l {0}
run: |
tar -zxf libint*tgz
mkdir libint && mv libint-2*/* libint/ && cd libint/
cmake \
-S. \
-Bbuild \
-GNinja \
-DCMAKE_INSTALL_PREFIX="${{github.workspace}}/installed" \
-DCMAKE_CXX_COMPILER=${CXX} \
-DLIBINT2_PYTHON=OFF \
-DCMAKE_PREFIX_PATH="${CONDA_PREFIX}" \
-S . \
-B build \
-G Ninja \
-D CMAKE_INSTALL_PREFIX="${{github.workspace}}/installed" \
-D CMAKE_CXX_COMPILER=${CXX} \
-D LIBINT2_REQUIRE_CXX_API_COMPILED=ON \
-D LIBINT2_ENABLE_PYTHON=ON \
-D CMAKE_PREFIX_PATH="${CONDA_PREFIX}" \
${{ matrix.cfg.libargs }}
cmake --build build --target install
cmake --build build --target install libint2-python-test
- name: Test Libint library - unit tests
shell: bash -l {0}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/cmake.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ on:
push:
branches:
- master
#pull_request:
pull_request:

jobs:
build_repo:
Expand Down
16 changes: 13 additions & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,13 @@ include(DynamicVersion)
dynamic_version(
PROJECT_PREFIX Libint2Compiler_
GIT_ARCHIVAL_FILE ${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules/.git_archival.txt
VERSION_FULL_MODE POST
OUTPUT_COMMIT LibintRepository_COMMIT
OUTPUT_VERSION LibintRepository_VERSION
OUTPUT_DESCRIBE LibintRepository_DESCRIBE
OUTPUT_DISTANCE LibintRepository_DISTANCE
OUTPUT_SHORT_HASH LibintRepository_SHORT_HASH
OUTPUT_VERSION_FULL LibintRepository_VERSION_FULL
)

set(CMAKE_BUILD_TYPE "Release" CACHE STRING "Choose the type of build.") # foil Ninja Debug on Windows
Expand Down Expand Up @@ -100,13 +103,20 @@ message(STATUS "Building using CMake ${CMAKE_VERSION} Generator ${CMAKE_GENERATO
option_with_default(CMAKE_BUILD_TYPE "Build type (Release or Debug)" Release)

### compiler-only
option_with_print(LIBINT_BUILD_LIBRARY_AS_SUBPROJECT
"[EXPERT] Build generated library as a subproject: if FALSE will configure and build separately" OFF)

### library-only
option_with_default(LIBINT2_ENABLE_PYTHON
option_with_print(LIBINT2_REQUIRE_CXX_API
"C++11 Libint API: define library targets + test (requires Eigen3, Boost is optional but strongly recommended)" ON)
option_with_print(LIBINT2_REQUIRE_CXX_API_COMPILED
"Build C++11 Compiled (not just header-only) targets (requires Eigen3, Boost strongly recommended)" ON)
option_with_print(LIBINT2_ENABLE_FORTRAN
"Build Fortran03+ Libint interface (requires Fortran)" OFF)
option_with_print(LIBINT2_ENABLE_PYTHON
"Build Python bindings (requires Python and Pybind11 and Eigen3)" OFF)
option_with_default(LIBINT2_PREFIX_PYTHON_INSTALL
option_with_print(LIBINT2_PREFIX_PYTHON_INSTALL
"For LIBINT2_ENABLE_PYTHON=ON, whether to install the Python module in the Linux manner to CMAKE_INSTALL_PREFIX or to not install it. See target libint2-python-wheel for alternate installation in the Python manner to Python_EXECUTABLE's site-packages." OFF)

option_with_print(BUILD_SHARED_LIBS
"Build Libint library as shared, not static" OFF)
option_with_print(LIBINT2_BUILD_SHARED_AND_STATIC_LIBS
Expand Down
Loading

0 comments on commit 0961899

Please sign in to comment.