monolish  0.14.0
MONOlithic LIner equation Solvers for Highly-parallel architecture
lu_mumps_cpu.cpp
Go to the documentation of this file.
1 #include "../../../include/monolish_blas.hpp"
2 #include "../../../include/monolish_equation.hpp"
3 #include "../../internal/monolish_internal.hpp"
4 
5 // #include "dmumps_c.h"
6 // #include "mpi.h"
7 
8 #define JOB_INIT -1
9 #define JOB_END -2
10 #define USE_COMM_WORLD -987654
11 
12 namespace monolish {
13 
14 // mumps is choushi warui..
15 template <>
17  vector<double> &x,
18  vector<double> &b) {
19  Logger &logger = Logger::get_instance();
20  logger.func_in(monolish_func);
21 
22  (void)(&A);
23  (void)(&x);
24  (void)(&b);
25  if (1) {
26  throw std::runtime_error("error sparse LU on CPU does not impl.");
27  }
28 
29  // DMUMPS_STRUC_C id;
30  // MUMPS_INT n = A.get_row();
31  // MUMPS_INT8 nnz = A.get_nnz();
32  //
33  // // covert mumps format (CRS -> 1-origin COO)
34  // std::vector<int>tmp_row(nnz);
35  // std::vector<int>tmp_col(nnz);
36  // for(int i=0; i<n; i++){
37  // for(int j = A.row_ptr[i]; j < A.row_ptr[i+1]; j++){
38  // tmp_row[j] = i+1;
39  // tmp_row[j] = A.col_ind[j]+1;
40  // }
41  // }
42  // MUMPS_INT* irn = A.row_ptr.data();
43  // MUMPS_INT* jcn = A.col_ind.data();
44  //
45  // double* a = A.val.data();
46  // double* rhs = b.data();
47  //
48  // MUMPS_INT myid, ierr;
49  // int* dummy;
50  // char*** dummyc;
51  //
52  // int error = 0;
53  // #if defined(MAIN_COMP)
54  // argv = &name;
55  // #endif
56  // ierr = MPI_Init(dummy, dummyc);
57  // ierr = MPI_Comm_rank(MPI_COMM_WORLD, &myid);
58  //
59  // /* Initialize a MUMPS instance. Use MPI_COMM_WORLD */
60  // id.comm_fortran=USE_COMM_WORLD;
61  // id.par=1; id.sym=0;
62  // id.job=JOB_INIT;
63  // dmumps_c(&id);
64  //
65  // /* Define the problem on the host */
66  // if (myid == 0) {
67  // id.n = n; id.nnz =nnz; id.irn=irn; id.jcn=jcn;
68  // id.a = a; id.rhs = rhs;
69  // }
70  //
71  // #define ICNTL(I) icntl[(I)-1] /* macro s.t. indices match documentation */
72  // /* No outputs */
73  // id.ICNTL(1)=-1; id.ICNTL(2)=-1; id.ICNTL(3)=-1; id.ICNTL(4)=0;
74  //
75  // /* Call the MUMPS package (analyse, factorization and solve). */
76  // id.job=6;
77  // dmumps_c(&id);
78  // if (id.infog[0]<0) {
79  // printf(" (PROC %d) ERROR RETURN: \tINFOG(1)=
80  // %d\n\t\t\t\tINFOG(2)=
81  // %d\n", myid, id.infog[0], id.infog[1]);
82  // error = 1;
83  // }
84  //
85  // /* Terminate instance. */
86  // id.job=JOB_END;
87  // dmumps_c(&id);
88  // if (myid == 0) {
89  // if (!error) {
90  // printf("Solution is : (%8.2f %8.2f)\n",
91  // rhs[0],rhs[1]); } else {
92  // printf("An error has occured, please check error code returned by
93  // MUMPS.\n");
94  // }
95  // }
96  // ierr = MPI_Finalize();
97 
98  logger.func_out();
99  return 0;
100 }
101 } // namespace monolish
monolish_func
#define monolish_func
Definition: monolish_logger.hpp:9
monolish::Logger
logger class (singleton, for developper class)
Definition: monolish_logger.hpp:19
monolish::Logger::func_out
void func_out()
Definition: logger_utils.cpp:80
monolish::equation::LU
LU solver class (Dense, CPU only now)
Definition: monolish_equation.hpp:201
monolish
Definition: monolish_matrix_blas.hpp:9
monolish::vector
vector class
Definition: monolish_coo.hpp:25
monolish::Logger::get_instance
static Logger & get_instance()
Definition: monolish_logger.hpp:42
monolish::matrix::CRS
Compressed Row Storage (CRS) format Matrix.
Definition: monolish_coo.hpp:29
monolish::Logger::func_in
void func_in(const std::string func_name)
Definition: logger_utils.cpp:69