Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Build system maintenance #4717

Merged
merged 2 commits into from
May 5, 2023
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
10 changes: 5 additions & 5 deletions .github/workflows/push_pull.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
uses: hendrikmuhs/[email protected]
with:
key: macos
save: ${{ ! startsWith(github.ref, 'refs/pull') }}
save: ${{ github.ref == 'refs/heads/python' }}
- name: Setup Python environment
uses: actions/[email protected]
with:
Expand All @@ -35,7 +35,7 @@ jobs:
debian:
runs-on: ubuntu-latest
container:
image: ghcr.io/espressomd/docker/debian:f6cf74049a2521b2b5580d23d42c8290c5f7611e-base-layer
image: ghcr.io/espressomd/docker/debian:fbdf2f2f9d76b761c0aa1308f17fb17e38501850-base-layer
credentials:
username: ${{ github.actor }}
password: ${{ secrets.github_token }}
Expand All @@ -47,7 +47,7 @@ jobs:
uses: hendrikmuhs/[email protected]
with:
key: debian
save: ${{ ! startsWith(github.ref, 'refs/pull') }}
save: ${{ github.ref == 'refs/heads/python' || ( github.repository != 'espressomd/espresso' && ! startsWith(github.ref, 'refs/pull') ) }}
- name: Setup Git environment
run: git config --global --add safe.directory "$GITHUB_WORKSPACE"
- name: Get runner specifications
Expand All @@ -74,7 +74,7 @@ jobs:
runs-on: ubuntu-latest
if: ${{ github.repository == 'espressomd/espresso' }}
container:
image: ghcr.io/espressomd/docker/ubuntu-wo-dependencies:f6cf74049a2521b2b5580d23d42c8290c5f7611e-base-layer
image: ghcr.io/espressomd/docker/ubuntu-wo-dependencies:fbdf2f2f9d76b761c0aa1308f17fb17e38501850-base-layer
credentials:
username: ${{ github.actor }}
password: ${{ secrets.github_token }}
Expand All @@ -86,7 +86,7 @@ jobs:
uses: hendrikmuhs/[email protected]
with:
key: ubuntu
save: ${{ ! startsWith(github.ref, 'refs/pull') }}
save: ${{ github.ref == 'refs/heads/python' }}
- name: Setup Git environment
run: git config --global --add safe.directory "$GITHUB_WORKSPACE"
- name: Get runner specifications
Expand Down
4 changes: 2 additions & 2 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
image: ghcr.io/espressomd/docker/ubuntu-22.04:cb0a2886ebd6a4fbd372503d7b46fc05fb1da5d5
image: ghcr.io/espressomd/docker/ubuntu-22.04:fbdf2f2f9d76b761c0aa1308f17fb17e38501850

stages:
- prepare
Expand Down Expand Up @@ -139,7 +139,7 @@ no_rotation:
fedora:36:
<<: *global_job_definition
stage: build
image: ghcr.io/espressomd/docker/fedora:3fd42369f84239b8c4f5d77067d404789c55ff44
image: ghcr.io/espressomd/docker/fedora:fbdf2f2f9d76b761c0aa1308f17fb17e38501850
variables:
with_cuda: 'false'
with_gsl: 'false'
Expand Down
5 changes: 2 additions & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#

cmake_minimum_required(VERSION 3.18)
cmake_minimum_required(VERSION 3.20)
message(STATUS "CMake version: ${CMAKE_VERSION}")
if(POLICY CMP0076)
# make target_sources() convert relative paths to absolute
Expand Down Expand Up @@ -234,8 +234,7 @@ endif()
# Python interpreter and Cython interface library
if(ESPRESSO_BUILD_WITH_PYTHON)
find_package(Python 3.9 REQUIRED COMPONENTS Interpreter Development NumPy)
# use version range 0.29.21...<3.0.0 in CMake 3.19
find_package(Cython 0.29.21 REQUIRED)
find_package(Cython 0.29.21...<3.0 REQUIRED)
find_program(IPYTHON_EXECUTABLE NAMES jupyter ipython3 ipython)
endif()

Expand Down
2 changes: 1 addition & 1 deletion cmake/FindClangTidy.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -44,5 +44,5 @@ if(CLANG_TIDY_EXE)
endif()

