Skip to content

Commit

Permalink
Merge remote-tracking branch 'app4triqs/unstable' into unstable
Browse files Browse the repository at this point in the history
  • Loading branch information
Thoemi09 committed Mar 25, 2024
2 parents 0d48eed + 2ec749a commit 2d7901d
Show file tree
Hide file tree
Showing 21 changed files with 96 additions and 2,657 deletions.
50 changes: 44 additions & 6 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,19 @@ on:
branches: [ unstable ]
pull_request:
branches: [ unstable ]
workflow_call:
workflow_dispatch:

env:
CMAKE_C_COMPILER_LAUNCHER: ccache
CMAKE_CXX_COMPILER_LAUNCHER: ccache
CCACHE_COMPILERCHECK: content
CCACHE_BASEDIR: ${{ github.workspace }}
CCACHE_DIR: ${{ github.workspace }}/.ccache
CCACHE_MAXSIZE: 500M
CCACHE_SLOPPINESS: pch_defines,time_macros,include_file_mtime,include_file_ctime
CCACHE_COMPRESS: "1"
CCACHE_COMPRESSLEVEL: "1"

jobs:
build:
Expand All @@ -16,12 +29,19 @@ jobs:
- {os: ubuntu-22.04, cc: gcc-12, cxx: g++-12}
- {os: ubuntu-22.04, cc: clang-15, cxx: clang++-15}
- {os: macos-12, cc: gcc-12, cxx: g++-12}
- {os: macos-12, cc: /usr/local/opt/llvm/bin/clang, cxx: /usr/local/opt/llvm/bin/clang++}
- {os: macos-12, cc: clang, cxx: clang++}

runs-on: ${{ matrix.os }}

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4

- uses: actions/cache/restore@v3
with:
path: ${{ env.CCACHE_DIR }}
key: ccache-${{ matrix.os }}-${{ matrix.cc }}-${{ github.run_id }}
restore-keys:
ccache-${{ matrix.os }}-${{ matrix.cc }}-

- name: Install ubuntu dependencies
if: matrix.os == 'ubuntu-22.04'
Expand All @@ -30,6 +50,7 @@ jobs:
sudo apt-get install lsb-release wget software-properties-common &&
wget -O /tmp/llvm.sh https://apt.llvm.org/llvm.sh && sudo chmod +x /tmp/llvm.sh && sudo /tmp/llvm.sh 15 &&
sudo apt-get install
ccache
clang-15
g++-12
gfortran
Expand Down Expand Up @@ -65,13 +86,19 @@ jobs:
- name: Install homebrew dependencies
if: matrix.os == 'macos-12'
run: |
brew install gcc@12 llvm boost eigen fftw hdf5 mpfr open-mpi openblas
pip3 install mako numpy scipy mpi4py
pip3 install -r requirements.txt
brew install ccache gcc@12 llvm boost eigen fftw hdf5 mpfr open-mpi openblas
mkdir $HOME/.venv
python3 -m venv $HOME/.venv/my_python
source $HOME/.venv/my_python/bin/activate
pip install mako numpy scipy mpi4py
pip install -r requirements.txt
echo "VIRTUAL_ENV=$VIRTUAL_ENV" >> $GITHUB_ENV
echo "PATH=$PATH" >> $GITHUB_ENV
- name: add clang cxxflags
if: ${{ contains(matrix.cxx, 'clang') }}
run:
run: |
echo "PATH=/usr/local/opt/llvm/bin:$PATH" >> $GITHUB_ENV
echo "CXXFLAGS=-stdlib=libc++" >> $GITHUB_ENV
- name: Build & Install TRIQS
Expand All @@ -98,7 +125,18 @@ jobs:
- name: Test triqs_Nevanlinna
env:
DYLD_FALLBACK_LIBRARY_PATH: /usr/local/opt/llvm/lib
OPENBLAS_NUM_THREADS: "1"
run: |
source $HOME/install/share/triqs/triqsvars.sh
cd build
ctest -j2 --output-on-failure
- name: ccache statistics
if: always()
run: ccache -sv

- uses: actions/cache/save@v3
if: always()
with:
path: ${{ env.CCACHE_DIR }}
key: ccache-${{ matrix.os }}-${{ matrix.cc }}-${{ github.run_id }}
17 changes: 15 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@

cmake_minimum_required(VERSION 3.20 FATAL_ERROR)
cmake_policy(VERSION 3.20)
if(POLICY CMP0144)
cmake_policy(SET CMP0144 NEW)
endif()

# ############
# Define Project
Expand All @@ -41,7 +44,7 @@ option(TRIQS_Support "TRIQS Support" ON)
if(TRIQS_Support)
find_package(TRIQS 3.2 REQUIRED)
message(STATUS "Compiling with TRIQS Support")

# Enforce Consistent Versioning
if(NOT ${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR} VERSION_EQUAL ${TRIQS_VERSION_MAJOR}.${TRIQS_VERSION_MINOR})
message(FATAL_ERROR "The ${PROJECT_NAME} version ${PROJECT_VERSION} is not compatible with TRIQS version ${TRIQS_VERSION}.")
Expand All @@ -50,7 +53,7 @@ else()
message(STATUS "Compiling without TRIQS Support! Limited functionality")
endif()

