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