28 #include "order_internal.h"
98 const spmatrix_t *spm,
105 pastix_graph_t *subgraph;
106 pastix_graph_t schurgraph;
107 pastix_graph_t zerosgraph;
108 pastix_graph_t *graph;
116 int subgraph_is_a_copy = 0;
122 if ( pastix_data == NULL ) {
123 pastix_print_error(
"pastix_subtask_order: wrong pastix_data parameter" );
127 pastix_print_error(
"pastix_subtask_order: wrong spm parameter" );
130 if ( !(pastix_data->
steps & STEP_INIT) ) {
131 pastix_print_error(
"pastix_subtask_order: pastixInit() has to be called before calling this function" );
135 iparm = pastix_data->
iparm;
139 if ( pastix_data->
schur_n > 0 )
153 if ( pastix_data->
zeros_n > 0 )
170 if ( pastix_data->
ordemesh != NULL ) {
178 procnum = pastix_data->
procnum;
182 pastix_print( procnum, 0,
"%s", OUT_STEP_ORDER );
191 if ( pastix_data->
graph != NULL ) {
193 memFree_null( pastix_data->
graph );
196 graph = pastix_data->
graph;
197 spmbase = spmFindBase( spm );
209 if ( spmbase != 0 ) {
213 for( i=0; i<pastix_data->
schur_n; i++ ) {
224 subgraph_is_a_copy = 1;
225 subgraph = &schurgraph;
229 schur_gN = subgraph->gN;
238 if ( spmbase != 0 ) {
242 for( i=0; i<pastix_data->
zeros_n; i++ ) {
253 if ( subgraph_is_a_copy ) {
257 subgraph_is_a_copy = 1;
258 subgraph = &zerosgraph;
262 pastix_print( procnum, 0,
"%s", OUT_ORDER_INIT );
274 pastix_print( procnum, 0, OUT_ORDER_METHOD,
"Scotch" );
276 #if defined(PASTIX_ORDERING_SCOTCH)
280 pastix_print_error(
"pastix_subtask_order: Ordering with Scotch requires to enable -DPASTIX_ORDERING_SCOTCH option" );
290 pastix_print(procnum, 0, OUT_ORDER_METHOD,
"PT-Scotch" );
292 #if defined(PASTIX_ORDERING_PTSCOTCH)
296 pastix_print_error(
"pastix_subtask_order: Ordering with PT-Scotch requires to enable -DPASTIX_ORDERING_PTSCOTCH option" );
306 pastix_print(procnum, 0, OUT_ORDER_METHOD,
"Metis" );
308 #if defined(PASTIX_ORDERING_METIS)
311 assert( ordemesh->
rangtab == NULL );
313 pastix_print_error(
"pastix_subtask_order: Ordering with Metis requires -DPASTIX_ORDERING_METIS flag at compile time" );
323 pastix_print( procnum, 0, OUT_ORDER_METHOD,
"Personal" );
329 pastix_print_error(
"pastix_subtask_order: Ordering not available (iparm[IPARM_ORDERING]=%d)\n",
338 MPI_Allreduce( &retval, &retval_rcv, 1, MPI_INT, MPI_MAX,
345 memFree_null( zeros_perm );
349 memFree_null( schur_perm );
361 if (( ordemesh->
rangtab == NULL ) ||
362 ( ordemesh->
treetab == NULL ) )
370 #if !defined(NDEBUG) && defined(PASTIX_DEBUG_ORDERING)
384 #if !defined(NDEBUG) && defined(PASTIX_DEBUG_ORDERING)
391 if ( subgraph_is_a_copy ) {
403 #if !defined(NDEBUG) && defined(PASTIX_DEBUG_ORDERING)
414 if ( zeros_perm != NULL ) { memFree_null( zeros_perm ); }
424 if ( schur_perm != NULL ) { memFree_null( schur_perm ); }
440 #if !defined(PASTIX_ORDERING_SCOTCH)
441 pastix_print_warning(
"Clustering is not available yet when Scotch is disabled" );
452 etree, iparm, do_schur );
461 #if defined(PASTIX_ORDER_DRAW_LASTSEP)
466 orderDrawGraph | orderDrawCoordinates );
470 MPI_Allreduce( &retval, &retval_rcv, 1, MPI_INT, MPI_MAX,
479 pastix_print(procnum, 0, OUT_ORDER_TIME, clockVal(timer));
486 if ( procnum == 0 ) {
490 MPI_Allreduce( &retval, &retval_rcv, 1, MPI_INT, MPI_MAX,
502 ( myorder != NULL ) )
504 if ( graph->loc2glob == NULL )
507 MPI_Allreduce( &retval, &retval_rcv, 1, MPI_INT, MPI_MAX,
520 if ( myorder->
permtab != NULL ) {
523 loc2glob = graph->loc2glob;
524 for( i = 0; i < n; i++, loc2glob++ ) {
525 myorder->
permtab[i] = permtab[*loc2glob];
528 if (myorder->
peritab != NULL) {
532 loc2glob = graph->loc2glob;
533 for( i = 0; i < n; i++, loc2glob++ ) {
534 myorder->
peritab[i] = peritab[*loc2glob];
552 pastix_data->
csc = spm;
555 pastix_data->
steps &= ~( STEP_SYMBFACT |
562 pastix_data->
steps |= STEP_ORDERING;
BEGIN_C_DECLS typedef int pastix_int_t
void eTreeExit(EliminTree *)
Free the elimination tree structure.
EliminTree * orderBuildEtree(const pastix_order_t *order)
This routine build the elimination tree associated to an ordering.
int pastix_subtask_order(pastix_data_t *pastix_data, const spmatrix_t *spm, pastix_order_t *myorder)
Computes the ordering of the given graph in parameters.
@ IPARM_AMALGAMATION_LVLBLAS
@ IPARM_AMALGAMATION_LVLCBLK
@ IPARM_SPLITTING_STRATEGY
@ PASTIX_ERR_BADPARAMETER
int graphIsolate(const pastix_graph_t *ingraph, pastix_graph_t *outgraph, pastix_int_t isolate_n, pastix_int_t *isolate_list, pastix_int_t **new_perm, pastix_int_t **new_invp)
Isolate a subset of vertices from a given graph.
void graphExit(pastix_graph_t *graph)
Free the content of the graph structure.
int graphScatterInPlace(pastix_graph_t *graph, PASTIX_Comm comm)
This routine scatter a graph from node root to the other nodes.
int graphPrepare(pastix_data_t *pastix_data, const spmatrix_t *spm, pastix_graph_t **graph)
This routine initializes the graph.
int graphGatherInPlace(pastix_graph_t *graph)
This routine gather a distributed graph on each node in place.
void graphBase(pastix_graph_t *graph, pastix_int_t baseval)
Rebase the graph to the given value.
void orderDraw(pastix_data_t *pastix_data, const char *extname, pastix_int_t sndeidx, int dump)
Dump the last separator into an ivview file.
int pastixOrderAlloc(pastix_order_t *ordeptr, pastix_int_t vertnbr, pastix_int_t cblknbr)
Allocate the order structure.
void orderFindSupernodes(const pastix_graph_t *graph, pastix_order_t *const ordeptr)
Computes the set of supernodes for a given permutation.
void pastixOrderBase(pastix_order_t *ordeptr, pastix_int_t baseval)
This routine sets the base of the given ordering structure to the given base value.
int orderApplyLevelOrder(pastix_order_t *order, pastix_int_t level_tasks2d, pastix_int_t width_tasks2d)
This routine reorder the elimination tree nodes per level.
pastix_int_t orderSupernodes(const pastix_graph_t *graph, pastix_order_t *order, EliminTree *etree, pastix_int_t *iparm, int do_schur)
Order the supernodes with one of the clustering strategies.
int orderComputePersonal(pastix_data_t *pastix_data, pastix_graph_t *graph, pastix_order_t *myorder)
Computes the personal ordering of the PaStiX instance.
int pastixOrderSave(pastix_data_t *pastix_data, const pastix_order_t *ordeptr)
Save an ordering to a file.
int orderComputeScotch(pastix_data_t *pastix_data, pastix_graph_t *graph)
Compute the ordering of the graph given as parameter with Scotch library.
int orderAmalgamate(int verbose, int ilu, int levelk, int rat_cblk, int rat_blas, pastix_graph_t *csc, pastix_order_t *orderptr, PASTIX_Comm pastix_comm)
Update the order structure with an amalgamation algorithm.
int orderComputePTScotch(pastix_data_t *pastix_data, pastix_graph_t *graph)
Compute the ordering of the graph given as parameter with PT-Scotch library.
int orderComputeMetis(pastix_data_t *pastix_data, pastix_graph_t *graph)
Compute the ordering of the graph given as parameter with Metis library.
int orderAddIsolate(pastix_order_t *ordemesh, pastix_int_t new_n, const pastix_int_t *perm)
This routine combines two permutation arrays when a subset of vertices has been isolated from the ori...
void pastixOrderBcast(pastix_order_t *ordemesh, int root, PASTIX_Comm pastix_comm)
This routine broadcast the ordemesh structure from node root to all the other nodes.
int pastixOrderCheck(const pastix_order_t *ordeptr)
This routine checks the correctness of the ordering structure.
int pastixOrderCopy(pastix_order_t *ordedst, const pastix_order_t *ordesrc)
This routine copy a given ordering in a new one.
void pastixOrderExit(pastix_order_t *ordeptr)
Free the arrays initialized in the order structure.
pastix_order_t * ordemesh
pastix_int_t * schur_list
pastix_int_t * zeros_list
Main PaStiX data structure.