# Default Install directory to TRIQS_ROOT if not given or invalid.
# Default Install directory to TRIQS_ROOT if not given or when provided as relative path.
if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT OR (NOT IS_ABSOLUTE ${CMAKE_INSTALL_PREFIX}))
if(TRIQS_Support)
message(STATUS "No install prefix given (or invalid). Defaulting to TRIQS_ROOT")
Expand Down Expand Up @@ -102,6 +105,9 @@ option(BUILD_SHARED_LIBS "Enable compilation of shared libraries" OFF)
# ############
# Global Compilation Settings

# Build static libraries by default
option(BUILD_SHARED_LIBS "Enable compilation of shared libraries" OFF)

# Export the list of compile-commands into compile_commands.json
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)

Expand All @@ -121,6 +127,7 @@ target_compile_options(${PROJECT_NAME}_warnings
-Wpedantic
-Wno-sign-compare
$<$<CXX_COMPILER_ID:GNU>:-Wno-comma-subscript>
$<$<CXX_COMPILER_ID:GNU>:-Wno-psabi> # Disable notes about ABI changes
$<$<CXX_COMPILER_ID:GNU>:-Wshadow=local>
$<$<CXX_COMPILER_ID:GNU>:-Wno-attributes>
$<$<CXX_COMPILER_ID:GNU>:-Wno-deprecated-declarations>
Expand All @@ -133,6 +140,9 @@ target_compile_options(${PROJECT_NAME}_warnings
$<$<CXX_COMPILER_ID:IntelLLVM>:-Wno-tautological-constant-compare>
)

# Provide GNU Installation directories
include(GNUInstallDirs)

# #############
# Build Project

Expand Down Expand Up @@ -164,6 +174,9 @@ endif()
# Additional configuration files
add_subdirectory(share)

# add packaging for automatic Versioning
add_subdirectory(packaging)

# #############
# Debian Package

Expand Down
3 changes: 0 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,6 @@ ARG APPNAME=Nevanlinna

RUN apt-get install -y libeigen3-dev libmpfr-dev

COPY requirements.txt /src/$APPNAME/requirements.txt
RUN pip3 install -r /src/$APPNAME/requirements.txt

COPY --chown=build . $SRC/$APPNAME
WORKDIR $BUILD/$APPNAME
RUN chown build .
Expand Down
9 changes: 5 additions & 4 deletions Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ properties([
def platforms = [:]

/****************** linux builds (in docker) */
/* Each platform must have a cooresponding Dockerfile.PLATFORM in triqs/packaging */
def dockerPlatforms = ["ubuntu-clang", "ubuntu-gcc", "sanitize"]
/* Each platform must have a corresponding Dockerfile.PLATFORM in triqs/packaging */
def dockerPlatforms = ["ubuntu-clang", "ubuntu-gcc", "ubuntu-intel", "sanitize"]
/* .each is currently broken in jenkins */
for (int i = 0; i < dockerPlatforms.size(); i++) {
def platform = dockerPlatforms[i]
Expand All @@ -42,10 +42,10 @@ for (int i = 0; i < dockerPlatforms.size(); i++) {
if (platform == documentationPlatform)
args = '-DBuild_Documentation=1'
else if (platform == "sanitize")
args = '-DASAN=ON -DUBSAN=ON'
args = '-DASAN=ON -DUBSAN=ON -DCMAKE_BUILD_TYPE=RelWithDebInfo'
def img = docker.build("flatironinstitute/${dockerName}:${env.BRANCH_NAME}-${env.STAGE_NAME}", "--build-arg APPNAME=${projectName} --build-arg BUILD_ID=${env.BUILD_TAG} --build-arg CMAKE_ARGS='${args}' .")
catchError(buildResult: 'UNSTABLE', stageResult: 'UNSTABLE') {
img.inside() {
img.inside("--shm-size=4gb") {
sh "make -C \$BUILD/${projectName} test CTEST_OUTPUT_ON_FAILURE=1"
}
}
Expand Down Expand Up @@ -90,6 +90,7 @@ for (int i = 0; i < osxPlatforms.size(); i++) {
"LD_LIBRARY_PATH=$hdf5/lib",
"PYTHONPATH=$installDir/lib/python3.9/site-packages",
"CMAKE_PREFIX_PATH=$venv/lib/cmake/triqs",
"VIRTUAL_ENV=$venv",
"OMP_NUM_THREADS=2"]) {
deleteDir()
/* note: this is installing into the parent (triqs) venv (install dir), which is thus shared among apps and so not be completely safe */
Expand Down
2 changes: 1 addition & 1 deletion c++/triqs_Nevanlinna/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ target_compile_definitions(${PROJECT_NAME}_c PUBLIC
)

# Install library and headers
install(TARGETS ${PROJECT_NAME}_c EXPORT ${PROJECT_NAME}-targets DESTINATION lib)
install(TARGETS ${PROJECT_NAME}_c EXPORT ${PROJECT_NAME}-targets DESTINATION ${CMAKE_INSTALL_LIBDIR})
install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} DESTINATION include FILES_MATCHING PATTERN "*.hpp" PATTERN "*.h")

# ========= Library Dependencies ==========
Expand Down
2 changes: 1 addition & 1 deletion deps/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ if(PythonSupport OR Build_Documentation)
external_dependency(Cpp2Py
GIT_REPO https://github.com/TRIQS/cpp2py
VERSION 2.0
GIT_TAG master
GIT_TAG unstable
BUILD_ALWAYS
EXCLUDE_FROM_ALL
)
Expand Down
Loading

0 comments on commit 2d7901d

Please sign in to comment.