33 #include "sopalin/sopalin_data.h"
40 #include "pastix_papi.h"
42 #if defined(PASTIX_WITH_PARSEC)
46 #if defined(PASTIX_WITH_STARPU)
50 #ifndef DOXYGEN_SHOULD_SKIP_THIS
51 static void (*sopalinFacto[5][4])(
pastix_data_t *, sopalin_data_t*) =
101 if (pastix_data == NULL) {
102 pastix_print_error(
"pastix_subtask_spm2bcsc: wrong pastix_data parameter" );
106 pastix_print_error(
"pastix_subtask_spm2bcsc: wrong spm parameter" );
109 if ( !(pastix_data->
steps & STEP_ANALYSE) ) {
110 pastix_print_error(
"pastix_subtask_spm2bcsc: All steps from pastix_task_init() to pastix_task_blend() have to be called before calling this function" );
141 if ( isSchedRuntime( isched ) ) {
145 assert( isSchedPthread( isched ) );
148 pastix_data->
sched = isched;
155 if ( pastix_data->
bcsc != NULL )
158 memFree_null( pastix_data->
bcsc );
160 MALLOC_INTERN( pastix_data->
bcsc, 1, pastix_bcsc_t );
179 pastix_data->
steps &= ~STEP_BCSC2CTAB;
180 pastix_data->
steps |= STEP_CSC2BCSC;
223 if (pastix_data == NULL) {
224 pastix_print_error(
"pastix_subtask_bcsc2ctab: wrong pastix_data parameter" );
227 if ( !(pastix_data->
steps & STEP_CSC2BCSC) ) {
228 pastix_print_error(
"pastix_subtask_bcsc2ctab: All steps from pastix_task_init() to pastix_stask_blend() have to be called before calling this function" );
231 if (pastix_data->
bcsc == NULL) {
232 pastix_print_error(
"pastix_subtask_bcsc2ctab: wrong pastix_data->bcsc parameter" );
237 pastix_check_and_correct_scheduler( pastix_data );
255 bcsc = pastix_data->
bcsc;
259 int isDouble = (bcsc->flttype == PastixComplex64) || (bcsc->flttype == PastixDouble);
262 pastix_print_warning(
"pastix_subtask_bcsc2ctab: Mixed precision solve is not possible with single precision matrix\n"
263 " Mixed precision is disabled\n" );
305 #if defined(PASTIX_WITH_MPI)
310 pastix_print_error(
"pastix_task_sopalin: Low-Rank with MPI communication is not available yet with PaRSEC\n" );
319 if (pastix_data->
bcsc != NULL)
343 #if defined(PASTIX_WITH_PARSEC)
347 if (pastix_data->
parsec == NULL) {
353 pastix_size_of( bcsc->flttype ), mtxtype,
359 #if defined(PASTIX_WITH_STARPU)
367 pastix_data->
bcsc->flttype );
378 pastix_data->
steps &= ~STEP_NUMFACT;
379 pastix_data->
steps |= STEP_BCSC2CTAB;
414 sopalin_data_t sopalin_data;
415 SolverBackup_t *sbackup;
417 PASTIX_Comm pastix_comm;
424 if (pastix_data == NULL) {
425 pastix_print_error(
"pastix_subtask_sopalin: wrong pastix_data parameter" );
428 if ( !(pastix_data->
steps & STEP_ANALYSE) ) {
429 pastix_print_error(
"pastix_subtask_sopalin: All steps from pastix_task_init() to pastix_task_analyze() have to be called before calling this function" );
432 if ( !(pastix_data->
steps & STEP_CSC2BCSC) ) {
433 pastix_print_error(
"pastix_subtask_sopalin: All steps from pastix_task_init() to pastix_task_analyze() have to be called before calling this function" );
436 if ( !(pastix_data->
steps & STEP_BCSC2CTAB) ) {
437 pastix_print_error(
"pastix_subtask_sopalin: All steps from pastix_task_init() to pastix_task_analyze() have to be called before calling this function" );
441 bcsc = pastix_data->
bcsc;
443 pastix_print_error(
"pastix_subtask_sopalin: wrong pastix_data_bcsc parameter" );
448 pastix_check_and_correct_scheduler( pastix_data );
451 iparm = pastix_data->
iparm;
452 dparm = pastix_data->
dparm;
458 sopalin_data.solvmtx = pastix_data->
solvmatr;
473 if ( (bcsc->flttype == PastixFloat) || (bcsc->flttype == PastixComplex32) ) {
474 eps = LAPACKE_slamch_work(
'e' );
477 eps = LAPACKE_dlamch_work(
'e' );
485 sopalin_data.solvmtx->diagthreshold = threshold;
486 sopalin_data.solvmtx->nbpivots = 0;
488 sopalin_data.cpu_coefs = &(pastix_data->
cpu_models->coefficients[bcsc->flttype-2]);
489 sopalin_data.gpu_coefs = &(pastix_data->
gpu_models->coefficients[bcsc->flttype-2]);
490 sopalin_data.cpu_models = pastix_data->
cpu_models;
491 sopalin_data.gpu_models = pastix_data->
gpu_models;
498 double timer, timer_local, flops, flops_g, energy = 0.;
507 clockSyncStart( timer, pastix_comm );
508 clockStart(timer_local);
510 factofct( pastix_data, &sopalin_data );
512 clockStop(timer_local);
513 clockSyncStop( timer, pastix_comm );
517 energy = papiEnergyStop();
528 MPI_Allreduce( &flops_l, &flops_g, 1, MPI_DOUBLE, MPI_SUM, pastix_data->
inter_node_comm );
533 int nbpivot_l = sopalin_data.solvmtx->nbpivots;
535 MPI_Allreduce( &nbpivot_l, &nbpivot_g, 1, MPI_INT, MPI_SUM, pastix_data->
inter_node_comm );
542 pastix_print_value( flops ),
543 pastix_print_unit( flops ),
544 pastix_print_value( flops_g ),
545 pastix_print_unit( flops_g ),
547 #if defined(PASTIX_WITH_PAPI)
551 pastix_print_value_deci( energy ),
552 pastix_print_unit_deci( energy ),
553 pastix_print_value_deci( power ),
554 pastix_print_unit_deci( power ) );
559 #if defined(PASTIX_WITH_PARSEC) && defined(PASTIX_DEBUG_PARSEC)
562 fprintf(stderr,
"-- Check status of PaRSEC nbtasks counters\n" );
563 for (i=0; i<32; i++) {
564 if ( parsec_nbtasks_on_gpu[i] != 0 ) {
565 fprintf(stderr,
"Device %d => %d\n",
566 i, parsec_nbtasks_on_gpu[i] );
568 parsec_nbtasks_on_gpu[i] = 0;
576 #if defined(PASTIX_NUMFACT_DUMP_SOLVER)
594 #if defined(PASTIX_WITH_MPI)
601 pastix_data->
steps &= ~( STEP_BCSC2CTAB |
604 pastix_data->
steps |= STEP_NUMFACT;
655 if (pastix_data == NULL) {
656 pastix_print_error(
"pastix_task_sopalin: wrong pastix_data parameter" );
660 pastix_print_error(
"pastix_task_sopalin: wrong spm parameter" );
663 if ( !(pastix_data->
steps & STEP_ANALYSE) ) {
664 pastix_print_error(
"pastix_task_sopalin: All steps from pastix_task_init() to pastix_task_blend() have to be called before calling this function" );
668 iparm = pastix_data->
iparm;
672 pastix_print( procnum, 0, OUT_STEP_SOPALIN,
677 steps = ~(STEP_CSC2BCSC |
682 pastix_data->
steps &= steps;
BEGIN_C_DECLS typedef int pastix_int_t
double bcscInit(const spmatrix_t *spm, const pastix_order_t *ord, const SolverMatrix *solvmtx, pastix_int_t initAt, pastix_bcsc_t *bcsc)
Initializes the block csc matrix.
void bcscExit(pastix_bcsc_t *bcsc)
Frees the block csc structure but do not free the bcsc pointer.
int solverBackupRestore(SolverMatrix *solvmtx, const SolverBackup_t *b)
Restore initial values.
void solverBackupExit(SolverBackup_t *b)
Free the solver backup data structure.
int solverDraw(const SolverMatrix *solvptr, FILE *stream, int verbose, const char *directory)
Writes a PostScript picture of the low-rank solver matrix.
SolverBackup_t * solverBackupInit(const SolverMatrix *solvmtx)
Initialize the backup structure.
void coeftabInit(pastix_data_t *pastix_data, pastix_coefside_t side)
Initialize the solver matrix structure.
void coeftabExit(SolverMatrix *solvmtx)
Free the solver matrix structure.
coeftab_fct_memory_t coeftabMemory[4]
List of functions to compute the memory gain in low-rank per precision.
void kernelsTraceStop()
Pauses the trace module.
void kernelsTraceStart()
Resumes the trace module.
pastix_compress_method_t compress_method
pastix_int_t compress_min_width
pastix_int_t compress_min_height
pastix_compress_when_t compress_when
static pastix_int_t core_get_rklimit_end(pastix_int_t M, pastix_int_t N)
Compute the maximal rank accepted for a given matrix size for Just-In-Time strategy.
const fct_rradd_t rraddMethods[PastixCompressMethodNbr][4]
Array of pointers to the multiple arithmetic and algorithmic variants of rradd.
const fct_ge2lr_t ge2lrMethods[PastixCompressMethodNbr][4]
Array of pointers to the multiple arithmetic and algorithmic variants of ge2lr.
double pastix_lr_minratio
Define the minimal ratio for which we accept to compress a matrix into a low-rank form or not.
pastix_int_t pastix_lr_ortho
Define the orthogonalization method.
pastix_int_t(* core_get_rklimit)(pastix_int_t, pastix_int_t)
Compute the maximal rank accepted for a given matrix size. The pointer is set according to the low-ra...
static pastix_int_t core_get_rklimit_begin(pastix_int_t M, pastix_int_t N)
Compute the maximal rank accepted for a given matrix size for Minimal-Memory strategy.
Structure to define the type of function to use for the low-rank kernels and their parameters.
spm_mtxtype_t pastix_mtxtype_t
Matrix symmetry type property.
FILE * pastix_fopenw(const char *dirname, const char *filename, const char *mode)
Open a file in the unique directory of the pastix instance.
void pastix_gendirectories(pastix_data_t *pastix_data)
Generate a unique temporary directory to store output files.
@ DPARM_EPSILON_MAGN_CTRL
@ DPARM_COMPRESS_TOLERANCE
@ DPARM_COMPRESS_MIN_RATIO
@ PastixCompressWhenBegin
@ PastixCompressWhenDuring
@ IPARM_COMPRESS_MIN_WIDTH
@ IPARM_COMPRESS_MIN_HEIGHT
@ IPARM_COMPRESS_PRESELECT
@ PASTIX_ERR_BADPARAMETER
int pastix_subtask_sopalin(pastix_data_t *pastix_data)
Factorize the given problem using Cholesky or LU decomposition.
int pastix_subtask_spm2bcsc(pastix_data_t *pastix_data, spmatrix_t *spm)
Fill the internal block CSC structure.
int pastix_subtask_bcsc2ctab(pastix_data_t *pastix_data)
Fill the internal solver matrix structure.
void parsec_sparse_matrix_init(SolverMatrix *solvmtx, int typesize, pastix_mtxtype_t mtxtype, int nodes, int myrank)
Generate the PaRSEC descriptor of the sparse matrix.
void pastix_parsec_init(pastix_data_t *pastix, int *argc, char **argv[], const int *bindtab)
Startup the PaRSEC runtime system.
void starpu_sparse_matrix_init(SolverMatrix *solvmtx, pastix_mtxtype_t mtxtype, int nodes, int myrank, pastix_coeftype_t flttype)
Generate the StarPU descriptor of the sparse matrix.
pastix_model_t * cpu_models
pastix_model_t * gpu_models
pastix_order_t * ordemesh
PASTIX_Comm inter_node_comm
int pastix_task_numfact(pastix_data_t *pastix_data, spmatrix_t *spm)
Perform all the numerical factorization steps: fill the internal block CSC and the solver matrix stru...
Main PaStiX data structure.
void sopalin_cgetrf(pastix_data_t *pastix_data, sopalin_data_t *sopalin_data)
TODO.
void sopalin_chetrf(pastix_data_t *pastix_data, sopalin_data_t *sopalin_data)
TODO.
void sopalin_cpotrf(pastix_data_t *pastix_data, sopalin_data_t *sopalin_data)
TODO.
void sopalin_cpxtrf(pastix_data_t *pastix_data, sopalin_data_t *sopalin_data)
TODO.
void sopalin_csytrf(pastix_data_t *pastix_data, sopalin_data_t *sopalin_data)
TODO.
void sopalin_dgetrf(pastix_data_t *pastix_data, sopalin_data_t *sopalin_data)
TODO.
void sopalin_dpotrf(pastix_data_t *pastix_data, sopalin_data_t *sopalin_data)
TODO.
void sopalin_dsytrf(pastix_data_t *pastix_data, sopalin_data_t *sopalin_data)
TODO.
void sopalin_sgetrf(pastix_data_t *pastix_data, sopalin_data_t *sopalin_data)
TODO.
void sopalin_spotrf(pastix_data_t *pastix_data, sopalin_data_t *sopalin_data)
TODO.
void sopalin_ssytrf(pastix_data_t *pastix_data, sopalin_data_t *sopalin_data)
TODO.
void sopalin_zgetrf(pastix_data_t *pastix_data, sopalin_data_t *sopalin_data)
TODO.
void sopalin_zhetrf(pastix_data_t *pastix_data, sopalin_data_t *sopalin_data)
TODO.
void sopalin_zpotrf(pastix_data_t *pastix_data, sopalin_data_t *sopalin_data)
TODO.
void sopalin_zpxtrf(pastix_data_t *pastix_data, sopalin_data_t *sopalin_data)
TODO.
void sopalin_zsytrf(pastix_data_t *pastix_data, sopalin_data_t *sopalin_data)
TODO.
pastix_coeftype_t flttype
pastix_factotype_t factotype