Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .codecov.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,3 +53,4 @@ ignore:
- "src/walberla_bridge/**/generated_kernels/*"
- "src/walberla_bridge/myintrin.h"
- "src/walberla_bridge/philox_rand.h"
- "build/_deps/**"
91 changes: 53 additions & 38 deletions maintainer/CI/build_cmake.sh
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,9 @@ set_default_value with_stokesian_dynamics false
set_default_value test_timeout 500
set_default_value hide_gpu false

# accumulate CMake params in a Bash array to preserve whitespace characters
declare -a cmake_param_list

if [ "${make_check_unit_tests}" = true ] || [ "${make_check_python}" = true ] || [ "${make_check_tutorials}" = true ] || [ "${make_check_samples}" = true ] || [ "${make_check_benchmarks}" = true ]; then
run_checks=true
else
Expand All @@ -144,44 +147,43 @@ if [ "${with_coverage}" = true ]; then
build_type="Coverage"
fi

if [ "${with_fast_math}" = true ]; then
cmake_param_protected="-DCMAKE_CXX_FLAGS=-ffast-math"
fi
cmake_param_list+=(
${cmake_params}
-D CMAKE_BUILD_TYPE=${build_type}
-D CMAKE_INSTALL_PREFIX=/tmp/espresso-unit-tests
-D ESPRESSO_INSIDE_DOCKER:BOOL=ON
-D ESPRESSO_WARNINGS_ARE_ERRORS:BOOL=ON
-D ESPRESSO_CTEST_ARGS:STRING="-j${check_procs}"
-D ESPRESSO_TEST_TIMEOUT:STRING=${test_timeout}
-D ESPRESSO_BUILD_BENCHMARKS:BOOL=${make_check_benchmarks}
-D ESPRESSO_BUILD_WITH_CCACHE:BOOL=${with_ccache}
-D ESPRESSO_BUILD_WITH_CALIPER:BOOL=${with_caliper}
-D ESPRESSO_BUILD_WITH_FPE:BOOL=${with_fpe}
-D ESPRESSO_BUILD_WITH_SHARED_MEMORY_PARALLELISM:BOOL=${with_shared_memory_parallelism}
-D ESPRESSO_BUILD_WITH_HDF5:BOOL=${with_hdf5}
-D ESPRESSO_BUILD_WITH_FFTW:BOOL=${with_fftw}
-D ESPRESSO_BUILD_WITH_GSL:BOOL=${with_gsl}
-D ESPRESSO_BUILD_WITH_SCAFACOS:BOOL=${with_scafacos}
-D ESPRESSO_BUILD_WITH_NLOPT:BOOL=${with_nlopt}
-D ESPRESSO_BUILD_WITH_STOKESIAN_DYNAMICS:BOOL=${with_stokesian_dynamics}
-D ESPRESSO_BUILD_WITH_WALBERLA:BOOL=${with_walberla}
-D ESPRESSO_BUILD_WITH_WALBERLA_AVX:BOOL=${with_walberla_avx}
-D ESPRESSO_BUILD_WITH_COVERAGE:BOOL=${with_coverage}
-D ESPRESSO_BUILD_WITH_COVERAGE_PYTHON:BOOL=${with_coverage_python}
-D ESPRESSO_BUILD_WITH_ASAN:BOOL=${with_asan}
-D ESPRESSO_BUILD_WITH_UBSAN:BOOL=${with_ubsan}
-D ESPRESSO_BUILD_WITH_CLANG_TIDY:BOOL=${with_static_analysis}
-D ESPRESSO_BUILD_WITH_CUDA:BOOL=${with_cuda}
)

cmake_params="-D CMAKE_BUILD_TYPE=${build_type} -D ESPRESSO_WARNINGS_ARE_ERRORS=ON ${cmake_params}"
cmake_params="${cmake_params} -D CMAKE_INSTALL_PREFIX=/tmp/espresso-unit-tests -D ESPRESSO_INSIDE_DOCKER=ON"
cmake_params="${cmake_params} -D ESPRESSO_CTEST_ARGS:STRING=-j${check_procs} -D ESPRESSO_TEST_TIMEOUT=${test_timeout}"