include( FindPackageHandleStandardArgs )
FIND_PACKAGE_HANDLE_STANDARD_ARGS( ClangTidy REQUIRED_VARS CLANG_TIDY_EXE
find_package_handle_standard_args( ClangTidy REQUIRED_VARS CLANG_TIDY_EXE
VERSION_VAR CLANG_TIDY_VERSION)
5 changes: 3 additions & 2 deletions cmake/FindCython.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,8 @@ if(CYTHON_EXECUTABLE)
endif()

include(FindPackageHandleStandardArgs)
# add HANDLE_VERSION_RANGE in CMake 3.19
FIND_PACKAGE_HANDLE_STANDARD_ARGS(Cython REQUIRED_VARS CYTHON_EXECUTABLE VERSION_VAR CYTHON_VERSION)
find_package_handle_standard_args(
Cython REQUIRED_VARS CYTHON_EXECUTABLE VERSION_VAR CYTHON_VERSION
HANDLE_VERSION_RANGE)

mark_as_advanced(CYTHON_EXECUTABLE)
3 changes: 3 additions & 0 deletions maintainer/CI/dox_warnings.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,9 @@
if re.search('^no uniquely matching class member found for $', warning):
# known bug, not fixed yet
continue
if re.search('^no matching (class|file) member found for $', warning):
# known bug, not fixed yet
continue
if re.search(
'^The following parameters? of .+ (is|are) not documented:$', warning):
# non-critical warning, enforcing it would encourage bad behavior, i.e.
Expand Down
6 changes: 4 additions & 2 deletions src/core/io/writer/h5md_core.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -338,16 +338,18 @@ static void write_le_off(LeesEdwardsBC const &lebc, h5xx::dataset &dataset) {
}

static void write_le_dir(LeesEdwardsBC const &lebc, h5xx::dataset &dataset) {
auto const shear_direction = static_cast<int>(lebc.shear_direction);
auto const extents = static_cast<h5xx::dataspace>(dataset).extents();
extend_dataset(dataset, Vector2hs{1, 0});
h5xx::write_dataset(dataset, Utils::Vector<int, 1>{lebc.shear_direction},
h5xx::write_dataset(dataset, Utils::Vector<int, 1>{shear_direction},
h5xx::slice(Vector2hs{extents[0], 0}, Vector2hs{1, 1}));
}

static void write_le_normal(LeesEdwardsBC const &lebc, h5xx::dataset &dataset) {
auto const shear_plane_normal = static_cast<int>(lebc.shear_plane_normal);
auto const extents = static_cast<h5xx::dataspace>(dataset).extents();
extend_dataset(dataset, Vector2hs{1, 0});
h5xx::write_dataset(dataset, Utils::Vector<int, 1>{lebc.shear_plane_normal},
h5xx::write_dataset(dataset, Utils::Vector<int, 1>{shear_plane_normal},
h5xx::slice(Vector2hs{extents[0], 0}, Vector2hs{1, 1}));
}

Expand Down
5 changes: 3 additions & 2 deletions src/core/lees_edwards/LeesEdwardsBC.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,11 @@
#include <initializer_list>

struct LeesEdwardsBC {
static auto constexpr invalid_dir = 3u;
double pos_offset = 0.;
double shear_velocity = 0.;
int shear_direction = -1;
int shear_plane_normal = -1;
unsigned int shear_direction = invalid_dir;
unsigned int shear_plane_normal = invalid_dir;
Utils::Vector3d distance(Utils::Vector3d const &d, Utils::Vector3d const &l,
Utils::Vector3d const &hal_l,
Utils::Vector3d const &l_inv,
Expand Down
28 changes: 15 additions & 13 deletions src/script_interface/lees_edwards/LeesEdwards.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
#include "Protocol.hpp"

#include "core/grid.hpp"
#include "core/lees_edwards/LeesEdwardsBC.hpp"
#include "core/lees_edwards/lees_edwards.hpp"

#include "script_interface/ScriptInterface.hpp"
Expand All @@ -35,7 +36,7 @@ namespace LeesEdwards {

class LeesEdwards : public AutoParameters<LeesEdwards> {
std::shared_ptr<Protocol> m_protocol;
LeesEdwardsBC const &m_lebc = box_geo.lees_edwards_bc();
LeesEdwardsBC const &m_lebc = ::box_geo.lees_edwards_bc();

public:
LeesEdwards() : m_protocol{nullptr} {
Expand All @@ -44,13 +45,14 @@ class LeesEdwards : public AutoParameters<LeesEdwards> {
[this](Variant const &value) {
if (is_none(value)) {
m_protocol = nullptr;
box_geo.set_lees_edwards_bc(LeesEdwardsBC{0., 0., -1, -1});
::box_geo.set_lees_edwards_bc(LeesEdwardsBC{});
::LeesEdwards::unset_protocol();
return;
}
context()->parallel_try_catch([this]() {
if (m_lebc.shear_direction == -1 or
m_lebc.shear_plane_normal == -1) {
auto constexpr invalid_dir = LeesEdwardsBC::invalid_dir;
if (m_lebc.shear_direction == invalid_dir or
m_lebc.shear_plane_normal == invalid_dir) {
throw std::runtime_error(
"Parameters 'shear_plane_normal' and 'shear_direction' "
"must be initialized together with 'protocol' on first "
Expand Down Expand Up @@ -94,7 +96,7 @@ class LeesEdwards : public AutoParameters<LeesEdwards> {
"'shear_plane_normal' must differ");
}
// update box geometry and cell structure
box_geo.set_lees_edwards_bc(
::box_geo.set_lees_edwards_bc(
LeesEdwardsBC{0., 0., shear_direction, shear_plane_normal});
::LeesEdwards::set_protocol(m_protocol->protocol());
});
Expand All @@ -109,28 +111,28 @@ class LeesEdwards : public AutoParameters<LeesEdwards> {
}

private:
int get_shear_axis(VariantMap const &params, std::string name) {
unsigned int get_shear_axis(VariantMap const &params, std::string name) {
auto const value = get_value<std::string>(params, name);
if (value == "x") {
return 0;
return 0u;
}
if (value == "y") {
return 1;
return 1u;
}
if (value == "z") {
return 2;
return 2u;
}
throw std::invalid_argument("Parameter '" + name + "' is invalid");
}

Variant get_shear_name(int axis) {
if (axis == 0) {
Variant get_shear_name(unsigned int axis) {
if (axis == 0u) {
return {std::string("x")};
}
if (axis == 1) {
if (axis == 1u) {
return {std::string("y")};
}
if (axis == 2) {
if (axis == 2u) {
return {std::string("z")};
}
return {none};
Expand Down
2 changes: 1 addition & 1 deletion src/utils/include/utils/Vector.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -448,7 +448,7 @@ auto hadamard_division(T const &a, U const &b) {
return a / b;
}

template <typename T> Vector<T, 3> unit_vector(int i) {
template <typename T> Vector<T, 3> unit_vector(unsigned int i) {
if (i == 0)
return {T{1}, T{0}, T{0}};
if (i == 1)
Expand Down