Skip to content

Commit

Permalink
Merge branch 'python' into python
Browse files Browse the repository at this point in the history
  • Loading branch information
jngrad committed Sep 30, 2022
2 parents e7cee0c + 21c23c5 commit 3f3b7a8
Show file tree
Hide file tree
Showing 654 changed files with 13,448 additions and 11,986 deletions.
6 changes: 1 addition & 5 deletions .github/actions/build_and_check/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,6 @@ inputs:
description: 'Whether to build with undefined behavior sanitizer'
required: true
default: 'false'
check_skip_long: # id of input
description: 'Whether to skip long python tests'
required: true
default: 'false'
runs:
using: "composite"
steps:
Expand All @@ -22,7 +18,7 @@ runs:
pip3 install numpy cython h5py scipy
shell: bash
- run: |
export myconfig=maxset with_cuda=false test_timeout=800 with_asan=${{ inputs.asan }} with_ubsan=${{ inputs.ubsan }} check_skip_long=${{ inputs.check_skip_long }}
export myconfig=maxset with_cuda=false test_timeout=800 with_asan=${{ inputs.asan }} with_ubsan=${{ inputs.ubsan }} check_skip_long=true build_procs=2 check_procs=2
bash maintainer/CI/build_cmake.sh
shell: bash
# This is a workaround for the unfortunate interaction of MacOS and OpenMPI 4
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ on:
schedule:
- cron: '0 7 * * *'

permissions:
contents: read # to fetch code (actions/checkout)

jobs:
deploy_docs:
runs-on: ubuntu-20.04
Expand Down
9 changes: 7 additions & 2 deletions .github/workflows/push_pull.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ on:
schedule:
- cron: '0 3 * * *'

permissions:
contents: read # to fetch code (actions/checkout)

jobs:
regular_check:
runs-on: macos-latest
Expand All @@ -22,9 +25,12 @@ jobs:
with:
asan: false
ubsan: false
check_skip_long: false

sanitizer_check:
permissions:
contents: read # to fetch code (actions/checkout)
issues: write # to create an issue

runs-on: macos-latest
if: (github.event_name == 'schedule' && github.repository == 'espressomd/espresso')
steps:
Expand All @@ -39,7 +45,6 @@ jobs:
with:
asan: true
ubsan: true
check_skip_long: true
- name: Setting job link variable
if: ${{ failure() }}
run: |
Expand Down
2 changes: 2 additions & 0 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -438,6 +438,8 @@ empty:
with_static_analysis: 'true'
with_scafacos: 'false'
with_stokesian_dynamics: 'false'
with_coverage: 'false'
with_coverage_python: 'true'
script:
- bash maintainer/CI/build_cmake.sh
tags:
Expand Down
92 changes: 59 additions & 33 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,8 @@ minimal_compiler_version("Intel" 18.0)
minimal_compiler_version("IntelLLVM" 2021.0)

include(FeatureSummary)
include(GNUInstallDirs)
project(ESPResSo)
include(GNUInstallDirs)
include(option_enum)
if(POLICY CMP0074)
# make find_package() use <PackageName>_ROOT variables
Expand Down Expand Up @@ -162,7 +162,7 @@ foreach(func_name __PRETTY_FUNCTION__ __FUNCSIG__ __FUNCTION__)
endforeach()

#
# Libraries
# Interface libraries
#

# CUDA compiler
Expand All @@ -188,25 +188,49 @@ if(WITH_CUDA)
endif()
endif(WITH_CUDA)

find_package(PythonInterp 3.8 REQUIRED)

# Python interpreter and Cython interface library
if(WITH_PYTHON)
find_package(Python 3.8 REQUIRED COMPONENTS Interpreter Development NumPy)
find_package(Cython 0.29.14 REQUIRED)
find_package(PythonHeaders REQUIRED)
find_package(NumPy REQUIRED)
find_program(IPYTHON_EXECUTABLE NAMES jupyter ipython3 ipython)
endif(WITH_PYTHON)

#
# Installation folders
#