cmake_params="${cmake_params} -D ESPRESSO_BUILD_BENCHMARKS=${make_check_benchmarks}"
cmake_params="${cmake_params} -D ESPRESSO_BUILD_WITH_CCACHE=${with_ccache}"
cmake_params="${cmake_params} -D ESPRESSO_BUILD_WITH_CALIPER=${with_caliper}"
cmake_params="${cmake_params} -D ESPRESSO_BUILD_WITH_FPE=${with_fpe}"
cmake_params="${cmake_params} -D ESPRESSO_BUILD_WITH_SHARED_MEMORY_PARALLELISM=${with_shared_memory_parallelism}"
cmake_params="${cmake_params} -D ESPRESSO_BUILD_WITH_HDF5=${with_hdf5}"
cmake_params="${cmake_params} -D ESPRESSO_BUILD_WITH_FFTW=${with_fftw}"
cmake_params="${cmake_params} -D ESPRESSO_BUILD_WITH_GSL=${with_gsl}"
cmake_params="${cmake_params} -D ESPRESSO_BUILD_WITH_SCAFACOS=${with_scafacos}"
cmake_params="${cmake_params} -D ESPRESSO_BUILD_WITH_NLOPT=${with_nlopt}"
cmake_params="${cmake_params} -D ESPRESSO_BUILD_WITH_STOKESIAN_DYNAMICS=${with_stokesian_dynamics}"
cmake_params="${cmake_params} -D ESPRESSO_BUILD_WITH_WALBERLA=${with_walberla}"

if [ "${with_walberla}" = true ]; then
if [ "${with_walberla_avx}" = true ]; then
cmake_params="${cmake_params} -D ESPRESSO_BUILD_WITH_WALBERLA_AVX=ON"
fi
if [ "${with_fast_math}" = true ]; then
cmake_param_list+=(-D CMAKE_CXX_FLAGS=-ffast-math)
fi

cmake_params="${cmake_params} -D ESPRESSO_BUILD_WITH_COVERAGE=${with_coverage}"
cmake_params="${cmake_params} -D ESPRESSO_BUILD_WITH_COVERAGE_PYTHON=${with_coverage_python}"
cmake_params="${cmake_params} -D ESPRESSO_BUILD_WITH_ASAN=${with_asan}"
cmake_params="${cmake_params} -D ESPRESSO_BUILD_WITH_UBSAN=${with_ubsan}"
cmake_params="${cmake_params} -D ESPRESSO_BUILD_WITH_CLANG_TIDY=${with_static_analysis}"
cmake_params="${cmake_params} -D ESPRESSO_BUILD_WITH_CUDA=${with_cuda}"

if [ "${with_cuda}" = true ]; then
cmake_params="${cmake_params} -D CUDAToolkit_ROOT=/usr/lib/cuda"
cmake_param_list+=(-D CUDAToolkit_ROOT=/usr/lib/cuda)
if [ "${CUDACXX}" = "" ] && [ "${CXX}" != "" ]; then
cmake_params="${cmake_params} -D CMAKE_CUDA_FLAGS='--compiler-bindir=$(which "${CXX}")'"
cmake_param_list+=(-D CMAKE_CUDA_HOST_COMPILER="${CXX}")
fi
fi

Expand All @@ -201,6 +203,7 @@ echo ""

builddir="${srcdir}/build"

echo "variables:"
outp srcdir builddir \
make_check_unit_tests make_check_python make_check_tutorials make_check_samples make_check_benchmarks \
cmake_params \
Expand Down Expand Up @@ -254,11 +257,21 @@ else
fi
fi

if [ -z "${cmake_param_protected}" ]; then
cmake -G Ninja "${srcdir}" ${cmake_params} || exit 1
else
cmake -G Ninja "${srcdir}" ${cmake_params} "${cmake_param_protected}" || exit 1
fi
# print cmake command, one parameter per line (line length is limited to 1024 chars on macOS)
echo "cmake -G Ninja \\"
for arg in "${cmake_param_list[@]}"; do
if [[ "${arg}" = *" "* ]]; then
echo -n " \"${arg}\""
else
echo -n " ${arg}"
fi
if [ ! "${arg}" = "-D" ]; then
echo " \\"
fi
done
echo " ${srcdir}"

cmake -G Ninja "${srcdir}" "${cmake_param_list[@]}" || exit 1
end "CONFIGURE"

# BUILD
Expand Down Expand Up @@ -353,6 +366,7 @@ fi
if [ "${with_coverage}" = true ] || [ "${with_coverage_python}" = true ]; then
start "COVERAGE"
cd "${builddir}"
rm -f _deps/highfive-src/.github/workflows/coverage.yml

# import codecov key
gpg --import "${CODECOV_PUBLIC_KEY}"
Expand All @@ -372,6 +386,7 @@ if [ "${with_coverage}" = true ] || [ "${with_coverage_python}" = true ]; then
echo "Running lcov and gcov..."
codecov_opts="${codecov_opts} --gcov"
"${srcdir}/maintainer/CI/run_lcov.sh" coverage.info
rm coverage.info
fi
if [ "${with_coverage_python}" = true ]; then
echo "Running python3-coverage..."
Expand Down
22 changes: 13 additions & 9 deletions maintainer/benchmarks/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ python_benchmark(FILE lj.py ARGUMENTS
python_benchmark(FILE lj.py ARGUMENTS
"--particles_per_core=10000;--volume_fraction=0.02")
python_benchmark(FILE mc_acid_base_reservoir.py ARGUMENTS
"--particles_per_core=500;--mode=benchmark")
"--particles_per_core=500")
python_benchmark(
FILE lj.py ARGUMENTS
"--particles_per_core=1000;--volume_fraction=0.10;--bonds" RUN_WITH_MPI FALSE)
Expand All @@ -129,15 +129,19 @@ python_benchmark(
python_benchmark(FILE ferrofluid.py ARGUMENTS "--particles_per_core=400")
python_benchmark(FILE mc_acid_base_reservoir.py ARGUMENTS
"--particles_per_core=500" RUN_WITH_MPI FALSE)
python_benchmark(FILE lb.py ARGUMENTS "--box_l=32;--single_precision")
python_benchmark(FILE lb.py ARGUMENTS "--box_l=32")
python_benchmark(FILE lb.py ARGUMENTS "--box_l=64;--single_precision")
python_benchmark(FILE lb.py ARGUMENTS "--box_l=64")
python_benchmark(FILE lb.py ARGUMENTS "--box_l=128;--single_precision")
python_benchmark(FILE lb.py ARGUMENTS "--box_l=128")
python_benchmark(FILE lb.py ARGUMENTS
"--box_l=32;--particles_per_core=0;--single_precision")
python_benchmark(FILE lb.py ARGUMENTS "--box_l=32;--particles_per_core=0")
python_benchmark(FILE lb.py ARGUMENTS
"--box_l=64;--particles_per_core=0;--single_precision")
python_benchmark(FILE lb.py ARGUMENTS "--box_l=64;--particles_per_core=0")
python_benchmark(FILE lb.py ARGUMENTS
"--box_l=128;--particles_per_core=0;--single_precision")
python_benchmark(FILE lb.py ARGUMENTS "--box_l=128;--particles_per_core=0")
if(NOT ESPRESSO_BUILD_WITH_WALBERLA_USE_AVX)
python_benchmark(FILE lb.py ARGUMENTS "--box_l=196;--single_precision")
python_benchmark(FILE lb.py ARGUMENTS "--box_l=196")
python_benchmark(FILE lb.py ARGUMENTS
"--box_l=196;--particles_per_core=0;--single_precision")
python_benchmark(FILE lb.py ARGUMENTS "--box_l=196;--particles_per_core=0")
endif()

add_custom_target(
Expand Down
8 changes: 4 additions & 4 deletions maintainer/benchmarks/ferrofluid.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
parser.add_argument("--volume_fraction", metavar="FRAC", action="store",
type=float, default=0.1, required=False,
help="Fraction of the simulation box volume occupied by "
"particles (range: [0.01-0.74], default: 0.50)")
"particles (range: [0.01-0.74], default: 0.10)")
parser.add_argument("--dipole_moment", metavar="FRAC", action="store",
type=float, default=2**0.5, required=False,
help="Magnitude of the dipole moment (same for all particles)")
Expand All @@ -55,7 +55,7 @@
assert measurement_steps >= 100, \
f"{measurement_steps} steps per tick are too short"

required_features = ["LENNARD_JONES"]
required_features = ["LENNARD_JONES", "DP3M"]
espressomd.assert_features(required_features)

# System
Expand Down Expand Up @@ -110,8 +110,8 @@
system.thermostat.set_langevin(kT=1.0, gamma=1.0, seed=42)

# tuning and equilibration
min_skin = 0.2
max_skin = 1.0
min_skin = 0.1
max_skin = 0.6
dp3m_params = {'prefactor': 1, 'accuracy': 1e-4}
print("Equilibration")
system.integrator.run(min(5 * measurement_steps, 60000))
Expand Down
3 changes: 2 additions & 1 deletion maintainer/benchmarks/lb.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,11 +98,12 @@
lb_grid = box_l
measurement_steps = 80
else:
mpi_factor = min(2., float(np.amax(system.cell_system.node_grid)))
# volume of N spheres with radius r: N * (4/3*pi*r^3)
box_l = (n_part * 4. / 3. * np.pi * (lj_sig / 2.)**3
/ args.volume_fraction)**(1. / 3.)
lb_grid = (n_part * args.lb_sites_per_particle)**(1. / 3.)
lb_grid = int(2. * round(lb_grid / 2.))
lb_grid = int(mpi_factor * np.ceil(lb_grid / mpi_factor))
agrid = box_l / lb_grid
measurement_steps = max(50, int(120**3 / lb_grid**3))
measurement_steps = 40
Expand Down
5 changes: 4 additions & 1 deletion maintainer/benchmarks/lj.py
Original file line number Diff line number Diff line change
Expand Up @@ -115,13 +115,16 @@
# warmup
benchmarks.minimize(system, n_part / 2.)

system.integrator.set_symplectic_euler()
system.integrator.set_vv()
system.thermostat.set_langevin(kT=1.0, gamma=1.0, seed=42)

# tuning and equilibration
min_skin = 0.2
max_skin = 1.0
print("Equilibration")
system.time_step = system.time_step / 10.
system.integrator.run(100)
system.time_step = system.time_step * 10.
system.integrator.run(min(5 * measurement_steps, 60000))
print("Tune skin: {:.3f}".format(system.cell_system.tune_skin(
min_skin=min_skin, max_skin=max_skin, tol=0.025, int_steps=200)))
Expand Down
3 changes: 3 additions & 0 deletions maintainer/benchmarks/p3m.py
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,9 @@
"tune_limits": [12, 160], "gpu": args.gpu}
p3m = espressomd.electrostatics.P3M(**p3m_params)
print("Quick equilibration")
system.time_step = system.time_step / 10.
system.integrator.run(100)
system.time_step = system.time_step * 10.
system.integrator.run(min(3 * measurement_steps, 1000))
print("Tune skin: {:.3f}".format(system.cell_system.tune_skin(
min_skin=min_skin, max_skin=max_skin, tol=0.05, int_steps=100,
Expand Down
9 changes: 3 additions & 6 deletions testsuite/python/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -110,12 +110,9 @@ function(python_test)
if(${TEST_GPU_SLOTS} GREATER 0 AND ESPRESSO_BUILD_WITH_CUDA)
set_property(TEST ${TEST_NAME} PROPERTY RESOURCE_GROUPS
"gpus:${TEST_GPU_SLOTS}")
endif()

if(${TEST_GPU_SLOTS} GREATER 0)
list(APPEND TEST_LABELS "gpu")
endif()
if(${TEST_NUM_PROC} EQUAL 2)
if(${TEST_NUM_PROC} GREATER_EQUAL 2)
list(APPEND TEST_LABELS "parallel")
endif()
if(${TEST_NUM_PROC} EQUAL 3)
Expand Down Expand Up @@ -262,7 +259,7 @@ python_test(FILE tabulated.py MAX_NUM_PROC 2)
python_test(FILE particle_slice.py MAX_NUM_PROC 4)
python_test(FILE rigid_bond.py MAX_NUM_PROC 4)
python_test(FILE rotation_per_particle.py MAX_NUM_PROC 4)
python_test(FILE rotational_inertia.py MAX_NUM_PROC 4)
python_test(FILE rotational_inertia.py MAX_NUM_PROC 2)
python_test(FILE rotational-diffusion-aniso.py MAX_NUM_PROC 1 LABELS long)
python_test(FILE rotational_dynamics.py MAX_NUM_PROC 1)
python_test(FILE script_interface.py MAX_NUM_PROC 4)
Expand Down Expand Up @@ -346,7 +343,7 @@ python_test(FILE lb_electrohydrodynamics.py MAX_NUM_PROC 4 GPU_SLOTS 1)
python_test(FILE cluster_analysis.py MAX_NUM_PROC 4)
python_test(FILE pair_criteria.py MAX_NUM_PROC 4)
python_test(FILE drude.py MAX_NUM_PROC 2)
python_test(FILE thermostats_anisotropic.py MAX_NUM_PROC 4)
python_test(FILE thermostats_anisotropic.py MAX_NUM_PROC 2)
python_test(FILE thermalized_bond.py MAX_NUM_PROC 4)
python_test(FILE thole.py MAX_NUM_PROC 4)
python_test(FILE lb_slice.py MAX_NUM_PROC 2 GPU_SLOTS 1)
Expand Down
1 change: 1 addition & 0 deletions testsuite/python/coulomb_cloud_wall_duplicated.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ def test_p3m(self):
self.compare("p3m", energy=True)

@utx.skipIfMissingGPU()
@utx.skipIfMissingFeatures("P3M")
def test_p3m_gpu(self):
p3m = espressomd.electrostatics.P3M(
**self.p3m_params, tune=False, gpu=True)
Expand Down
2 changes: 1 addition & 1 deletion testsuite/python/icc_electrodes.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
import numpy as np


@utx.skipIfMissingFeatures(["ELECTROSTATICS", "EXTERNAL_FORCES"])
@utx.skipIfMissingFeatures(["ELECTROSTATICS", "P3M", "EXTERNAL_FORCES"])
class Test(ut.TestCase):

def test_electrodes(self):
Expand Down
19 changes: 10 additions & 9 deletions testsuite/python/random_pairs.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,13 @@

class RandomPairTest(ut.TestCase):

"""This test creates a system of random particles.
Then the interaction pairs for a certain cutoff
are calculated by brute force in python (pairs_n2),
and compared to the pairs returned by the cell
systems, which should be identical. This check is
repeated for all valid combinations of periodicities.
"""
This test creates a system of random particles.
Then the interaction pairs for a certain cutoff
are calculated by brute force in python (pairs_n2),
and compared to the pairs returned by the cell
systems, which should be identical. This check is
repeated for all valid combinations of periodicities.

"""
system = espressomd.System(box_l=[10., 15., 15.])
Expand Down Expand Up @@ -69,16 +70,16 @@ def euclidean_pbc(a, b, box_l):
def tearDown(self):
self.system.part.clear()

def pairs_n2(self, dist):
def pairs_n2(self, cutoff):
# Go through list of all possible pairs for full periodicity
# and skip those that are not within the desired distance
# for the current periodicity

pairs = []
parts = self.system.part
for p in self.all_pairs:
if self.system.distance(parts.by_id(
p[0]), parts.by_id(p[1])) <= dist:
dist = self.system.distance(parts.by_id(p[0]), parts.by_id(p[1]))
if dist <= cutoff:
pairs.append(p)
return set(pairs)

Expand Down
Loading