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
51static 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;
425 if (pastix_data == NULL) {
426 pastix_print_error(
"pastix_subtask_sopalin: wrong pastix_data parameter" );
429 if ( !(pastix_data->
steps & STEP_ANALYSE) ) {
430 pastix_print_error(
"pastix_subtask_sopalin: All steps from pastix_task_init() to pastix_task_analyze() have to be called before calling this function" );
433 if ( !(pastix_data->
steps & STEP_CSC2BCSC) ) {
434 pastix_print_error(
"pastix_subtask_sopalin: All steps from pastix_task_init() to pastix_task_analyze() have to be called before calling this function" );
437 if ( !(pastix_data->
steps & STEP_BCSC2CTAB) ) {
438 pastix_print_error(
"pastix_subtask_sopalin: All steps from pastix_task_init() to pastix_task_analyze() have to be called before calling this function" );
442 bcsc = pastix_data->
bcsc;
444 pastix_print_error(
"pastix_subtask_sopalin: wrong pastix_data_bcsc parameter" );
449 pastix_check_and_correct_scheduler( pastix_data );
452 iparm = pastix_data->
iparm;
453 dparm = pastix_data->
dparm;
467 sopalin_data.solvmtx = pastix_data->
solvmatr;
482 if ( (bcsc->flttype == PastixFloat) || (bcsc->flttype == PastixComplex32) ) {
483 eps = LAPACKE_slamch_work(
'e' );
486 eps = LAPACKE_dlamch_work(
'e' );
494 sopalin_data.solvmtx->diagthreshold = threshold;
495 sopalin_data.solvmtx->nbpivots = 0;
497 sopalin_data.cpu_coefs = &(pastix_data->
cpu_models->coefficients[bcsc->flttype-2]);
498 sopalin_data.gpu_coefs = &(pastix_data->
gpu_models->coefficients[bcsc->flttype-2]);
499 sopalin_data.cpu_models = pastix_data->
cpu_models;
500 sopalin_data.gpu_models = pastix_data->
gpu_models;
507 double timer, timer_local, flops, flops_g, energy = 0.;
516 clockSyncStart( timer, pastix_comm );
517 clockStart(timer_local);
519 factofct( pastix_data, &sopalin_data );
521 clockStop(timer_local);
522 clockSyncStop( timer, pastix_comm );
526 energy = papiEnergyStop();
537 MPI_Allreduce( &flops_l, &flops_g, 1, MPI_DOUBLE, MPI_SUM, pastix_data->
inter_node_comm );
542 int nbpivot_l = sopalin_data.solvmtx->nbpivots;
544 MPI_Allreduce( &nbpivot_l, &nbpivot_g, 1, MPI_INT, MPI_SUM, pastix_data->
inter_node_comm );
551 pastix_print_value( flops ),
552 pastix_print_unit( flops ),
553 pastix_print_value( flops_g ),
554 pastix_print_unit( flops_g ),
556#if defined(PASTIX_WITH_PAPI)
560 pastix_print_value_deci( energy ),
561 pastix_print_unit_deci( energy ),
562 pastix_print_value_deci( power ),
563 pastix_print_unit_deci( power ) );
568#if defined(PASTIX_WITH_PARSEC) && defined(PASTIX_DEBUG_PARSEC)
571 fprintf(stderr,
"-- Check status of PaRSEC nbtasks counters\n" );
572 for (i=0; i<32; i++) {
573 if ( parsec_nbtasks_on_gpu[i] != 0 ) {
574 fprintf(stderr,
"Device %d => %d\n",
575 i, parsec_nbtasks_on_gpu[i] );
577 parsec_nbtasks_on_gpu[i] = 0;
586#if defined(PASTIX_NUMFACT_DUMP_SOLVER)
604#if defined(PASTIX_WITH_MPI)
611 pastix_data->
steps &= ~( STEP_BCSC2CTAB |
614 pastix_data->
steps |= STEP_NUMFACT;
665 if (pastix_data == NULL) {
666 pastix_print_error(
"pastix_task_sopalin: wrong pastix_data parameter" );
670 pastix_print_error(
"pastix_task_sopalin: wrong spm parameter" );
673 if ( !(pastix_data->
steps & STEP_ANALYSE) ) {
674 pastix_print_error(
"pastix_task_sopalin: All steps from pastix_task_init() to pastix_task_blend() have to be called before calling this function" );
678 iparm = pastix_data->
iparm;
682 pastix_print( procnum, 0, OUT_STEP_SOPALIN,
687 steps = ~(STEP_CSC2BCSC |
692 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 kernelsTraceStart(void)
Resumes the trace module.
void kernelsTraceStop(void)
Pauses 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.
int pastixBlasSetNumThreadsOne(void)
Set the number of threads for blas calls (BLIS, MKL, OpenBLAS) to 1 and return the previous number of...
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.
int pastixBlasSetNumThreads(int nt)
Set the number of threads for blas calls (BLIS, MKL, OpenBLAS) and return the previous number of blas...
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