string(REGEX REPLACE "/+$" "" CMAKE_INSTALL_PREFIX "${CMAKE_INSTALL_PREFIX}")

# folder for binaries and wrapper scripts
set(ESPRESSO_INSTALL_BINDIR "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_BINDIR}")

# folder for C++ and CUDA shared objects
set(ESPRESSO_INSTALL_LIBDIR "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}")

# python site-packages, can be overriden with CMake options
if(WITH_PYTHON)
if(NOT ESPRESSO_INSTALL_PYTHON)
if(CMAKE_INSTALL_PREFIX STREQUAL "/")
set(ESPRESSO_INSTALL_PYTHON "${Python_SITEARCH}")
else()
set(ESPRESSO_INSTALL_PYTHON
"${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}/python${Python_VERSION_MAJOR}.${Python_VERSION_MINOR}/site-packages"
)
endif()
endif()
# override: package C++, CUDA and Cython shared objects together
set(ESPRESSO_INSTALL_LIBDIR "${ESPRESSO_INSTALL_PYTHON}/espressomd")
endif()

#
# Libraries
#

find_package(FFTW3)
if(FFTW3_FOUND)
set(FFTW 3)
endif(FFTW3_FOUND)

# If we build Python bindings, turn on script interface
if(WITH_PYTHON)
set(WITH_SCRIPT_INTERFACE ON)
endif()

# We need the parallel hdf5 version!
if(WITH_HDF5)
# The FindHDF5 function will fall back to the serial version if no parallel
Expand Down Expand Up @@ -263,8 +287,7 @@ if(GSL_FOUND)
endif(GSL_FOUND)

