Ice Sheet System Model  4.18
Code documentation
IssmMpiDenseMat.h
Go to the documentation of this file.
1 
9 #ifndef _ISSM_MPI_DENSE_MAT_H_
10 #define _ISSM_MPI_DENSE_MAT_H_
11 
12 /*Headers:*/
13 /*{{{*/
14 #ifdef HAVE_CONFIG_H
15  #include <config.h>
16 #else
17 #error "Cannot compile with HAVE_CONFIG_H symbol! run configure first!"
18 #endif
19 
20 #include "../../shared/shared.h"
21 #include "../../datastructures/datastructures.h"
22 #include "../mumps/mumpsincludes.h"
23 #include "./Bucket.h"
24 #include "./IssmMpiVec.h"
25 #include <math.h>
26 
27 /*}}}*/
28 
29 /*We need to template this class, in case we want to create Matrices that hold
30  IssmDouble* matrix or IssmPDouble* matrix.
31  Such matrices would be useful for use without or with the matlab or python
32  interface (which do not care for IssmDouble types, but only rely on
33  IssmPDouble types)*/
34 template <class doubletype> class IssmAbsMat;
35 
36 template <class doubletype>
37 class IssmMpiDenseMat:public IssmAbsMat<doubletype>{
38 
39  public:
40 
41  int M,N; //global size
42  int m; //local number of rows
43  doubletype* matrix; /*here, doubletype is either IssmDouble or IssmPDouble*/
44  DataSet* buckets; /*here, we store buckets of values that we will Assemble into a global matrix.*/
45 
46  /*IssmMpiDenseMat constructors, destructors*/
47  IssmMpiDenseMat(){/*{{{*/
48  this->M=0;
49  this->N=0;
50  this->m=0;
51  this->matrix=NULL;
52  this->buckets=new DataSet();
53  }
54  /*}}}*/
55  IssmMpiDenseMat(int Min,int Nin){/*{{{*/
56  this->Init(Min,Nin);
57  }
58  /*}}}*/
59  IssmMpiDenseMat(int pM,int pN, doubletype sparsity){/*{{{*/
60  /*no sparsity involved here, we are fully dense, so just use the previous constructor: */
61  this->Init(pM,pN);
62  }
63  /*}}}*/
64  IssmMpiDenseMat(int min,int nin,int Min,int Nin,int* d_nnz,int* o_nnz){/*{{{*/
65  /*not needed, we are fully dense!: */
66 
67  this->buckets=new DataSet();
68 
69  this->M=Min;
70  this->N=Nin;
71  this->m=min;
72 
73  /*Initialize pointer: */
74  this->matrix=NULL;
75 
76  /*Allocate: */
77  if (m*N)this->matrix=xNewZeroInit<doubletype>(this->m*N);
78  }
79  /*}}}*/
80  IssmMpiDenseMat(doubletype* serial_mat,int Min,int Nin,doubletype sparsity){/*{{{*/
81 
82  /*Here, we assume that the serial_mat is local to the local cpu, and that it has
83  * the correct size (m rows by N colums), n determined by DetermineLocalSize: */
84  this->buckets=new DataSet();
85  this->M=Min;
86  this->N=Nin;
87  this->m=DetermineLocalSize(this->M,IssmComm::GetComm());
88 
89  this->matrix=NULL;
90  if(m*N){
91  this->matrix=xNewZeroInit<doubletype>(m*N);
92  xMemCpy<doubletype>(this->matrix,serial_mat,m*N);
93  }
94  }
95  /*}}}*/
96  IssmMpiDenseMat(int pM,int pN, int connectivity,int numberofdofspernode){/*{{{*/
97  /*not needed, we are fully dense!: */
98  this->Init(pM,pN);
99  }
100  /*}}}*/
102  xDelete<doubletype>(this->matrix);
103  M=0;
104  N=0;
105  m=0;
106  delete this->buckets;
107  }
108  /*}}}*/
109  void Init(int Min,int Nin){/*{{{*/
110 
111  this->buckets=new DataSet();
112 
113  this->M=Min;
114  this->N=Nin;
115 
116  /*Figure out local number of rows: */
117  this->m=DetermineLocalSize(this->M,IssmComm::GetComm());
118 
119  /*Initialize pointer: */
120  this->matrix=NULL;
121 
122  /*Allocate: */
123  if (m*N)this->matrix=xNewZeroInit<doubletype>(this->m*N);
124  }
125  /*}}}*/
126 
127  /*IssmMpiDenseMat specific routines */
128  void Echo(void){/*{{{*/
129 
130  int my_rank;
131  int i,j,k;
132 
133  /*Do a synchronized dump across all the rows: */
134  my_rank=IssmComm::GetRank();
135  for(i=0;i<IssmComm::GetSize();i++){
136  if (my_rank==i){
137  _printf_("cpu " << i << " #rows: " << this->m << "\n");
138  for (j=0;j<this->m;j++){
139  _printf_("row " << j << ":");
140  for (k=0;k<this->N;k++){
141  if(this->matrix[j*this->N+k]!=0)_printf_("(" << k << "," << this->matrix[j*this->N+k] << ") ");
142  }
143  _printf_("\n");
144  }
145  }
147  }
148 
149  }
150  /*}}}*/
151  void Assemble(){/*{{{*/
152 
153  int i,j;
154 
155  int *RowRank = NULL;
156  int num_procs;
157 
158  int *row_indices_forcpu = NULL;
159  int *col_indices_forcpu = NULL;
160  int *modes_forcpu = NULL;
161  doubletype *values_forcpu = NULL;
162  int *numvalues_forcpu = NULL;
163  DataSet **bucketsforcpu = NULL;
164 
165  int **row_indices_fromcpu = NULL;
166  int **col_indices_fromcpu = NULL;
167  int **modes_fromcpu = NULL;
168  doubletype **values_fromcpu = NULL;
169  int *numvalues_fromcpu = NULL;
170 
171  int lower_row;
172  int upper_row;
173  int* sendcnts = NULL;
174  int* displs = NULL;
175  int count = 0;
176 
177  /*some communicator info: */
178  num_procs=IssmComm::GetSize();
180 
181  /*First, make a vector of size M, which for each row between 0 and M-1, tells which cpu this row belongs to: */
182  RowRank=DetermineRowRankFromLocalSize(M,m,comm);
183 
184  /*Now, sort out our dataset of buckets according to cpu ownership of rows: {{{*/
185  bucketsforcpu=xNew<DataSet*>(num_procs);
186 
187  for(i=0;i<num_procs;i++){
188  DataSet* bucketsofcpu_i=new DataSet();
189  for (j=0;j<buckets->Size();j++){
191  bucket->SpawnBucketsPerCpu(bucketsofcpu_i,i,RowRank);
192  }
193  bucketsforcpu[i]=bucketsofcpu_i;
194  }
195  /*}}}*/
196 
197  /*Recap, each cpu has num_procs datasets of buckets. For a certain cpu j, for a given dataset i, the buckets this {{{
198  * dataset owns correspond to rows that are owned by cpu i, not j!. Out of all the buckets we own, make row,col,value,insert_mode
199  * vectors that will be shipped around the cluster: */
200  this->BucketsBuildScatterBuffers(&numvalues_forcpu,&row_indices_forcpu,&col_indices_forcpu,&values_forcpu,&modes_forcpu,bucketsforcpu,num_procs);
201  /*}}}*/
202 
203  /*Now, we need to allocate on each cpu arrays to receive data from all the other cpus. To know what we need to allocate, we need {{{
204  *some scatter calls: */
205  numvalues_fromcpu = xNew<int>(num_procs);
206  for(i=0;i<num_procs;i++){
207  ISSM_MPI_Scatter(numvalues_forcpu,1,ISSM_MPI_INT,numvalues_fromcpu+i,1,ISSM_MPI_INT,i,comm);
208  }
209 
210  row_indices_fromcpu=xNew<int*>(num_procs);
211  col_indices_fromcpu=xNew<int*>(num_procs);
212  values_fromcpu=xNew<doubletype*>(num_procs);
213  modes_fromcpu=xNew<int*>(num_procs);
214  for(i=0;i<num_procs;i++){
215  int size=numvalues_fromcpu[i];
216  if(size){
217  row_indices_fromcpu[i]=xNew<int>(size);
218  col_indices_fromcpu[i]=xNew<int>(size);
219  values_fromcpu[i]=xNew<doubletype>(size);
220  modes_fromcpu[i]=xNew<int>(size);
221  }
222  else{
223  row_indices_fromcpu[i]=NULL;
224  col_indices_fromcpu[i]=NULL;
225  values_fromcpu[i]=NULL;
226  modes_fromcpu[i]=NULL;
227  }
228  }
229  /*}}}*/
230 
231  /*Scatter values around: {{{*/
232  /*Now, to scatter values across the cluster, we need sendcnts and displs. Our sendbufs have been built by BucketsBuildScatterBuffers, with a stride given
233  * by numvalues_forcpu. Get this ready to go before starting the scatter itslef. For reference, here is the ISSM_MPI_Scatterv prototype:
234  * int ISSM_MPI_Scatterv( void *sendbuf, int *sendcnts, int *displs, ISSM_MPI_Datatype sendtype, void *recvbuf, int recvcnt, ISSM_MPI_Datatype recvtype, int root, ISSM_MPI_Comm comm) :*/
235  sendcnts=xNew<int>(num_procs);
236  displs=xNew<int>(num_procs);
237  count=0;
238  for(i=0;i<num_procs;i++){
239  sendcnts[i]=numvalues_forcpu[i];
240  displs[i]=count;
241  count+=numvalues_forcpu[i];
242  }
243 
244  for(i=0;i<num_procs;i++){
245  ISSM_MPI_Scatterv( row_indices_forcpu, sendcnts, displs, ISSM_MPI_INT, row_indices_fromcpu[i], numvalues_fromcpu[i], ISSM_MPI_INT, i, comm);
246  ISSM_MPI_Scatterv( col_indices_forcpu, sendcnts, displs, ISSM_MPI_INT, col_indices_fromcpu[i], numvalues_fromcpu[i], ISSM_MPI_INT, i, comm);
247  ISSM_MPI_Scatterv( values_forcpu, sendcnts, displs, ISSM_MPI_DOUBLE, values_fromcpu[i], numvalues_fromcpu[i], ISSM_MPI_DOUBLE, i, comm);
248  ISSM_MPI_Scatterv( modes_forcpu, sendcnts, displs, ISSM_MPI_INT, modes_fromcpu[i], numvalues_fromcpu[i], ISSM_MPI_INT, i, comm);
249  }
250  /*}}}*/
251 
252  /*Plug values into global matrix: {{{*/
253  GetOwnershipBoundariesFromRange(&lower_row,&upper_row,m,comm);
254  for(i=0;i<num_procs;i++){
255  int numvalues=numvalues_fromcpu[i];
256  int* rows=row_indices_fromcpu[i];
257  int* cols=col_indices_fromcpu[i];
258  doubletype* values=values_fromcpu[i];
259  int* mods=modes_fromcpu[i];
260 
261  for(j=0;j<numvalues;j++){
262  if(mods[j]==ADD_VAL) *(matrix+N*(rows[j]-lower_row)+cols[j])+=values[j];
263  else *(matrix+N*(rows[j]-lower_row)+cols[j])=values[j];
264  }
265  }
266  /*}}}*/
267 
268  /*Free ressources:{{{*/
269  xDelete<int>(RowRank);
270  xDelete<int>(row_indices_forcpu);
271  xDelete<int>(col_indices_forcpu);
272  xDelete<int>(modes_forcpu);
273  xDelete<doubletype>(values_forcpu);
274  xDelete<int>(numvalues_forcpu);
275 
276  for(i=0;i<num_procs;i++){
277  DataSet* buckets=bucketsforcpu[i];
278  delete buckets;
279  }
280  xDelete<DataSet*>(bucketsforcpu);
281 
282  for(i=0;i<num_procs;i++){
283  int* rows=row_indices_fromcpu[i];
284  int* cols=col_indices_fromcpu[i];
285  int* modes=modes_fromcpu[i];
286  doubletype* values=values_fromcpu[i];
287 
288  xDelete<int>(rows);
289  xDelete<int>(cols);
290  xDelete<int>(modes);
291  xDelete<doubletype>(values);
292  }
293  xDelete<int*>(row_indices_fromcpu);
294  xDelete<int*>(col_indices_fromcpu);
295  xDelete<int*>(modes_fromcpu);
296  xDelete<doubletype*>(values_fromcpu);
297  xDelete<int>(numvalues_fromcpu);
298 
299  xDelete<int>(sendcnts);
300  xDelete<int>(displs);
301  /*}}}*/
302 
303  }
304  /*}}}*/
305  doubletype Norm(NormMode mode){/*{{{*/
306 
307  doubletype norm,local_norm;
308  doubletype absolute;
309  int i,j;
310 
311  switch(mode){
312  case NORM_INF:
313  local_norm=0.;
314  for(i=0;i<this->m;i++){
315  absolute=0;
316  for(j=0;j<this->N;j++){
317  absolute+=fabs(this->matrix[N*i+j]);
318  }
319  local_norm=max(local_norm,absolute);
320  }
321  ISSM_MPI_Reduce(&local_norm, &norm, 1, ISSM_MPI_DOUBLE, ISSM_MPI_MAX, 0, IssmComm::GetComm());
323  return norm;
324  break;
325  case NORM_FROB:
326  local_norm=0.;
327  for(i=0;i<this->m;i++){
328  for(j=0;j<this->N;j++){
329  local_norm+=this->matrix[N*i+j]*this->matrix[N*i+j];
330  }
331  }
332  ISSM_MPI_Reduce(&local_norm, &norm, 1, ISSM_MPI_DOUBLE, ISSM_MPI_SUM, 0, IssmComm::GetComm());
334  return sqrt(norm);
335  break;
336 
337  default:
338  _error_("unknown norm !");
339  break;
340  }
341  }
342  /*}}}*/
343  void GetSize(int* pM,int* pN){/*{{{*/
344  *pM=M;
345  *pN=N;
346  }
347  /*}}}*/
348  void GetLocalSize(int* pM,int* pN){/*{{{*/
349  *pM=m;
350  *pN=N;
351  }
352  /*}}}*/
354 
355  int i,j;
356  doubletype *X_serial = NULL;
357 
358  /*A check on the types: */
359  if(IssmVecTypeFromToolkitOptions()!=MpiEnum)_error_("MatMult operation only possible with 'mpi' vectors");
360 
361  /*Now that we are sure, cast vectors: */
364 
365  /*Serialize input Xin: */
366  X_serial=X->ToMPISerial();
367 
368  /*Every cpu has a serial version of the input vector. Use it to do the Matrix-Vector multiply
369  *locally and plug it into AXin: */
370  for(i=0;i<this->m;i++){
371  for(j=0;j<this->N;j++){
372  AX->vector[i]+=this->matrix[i*N+j]*X_serial[j];
373  }
374  }
375 
376  /*Free ressources: */
377  xDelete<doubletype>(X_serial);
378  }
379  /*}}}*/
381 
382  IssmMpiDenseMat<doubletype>* dup=new IssmMpiDenseMat<doubletype>(this->matrix,this->M,this->N,0);
383  return dup;
384 
385  }
386  /*}}}*/
387  doubletype* ToSerial(void){/*{{{*/
388  _error_("not supported yet!");
389  }
390  /*}}}*/
391  void SetValues(int min,int* idxm,int nin,int* idxn,doubletype* values,InsMode mode){/*{{{*/
392 
393  /*we need to store all the values we collect here in order to Assemble later.
394  * Indeed, the values we are collecting here most of the time will not belong
395  * to us, but to another part of the matrix on another cpu: */
396  _assert_(buckets);
397 
398  buckets->AddObject(new Bucket<doubletype>(min,idxm,nin,idxn,values,mode));
399 
400  }
401  /*}}}*/
402  void SetZero(void){/*{{{*/
403  for(int i=0;i<this->m*this->N;i++) this->matrix[i] = 0.;
404  }/*}}}*/
405  void Convert(MatrixType type){/*{{{*/
406  _error_("not supported yet!");
407  }
408  /*}}}*/
409  void BucketsBuildScatterBuffers(int** pnumvalues_forcpu,int** prow_indices_forcpu,int** pcol_indices_forcpu,doubletype** pvalues_forcpu,int** pmodes_forcpu,DataSet** bucketsforcpu,int num_procs){/*{{{*/
410 
411  /*intermediary: */
412  int i,j;
413  int count = 0;
414  int total_size = 0;
415  int *temp_row_indices_forcpu = NULL;
416  int *temp_col_indices_forcpu = NULL;
417  doubletype *temp_values_forcpu = NULL;
418  int *temp_modes_forcpu = NULL;
419 
420  /*output: */
421  int *numvalues_forcpu = NULL;
422  int *row_indices_forcpu = NULL;
423  int *col_indices_forcpu = NULL;
424  doubletype *values_forcpu = NULL;
425  int *modes_forcpu = NULL;
426 
427  /*figure out size of buffers per cpu: */
428 
429  numvalues_forcpu=xNew<int>(num_procs);
430  for(i=0;i<num_procs;i++){
431  DataSet *buckets = bucketsforcpu[i];
432 
433  count=0;
434  for(j=0;j<buckets->Size();j++){
436  count+=bucket->MarshallSize();
437  }
438 
439  numvalues_forcpu[i]=count;
440  }
441 
442  /*now, figure out size of total buffers (for all cpus!): */
443  count=0;
444  for(i=0;i<num_procs;i++){
445  count+=numvalues_forcpu[i];
446  }
447  total_size=count;
448 
449  /*Allocate buffers: */
450  row_indices_forcpu = xNew<int>(total_size);
451  col_indices_forcpu = xNew<int>(total_size);
452  values_forcpu = xNew<doubletype>(total_size);
453  modes_forcpu = xNew<int>(total_size);
454 
455  /*we are going to march through the buffers, and marshall data onto them, so in order to not
456  *lose track of where these buffers are located in memory, we are going to work using copies
457  of them: */
458  temp_row_indices_forcpu=row_indices_forcpu;
459  temp_col_indices_forcpu=col_indices_forcpu;
460  temp_values_forcpu=values_forcpu;
461  temp_modes_forcpu=modes_forcpu;
462 
463  /*Fill buffers: */
464  for(i=0;i<num_procs;i++){
465  DataSet *buckets = bucketsforcpu[i];
466  for(j=0;j<buckets->Size();j++){
468  bucket->Marshall(&temp_row_indices_forcpu,&temp_col_indices_forcpu,&temp_values_forcpu,&temp_modes_forcpu); //pass in the address of the buffers, so as to have the Marshall routine increment them.
469  }
470  }
471 
472  /*sanity check: */
473  if (temp_row_indices_forcpu!=row_indices_forcpu+total_size)_error_("problem with marshalling of buckets");
474  if (temp_col_indices_forcpu!=col_indices_forcpu+total_size)_error_("problem with marshalling of buckets");
475  if (temp_values_forcpu!=values_forcpu+total_size)_error_("problem with marshalling of buckets");
476  if (temp_modes_forcpu!=modes_forcpu+total_size)_error_("problem with marshalling of buckets");
477 
478  /*output buffers: */
479  *pnumvalues_forcpu = numvalues_forcpu;
480  *prow_indices_forcpu = row_indices_forcpu;
481  *pcol_indices_forcpu = col_indices_forcpu;
482  *pvalues_forcpu = values_forcpu;
483  *pmodes_forcpu = modes_forcpu;
484  }
485  /*}}}*/
486  #ifndef _HAVE_WRAPPERS_
487  /*Solve{{{*/
489 
490  /*output: */
491  IssmMpiVec<IssmDouble>* uf=NULL;
492  IssmMpiVec<IssmDouble>* pf=NULL;
493 
494  /*Assume we are getting an IssmMpiVec in input, downcast: */
495  pf=(IssmMpiVec<IssmDouble>*)pfin;
496 
498  case MumpsEnum: {
499  /*Initialize output: */
500  uf=pf->Duplicate();
501  #ifdef _HAVE_MUMPS_
502  MpiDenseMumpsSolve(/*output*/ uf->vector,uf->M,uf->m, /*stiffness matrix:*/ this->matrix,this->M,this->N,this->m, /*right hand side load vector: */ pf->vector,pf->M,pf->m,parameters);
503  #else
504  _error_("IssmMpiDenseMat solver requires MUMPS solver");
505  #endif
506  return (IssmAbsVec<IssmDouble>*)uf;
507  }
508  case GslEnum: {
509 
510  IssmDouble* x=NULL;
511  #ifdef _HAVE_GSL_
512 
513  DenseGslSolve(/*output*/ &x,/*stiffness matrix:*/ this->matrix,this->M,this->N, /*right hand side load vector: */ pf->vector,pf->M,parameters);
514 
515  uf=new IssmMpiVec<IssmDouble>(x,this->N); xDelete(x);
516 
517  return (IssmAbsVec<IssmDouble>*)uf;
518  #else
519  _error_("GSL support not compiled in!");
520  #endif
521  }
522  default:
523  _error_("solver type not supported yet!");
524  }
525 
526  }/*}}}*/
527  #endif
528 };
529 
530 #endif //#ifndef _ISSM_MPI_DENSE_MAT_H_
DataSet::Size
int Size()
Definition: DataSet.cpp:399
_assert_
#define _assert_(ignore)
Definition: exceptions.h:37
IssmMpiVec::vector
doubletype * vector
Definition: IssmMpiVec.h:40
IssmDouble
double IssmDouble
Definition: types.h:37
IssmMpiDenseMat::GetSize
void GetSize(int *pM, int *pN)
Definition: IssmMpiDenseMat.h:343
DataSet::AddObject
int AddObject(Object *object)
Definition: DataSet.cpp:252
_printf_
#define _printf_(StreamArgs)
Definition: Print.h:22
Parameters
Declaration of Parameters class.
Definition: Parameters.h:18
ISSM_MPI_SUM
#define ISSM_MPI_SUM
Definition: issmmpi.h:134
ADD_VAL
@ ADD_VAL
Definition: toolkitsenums.h:14
IssmComm::GetComm
static ISSM_MPI_Comm GetComm(void)
Definition: IssmComm.cpp:30
IssmMpiDenseMat::MatMult
void MatMult(IssmAbsVec< doubletype > *Xin, IssmAbsVec< doubletype > *AXin)
Definition: IssmMpiDenseMat.h:353
GetOwnershipBoundariesFromRange
void GetOwnershipBoundariesFromRange(int *plower_row, int *pupper_row, int range, ISSM_MPI_Comm comm)
Definition: GetOwnershipBoundariesFromRange.cpp:16
IssmMpiDenseMat::buckets
DataSet * buckets
Definition: IssmMpiDenseMat.h:44
IssmMpiDenseMat::SetZero
void SetZero(void)
Definition: IssmMpiDenseMat.h:402
NORM_INF
@ NORM_INF
Definition: toolkitsenums.h:15
ISSM_MPI_MAX
#define ISSM_MPI_MAX
Definition: issmmpi.h:131
IssmMpiDenseMat::M
int M
Definition: IssmMpiDenseMat.h:41
IssmMpiDenseMat::Norm
doubletype Norm(NormMode mode)
Definition: IssmMpiDenseMat.h:305
IssmMpiDenseMat::Assemble
void Assemble()
Definition: IssmMpiDenseMat.h:151
IssmMpiVec.h
implementation of parallel dense ISSM vector. Internally, the parallel dense vector is split in rows ...
IssmMpiDenseMat::Convert
void Convert(MatrixType type)
Definition: IssmMpiDenseMat.h:405
IssmMpiDenseMat::IssmMpiDenseMat
IssmMpiDenseMat(int min, int nin, int Min, int Nin, int *d_nnz, int *o_nnz)
Definition: IssmMpiDenseMat.h:64
IssmMpiDenseMat::ToSerial
doubletype * ToSerial(void)
Definition: IssmMpiDenseMat.h:387
Bucket
Definition: Bucket.h:19
IssmAbsMat
Definition: IssmAbsMat.h:27
IssmMpiDenseMat::matrix
doubletype * matrix
Definition: IssmMpiDenseMat.h:43
MpiEnum
@ MpiEnum
Definition: EnumDefinitions.h:1193
IssmMpiDenseMat::IssmMpiDenseMat
IssmMpiDenseMat(int pM, int pN, doubletype sparsity)
Definition: IssmMpiDenseMat.h:59
DetermineLocalSize
int DetermineLocalSize(int global_size, ISSM_MPI_Comm comm)
Definition: DetermineLocalSize.cpp:9
IssmSolverTypeFromToolkitOptions
int IssmSolverTypeFromToolkitOptions(void)
Definition: IssmToolkitUtils.cpp:86
Bucket::MarshallSize
int MarshallSize(void)
Definition: Bucket.h:233
IssmMpiVec::ToMPISerial
doubletype * ToMPISerial(void)
Definition: IssmMpiVec.h:413
ISSM_MPI_DOUBLE
#define ISSM_MPI_DOUBLE
Definition: issmmpi.h:125
IssmMpiDenseMat::Echo
void Echo(void)
Definition: IssmMpiDenseMat.h:128
MatrixType
MatrixType
Definition: toolkitsenums.h:16
ISSM_MPI_INT
#define ISSM_MPI_INT
Definition: issmmpi.h:127
MumpsEnum
@ MumpsEnum
Definition: EnumDefinitions.h:1195
IssmMpiDenseMat::SetValues
void SetValues(int min, int *idxm, int nin, int *idxn, doubletype *values, InsMode mode)
Definition: IssmMpiDenseMat.h:391
xDelete
void xDelete(T **&aT_pp)
Definition: MemOps.h:97
Bucket.h
: header file for Bucket object
NORM_FROB
@ NORM_FROB
Definition: toolkitsenums.h:15
IssmComm::GetSize
static int GetSize(void)
Definition: IssmComm.cpp:46
IssmMpiDenseMat::Init
void Init(int Min, int Nin)
Definition: IssmMpiDenseMat.h:109
IssmMpiDenseMat::~IssmMpiDenseMat
~IssmMpiDenseMat()
Definition: IssmMpiDenseMat.h:101
IssmMpiDenseMat
Definition: IssmMpiDenseMat.h:37
ISSM_MPI_Bcast
int ISSM_MPI_Bcast(void *buffer, int count, ISSM_MPI_Datatype datatype, int root, ISSM_MPI_Comm comm)
Definition: issmmpi.cpp:162
IssmAbsVec
Definition: IssmAbsVec.h:24
Bucket::SpawnBucketsPerCpu
void SpawnBucketsPerCpu(DataSet *bucketsofcpu_i, int rank_i, int *rowranks)
Definition: Bucket.h:137
IssmMpiDenseMat::IssmMpiDenseMat
IssmMpiDenseMat(int Min, int Nin)
Definition: IssmMpiDenseMat.h:55
NormMode
NormMode
Definition: toolkitsenums.h:15
IssmComm::GetRank
static int GetRank(void)
Definition: IssmComm.cpp:34
IssmMpiDenseMat::GetLocalSize
void GetLocalSize(int *pM, int *pN)
Definition: IssmMpiDenseMat.h:348
MpiDenseMumpsSolve
void MpiDenseMumpsSolve(IssmDouble *uf, int uf_M, int uf_m, IssmDouble *Kff, int Kff_M, int Kff_N, int Kff_m, IssmDouble *pf, int pf_M, int pf_m, Parameters *parameters)
Definition: MpiDenseMumpsSolve.cpp:109
Bucket::Marshall
void Marshall(char **pmarshalled_data, int *pmarshalled_data_size, int marshall_direction)
Definition: Bucket.h:131
_error_
#define _error_(StreamArgs)
Definition: exceptions.h:49
IssmMpiDenseMat::m
int m
Definition: IssmMpiDenseMat.h:42
IssmMpiDenseMat::Duplicate
IssmMpiDenseMat< doubletype > * Duplicate(void)
Definition: IssmMpiDenseMat.h:380
DataSet::GetObjectByOffset
Object * GetObjectByOffset(int offset)
Definition: DataSet.cpp:334
min
IssmDouble min(IssmDouble a, IssmDouble b)
Definition: extrema.cpp:14
ISSM_MPI_Comm
int ISSM_MPI_Comm
Definition: issmmpi.h:118
IssmMpiVec::m
int m
Definition: IssmMpiVec.h:39
ISSM_MPI_Barrier
int ISSM_MPI_Barrier(ISSM_MPI_Comm comm)
Definition: issmmpi.cpp:148
InsMode
InsMode
Definition: toolkitsenums.h:14
IssmVecTypeFromToolkitOptions
int IssmVecTypeFromToolkitOptions(void)
Definition: IssmToolkitUtils.cpp:56
IssmMpiDenseMat::IssmMpiDenseMat
IssmMpiDenseMat(int pM, int pN, int connectivity, int numberofdofspernode)
Definition: IssmMpiDenseMat.h:96
DenseGslSolve
void DenseGslSolve(IssmPDouble **pX, IssmPDouble *A, IssmPDouble *B, int n)
Definition: DenseGslSolve.cpp:25
IssmMpiVec
Definition: IssmMpiVec.h:34
ISSM_MPI_Reduce
int ISSM_MPI_Reduce(void *sendbuf, void *recvbuf, int count, ISSM_MPI_Datatype datatype, ISSM_MPI_Op op, int root, ISSM_MPI_Comm comm)
Definition: issmmpi.cpp:373
max
IssmDouble max(IssmDouble a, IssmDouble b)
Definition: extrema.cpp:24
DataSet
Declaration of DataSet class.
Definition: DataSet.h:14
bamg::Min
T Min(const T &a, const T &b)
Definition: extrema.h:6
IssmMpiVec::M
int M
Definition: IssmMpiVec.h:38
DetermineRowRankFromLocalSize
int * DetermineRowRankFromLocalSize(int global_size, int localsize, ISSM_MPI_Comm comm)
Definition: DetermineRowRankFromLocalSize.cpp:12
GslEnum
@ GslEnum
Definition: EnumDefinitions.h:1094
IssmMpiVec::Duplicate
IssmMpiVec< doubletype > * Duplicate(void)
Definition: IssmMpiVec.h:374
IssmMpiDenseMat::N
int N
Definition: IssmMpiDenseMat.h:41
ISSM_MPI_Scatter
int ISSM_MPI_Scatter(void *sendbuf, int sendcnt, ISSM_MPI_Datatype sendtype, void *recvbuf, int recvcnt, ISSM_MPI_Datatype recvtype, int root, ISSM_MPI_Comm comm)
Definition: issmmpi.cpp:407
IssmMpiDenseMat::Solve
IssmAbsVec< IssmDouble > * Solve(IssmAbsVec< IssmDouble > *pfin, Parameters *parameters)
Definition: IssmMpiDenseMat.h:488
IssmMpiDenseMat::BucketsBuildScatterBuffers
void BucketsBuildScatterBuffers(int **pnumvalues_forcpu, int **prow_indices_forcpu, int **pcol_indices_forcpu, doubletype **pvalues_forcpu, int **pmodes_forcpu, DataSet **bucketsforcpu, int num_procs)
Definition: IssmMpiDenseMat.h:409
IssmMpiDenseMat::IssmMpiDenseMat
IssmMpiDenseMat()
Definition: IssmMpiDenseMat.h:47
ISSM_MPI_Scatterv
int ISSM_MPI_Scatterv(void *sendbuf, int *sendcnts, int *displs, ISSM_MPI_Datatype sendtype, void *recvbuf, int recvcnt, ISSM_MPI_Datatype recvtype, int root, ISSM_MPI_Comm comm)
Definition: issmmpi.cpp:444
IssmMpiDenseMat::IssmMpiDenseMat
IssmMpiDenseMat(doubletype *serial_mat, int Min, int Nin, doubletype sparsity)
Definition: IssmMpiDenseMat.h:80