Skip to content

Commit dc87ede

Browse files
authored
Update dependency requirements (#5181)
Prepare ESPResSo for a dev-EESSI release. Description of changes: - bump HighFive version requirements - allow Cython 3.1.x and Cython 3.0.4 for foss/2023b - make Gay-Berne potential part of the default myconfig file - fix CMake parsing of environment variable `ESPRESSO_MYCONFIG` - limit testsuite to 3 cores on the macOS runner to avoid timeouts
1 parent 3f929c4 commit dc87ede

File tree

15 files changed

+54
-45
lines changed

15 files changed

+54
-45
lines changed

.github/workflows/push_pull.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,16 +38,17 @@ jobs:
3838
codesign -d -vv /usr/local/lib/libomp.dylib
3939
echo "::endgroup::"
4040
# Python dependencies
41-
python3 -m venv venv
41+
python -m venv venv
4242
. venv/bin/activate
43-
pip3 install -c requirements.txt cython numpy scipy packaging
43+
python -m pip install -c requirements.txt cython numpy scipy packaging
4444
deactivate
4545
shell: bash
4646
- name: Build and check
4747
uses: ./.github/actions/build_and_check
4848
env:
4949
build_procs: 3
5050
check_procs: 3
51+
cmake_params: '-D ESPRESSO_TEST_NP=3'
5152
with_ccache: 'true'
5253
with_fftw: 'true'
5354
with_walberla: 'true'

CMakeLists.txt

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -301,7 +301,10 @@ endif()
301301
# Python interpreter and Cython interface library
302302
if(ESPRESSO_BUILD_WITH_PYTHON)
303303
find_package(Python 3.11 REQUIRED COMPONENTS Interpreter Development NumPy)
304-
find_package(Cython 3.0.8...<3.1.0 REQUIRED)
304+
find_package(Cython 3.0.4...<3.2.0 REQUIRED)
305+
if(CYTHON_VERSION VERSION_LESS 3.0.8)
306+
message(WARNING "We strongly recommend using Cython 3.0.8 or later")
307+
endif()
305308
find_program(IPYTHON_EXECUTABLE NAMES jupyter ipython3 ipython)
306309
endif()
307310

@@ -746,7 +749,7 @@ if(ESPRESSO_BUILD_WITH_HDF5)
746749
FetchContent_Declare(
747750
HighFive
748751
GIT_REPOSITORY https://github.com/highfive-devs/highfive.git
749-
GIT_TAG v.3.1.1
752+
GIT_TAG v3.2.0
750753
)
751754
# cmake-format: on
752755
FetchContent_MakeAvailable(HighFive)

cmake/espresso_myconfig.cmake

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@
2222

2323
# heed the environment variable "ESPRESSO_MYCONFIG"
2424
if(NOT ESPRESSO_MYCONFIG_FILE)
25-
if(ENV{ESPRESSO_MYCONFIG})
26-
set(ESPRESSO_MYCONFIG_FILE ENV{ESPRESSO_MYCONFIG})
25+
if(DEFINED ENV{ESPRESSO_MYCONFIG})
26+
set(ESPRESSO_MYCONFIG_FILE $ENV{ESPRESSO_MYCONFIG})
2727
else()
2828
# test whether ESPRESSO_MYCONFIG_NAME is found in the object or source dir
2929
find_file(ESPRESSO_MYCONFIG_FILE NAMES ${ESPRESSO_MYCONFIG_NAME}

requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# build system
2-
cython>=3.0.8,<3.1.0
2+
cython>=3.0.4,<3.2.0
33
setuptools>=68.1.2
44
packaging>=24.0
55
# required scientific packages

src/config/myconfig-default.hpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@
5757
#define LJCOS2
5858
#define GAUSSIAN
5959
#define HAT
60+
#define GAY_BERNE
6061
#define SMOOTH_STEP
6162
#define HERTZIAN
6263
#define SOFT_SPHERE

src/core/aosoa_pack.hpp

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,22 @@ struct CellStructure::AoSoA_pack {
9090
#endif
9191
}
9292
}
93+
94+
template <typename array_layout>
95+
Utils::Vector3d get_vector_at(
96+
Kokkos::View<double *[3], array_layout, Kokkos::HostSpace> const &view,
97+
std::size_t i) const {
98+
return {view(i, 0), view(i, 1), view(i, 2)};
99+
}
100+
101+
template <typename array_layout>
102+
void set_vector_at(
103+
Kokkos::View<double *[3], array_layout, Kokkos::HostSpace> &view,
104+
std::size_t i, Utils::Vector3d const &value) {
105+
view(i, 0) = value[0];
106+
view(i, 1) = value[1];
107+
view(i, 2) = value[2];
108+
}
93109
};
94110

95111
#endif // ESPRESSO_SHARED_MEMORY_PARALLELISM

