Skip to content

Add poisson examples (WIP) - #2054

Open
cflinto wants to merge 4 commits into
developfrom
add-poisson-examples
Open

Add poisson examples (WIP)#2054
cflinto wants to merge 4 commits into
developfrom
add-poisson-examples

Conversation

@cflinto

@cflinto cflinto commented Jul 22, 2026

Copy link
Copy Markdown

This PR introduces a series of examples demonstrating how to solve a 3D Poisson equation using Ginkgo's distributed matrix capabilities.

For the moment, I have only completed the distributed-poisson-assembled-matrix example. I am opening this PR early to get some initial feedback on the structure (@yhmtsai ?). The other two examples (distributed-poisson-matrix-free-monolithic and distributed-poisson-matrix-free-split) are NOT done yet.

MarcelKoch and others added 4 commits December 9, 2024 15:42
The Ginkgo team is proud to announce the new Ginkgo minor release 1.9.0.

This release brings new features such as:
- Support for half precision (IEEE FP16). The type `gko::half` can now be selected in most instances as the value type
  of a matrix, solver, preconditioner, etc. If the selected backend supports FP16 as a native type, the native type is
  used within the kernels, otherwise an overhead might occur. The new behavior is enabled by default, but it can be
  turned off during configuration.
- New implementations of the ILU and IC factorization for CUDA, HIP, OpenMP, and Reference backends. These are
  available in addition to the existing implementations based on the vendor libraries cuSPARSE and hipSPARSE.
- New (S)SOR and Gauss-Seidel preconditioners.
- Simplifyied distributed matrix assembly by exchanging local rows between neighboring processes.

And more!

See [the Changelog](./CHANGELOG.md) for more information.
The Ginkgo team is proud to announce the new Ginkgo minor release 1.10.0.
This release brings new features such as:
- Support for bfloat16 precision. The type `gko::bfloat16` can now be selected in most instances as the value type of a matrix, solver, preconditioner, etc. If the selected backend supports bfloat16 as a native type, the native type is used within the kernels, otherwise they may incur a conversion overhead. The new behavior is enabled by default, but it can be turned off during CMake configuration.
- Mixed precision support in our distributed matrix, provided the underlying matrix formats support mixed precision.
- New pipelined CG solver. This specialization of the CG solver is suitable to reduce the communication overhead in large scale distributed computations.
- New Chebyshev iteration solver.
- An OpenMP implementation of the merge-path based SpMV algorithm.

And more!

See the changelog for more details.
The Ginkgo team is proud to announce the new Ginkgo minor release 1.11.0.
This release brings new features such as:

- New interface for sparse matrix-matrix multiplication and addition. The new interface can yield speedups, in the case of repeated computations where the matrix values may change, but the matrix structure (i.e. position of non-zero entries) doesn't.
- Performance improvements for the distributed SpMV and pipelined CG solver.
- Better support for ARM platforms and support for ROCm 7 and CUDA 13.

And more!

See the changelog for more details.
@yhmtsai
yhmtsai self-requested a review July 23, 2026 08:14

@yhmtsai yhmtsai left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the assembled part looks good to me

Comment on lines +1 to +2
add_executable(distributed-poisson-assembled-matrix distributed-poisson-assembled-matrix.cpp)
target_link_libraries(distributed-poisson-assembled-matrix Ginkgo::ginkgo)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you will need to install pre-commit and run the formatting

#endif

// Helper function to map 3D grid coordinates (x, y, z) to a global 1D row index.
// The modulo operator (%) is used to enforce periodic boundary conditions,

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
// The modulo operator (%) is used to enforce periodic boundary conditions,
// The modulo operator (%) is used to enforce periodic boundary conditions,
// The addition operator (+ Nx/Ny/Nz) is used to deal with negative index in periodic boundary condition

if I understand it correctly

Comment on lines +97 to +104
const std::map<std::string, std::function<std::shared_ptr<gko::Executor>(MPI_Comm)>> executor_factory_mpi{
{"reference", [](MPI_Comm) { return gko::ReferenceExecutor::create(); }},
{"omp", [](MPI_Comm) { return gko::OmpExecutor::create(); }},
{"cuda", [](MPI_Comm comm) {
int device_id = gko::experimental::mpi::map_rank_to_device_id(
comm, gko::CudaExecutor::get_num_devices());
return gko::CudaExecutor::create(device_id, gko::ReferenceExecutor::create());
}}};

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

because you fully rely on the ginkgo functionality, it should also work on the other devices. Could you copy the full executor map here?
It might not be necessary in other example if you do not have them on different backend

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants