22#include "arccore/alina/BuiltinBackend.h"
23#include "arccore/alina/Adapters.h"
24#include "arccore/alina/DistributedMatrix.h"
25#include "arccore/alina/IO.h"
26#include "arccore/alina/Profiler.h"
30int main(
int argc,
char* argv[])
36 int chunk_len = (n + comm.size - 1) / comm.size;
37 int chunk_beg = std::min(n, chunk_len * comm.rank);
38 int chunk_end = std::min(n, chunk_len * (comm.rank + 1));
39 int chunk = chunk_end - chunk_beg;
42 ptr.reserve(chunk + 1);
45 col.reserve(chunk * 4);
46 std::vector<double> val;
47 val.reserve(chunk * 4);
49 for (
int i = 0, j = chunk_beg; i < chunk; ++i, ++j) {
68 ptr.push_back(col.size());
74 Matrix A(comm, std::tie(chunk, ptr, col, val), chunk);
77 std::ostringstream fname;
78 fname <<
"A_loc_" << comm.rank <<
".mtx";
79 Alina::IO::mm_write(fname.str(), *A.local());
83 std::ostringstream fname;
84 fname <<
"A_rem_" << comm.rank <<
".mtx";
85 Alina::IO::mm_write(fname.str(), *A.remote());
91 std::ostringstream fname;
92 fname <<
"B_loc_" << comm.rank <<
".mtx";
93 Alina::IO::mm_write(fname.str(), *B->local());
97 std::ostringstream fname;
98 fname <<
"B_rem_" << comm.rank <<
".mtx";
99 Alina::IO::mm_write(fname.str(), *B->remote());
Distributed Matrix using message passing.
Matrix class, to be used by user.
static Ref< IMessagePassingMng > createAndInitializeMPI(int *argc, char **argv[], int wanted_thread_level)
Initialize MPI and creates a manager associated with the MPI_WORLD_COMM communicator.
__host__ __device__ Real3x3 transpose(const Real3x3 &t)
Transpose the matrix.
-- tab-width: 2; indent-tabs-mode: nil; coding: utf-8-with-signature --
Convenience wrapper around MPI_Comm.