src/core/electrostatics/elc.hpp

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -116,28 +116,24 @@ struct elc_data {
116116
double space_box;
117117

118118
#ifdef ESPRESSO_SHARED_MEMORY_PARALLELISM
119-
static auto copy_aosoa_vector_elc(std::size_t i, auto &slice) {
120-
return Utils::Vector3d{slice(i, 0), slice(i, 1), slice(i, 2)};
121-
}
122-
123119
/// pairwise contributions from lower and upper layers
124120
void dielectric_layers_contribution(BoxGeometry const &box_geo,
125121
std::size_t p1, std::size_t p2,
126122
auto &aosoa, double q1q2,
127123
auto &&kernel) const {
128124
if (aosoa.position(p1, 2) < space_layer) {
129125
auto const q_eff = delta_mid_bot * q1q2;
130-
auto pos2 = copy_aosoa_vector_elc(p2, aosoa.position);
131-
auto pos1 = copy_aosoa_vector_elc(p1, aosoa.position);
126+
auto pos2 = aosoa.get_vector_at(aosoa.position, p2);
127+
auto pos1 = aosoa.get_vector_at(aosoa.position, p1);
132128
pos1[2] *= -1.;
133129
auto const d = box_geo.get_mi_vector(pos2, pos1);
134130
kernel(q_eff, d);
135131
}
136132
if (aosoa.position(p1, 2) > (box_h - space_layer)) {
137133
auto const q_eff = delta_mid_top * q1q2;
138134
auto const z = 2. * box_h - aosoa.position(p1, 2);
139-
auto pos2 = copy_aosoa_vector_elc(p2, aosoa.position);
140-
auto pos1 = copy_aosoa_vector_elc(p1, aosoa.position);
135+
auto pos2 = aosoa.get_vector_at(aosoa.position, p2);
136+
auto pos1 = aosoa.get_vector_at(aosoa.position, p1);
141137
pos1[2] = 2. * box_h - pos1[2];
142138
auto const d = box_geo.get_mi_vector(pos2, pos1);
143139
kernel(q_eff, d);

src/core/electrostatics/p3m.cpp

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -377,9 +377,7 @@ template <int cao> struct AssignCharge {
377377
p3m.inter_weights.zfill(n_part); // allocate buffer for parallel write
378378
kokkos_parallel_range_for(
379379
"InterpolationWeights", std::size_t{0u}, n_part, [&](auto p_index) {
380-
Utils::Vector3d const p_pos{aosoa.position(p_index, 0),
381-
aosoa.position(p_index, 1),
382-
aosoa.position(p_index, 2)};
380+
auto const p_pos = aosoa.get_vector_at(aosoa.position, p_index);
383381
auto constexpr memory_order =
384382
std::remove_reference<decltype(p3m)>::type::memory_order;
385383
auto const weights =

src/core/forces_cabana.hpp

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -101,15 +101,11 @@ struct ForcesKernel {
101101
nonbonded_ias.get_ia_param(aosoa.type(i), aosoa.type(j));
102102

103103
ParticleForce pf{};
104-
Utils::Vector3d const pos1 = {aosoa.position(i, 0), aosoa.position(i, 1),
105-
aosoa.position(i, 2)};
106-
Utils::Vector3d const pos2 = {aosoa.position(j, 0), aosoa.position(j, 1),
107-
aosoa.position(j, 2)};
104+
auto const pos1 = aosoa.get_vector_at(aosoa.position, i);
105+
auto const pos2 = aosoa.get_vector_at(aosoa.position, j);
108106
#if defined(ESPRESSO_GAY_BERNE) or defined(ESPRESSO_DIPOLES)
109-
Utils::Vector3d const dir1 = {aosoa.director(i, 0), aosoa.director(i, 1),
110-
aosoa.director(i, 2)};
111-
Utils::Vector3d const dir2 = {aosoa.director(j, 0), aosoa.director(j, 1),
112-
aosoa.director(j, 2)};
107+
auto const dir1 = aosoa.get_vector_at(aosoa.director, i);
108+
auto const dir2 = aosoa.get_vector_at(aosoa.director, j);
113109
#endif
114110

115111
#ifdef ESPRESSO_NPT
@@ -164,10 +160,8 @@ struct ForcesKernel {
164160
#ifdef ESPRESSO_DPD
165161
if (thermostat.thermo_switch & THERMO_DPD) {
166162
auto const dist2 = dist * dist;
167-
Utils::Vector3d const vel1 = {aosoa.velocity(i, 0), aosoa.velocity(i, 1),
168-
aosoa.velocity(i, 2)};
169-
Utils::Vector3d const vel2 = {aosoa.velocity(j, 0), aosoa.velocity(j, 1),
170-
aosoa.velocity(j, 2)};
163+
auto const vel1 = aosoa.get_vector_at(aosoa.velocity, i);
164+
auto const vel2 = aosoa.get_vector_at(aosoa.velocity, j);
171165
auto const force =
172166
dpd_pair_force(pos1, vel1, aosoa.id(i), pos2, vel2, aosoa.id(j),
173167
*thermostat.dpd, box_geo, ia_params, d, dist, dist2);

src/core/magnetostatics/dp3m.cpp

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -174,9 +174,7 @@ template <int cao> struct AssignDipole {
174174
dp3m.inter_weights.zfill(n_part); // allocate buffer for parallel write
175175
kokkos_parallel_range_for(
176176
"InterpolationWeights", std::size_t{0u}, n_part, [&](auto p_index) {
177-
Utils::Vector3d const p_pos{aosoa.position(p_index, 0),
178-
aosoa.position(p_index, 1),
179-
aosoa.position(p_index, 2)};
177+
auto const p_pos = aosoa.get_vector_at(aosoa.position, p_index);
180178
auto const weights =
181179
p3m_calculate_interpolation_weights<cao, memory_order>(
182180
p_pos, dp3m.params.ai, dp3m.local_mesh);

0 commit comments

Comments
 (0)