From db0cbd245f233f7e9056c50883691b4847733055 Mon Sep 17 00:00:00 2001 From: "Jack S. Hale" Date: Fri, 29 May 2026 09:59:30 +0200 Subject: [PATCH 1/4] Remove Dockerfile, ancient --- Dockerfile | 79 ---------------------------------------------- src/CMakeLists.txt | 5 ++- 2 files changed, 2 insertions(+), 82 deletions(-) delete mode 100644 Dockerfile diff --git a/Dockerfile b/Dockerfile deleted file mode 100644 index 343ced5..0000000 --- a/Dockerfile +++ /dev/null @@ -1,79 +0,0 @@ -# Builds a Docker image with the necessary libraries for compiling -# FEniCS. The image is at -# https://hub.docker.com/r/fenicsproject/performance-tests -# -# Authors: Garth N. Wells - -ARG PETSC_VERSION=3.12.4 - -FROM ubuntu:20.04 - -WORKDIR /tmp - -# Environment variables -ENV OPENBLAS_NUM_THREADS=1 - -# Non-Python utilities and libraries -RUN apt-get -qq update && \ - apt-get -y --with-new-pkgs \ - -o Dpkg::Options::="--force-confold" upgrade && \ - apt-get -y install \ - bison \ - clang \ - cmake \ - flex \ - g++ \ - gfortran \ - git \ - libboost-filesystem-dev \ - libboost-iostreams-dev \ - libboost-math-dev \ - libboost-program-options-dev \ - libboost-system-dev \ - libboost-thread-dev \ - libboost-timer-dev \ - liblapack-dev \ - libmpich-dev \ - libopenblas-dev \ - libhdf5-mpich-dev \ - mpich \ - ninja-build \ - python3 \ - python3-dev \ - pkg-config \ - wget && \ - apt-get clean && \ - rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* - -# Install PETSc from source -ARG PETSC_VERSION -RUN git clone --branch v${PETSC_VERSION} --depth 1 https://gitlab.com/petsc/petsc.git && \ - cd petsc && \ - python3 ./configure --with-64-bit-indices=0 \ - --COPTFLAGS="-O3" \ - --CXXOPTFLAGS="-O3" \ - --FOPTFLAGS="-O3" \ - --with-c-support \ - --with-fortran-bindings=no \ - --with-debugging=0 \ - --with-shared-libraries \ - --download-hypre \ - --download-ptscotch \ - --prefix=/usr/local/petsc-32 && \ - make && \ - make install && \ - git clean -fdx . && \ - python3 ./configure --with-64-bit-indices=1 \ - --COPTFLAGS="-O3" \ - --CXXOPTFLAGS="-O3" \ - --FOPTFLAGS="-O3" \ - --with-c-support \ - --with-fortran-bindings=no \ - --with-debugging=0 \ - --with-shared-libraries \ - --download-hypre \ - --download-ptscotch \ - --prefix=/usr/local/petsc-64 && \ - make && \ - make install && \ - rm -rf /tmp/* diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 36c03f2..2f3f360 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -15,9 +15,8 @@ set(CMAKE_CXX_EXTENSIONS OFF) # DOLFIN_CMAKE_CONFIG_PATH) find_package(DOLFINX REQUIRED) -# set(CMAKE_BUILD_TYPE "Release") -set(CMAKE_CXX_FLAGS "-Ofast ${CMAKE_CXX_FLAGS} -g -Wall") -set(CMAKE_C_FLAGS "-Ofast ${CMAKE_C_FLAGS} -g -Wall") +set(CMAKE_CXX_FLAGS "-O3 -ffast-math ${CMAKE_CXX_FLAGS} -g -Wall") +set(CMAKE_C_FLAGS "-O3 -ffast-math ${CMAKE_C_FLAGS} -g -Wall") # Compile UFL files add_custom_command( From 3ddb62ece32d1eae7a4f74497287834eba873ec4 Mon Sep 17 00:00:00 2001 From: "Jack S. Hale" Date: Fri, 29 May 2026 11:13:20 +0200 Subject: [PATCH 2/4] Trigger CI? From d78f4bed07c6ed8bd46716294c4e600214cd3588 Mon Sep 17 00:00:00 2001 From: "Jack S. Hale" Date: Fri, 29 May 2026 12:48:40 +0200 Subject: [PATCH 3/4] Tweaks for main DOLFINx graph partitioner change --- src/mesh.cpp | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/mesh.cpp b/src/mesh.cpp index 44f5dcf..b723d55 100644 --- a/src/mesh.cpp +++ b/src/mesh.cpp @@ -179,8 +179,7 @@ create_cube_mesh(MPI_Comm comm, std::size_t target_dofs, bool target_dofs_total, else MPI_Comm_dup(comm, &sub_comm); - auto cell_part = dolfinx::mesh::create_cell_partitioner(dolfinx::mesh::GhostMode::none, - graph_part, 2); + auto cell_part = dolfinx::mesh::create_cell_partitioner(dolfinx::mesh::GhostMode::none, graph_part, 2); auto mesh = dolfinx::mesh::create_box( comm, sub_comm, {{{0.0, 0.0, 0.0}, {1.0, 1.0, 1.0}}}, {Nx, Ny, Nz}, dolfinx::mesh::CellType::tetrahedron, cell_part); @@ -198,7 +197,7 @@ create_cube_mesh(MPI_Comm comm, std::size_t target_dofs, bool target_dofs_total, mesh.topology_mutable()->create_connectivity(3, 1); auto [new_mesh, _parent_edges, _parent_facet] = dolfinx::refinement::refine( mesh, std::nullopt, - dolfinx::mesh::create_cell_partitioner(dolfinx::mesh::GhostMode::shared_facet), + dolfinx::mesh::create_cell_partitioner(dolfinx::mesh::GhostMode::shared_facet, 2), dolfinx::refinement::Option::parent_cell_and_facet); mesh = std::move(new_mesh); } @@ -375,7 +374,7 @@ create_spoke_mesh(MPI_Comm comm, std::size_t target_dofs, { auto [new_mesh, _parent_edges, _parent_facet] = dolfinx::refinement::refine( *mesh, std::nullopt, - dolfinx::mesh::create_cell_partitioner(dolfinx::mesh::GhostMode::shared_facet), + dolfinx::mesh::create_cell_partitioner(dolfinx::mesh::GhostMode::shared_facet, 2), dolfinx::refinement::Option::parent_cell_and_facet); mesh = std::make_shared>(new_mesh); mesh->topology_mutable()->create_entities(1); @@ -413,7 +412,7 @@ create_spoke_mesh(MPI_Comm comm, std::size_t target_dofs, auto [new_mesh, _parent_edges, _parent_facet] = dolfinx::refinement::refine( *mesh, marked_edges, - dolfinx::mesh::create_cell_partitioner(dolfinx::mesh::GhostMode::shared_facet), + dolfinx::mesh::create_cell_partitioner(dolfinx::mesh::GhostMode::shared_facet, 2), dolfinx::refinement::Option::parent_cell_and_facet); meshi = std::make_shared>(new_mesh); From e9f234913b7ff47b6c892ff1bce3a5844ecb9839 Mon Sep 17 00:00:00 2001 From: "Jack S. Hale" Date: Fri, 29 May 2026 12:51:36 +0200 Subject: [PATCH 4/4] clang-format --- src/cgpoisson_problem.h | 5 +++-- src/main.cpp | 3 ++- src/mesh.cpp | 32 +++++++++++++++++++------------- 3 files changed, 24 insertions(+), 16 deletions(-) diff --git a/src/cgpoisson_problem.h b/src/cgpoisson_problem.h index 977db83..76d6f1f 100644 --- a/src/cgpoisson_problem.h +++ b/src/cgpoisson_problem.h @@ -20,6 +20,7 @@ std::tuple>, std::shared_ptr>, std::function&, const dolfinx::la::Vector&)>> - problem(std::shared_ptr> mesh, int order, std::string scatterer); +problem(std::shared_ptr> mesh, int order, + std::string scatterer); -} // namespace poisson +} // namespace cgpoisson diff --git a/src/main.cpp b/src/main.cpp index b507d12..ee6461b 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -264,7 +264,8 @@ int main(int argc, char* argv[]) std::string fmt = "[%Y-%m-%d %H:%M:%S.%e] [" + thread_name + "] [%l] %v"; spdlog::set_pattern(fmt); - // Turn off logging except on rank 0, if set (e.g. use SPDLOG_LEVEL=info in CLI) + // Turn off logging except on rank 0, if set (e.g. use SPDLOG_LEVEL=info in + // CLI) if (mpi_rank != 0) spdlog::set_level(spdlog::level::err); diff --git a/src/mesh.cpp b/src/mesh.cpp index b723d55..0ef94c8 100644 --- a/src/mesh.cpp +++ b/src/mesh.cpp @@ -42,13 +42,15 @@ namespace // // 1. Available at . constexpr std::tuple -num_entities(std::int64_t i, std::int64_t j, std::int64_t k, int nrefine) { +num_entities(std::int64_t i, std::int64_t j, std::int64_t k, int nrefine) +{ i <<= nrefine; j <<= nrefine; k <<= nrefine; std::int64_t vertices = (i + 1) * (j + 1) * (k + 1); - std::int64_t edges = 7*i*j*k + 3*(i*j + i*k + j*k) + (i + j + k); - std::int64_t faces = 12*i*j*k + 2*(i*j + i*k + j*k); + std::int64_t edges + = 7 * i * j * k + 3 * (i * j + i * k + j * k) + (i + j + k); + std::int64_t faces = 12 * i * j * k + 2 * (i * j + i * k + j * k); std::int64_t cells = 6 * (i * j * k); return {vertices, edges, faces, cells}; } @@ -179,7 +181,8 @@ create_cube_mesh(MPI_Comm comm, std::size_t target_dofs, bool target_dofs_total, else MPI_Comm_dup(comm, &sub_comm); - auto cell_part = dolfinx::mesh::create_cell_partitioner(dolfinx::mesh::GhostMode::none, graph_part, 2); + auto cell_part = dolfinx::mesh::create_cell_partitioner( + dolfinx::mesh::GhostMode::none, graph_part, 2); auto mesh = dolfinx::mesh::create_box( comm, sub_comm, {{{0.0, 0.0, 0.0}, {1.0, 1.0, 1.0}}}, {Nx, Ny, Nz}, dolfinx::mesh::CellType::tetrahedron, cell_part); @@ -196,9 +199,10 @@ create_cube_mesh(MPI_Comm comm, std::size_t target_dofs, bool target_dofs_total, { mesh.topology_mutable()->create_connectivity(3, 1); auto [new_mesh, _parent_edges, _parent_facet] = dolfinx::refinement::refine( - mesh, std::nullopt, - dolfinx::mesh::create_cell_partitioner(dolfinx::mesh::GhostMode::shared_facet, 2), - dolfinx::refinement::Option::parent_cell_and_facet); + mesh, std::nullopt, + dolfinx::mesh::create_cell_partitioner( + dolfinx::mesh::GhostMode::shared_facet, 2), + dolfinx::refinement::Option::parent_cell_and_facet); mesh = std::move(new_mesh); } @@ -373,9 +377,10 @@ create_spoke_mesh(MPI_Comm comm, std::size_t target_dofs, < target) { auto [new_mesh, _parent_edges, _parent_facet] = dolfinx::refinement::refine( - *mesh, std::nullopt, - dolfinx::mesh::create_cell_partitioner(dolfinx::mesh::GhostMode::shared_facet, 2), - dolfinx::refinement::Option::parent_cell_and_facet); + *mesh, std::nullopt, + dolfinx::mesh::create_cell_partitioner( + dolfinx::mesh::GhostMode::shared_facet, 2), + dolfinx::refinement::Option::parent_cell_and_facet); mesh = std::make_shared>(new_mesh); mesh->topology_mutable()->create_entities(1); } @@ -411,9 +416,10 @@ create_spoke_mesh(MPI_Comm comm, std::size_t target_dofs, marked_edges.push_back(i); auto [new_mesh, _parent_edges, _parent_facet] = dolfinx::refinement::refine( - *mesh, marked_edges, - dolfinx::mesh::create_cell_partitioner(dolfinx::mesh::GhostMode::shared_facet, 2), - dolfinx::refinement::Option::parent_cell_and_facet); + *mesh, marked_edges, + dolfinx::mesh::create_cell_partitioner( + dolfinx::mesh::GhostMode::shared_facet, 2), + dolfinx::refinement::Option::parent_cell_and_facet); meshi = std::make_shared>(new_mesh); double actual_fraction