if(WITH_STOKESIAN_DYNAMICS)
set(CMAKE_INSTALL_LIBDIR
"${CMAKE_INSTALL_PREFIX}/${PYTHON_INSTDIR}/espressomd")
set(CMAKE_INSTALL_LIBDIR "${ESPRESSO_INSTALL_LIBDIR}")
include(FetchContent)
FetchContent_Declare(
stokesian_dynamics
Expand Down Expand Up @@ -337,7 +360,7 @@ find_package(Boost 1.69.0 REQUIRED ${BOOST_COMPONENTS})
# Paths
#

set(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/${PYTHON_INSTDIR}/espressomd")
set(CMAKE_INSTALL_RPATH "${ESPRESSO_INSTALL_LIBDIR}")

#
# Flags
Expand All @@ -346,25 +369,25 @@ set(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/${PYTHON_INSTDIR}/espressomd")
# drop 'lib' prefix from all libraries
set(CMAKE_SHARED_LIBRARY_PREFIX "")

add_library(Espresso_coverage_flags INTERFACE)
add_library(Espresso::coverage_flags ALIAS Espresso_coverage_flags)
add_library(espresso_coverage_flags INTERFACE)
add_library(espresso::coverage_flags ALIAS espresso_coverage_flags)
if(WITH_COVERAGE)
if(CMAKE_CXX_COMPILER_ID MATCHES "Clang")
target_compile_options(
Espresso_coverage_flags INTERFACE -g -fprofile-instr-generate
espresso_coverage_flags INTERFACE -g -fprofile-instr-generate
-fcoverage-mapping)
else()
target_compile_options(
Espresso_coverage_flags INTERFACE -g --coverage -fprofile-arcs
espresso_coverage_flags INTERFACE -g --coverage -fprofile-arcs
-ftest-coverage)
target_link_libraries(Espresso_coverage_flags INTERFACE gcov)
target_link_libraries(espresso_coverage_flags INTERFACE gcov)
endif()
endif()

add_library(Espresso_cpp_flags INTERFACE)
add_library(Espresso::cpp_flags ALIAS Espresso_cpp_flags)
add_library(espresso_cpp_flags INTERFACE)
add_library(espresso::cpp_flags ALIAS espresso_cpp_flags)
target_compile_options(
Espresso_cpp_flags
espresso_cpp_flags
INTERFACE
-Wall
-Wextra
Expand All @@ -374,8 +397,11 @@ target_compile_options(
$<$<CXX_COMPILER_ID:Clang>:-Wextern-initializer>
$<$<CXX_COMPILER_ID:Clang>:-Wrange-loop-analysis>
-Wfloat-conversion
$<$<CXX_COMPILER_ID:Clang,AppleClang>:-Wimplicit-float-conversion>
$<$<CXX_COMPILER_ID:Clang,AppleClang,IntelLLVM>:-Wimplicit-float-conversion>
$<$<CXX_COMPILER_ID:Clang,AppleClang,IntelLLVM>:-Wunused-exception-parameter>
$<$<CXX_COMPILER_ID:Clang,AppleClang,IntelLLVM>:-Wmissing-variable-declarations>
$<$<AND:$<CXX_COMPILER_ID:Clang>,$<VERSION_GREATER_EQUAL:$<CXX_COMPILER_VERSION>,11.0.0>>:-Wnon-c-typedef-for-linkage>
$<$<NOT:$<CXX_COMPILER_ID:Intel>>:-Wdelete-non-virtual-dtor>
# disable warnings from -Wextra
-Wno-sign-compare
-Wno-unused-function
Expand All @@ -390,18 +416,18 @@ target_compile_options(
# disable warning from -Wextra on ARM processors
if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU" AND CMAKE_SYSTEM_PROCESSOR MATCHES
"arm")
target_compile_options(Espresso_cpp_flags INTERFACE -Wno-psabi)
target_compile_options(espresso_cpp_flags INTERFACE -Wno-psabi)
endif()

# prevent 80-bit arithmetic on old Intel processors
if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU" AND CMAKE_SIZEOF_VOID_P EQUAL 4
AND CMAKE_SYSTEM_PROCESSOR MATCHES "[xX]86")
target_compile_options(Espresso_cpp_flags INTERFACE -ffloat-store)
target_compile_options(espresso_cpp_flags INTERFACE -ffloat-store)
endif()

# enable boost::variant with more than 20 types
target_compile_options(
Espresso_cpp_flags INTERFACE -DBOOST_MPL_CFG_NO_PREPROCESSED_HEADERS
espresso_cpp_flags INTERFACE -DBOOST_MPL_CFG_NO_PREPROCESSED_HEADERS
-DBOOST_MPL_LIMIT_LIST_SIZE=30)

set(CMAKE_MACOSX_RPATH TRUE)
Expand All @@ -417,22 +443,22 @@ if(WITH_ASAN AND WITH_MSAN)
endif()
if(WITH_ASAN)
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -g -O1")
target_compile_options(Espresso_cpp_flags INTERFACE -fsanitize=address
target_compile_options(espresso_cpp_flags INTERFACE -fsanitize=address
-fno-omit-frame-pointer)
target_link_libraries(Espresso_cpp_flags INTERFACE -fsanitize=address)
target_link_libraries(espresso_cpp_flags INTERFACE -fsanitize=address)
endif()
if(WITH_MSAN)
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -g -O1")
target_compile_options(Espresso_cpp_flags INTERFACE -fsanitize=memory
target_compile_options(espresso_cpp_flags INTERFACE -fsanitize=memory
-fno-omit-frame-pointer)
target_link_libraries(Espresso_cpp_flags INTERFACE -fsanitize=memory)
target_link_libraries(espresso_cpp_flags INTERFACE -fsanitize=memory)
endif()
if(WITH_UBSAN)
target_compile_options(Espresso_cpp_flags INTERFACE -fsanitize=undefined)
target_link_libraries(Espresso_cpp_flags INTERFACE -fsanitize=undefined)
target_compile_options(espresso_cpp_flags INTERFACE -fsanitize=undefined)
target_link_libraries(espresso_cpp_flags INTERFACE -fsanitize=undefined)
endif()

target_link_libraries(Espresso_cpp_flags INTERFACE Espresso::coverage_flags)
target_link_libraries(espresso_cpp_flags INTERFACE espresso::coverage_flags)

#
# Static analysis
Expand Down
12 changes: 9 additions & 3 deletions Readme.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
# Invitation to the ESPResSo Summer School 2022

[![CECAM Flagship School registration link](https://img.shields.io/badge/CECAM%20Flagship%20School-Register%20Now-blue?style=for-the-badge)](https://www.cecam.org/workshop-details/1146)

The summer school "Simulating the dynamics of soft matter with ESPResSo, PyStencils and LbmPy" will take place on October 10-14, 2022, in Stuttgart. Registration is now open on [CECAM](https://www.cecam.org/workshop-details/1146).

# ESPResSo

[![GitLab CI](https://gitlab.icp.uni-stuttgart.de/espressomd/espresso/badges/python/pipeline.svg)](https://gitlab.icp.uni-stuttgart.de/espressomd/espresso/commits/python)
Expand Down Expand Up @@ -56,7 +62,7 @@ walk you through the basic usage of ESPResSo. Advanced simulation
methods are extensively documented, with examples and links to the
relevant literature. Additional resources such as tutorials and
doxygen documentation can be found on https://espressomd.github.io.
The official website is http://espressomd.org/wordpress/.
The official website is https://espressomd.org/wordpress/.

## Installation

Expand All @@ -74,7 +80,7 @@ to use 4.1.4.
### Join the community

Please consider subscribing to our
[mailing list](http://espressomd.org/wordpress/community-and-support/mailing-lists/)
[mailing list](https://espressomd.org/wordpress/community-and-support/mailing-lists/)
if you're actively using ESPResSo, as we occasionally need community
feedback when making decisions on the future of specific features in
upcoming releases. You'll also get notifications on bugfix releases.
Expand All @@ -83,7 +89,7 @@ upcoming releases. You'll also get notifications on bugfix releases.

If you use ESPResSo to publish scientific results, we would ask you to
acknowledge this usage by mentioning the software with its version number and
[citing the relevant papers](http://espressomd.org/wordpress/about/please-cite-us/).
[citing the relevant papers](https://espressomd.org/wordpress/about/please-cite-us/).
A number of algorithms in ESPResSo are fairly advanced and unique to ESPResSo.
The authors of these contributions kindly ask you to cite the relevant
publications, as indicated in the documentation. For detailed instructions, see
Expand Down
22 changes: 12 additions & 10 deletions cmake/FindCUDACompilerClang.cmake
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# Copyright (C) 2009-2020 The ESPResSo project
#
# Copyright (C) 2009-2022 The ESPResSo project
# Copyright (C) 2009,2010
# Max-Planck-Institute for Polymer Research, Theory Group
#
Expand Down Expand Up @@ -28,8 +29,8 @@ if(NOT CMAKE_CXX_COMPILER_ID MATCHES "Clang")
)
endif()

add_library(Espresso_cuda_flags INTERFACE)
add_library(Espresso::cuda_flags ALIAS Espresso_cuda_flags)
add_library(espresso_cuda_flags INTERFACE)
add_library(espresso::cuda_flags ALIAS espresso_cuda_flags)

function(detect_clang_cuda_path)
execute_process(COMMAND ${CMAKE_CUDA_COMPILER} ${CMAKE_CXX_FLAGS} --verbose
Expand All @@ -47,7 +48,7 @@ function(detect_clang_cuda_path)
if(CLANG_VERBOSE_OUTPUT MATCHES "Found CUDA installation")
set(CLANG_VERBOSE_OUTPUT ${CLANG_VERBOSE_OUTPUT} PARENT_SCOPE)
message(STATUS "Clang did not automatically detect a compatible CUDA library; adding compiler flag --cuda-path=${unix_cuda_path}")
target_compile_options(Espresso_cuda_flags INTERFACE "--cuda-path=${unix_cuda_path}")
target_compile_options(espresso_cuda_flags INTERFACE "--cuda-path=${unix_cuda_path}")
return()
endif()
endif()
Expand All @@ -66,7 +67,7 @@ string(REGEX REPLACE "^.*Found CUDA installation: .* version ([0-9\.]+|unknown).
message(STATUS "Found CUDA-capable host compiler: ${CMAKE_CUDA_COMPILER}")
if(NOT CLANG_VERBOSE_OUTPUT MATCHES "Found CUDA installation" OR CUDA_VERSION STREQUAL "unknown")
message(STATUS "Clang did not automatically detect a compatible CUDA library; adding compiler flag -Wno-unknown-cuda-version")
target_compile_options(Espresso_cuda_flags INTERFACE -Wno-unknown-cuda-version)
target_compile_options(espresso_cuda_flags INTERFACE -Wno-unknown-cuda-version)
message(STATUS "Found CUDA version: ${CUDAToolkit_VERSION}")
message(STATUS "Found CUDA installation: ${CUDAToolkit_LIBRARY_DIR}")
else()
Expand All @@ -75,7 +76,7 @@ else()
CUDA_VERSION VERSION_GREATER_EQUAL "11.0" AND
CUDA_VERSION VERSION_LESS "12.0")
message(STATUS "Clang ${CMAKE_CXX_COMPILER_VERSION} doesn't natively support CUDA ${CUDAToolkit_VERSION_MAJOR}.${CUDAToolkit_VERSION_MINOR}; adding compiler flag -Wno-unknown-cuda-version")
target_compile_options(Espresso_cuda_flags INTERFACE -Wno-unknown-cuda-version)
target_compile_options(espresso_cuda_flags INTERFACE -Wno-unknown-cuda-version)
endif()
message(STATUS "Found CUDA version: ${CUDAToolkit_VERSION} (recognized by Clang as ${CUDA_VERSION})")
message(STATUS "Found CUDA installation: ${CUDA_DIR}")
Expand All @@ -84,16 +85,17 @@ set(CUDA_VERSION ${CUDAToolkit_VERSION})
set(CUDA 1)

target_compile_options(
Espresso_cuda_flags
espresso_cuda_flags
INTERFACE
$<$<STREQUAL:${CMAKE_BUILD_TYPE},Debug>:-g>
$<$<STREQUAL:${CMAKE_BUILD_TYPE},Release>:-O3 -DNDEBUG>
$<$<STREQUAL:${CMAKE_BUILD_TYPE},MinSizeRel>:-O2 -DNDEBUG>
$<$<STREQUAL:${CMAKE_BUILD_TYPE},RelWithDebInfo>:-O2 -g -DNDEBUG>
$<$<STREQUAL:${CMAKE_BUILD_TYPE},Coverage>:-O3 -g>
$<$<STREQUAL:${CMAKE_BUILD_TYPE},RelWithAssert>:-O3 -g>
$<$<VERSION_LESS:${CMAKE_CUDA_COMPILER_VERSION},11>:--cuda-gpu-arch=sm_30>
--cuda-gpu-arch=sm_52
$<$<VERSION_LESS:${CMAKE_CUDA_COMPILER_VERSION},12>:--cuda-gpu-arch=sm_52> # GTX-900 series (Maxwell)
$<$<VERSION_GREATER_EQUAL:${CMAKE_CUDA_COMPILER_VERSION},12>:--cuda-gpu-arch=sm_61> # GTX-1000 series (Pascal)
$<$<VERSION_GREATER_EQUAL:${CMAKE_CUDA_COMPILER_VERSION},12>:--cuda-gpu-arch=sm_75> # RTX-2000 series (Turing)
)

function(add_gpu_library)
Expand All @@ -107,7 +109,7 @@ function(add_gpu_library)
set_source_files_properties(${TARGET_SOURCES} PROPERTIES LANGUAGE "CXX")
add_library(${ARGV})
set_target_properties(${TARGET_NAME} PROPERTIES LINKER_LANGUAGE "CXX")
target_link_libraries(${TARGET_NAME} PRIVATE Espresso::cuda_flags)
target_link_libraries(${TARGET_NAME} PRIVATE espresso::cuda_flags)
endfunction()

include(FindPackageHandleStandardArgs)
Expand Down
Loading

0 comments on commit 3f3b7a8

Please sign in to comment.