PaStiX Handbook  6.3.2
coeftab.c
Go to the documentation of this file.
1 /**
2  *
3  * @file coeftab.c
4  *
5  * PaStiX coefficient array initialization and free routines.
6  *
7  * @copyright 2015-2023 Bordeaux INP, CNRS (LaBRI UMR 5800), Inria,
8  * Univ. Bordeaux. All rights reserved.
9  *
10  * @version 6.3.2
11  * @author Xavier Lacoste
12  * @author Pierre Ramet
13  * @author Mathieu Faverge
14  * @author Esragul Korkmaz
15  * @author Gregoire Pichon
16  * @author Tony Delarue
17  * @date 2023-07-21
18  *
19  **/
20 #include "common.h"
21 #include "bcsc/bcsc.h"
22 #include "isched.h"
23 #include "blend/solver.h"
24 #include "sopalin/coeftab.h"
25 #include "pastix_zcores.h"
26 #include "pastix_ccores.h"
27 #include "pastix_dcores.h"
28 #include "pastix_scores.h"
29 #include "cpucblk_zpack.h"
30 #include "cpucblk_cpack.h"
31 #include "cpucblk_dpack.h"
32 #include "cpucblk_spack.h"
33 
34 #include "pastix_zccores.h"
35 #include "pastix_dscores.h"
36 
37 #if defined(PASTIX_WITH_PARSEC)
39 #endif
40 
41 #if defined(PASTIX_WITH_STARPU)
43 #endif
44 
46 {
48 };
49 
50 #ifndef DOXYGEN_SHOULD_SKIP_THIS
51 static void (*initfunc[2][4])( pastix_coefside_t, const SolverMatrix*,
52  const pastix_bcsc_t*, pastix_int_t, const char *) =
53 {
54  /* Normal precision functions */
55  {
60  },
61  /* Mixed-precision functions */
62  {
67  }
68 };
69 #endif /* DOXYGEN_SHOULD_SKIP_THIS */
70 
71 /**
72  * @brief Internal structure specific to the parallel call of pcoeftabInit()
73  */
74 struct coeftabinit_s {
75  const SolverMatrix *datacode; /**< The solver matrix */
76  const pastix_bcsc_t *bcsc; /**< The internal block CSC */
77  const char *dirname; /**< The pointer to the output directory */
78  pastix_coefside_t side; /**< The side of the matrix beeing initialized */
79  pastix_int_t mixed; /**< The mixed-precision parameter */
80 };
81 
82 /**
83  *******************************************************************************
84  *
85  * @brief Allocates the entire coeftab matrix with a single allocation.
86  *
87  * The different cblk coeftabs are assigned inside the
88  * allocation, each one with their right size.
89  *
90  *******************************************************************************
91  *
92  * @param[inout] pastix_data
93  * The pastix_data structure that describes the solver instance.
94  * On exit, the internal coeftab matrix is allocated.
95  *
96  *******************************************************************************/
97 void
98 coeftabAlloc( pastix_data_t *pastix_data )
99 {
100  SolverMatrix *solvmatr = pastix_data->solvmatr;
101  SolverCblk *cblk = solvmatr->cblktab;
102  pastix_int_t i, step = 0;
103  pastix_coeftype_t flttype = solvmatr->flttype;
104  size_t size = solvmatr->coefnbr * pastix_size_of( flttype );
105  char *workL = NULL;
106  char *workU = NULL;
107 
108  workL = pastix_malloc_pinned( size );
109  memset( workL, 0, size );
110 
111  /* Only allocates the U part if necessary */
112  if ( pastix_data->iparm[IPARM_FACTORIZATION] == PastixFactLU ) {
113  workU = pastix_malloc_pinned( size );
114  memset( workU, 0, size );
115  }
116 
117  /*
118  * Assign the cblks to their corresponding index in work
119  * lcoeftabs and ucoeftabs are both one allocation
120  */
121  for ( i=0; i<solvmatr->cblknbr; i++, cblk++ ) {
122 
123  /* FANIN and RECV cblks are allocated independently */
124  if ( cblk->cblktype & (CBLK_RECV|CBLK_FANIN) ) {
125  continue;
126  }
127 
128  assert( cblk->lcoeftab == NULL );
129  assert( (size_t) (step) < size );
130  cblk->lcoeftab = workL + step;
131 
132  if ( pastix_data->iparm[IPARM_FACTORIZATION] == PastixFactLU ) {
133  assert( cblk->ucoeftab == NULL );
134  cblk->ucoeftab = workU + step;
135  }
136 
137  step += cblk_colnbr( cblk ) * cblk->stride * pastix_size_of( flttype );
138  }
139 }
140 
141 /**
142  *******************************************************************************
143  *
144  * @brief Internal routine called by each static thread to Initialize the solver
145  * matrix structure.
146  *
147  * This routine is the routine called by each thread in the static scheduler and
148  * launched by the coeftabinit().
149  *
150  *******************************************************************************
151  *
152  * @param[inout] ctx
153  * The internal scheduler context
154  *
155  * @param[in] args
156  * The data structure specific to the function cpucblk_zinit()
157  *
158  *******************************************************************************/
159 void
160 pcoeftabInit( isched_thread_t *ctx,
161  void *args )
162 {
163  struct coeftabinit_s *ciargs = (struct coeftabinit_s*)args;
164  const SolverMatrix *datacode = ciargs->datacode;
165  const pastix_bcsc_t *bcsc = ciargs->bcsc;
166  const char *dirname = ciargs->dirname;
167  pastix_coefside_t side = ciargs->side;
168  pastix_int_t mixed = ciargs->mixed;
169  pastix_int_t i, itercblk;
170  pastix_int_t task;
171  int rank = ctx->rank;
172 
173  for (i=0; i < datacode->ttsknbr[rank]; i++)
174  {
175  task = datacode->ttsktab[rank][i];
176  itercblk = datacode->tasktab[task].cblknum;
177 
178  /* Init as full rank */
179  initfunc[mixed][bcsc->flttype - 2]( side, datacode, bcsc, itercblk, dirname );
180  }
181 }
182 
183 /**
184  *******************************************************************************
185  *
186  * @brief Initialize the solver matrix structure
187  *
188  * This routine is a parallel routine to initialize the solver matrix structure
189  * through the internal static scheduler
190  *
191  *******************************************************************************
192  *
193  * @param[inout] pastix_data
194  * The pastix_data structure that hold the solver matrix to initialize.
195  *
196  * @param[in] side
197  * Describe the side(s) of the matrix that must be initialized.
198  * @arg PastixLCoef if lower part only
199  * @arg PastixUCoef if upper part only
200  * @arg PastixLUCoef if both sides.
201  *
202  *******************************************************************************/
203 void
205  pastix_coefside_t side )
206 {
207  struct coeftabinit_s args;
208 
209  pastix_data->solvmatr->globalalloc = pastix_data->iparm[IPARM_GLOBAL_ALLOCATION];
210  args.datacode = pastix_data->solvmatr;
211  args.bcsc = pastix_data->bcsc;
212  args.side = side;
213  args.mixed = pastix_data->iparm[IPARM_MIXED];
214 
215  /* Allocates the coeftab matrix before multi-threading if global allocation is enabled */
216  if ( args.datacode->globalalloc )
217  {
218  if ( pastix_data->iparm[IPARM_COMPRESS_WHEN] != PastixCompressNever ) {
219  pastix_print_warning( "Global allocation is not allowed with compression. It is disabled\n" );
220  pastix_data->solvmatr->globalalloc = 0;
221  }
222  else {
223  /* Make sure there is no compression */
224  assert( pastix_data->iparm[IPARM_COMPRESS_WHEN] == PastixCompressNever );
225  coeftabAlloc( pastix_data );
226  }
227  }
228 
229 #if defined(PASTIX_DEBUG_DUMP_COEFTAB)
230  /* Make sure dir_local is initialized before calling it with multiple threads */
231  pastix_gendirectories( pastix_data );
232 #endif
233  args.dirname = pastix_data->dir_local;
234 
235  /* Initialize ILU level block variables */
236  {
237  SolverCblk *cblk = pastix_data->solvmatr->cblktab;
238  SolverBlok *blok = pastix_data->solvmatr->bloktab;
239  pastix_int_t i;
240 
241  for (i=0; i<pastix_data->solvmatr->cblknbr; i++, cblk++) {
242  cblk->ctrbcnt = cblk[1].brownum - cblk[0].brownum;
243  }
244 
245  for (i=0; i<pastix_data->solvmatr->bloknbr; i++, blok++) {
246  blok->iluklvl = INT_MAX;
247  }
248  }
249  isched_parallel_call( pastix_data->isched, pcoeftabInit, &args );
250 }
251 
252 /**
253  *******************************************************************************
254  *
255  * @brief Free the solver matrix structure
256  *
257  * This routine free all data structure refereing to the solver matrix L, even
258  * the runtime descriptors if present.
259  *
260  *******************************************************************************
261  *
262  * @param[inout] solvmtx
263  * The solver matrix structure of the problem.
264  *
265  *******************************************************************************/
266 void
268 {
269  pastix_int_t i;
270 
271 #if defined(PASTIX_WITH_PARSEC)
272  {
273  if ( solvmtx->parsec_desc != NULL ) {
274  parsec_sparse_matrix_destroy( solvmtx->parsec_desc );
275  free( solvmtx->parsec_desc );
276  }
277  solvmtx->parsec_desc = NULL;
278  }
279 #endif
280 #if defined(PASTIX_WITH_STARPU)
281  {
282  if ( solvmtx->starpu_desc != NULL ) {
283  starpu_sparse_matrix_destroy( solvmtx->starpu_desc );
284  free( solvmtx->starpu_desc );
285  }
286  solvmtx->starpu_desc = NULL;
287  }
288 #endif
289 
290  /* If the coeftab is a single allocation, only free the first block */
291  if ( solvmtx->globalalloc ) {
292  pastix_free_pinned( solvmtx->cblktab->lcoeftab );
293  if ( solvmtx->cblktab->ucoeftab ) {
294  pastix_free_pinned( solvmtx->cblktab->ucoeftab );
295  }
296  }
297 
298  /* Free arrays of solvmtx */
299  if ( solvmtx->cblktab )
300  {
301  SolverCblk *cblk = solvmtx->cblktab;
302 
303  for ( i = 0; i < solvmtx->cblknbr; i++, cblk++ ) {
304  if ( cblk->cblktype & (CBLK_FANIN|CBLK_RECV) ) {
305  continue;
306  }
307  /* If the blocks are already freed set them to NULL, else free them */
308  if ( solvmtx->globalalloc ) {
309  cblk->lcoeftab = NULL;
310  if ( cblk->ucoeftab ) {
311  cblk->ucoeftab = NULL;
312  }
313  }
314  /* Free is precision independent, so we can use any version */
315  else {
316  cpucblk_zfree( PastixLUCoef, cblk );
317  }
318  }
319  }
320 }
321 
322 /**
323  * @brief Internal structure specific to the parallel call of pcoeftabComp()
324  */
325 struct coeftabcomp_s {
326  SolverMatrix *solvmtx; /**< The solver matrix */
327  pastix_coeftype_t flttype; /**< The arithmetic type */
328  pastix_atomic_lock_t lock; /**< Lock to protect the gain update */
329  pastix_int_t gain; /**< The memory gain on output */
330 };
331 
332 /**
333  *******************************************************************************
334  *
335  * @brief Internal routine called by each static thread to Initialize the solver
336  * matrix structure.
337  *
338  * This routine is the routine called by each thread in the static scheduler and
339  * launched by the coeftabCompress().
340  *
341  *******************************************************************************
342  *
343  * @param[inout] ctx
344  * The internal scheduler context
345  *
346  * @param[in] args
347  * The data structure specific to the function cpucblk_zcompress()
348  *
349  *******************************************************************************/
350 static void
351 pcoeftabComp( isched_thread_t *ctx,
352  void *args )
353 {
354  struct coeftabcomp_s *ccargs = (struct coeftabcomp_s*)args;
355  SolverMatrix *solvmtx = ccargs->solvmtx;
356  pastix_coeftype_t flttype = ccargs->flttype;
357  pastix_atomic_lock_t *lock = &(ccargs->lock);
358  pastix_int_t *fullgain = &(ccargs->gain);
359  SolverCblk *cblk;
361  pastix_int_t i, itercblk;
362  pastix_int_t task, gain = 0;
363  int rank = ctx->rank;
364 
365  pastix_int_t (*compfunc)( const SolverMatrix*, pastix_coefside_t, int, SolverCblk* ) = NULL;
366 
367  switch( flttype ) {
368  case PastixComplex32:
369  compfunc = cpucblk_ccompress;
370  break;
371  case PastixComplex64:
372  compfunc = cpucblk_zcompress;
373  break;
374  case PastixFloat:
375  compfunc = cpucblk_scompress;
376  break;
377  case PastixDouble:
378  case PastixPattern:
379  default:
380  compfunc = cpucblk_dcompress;
381  }
382 
383  for (i=0; i < solvmtx->ttsknbr[rank]; i++)
384  {
385  task = solvmtx->ttsktab[rank][i];
386  itercblk = solvmtx->tasktab[task].cblknum;
387  cblk = solvmtx->cblktab + itercblk;
388 
389  if ( cblk->cblktype & CBLK_COMPRESSED ) {
390  gain += compfunc( solvmtx, side, -1, cblk );
391  }
392  }
393 
394  pastix_atomic_lock( lock );
395  *fullgain += gain;
396  pastix_atomic_unlock( lock );
397 }
398 
399 /**
400  *******************************************************************************
401  *
402  * @brief Compress the factorized matrix structure if not already done.
403  *
404  * This routine compress all column blocks that are marked for compression, and
405  * return the amount of memory saved by the compression.
406  *
407  *******************************************************************************
408  *
409  * @param[inout] pastix_data
410  * The pastix_data structure that holds the problem
411  *
412  *******************************************************************************
413  *
414  * @return The memory gain resulting from the compression to low-rank format in
415  * number of elements.
416  *
417  *******************************************************************************/
420 {
421  struct coeftabcomp_s args;
422  pastix_lr_t *lr;
423 
424  args.solvmtx = pastix_data->solvmatr;
425  args.flttype = pastix_data->bcsc->flttype;
426  args.lock = PASTIX_ATOMIC_UNLOCKED;
427  args.gain = 0;
428 
429  /* Set the lowrank properties */
430  lr = &(pastix_data->solvmatr->lowrank);
431  lr->compress_method = pastix_data->iparm[IPARM_COMPRESS_METHOD];
432  lr->compress_min_width = pastix_data->iparm[IPARM_COMPRESS_MIN_WIDTH];
433  lr->compress_min_height = pastix_data->iparm[IPARM_COMPRESS_MIN_HEIGHT];
434  lr->tolerance = pastix_data->dparm[DPARM_COMPRESS_TOLERANCE];
435 
436  isched_parallel_call( pastix_data->isched, pcoeftabComp, (void*)(&args) );
437 
438  return args.gain;
439 }
440 
441 /**
442  *******************************************************************************
443  *
444  * @brief Compute the ILU levels of a cblk
445  *
446  *******************************************************************************
447  *
448  * @param[in] solvmtx
449  * The solver matrix data structure.
450  *
451  * @param[in] cblk
452  * The column block to compute the ILU levels of.
453  *
454  *******************************************************************************/
455 void
457 {
458  /* If there are off diagonal supernodes in the column */
459  SolverBlok *blokB = cblk->fblokptr + 1; /* this diagonal block */
460  SolverBlok *lblkB = cblk[1].fblokptr; /* the next diagonal block */
461 
462  for (; blokB<lblkB; blokB++) {
463  SolverCblk *fcblk = solvmtx->cblktab + blokB->fcblknm;
464  SolverBlok *blokC = fcblk->fblokptr;
465  SolverBlok *blokA;
466 
467  /* If there are off-diagonal supernodes in the column*/
468  for (blokA=blokB; blokA<lblkB; blokA++) {
469  int lvl_AB;
470 
471  /* Find the facing block */
472  while ( !is_block_inside_fblock(blokA, blokC) ) {
473  blokC++;
474  assert( blokC < fcblk[1].fblokptr );
475  }
476 
477  /* Compute the level k of the block */
478  if ( (blokA->iluklvl == INT_MAX) ||
479  (blokB->iluklvl == INT_MAX) )
480  {
481  lvl_AB = INT_MAX;
482  }
483  else {
484  lvl_AB = blokA->iluklvl + blokB->iluklvl + 1;
485  }
486 
487  pastix_cblk_lock( fcblk );
488  blokC->iluklvl = pastix_imin( blokC->iluklvl,
489  lvl_AB );
490  assert( blokC->iluklvl >= 0 );
491  pastix_cblk_unlock( fcblk );
492  }
493 
494  pastix_atomic_dec_32b( &(fcblk->ctrbcnt) );
495  }
496 }
497 
498 #if defined(PASTIX_WITH_MPI)
499 /**
500  *******************************************************************************
501  *
502  * @brief Send all the cblk to their original nodes from the root node.
503  *
504  *******************************************************************************
505  *
506  * @param[inout] solvmtx
507  * The solver matrix to scatter.
508  *
509  * @param[in] comm
510  * MPI communicator
511  *
512  * @param[in] root
513  * Root node from which the solvmtx is scattered.
514  *
515  * @param[in] typesze
516  * Size of the data elements in the SolverMatrix.
517  *
518  ******************************************************************************/
519 void
520 coeftab_scatter( SolverMatrix *solvmtx,
521  PASTIX_Comm comm,
522  pastix_int_t root,
523  pastix_coeftype_t flttype )
524 {
525  static void (*free_fct_array[4])( pastix_coefside_t, SolverCblk * ) = {
527  };
528  void (*free_fct)( pastix_coefside_t, SolverCblk * ) = free_fct_array[ flttype - 2 ];
529  SolverCblk *cblk;
530  pastix_int_t i;
531  MPI_Status status;
532  size_t eltsize = pastix_size_of( flttype );
534 
535  if ( solvmtx->factotype == PastixFactLU ) {
536  side = PastixLUCoef;
537  eltsize *= 2;
538  }
539 
540  cblk = solvmtx->cblktab;
541  for(i=0; i<solvmtx->cblknbr; i++, cblk++)
542  {
543  size_t cblksize = eltsize * cblk->stride * cblk_colnbr( cblk );
544 
545  /* Data which does not belong to the root node must be sent */
546  if ( (solvmtx->clustnum == root) &&
547  (solvmtx->clustnum != cblk->ownerid) )
548  {
549  MPI_Send( cblk->lcoeftab, cblksize, MPI_CHAR,
550  cblk->ownerid, i, comm );
551  free_fct( side, cblk );
552  }
553 
554  /* Data which belongs locally must be received */
555  if ( (solvmtx->clustnum != root) &&
556  (solvmtx->clustnum == cblk->ownerid) )
557  {
558  MPI_Recv( cblk->lcoeftab, cblksize, MPI_CHAR,
559  root, i, comm, &status );
560  }
561  }
562 }
563 
564 /**
565  *******************************************************************************
566  *
567  * @brief Gather all the column blocks on the root node.
568  *
569  *******************************************************************************
570  *
571  * @param[inout] solvmtx
572  * The solver matrix to gather.
573  *
574  * @param[in] comm
575  * MPI communicator
576  *
577  * @param[in] root
578  * Root node on which the solvmtx is gathered.
579  *
580  * @param[in] typesze
581  * Size of the data elements in the SolverMatrix.
582  *
583  ******************************************************************************/
584 void
585 coeftab_gather( SolverMatrix *solvmtx,
586  PASTIX_Comm comm,
587  pastix_int_t root,
588  pastix_coeftype_t flttype )
589 {
590  static void (*alloc_fct_array[4])( pastix_coefside_t, SolverCblk * ) = {
592  };
593  void (*alloc_fct)( pastix_coefside_t, SolverCblk * ) = alloc_fct_array[ flttype - 2 ];
594  SolverCblk *cblk;
595  pastix_int_t i;
596  MPI_Status status;
597  size_t eltsize = pastix_size_of( flttype );
599  size_t bufsize = 0;
600  void *recvbuf = NULL;
601 
602  if ( solvmtx->factotype == PastixFactLU ) {
603  side = PastixLUCoef;
604  eltsize *= 2;
605  }
606 
607  cblk = solvmtx->cblktab;
608  for( i=0; i<solvmtx->cblknbr; i++, cblk++ )
609  {
610  size_t cblksize = eltsize * cblk->stride * cblk_colnbr( cblk );
611 
612  if ( (solvmtx->clustnum == root) &&
613  (solvmtx->clustnum != cblk->ownerid) )
614  {
615  if ( cblk->cblktype & CBLK_COMPRESSED ) {
616 
617  cblksize += (cblk[1].fblokptr - cblk[0].fblokptr) * sizeof(int);
618  if ( side != PastixLCoef ) {
619  cblksize *= 2;
620  }
621  MALLOC_INTERN( recvbuf, cblksize, char );
622  MPI_Recv( recvbuf, cblksize, MPI_CHAR,
623  cblk->ownerid, i, comm, &status );
624 
625  switch ( flttype ) {
626  case PastixComplex64:
627  cpucblk_zunpack_lr( side, cblk, recvbuf );
628  break;
629  case PastixComplex32:
630  cpucblk_cunpack_lr( side, cblk, recvbuf );
631  break;
632  case PastixDouble:
633  cpucblk_dunpack_lr( side, cblk, recvbuf );
634  break;
635  case PastixFloat:
636  cpucblk_sunpack_lr( side, cblk, recvbuf );
637  break;
638  default:
639  assert( 0 );
640  }
641  free( recvbuf );
642  }
643  else {
644  alloc_fct( side, cblk );
645  MPI_Recv( cblk->lcoeftab, cblksize, MPI_CHAR,
646  cblk->ownerid, i, comm, &status );
647  }
648  }
649 
650  if ( (solvmtx->clustnum != root) &&
651  (solvmtx->clustnum == cblk->ownerid) )
652  {
653  if ( cblk->cblktype & CBLK_COMPRESSED ) {
654  void *buffer = NULL;
655 
656  switch ( flttype ) {
657  case PastixComplex64:
658  bufsize = cpucblk_zcompute_size( side, cblk );
659  buffer = cpucblk_zpack_lr( side, cblk, bufsize );
660  break;
661 
662  case PastixComplex32:
663  bufsize = cpucblk_ccompute_size( side, cblk );
664  buffer = cpucblk_cpack_lr( side, cblk, bufsize );
665  break;
666 
667  case PastixDouble:
668  bufsize = cpucblk_dcompute_size( side, cblk );
669  buffer = cpucblk_dpack_lr( side, cblk, bufsize );
670  break;
671 
672  case PastixFloat:
673  bufsize = cpucblk_scompute_size( side, cblk );
674  buffer = cpucblk_spack_lr( side, cblk, bufsize );
675  break;
676 
677  default:
678  assert( 0 );
679  }
680 
681  MPI_Send( buffer, bufsize, MPI_CHAR,
682  root, i, comm );
683  free( buffer );
684  } else {
685  MPI_Send( cblk->lcoeftab, cblksize, MPI_CHAR,
686  root, i, comm );
687  }
688  }
689  }
690 }
691 
692 /**
693  *******************************************************************************
694  *
695  * @brief Nullify all the distant cblks.
696  *
697  *******************************************************************************
698  *
699  * @param[inout] solvmtx
700  * The solver matrix.
701  *
702  ******************************************************************************/
703 void
704 coeftab_nullify( SolverMatrix *solvmtx )
705 {
706  SolverCblk *cblk;
707  pastix_int_t i;
709 
710  cblk = solvmtx->cblktab;
711  for( i=0; i < solvmtx->cblknbr; i++, cblk++ )
712  {
713  if ( solvmtx->clustnum != cblk->ownerid )
714  {
715  cpucblk_zfree( side, cblk );
716  }
717  }
718 }
719 #endif /* PASTIX_WITH_MPI */
void coeftabAlloc(pastix_data_t *pastix_data)
Allocates the entire coeftab matrix with a single allocation.
Definition: coeftab.c:98
void pcoeftabInit(isched_thread_t *ctx, void *args)
Internal routine called by each static thread to Initialize the solver matrix structure.
Definition: coeftab.c:160
static void pcoeftabComp(isched_thread_t *ctx, void *args)
Internal routine called by each static thread to Initialize the solver matrix structure.
Definition: coeftab.c:351
size_t cpucblk_ccompute_size(pastix_coefside_t side, const SolverCblk *cblk)
Compute the size of the buffer to send.
void cpucblk_cunpack_lr(pastix_coefside_t side, SolverCblk *cblk, void *buffer)
Unpack low rank data and fill the column block concerned by the computation.
void * cpucblk_cpack_lr(pastix_coefside_t side, SolverCblk *cblk, size_t size)
Pack low-rank data for column block.
void * cpucblk_dpack_lr(pastix_coefside_t side, SolverCblk *cblk, size_t size)
Pack low-rank data for column block.
size_t cpucblk_dcompute_size(pastix_coefside_t side, const SolverCblk *cblk)
Compute the size of the buffer to send.
void cpucblk_dunpack_lr(pastix_coefside_t side, SolverCblk *cblk, void *buffer)
Unpack low rank data and fill the column block concerned by the computation.
size_t cpucblk_scompute_size(pastix_coefside_t side, const SolverCblk *cblk)
Compute the size of the buffer to send.
void cpucblk_sunpack_lr(pastix_coefside_t side, SolverCblk *cblk, void *buffer)
Unpack low rank data and fill the column block concerned by the computation.
void * cpucblk_spack_lr(pastix_coefside_t side, SolverCblk *cblk, size_t size)
Pack low-rank data for column block.
size_t cpucblk_zcompute_size(pastix_coefside_t side, const SolverCblk *cblk)
Compute the size of the buffer to send.
void * cpucblk_zpack_lr(pastix_coefside_t side, SolverCblk *cblk, size_t size)
Pack low-rank data for column block.
void cpucblk_zunpack_lr(pastix_coefside_t side, SolverCblk *cblk, void *buffer)
Unpack low rank data and fill the column block concerned by the computation.
BEGIN_C_DECLS typedef int pastix_int_t
Definition: datatypes.h:51
void coeftabComputeCblkILULevels(const SolverMatrix *solvmtx, SolverCblk *cblk)
Compute the ILU levels of a cblk.
Definition: coeftab.c:456
void(* coeftab_fct_memory_t)(const SolverMatrix *, const pastix_int_t *, pastix_fixdbl_t *)
Type of the memory gain functions.
Definition: coeftab.h:54
void coeftab_smemory(const SolverMatrix *solvmtx, const pastix_int_t *iparm, pastix_fixdbl_t *dparm)
Compute the memory usage for the entire matrix.
Definition: coeftab_s.c:573
void coeftab_cmemory(const SolverMatrix *solvmtx, const pastix_int_t *iparm, pastix_fixdbl_t *dparm)
Compute the memory usage for the entire matrix.
Definition: coeftab_c.c:573
pastix_int_t coeftabCompress(pastix_data_t *pastix_data)
Compress the factorized matrix structure if not already done.
Definition: coeftab.c:419
void coeftabInit(pastix_data_t *pastix_data, pastix_coefside_t side)
Initialize the solver matrix structure.
Definition: coeftab.c:204
void coeftab_dmemory(const SolverMatrix *solvmtx, const pastix_int_t *iparm, pastix_fixdbl_t *dparm)
Compute the memory usage for the entire matrix.
Definition: coeftab_d.c:573
void coeftabExit(SolverMatrix *solvmtx)
Free the solver matrix structure.
Definition: coeftab.c:267
void coeftab_zmemory(const SolverMatrix *solvmtx, const pastix_int_t *iparm, pastix_fixdbl_t *dparm)
Compute the memory usage for the entire matrix.
Definition: coeftab_z.c:573
coeftab_fct_memory_t coeftabMemory[4]
List of functions to compute the memory gain in low-rank per precision.
Definition: coeftab.c:45
void cpucblk_zinit(pastix_coefside_t side, const SolverMatrix *solvmtx, const pastix_bcsc_t *bcsc, pastix_int_t itercblk, const char *directory)
Fully initialize a single cblk.
void cpucblk_dalloc(pastix_coefside_t side, SolverCblk *cblk)
Allocate the cblk structure to store the coefficient.
void cpucblk_sinit(pastix_coefside_t side, const SolverMatrix *solvmtx, const pastix_bcsc_t *bcsc, pastix_int_t itercblk, const char *directory)
Fully initialize a single cblk.
void cpucblk_zalloc(pastix_coefside_t side, SolverCblk *cblk)
Allocate the cblk structure to store the coefficient.
void cpucblk_dfree(pastix_coefside_t side, SolverCblk *cblk)
Free the cblk structure that store the coefficient.
void cpucblk_salloc(pastix_coefside_t side, SolverCblk *cblk)
Allocate the cblk structure to store the coefficient.
void cpucblk_dinit(pastix_coefside_t side, const SolverMatrix *solvmtx, const pastix_bcsc_t *bcsc, pastix_int_t itercblk, const char *directory)
Fully initialize a single cblk.
void cpucblk_sfree(pastix_coefside_t side, SolverCblk *cblk)
Free the cblk structure that store the coefficient.
void cpucblk_zfree(pastix_coefside_t side, SolverCblk *cblk)
Free the cblk structure that store the coefficient.
void cpucblk_cinit(pastix_coefside_t side, const SolverMatrix *solvmtx, const pastix_bcsc_t *bcsc, pastix_int_t itercblk, const char *directory)
Fully initialize a single cblk.
pastix_int_t cpucblk_zcompress(const SolverMatrix *solvmtx, pastix_coefside_t side, int max_ilulvl, SolverCblk *cblk)
Compress a single column block from full-rank to low-rank format.
void cpucblk_calloc(pastix_coefside_t side, SolverCblk *cblk)
Allocate the cblk structure to store the coefficient.
void cpucblk_cfree(pastix_coefside_t side, SolverCblk *cblk)
Free the cblk structure that store the coefficient.
pastix_int_t cpucblk_dcompress(const SolverMatrix *solvmtx, pastix_coefside_t side, int max_ilulvl, SolverCblk *cblk)
Compress a single column block from full-rank to low-rank format.
pastix_int_t cpucblk_ccompress(const SolverMatrix *solvmtx, pastix_coefside_t side, int max_ilulvl, SolverCblk *cblk)
Compress a single column block from full-rank to low-rank format.
pastix_int_t cpucblk_scompress(const SolverMatrix *solvmtx, pastix_coefside_t side, int max_ilulvl, SolverCblk *cblk)
Compress a single column block from full-rank to low-rank format.
Structure to define the type of function to use for the low-rank kernels and their parameters.
spm_coeftype_t pastix_coeftype_t
Arithmetic types.
Definition: api.h:294
void pastix_gendirectories(pastix_data_t *pastix_data)
Generate a unique temporary directory to store output files.
Definition: api.c:76
enum pastix_coefside_e pastix_coefside_t
Data blocks used in the kernel.
@ PastixFactLU
Definition: api.h:317
@ DPARM_COMPRESS_TOLERANCE
Definition: api.h:184
@ PastixLCoef
Definition: api.h:478
@ PastixLUCoef
Definition: api.h:480
@ PastixCompressNever
Definition: api.h:385
@ IPARM_FACTORIZATION
Definition: api.h:99
@ IPARM_COMPRESS_WHEN
Definition: api.h:131
@ IPARM_COMPRESS_MIN_WIDTH
Definition: api.h:129
@ IPARM_MIXED
Definition: api.h:139
@ IPARM_COMPRESS_MIN_HEIGHT
Definition: api.h:130
@ IPARM_COMPRESS_METHOD
Definition: api.h:132
@ IPARM_GLOBAL_ALLOCATION
Definition: api.h:126
void parsec_sparse_matrix_destroy(parsec_sparse_matrix_desc_t *desc)
Free the PaRSEC descriptor of the sparse matrix.
void starpu_sparse_matrix_destroy(starpu_sparse_matrix_desc_t *desc)
Free the StarPU descriptor of the sparse matrix.
SolverMatrix * solvmatr
Definition: pastixdata.h:102
pastix_int_t * iparm
Definition: pastixdata.h:69
char * dir_local
Definition: pastixdata.h:110
double * dparm
Definition: pastixdata.h:70
isched_t * isched
Definition: pastixdata.h:85
pastix_bcsc_t * bcsc
Definition: pastixdata.h:101
Main PaStiX data structure.
Definition: pastixdata.h:67
-by-step
void cpucblk_dsinit(pastix_coefside_t side, const SolverMatrix *solvmtx, const pastix_bcsc_t *bcsc, pastix_int_t itercblk, const char *directory)
Fully initialize a single mixed-precision cblk.
void cpucblk_zcinit(pastix_coefside_t side, const SolverMatrix *solvmtx, const pastix_bcsc_t *bcsc, pastix_int_t itercblk, const char *directory)
Fully initialize a single mixed-precision cblk.
pastix_coeftype_t flttype
Definition: solver.h:225
void * ucoeftab
Definition: solver.h:172
pastix_int_t cblknum
Definition: solver.h:121
pastix_lr_t lowrank
Definition: solver.h:230
pastix_int_t brownum
Definition: solver.h:166
static pastix_int_t cblk_colnbr(const SolverCblk *cblk)
Compute the number of columns in a column block.
Definition: solver.h:324
int iluklvl
Definition: solver.h:147
pastix_int_t fcblknm
Definition: solver.h:140
static int is_block_inside_fblock(const SolverBlok *blok, const SolverBlok *fblok)
Check if a block is included inside another one.
Definition: solver.h:499
pastix_int_t cblknbr
Definition: solver.h:208
SolverBlok *restrict bloktab
Definition: solver.h:223
int globalalloc
Definition: solver.h:226
pastix_factotype_t factotype
Definition: solver.h:231
volatile int32_t ctrbcnt
Definition: solver.h:158
SolverBlok * fblokptr
Definition: solver.h:163
pastix_int_t bloknbr
Definition: solver.h:220
SolverCblk *restrict cblktab
Definition: solver.h:222
pastix_int_t stride
Definition: solver.h:164
int8_t cblktype
Definition: solver.h:159
int ownerid
Definition: solver.h:175
void * lcoeftab
Definition: solver.h:171
pastix_int_t coefnbr
Definition: solver.h:206
Solver block structure.
Definition: solver.h:137
Solver column block structure.
Definition: solver.h:156
Solver column block structure.
Definition: solver.h:200