Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings
/ezpPublic

🪢 lightweight C++ wrapper for selected distributed solvers

License

NotificationsYou must be signed in to change notification settings

TLCFEM/ezp

Repository files navigation

codecovmaster

ezp is a lightweight C++ wrapper for selected distributed solvers for linear systems.

Features

  1. easy to use interface
  2. drop-in header-only library
  3. standalone solver binaries that can be invoked by various callers
  4. random tested implementation

The following solvers are implemented.

availabilitytype of matrixoperationsolverpackage
general (partial pivoting)simplePxGESVScaLAPACK
general (partial pivoting)expertPxGESVXScaLAPACK
symmetric/Hermitian positive definitesimplePxPOSVScaLAPACK
symmetric/Hermitian positive definiteexpertPxPOSVXScaLAPACK
general band (partial pivoting)simplePxGBSVScaLAPACK
general band (no pivoting)simplePxDBSVScaLAPACK
symmetric/Hermitian positive definite bandsimplePxPBSVScaLAPACK
sparse (one- or zero-indexing CSR format)directPARDISOMKL
sparse (one-indexing COO format)directMUMPSMUMPS
sparse (zero-indexing CSR format)iterativeLisLis

Dependency

Theezp library requires C++ 20 compatible compiler.The following drivers are needed.

  1. an implementation ofLAPACK andBLAS, such asOpenBLAS,MKL, etc.
  2. an implementation ofScaLAPACK
  3. an implementation ofMPI, such asOpenMPI,MPICH, etc.

Example

It is assumed that the root node (rank 0) prepares the left hand side$$A$$ and right hand side$$B$$.The solvers distribute the matrices to available processes and solve the system, return the solution back to the masternode.

The solvers are designed in such a way that allBLACS andScaLAPACK details are hidden.One shall prepare the matrices (on the root node) and call the solver.The following is a typical example.It highly resembles the sequential version of how one would typically solve a linear system.

The following is a working example.

#include<ezp/pgesv.hpp>#include<iomanip>#include<iostream>usingnamespaceezp;intmain() {// get the current blacs environmentconstauto rank = get_env<int>().rank();constexprauto N =6, NRHS =2;// storage for the matrices A and B    std::vector<double> A, B;if(0 == rank) {// the matrices are only initialized on the root process        A.resize(N * N,0.);        B.resize(N * NRHS,1.);// helper functor to convert 2D indices to 1D indices// it's likely the matrices are provided by some other subsystemconstauto IDX = par_dgesv<int>::indexer{N};for(auto I =0; I < N; ++I) A[IDX(I, I)] =static_cast<double>(I);    }// create a parallel solver// it takes the number of rows and columns of the process grid as arguments// or let the library automatically determine as follows// need to wrap the data in full_mat objects// it requires the number of rows and columns of the matrix, and a pointer to the data// on non-root processes, the data pointer is nullptr as the vector is empty// par_dgesv<int>().solve(full_mat{N, N, A.data()}, full_mat{N, NRHS, B.data()});    par_dgesv<int>().solve({N, N, A.data()}, {N, NRHS, B.data()});if(0 == rank) {        std::cout <<std::setprecision(10) <<"Solution:\n";for(auto i =0; i < B.size(); ++i) std::cout << B[i] <<'\n';    }return0;}

About

🪢 lightweight C++ wrapper for selected distributed solvers

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

[8]ページ先頭

©2009-2025 Movatter.jp