Skip to content

Commit

Permalink
Merge branch 'python' into cells
Browse files Browse the repository at this point in the history
  • Loading branch information
RudolfWeeber authored Aug 31, 2020
2 parents 66c7a94 + 748e9d0 commit 994e699
Show file tree
Hide file tree
Showing 201 changed files with 4,122 additions and 3,685 deletions.
37 changes: 25 additions & 12 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
image: docker.pkg.github.com/espressomd/docker/ubuntu-20.04:8a7d258889d87dcc9c96a200784b30b532d45b33
image: docker.pkg.github.com/espressomd/docker/ubuntu-20.04:e583d4b2eb8eedd10068957f952bd67008475ee5

stages:
- prepare
Expand Down Expand Up @@ -114,7 +114,7 @@ no_rotation:
ubuntu:wo-dependencies:
<<: *global_job_definition
stage: build
image: docker.pkg.github.com/espressomd/docker/ubuntu-wo-dependencies:fc7628d32de0fce605976ba9edebe7eff186e618
image: docker.pkg.github.com/espressomd/docker/ubuntu-wo-dependencies:e583d4b2eb8eedd10068957f952bd67008475ee5
script:
- export myconfig=maxset with_cuda=false make_check_unit_tests=false make_check_python=false
- bash maintainer/CI/build_cmake.sh
Expand Down Expand Up @@ -199,6 +199,24 @@ clang-sanitizer:
- linux
- cuda

cuda11-maxset:
<<: *global_job_definition
stage: build
image: docker.pkg.github.com/espressomd/docker/cuda:e583d4b2eb8eedd10068957f952bd67008475ee5
variables:
CC: 'gcc-9'
CXX: 'g++-9'
script:
- export myconfig=maxset with_cuda=true with_coverage=false test_timeout=900 srcdir=${CI_PROJECT_DIR}
- export with_scafacos=true with_stokesian_dynamics=true
- bash maintainer/CI/build_cmake.sh
tags:
- docker
- linux
- cuda
only:
- schedules

cuda10-maxset:
<<: *global_job_definition
stage: build
Expand Down Expand Up @@ -230,11 +248,6 @@ cuda9-maxset:
- export myconfig=maxset with_cuda=true with_coverage=true test_timeout=900 srcdir=${CI_PROJECT_DIR}
- export with_scafacos=true with_stokesian_dynamics=true
- bash maintainer/CI/build_cmake.sh
artifacts:
paths:
- build/
expire_in: 1 week
when: on_success
tags:
- docker
- linux
Expand Down Expand Up @@ -354,7 +367,7 @@ empty:
rocm-maxset:
<<: *global_job_definition
stage: build
image: docker.pkg.github.com/espressomd/docker/rocm:d496478230db4e5c286680e3bdc1621af1fccffc
image: docker.pkg.github.com/espressomd/docker/rocm:cb775a82f49a7f6d4a806f17358caec797f48f73
script:
- export myconfig=maxset with_cuda=true with_cuda_compiler=hip
- export with_stokesian_dynamics=false
Expand Down Expand Up @@ -457,7 +470,7 @@ check_cuda_maxset_no_gpu:
<<: *global_job_definition
stage: additional_checks
when: on_success
needs:
needs:
- cuda10-maxset
script:
- export CUDA_VISIBLE_DEVICES=""
Expand All @@ -470,9 +483,9 @@ check_cuda_maxset_no_gpu:

check_with_odd_no_of_processors:
<<: *global_job_definition
stage: additional_checks
stage: additional_checks
when: on_success
needs:
needs:
- cuda10-maxset
script:
- cd ${CI_PROJECT_DIR}/build
Expand Down Expand Up @@ -507,7 +520,7 @@ deploy_sphinx_documentation:
dependencies:
- check_sphinx
script:
- cd ${CI_PROJECT_DIR}/build/doc/sphinx/html &&
- cd ${CI_PROJECT_DIR}/build/doc/sphinx/html &&
rsync -avz --delete -e "ssh -i ${HOME}/.ssh/espresso_rsa" ./ [email protected]:/home/espresso/public_html/html/doc

deploy_doxygen_documentation:
Expand Down
8 changes: 5 additions & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#

cmake_minimum_required(VERSION 3.10)
cmake_minimum_required(VERSION 3.11)
message(STATUS "CMake version: ${CMAKE_VERSION}")
if(POLICY CMP0076)
# make target_sources() convert relative paths to absolute
Expand Down Expand Up @@ -166,7 +166,7 @@ if(WITH_CUDA)
endif()
endif(WITH_CUDA)

find_package(PythonInterp 3.5 REQUIRED)
find_package(PythonInterp 3.6 REQUIRED)

if(WITH_PYTHON)
find_package(Cython 0.26 REQUIRED)
Expand Down Expand Up @@ -278,7 +278,6 @@ endif(WITH_STOKESIAN_DYNAMICS)
if(WITH_STOKESIAN_DYNAMICS)
set(CMAKE_INSTALL_LIBDIR
"${CMAKE_INSTALL_PREFIX}/${PYTHON_INSTDIR}/espressomd")
cmake_minimum_required(VERSION 3.11)
include(FetchContent)
FetchContent_Declare(
stokesian_dynamics
Expand Down Expand Up @@ -485,6 +484,9 @@ if(WITH_TESTS)
if(WITH_PYTHON)
add_subdirectory(testsuite)
endif(WITH_PYTHON)
set(CTEST_ARGS ""
CACHE STRING
"Extra arguments to give to ctest calls (separated by semicolons)")
endif(WITH_TESTS)

if(WITH_BENCHMARKS)
Expand Down
9 changes: 7 additions & 2 deletions cmake/FindCUDACompilerHIP.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -27,21 +27,26 @@ find_package(HIP ${CUDACompilerHIP_FIND_VERSION} MODULE REQUIRED)
# patch HCC_PATH environment variable and reload HIP
if(HIP_VERSION VERSION_LESS 3.1)
set(HCC_PATH "${HIP_ROOT_DIR}")
else()
elseif(HIP_VERSION VERSION_LESS 3.5)
set(HCC_PATH "${ROCM_HOME}/hcc")
else()
set(HIP_HIPCC_CMAKE_LINKER_HELPER "${HIP_HIPCC_EXECUTABLE}")
unset(HCC_PATH)
endif()
find_package(HIP ${CUDACompilerHIP_FIND_VERSION} MODULE REQUIRED)

set(CUDA 1)
set(HIP 1)

list(APPEND HIP_HCC_FLAGS
list(APPEND HIP_HIPCC_FLAGS
-std=c++${CMAKE_CUDA_STANDARD} -pedantic -Wall -Wextra
-Wno-sign-compare -Wno-unused-function -Wno-unused-variable
-Wno-unused-parameter -Wno-missing-braces -Wno-gnu-anonymous-struct
-Wno-nested-anon-types -Wno-gnu-zero-variadic-macro-arguments
-Wno-c99-designator -Wno-macro-redefined -Wno-duplicate-decl-specifier
$<$<VERSION_GREATER_EQUAL:${HIP_VERSION},3.3>:-Wno-deprecated-copy>
$<$<VERSION_GREATER_EQUAL:${HIP_VERSION},3.7>:-Wno-c++17-extensions>
$<$<VERSION_GREATER_EQUAL:${HIP_VERSION},3.7>:-Wno-unused-command-line-argument>
$<$<BOOL:${WARNINGS_ARE_ERRORS}>:-Werror>)

list(APPEND HIP_HIPCC_FLAGS_DEBUG -g)
Expand Down
6 changes: 5 additions & 1 deletion cmake/FindCUDACompilerNVCC.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,11 @@ list(APPEND CUDA_NVCC_FLAGS_MINSIZEREL -O2 -Xptxas=-O2 -Xcompiler=-Os -DNDEBUG)
list(APPEND CUDA_NVCC_FLAGS_RELWITHDEBINFO -O2 -g -Xptxas=-O2 -Xcompiler=-O2,-g -DNDEBUG)
list(APPEND CUDA_NVCC_FLAGS_COVERAGE -O3 -g -Xptxas=-O3 -Xcompiler=-Og,-g)
list(APPEND CUDA_NVCC_FLAGS_RELWITHASSERT -O3 -g -Xptxas=-O3 -Xcompiler=-O3,-g)
if(CMAKE_CUDA_COMPILER_VERSION VERSION_LESS 11)
list(APPEND CUDA_NVCC_FLAGS -gencode=arch=compute_30,code=sm_30)
endif()
list(APPEND CUDA_NVCC_FLAGS
-gencode=arch=compute_30,code=sm_30 -gencode=arch=compute_52,code=sm_52
-gencode=arch=compute_52,code=sm_52
-gencode=arch=compute_52,code=compute_52 -std=c++${CMAKE_CUDA_STANDARD}
$<$<BOOL:${WARNINGS_ARE_ERRORS}>:-Xcompiler=-Werror;-Xptxas=-Werror>
$<$<BOOL:${CMAKE_OSX_SYSROOT}>:-Xcompiler=-isysroot;-Xcompiler=${CMAKE_OSX_SYSROOT}>)
Expand All @@ -60,6 +63,7 @@ function(find_gpu_library)
cmake_parse_arguments(LIBRARY "REQUIRED" "NAMES;VARNAME" "" ${ARGN})
list(APPEND LIBRARY_PATHS
${CUDA_TOOLKIT_ROOT_DIR}/lib64 ${CUDA_TOOLKIT_ROOT_DIR}/lib
${CUDA_TOOLKIT_ROOT_DIR}/compat
/usr/local/nvidia/lib /usr/lib/x86_64-linux-gnu)
if(LIBRARY_REQUIRED)
find_library(${LIBRARY_VARNAME} NAMES ${LIBRARY_NAMES} PATHS ${LIBRARY_PATHS} NO_DEFAULT_PATH REQUIRED)
Expand Down
7 changes: 6 additions & 1 deletion cmake/FindFFTW3.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ if(FFTW3_INCLUDE_DIR)
endif(FFTW3_INCLUDE_DIR)

find_path(FFTW3_INCLUDE_DIR fftw3.h)

find_library(FFTW3_LIBRARIES NAMES fftw3)

# handle the QUIETLY and REQUIRED arguments and set FFTW_FOUND to TRUE if all
Expand All @@ -38,3 +37,9 @@ find_package_handle_standard_args(FFTW3 DEFAULT_MSG FFTW3_LIBRARIES
FFTW3_INCLUDE_DIR)

mark_as_advanced(FFTW3_LIBRARIES FFTW3_INCLUDE_DIR)

if(FFTW3_FOUND AND NOT TARGET FFTW3::FFTW3)
add_library(FFTW3::FFTW3 INTERFACE IMPORTED)
target_include_directories(FFTW3::FFTW3 INTERFACE "${FFTW3_INCLUDE_DIR}")
target_link_libraries(FFTW3::FFTW3 INTERFACE "${FFTW3_LIBRARIES}")
endif()
2 changes: 1 addition & 1 deletion doc/sphinx/advanced_methods.rst
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ Several modes are available for different types of binding.
import espressomd
from espressomd.interactions import HarmonicBond

system = espressomd.System()
system = espressomd.System(box_l=[1, 1, 1])
bond_centers = HarmonicBond(k=1000, r_0=<CUTOFF>)
system.bonded_inter.add(bond_centers)
system.collision_detection.set_params(mode="bind_centers", distance=<CUTOFF>,
Expand Down
2 changes: 1 addition & 1 deletion doc/sphinx/constraints.rst
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ Available shapes
Python syntax::

import espressomd from espressomd.shapes import <SHAPE>
system = espressomd.System()
system = espressomd.System(box_l=[1, 1, 1])

``<SHAPE>`` can be any of the available shapes.

Expand Down
27 changes: 15 additions & 12 deletions doc/sphinx/electrostatics.rst
Original file line number Diff line number Diff line change
Expand Up @@ -35,20 +35,22 @@ Note that using the electrostatic interaction also requires assigning charges to
the particles via the particle property
:py:attr:`espressomd.particle_data.ParticleHandle.q`.

This example shows the general usage of an electrostatic method ``<SOLVER>``.
All of them need the Bjerrum length and a set of other required parameters.
First, an instance of the solver is created and only after adding it to the actors
list, it is activated. Internally the method calls a tuning routine on
activation to achieve the given accuracy::
All solvers need a prefactor and a set of other required parameters.
This example shows the general usage of the electrostatic method ``P3M``.
An instance of the solver is created and added to the actors list, at which
point it will be automatically activated. This activation will internally
call a tuning function to achieve the requested accuracy::

import espressomd
from espressomd import electrostatics
import espressomd.electrostatics

system = espressomd.System()
solver = electrostatics.<SOLVER>(prefactor=C, <ADDITIONAL REQUIRED PARAMETERS>)
system = espressomd.System(box_l=[10, 10, 10])
system.time_step = 0.01
system.part.add(pos=[[0, 0, 0], [1, 1, 1]], q=[-1, 1])
solver = espressomd.electrostatics.P3M(prefactor=2, accuracy=1e-3)
system.actors.add(solver)

where the prefactor :math:`C` is defined as in Eqn. :eq:`coulomb_prefactor`
where the prefactor is defined as :math:`C` in Eqn. :eq:`coulomb_prefactor`.

.. _Coulomb P3M:

Expand All @@ -60,9 +62,10 @@ Coulomb P3M
For this feature to work, you need to have the ``fftw3`` library
installed on your system. In |es|, you can check if it is compiled in by
checking for the feature ``FFTW`` with ``espressomd.features``.
P3M requires full periodicity (1 1 1). Make sure that you know the relevance of the
P3M parameters before using P3M! If you are not sure, read the following
references:
P3M requires full periodicity (1 1 1). When using a non-metallic dielectric
constant (``epsilon != 0.0``), the box must be cubic.
Make sure that you know the relevance of the P3M parameters before using P3M!
If you are not sure, read the following references:
:cite:`ewald21,hockney88,kolafa92,deserno98a,deserno98b,deserno00,deserno00a,cerda08d`.

.. _Tuning Coulomb P3M:
Expand Down
21 changes: 15 additions & 6 deletions doc/sphinx/installation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,11 @@ are required:
.. code-block:: bash
sudo apt install python3-matplotlib python3-scipy ipython3 jupyter-notebook
sudo pip3 install 'pint>=0.9'
pip3 install --user 'pint>=0.9' 'jupyter_contrib_nbextensions==0.5.1' \
'sphinx>=1.6.7,!=2.1.0,!=3.0.0' 'sphinxcontrib-bibtex>=0.3.5'
jupyter contrib nbextension install --user
jupyter nbextension enable rubberband/main
jupyter nbextension enable exercise2/main
Nvidia GPU acceleration
"""""""""""""""""""""""
Expand Down Expand Up @@ -829,10 +833,10 @@ to actually write a simulation script for |es|.
Running an interactive notebook
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Running the Jupyter interpreter requires using the ``ipypresso`` script, which
Running a Jupyter session requires using the ``ipypresso`` script, which
is also located in the build directory (its name comes from the IPython
interpreter, today known as Jupyter). To run the tutorials, you will need
to start the Jupyter interpreter in notebook mode:
to start a Jupyter session:
.. code-block:: bash
Expand All @@ -858,11 +862,16 @@ will exit the Python interpreter and Jupyter will notify you that the current
Python kernel stopped. If a cell takes too long to execute, you may interrupt
it with the stop button.
To close the Jupyter notebook, go to the terminal where it was started and use
Solutions cells are created using the ``exercise2`` plugin from nbextensions.
To prevent solution code cells from running when clicking on "Run All", these
code cells need to be converted to Markdown cells and fenced with `````python``
and ```````.
To close the Jupyter session, go to the terminal where it was started and use
the keyboard shortcut Ctrl+C twice.
When starting the Jupyter interpreter in notebook mode, you may see the
following warning in the terminal:
When starting a Jupyter session, you may see the following warning in the
terminal:
.. code-block:: none
Expand Down
2 changes: 1 addition & 1 deletion doc/sphinx/inter_non-bonded.rst
Original file line number Diff line number Diff line change
Expand Up @@ -620,7 +620,7 @@ that the Thole correction acts between all dipoles, intra- and intermolecular.
Again, the accuracy is related to the P3M accuracy and the split between
short-range and long-range electrostatics interaction. It is configured by::

system = espressomd.System()
system = espressomd.System(box_l=[1, 1, 1])
system.non_bonded_inter[type_1,type_2].thole.set_params(scaling_coeff=<float>, q1q2=<float>)

with parameters:
Expand Down
2 changes: 1 addition & 1 deletion doc/sphinx/io.rst
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ capabilities. The usage is quite simple:
.. code:: python
from espressomd.io.mppiio import mpiio
system = espressomd.System()
system = espressomd.System(box_l=[1, 1, 1])
# ... add particles here
mpiio.write("/tmp/mydata", positions=True, velocities=True, types=True, bonds=True)
Expand Down
13 changes: 10 additions & 3 deletions doc/sphinx/magnetostatics.rst
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,15 @@ relative permittivity of the background material, respectively.

Magnetostatic interactions are activated via the actor framework::

from espressomd.magnetostatics import DipolarDirectSumCpu
import espressomd
import espressomd.magnetostatics

direct_sum = DipolarDirectSumCpu(prefactor=1)
system = espressomd.System(box_l=[10, 10, 10])
system.time_step = 0.01
system.part.add(pos=[[0, 0, 0], [1, 1, 1]],
rotation=2 * [(1, 1, 1)], dip=2 * [(1, 0, 0)])

direct_sum = espressomd.magnetostatics.DipolarDirectSumCpu(prefactor=1)
system.actors.add(direct_sum)
# ...
system.actors.remove(direct_sum)
Expand All @@ -49,7 +55,8 @@ Dipolar P3M
This is the dipolar version of the P3M algorithm, described in :cite:`cerda08d`.

Make sure that you know the relevance of the P3M parameters before using
P3M! If you are not sure, read the following references
P3M! If you are not sure, read the following references:
:cite:`ewald21,hockney88,kolafa92,deserno98a,deserno98b,deserno00,deserno00a,cerda08d`.

Note that dipolar P3M does not work with non-cubic boxes.

Expand Down
Loading

0 comments on commit 994e699

Please sign in to comment.