37 #include "order/order_internal.h"
40 #include "spm/src/common.h"
42 #if defined( PASTIX_WITH_MPI )
88 const spmatrix_t *spm = pastix_data->
csc;
89 pastix_bcsc_t *bcsc = pastix_data->
bcsc;
104 assert( m == spm->nexp );
105 assert( Pb->
m == bcsc_n );
107 assert( Pb->
ld == bcsc_n );
110 bvec_handle_comm_init( pastix_data, Pb );
116 bvec_callocate_buf_dst( comm_rhs );
132 for ( il = 0, ile = 0; ile < m; ile += dofi, il++ ) {
133 ig = loc2glob[ il ] - baseval_spm;
134 ilpe = bvec_glob2Ploc( pastix_data, ig );
135 dofi = ( dof > 0 ) ? dof : dofs[ ig+1 ] - dofs[ ig ];
146 for ( j = 0; j < nrhs; j++ ) {
149 val_cnt[ c ] += dofi;
153 for ( j = 0; j < nrhs; j++ ) {
154 memcpy( pb + ilpe + j * bcsc_n, b + ile + j * ldb, dofi *
sizeof(
pastix_complex32_t) );
159 bvec_cexchange_data_dst( pastix_data,
PastixDirForward, nrhs, b, ldb, Pb, NULL );
161 bvec_handle_comm_exit( Pb->
rhs_comm );
163 memFree_null( idx_cnt );
164 memFree_null( val_cnt );
213 const spmatrix_t *spm = pastix_data->
csc;
226 assert( Pb->
m == pastix_data->
bcsc->n );
227 assert( m == spm->nexp );
231 bvec_compute_Ploc2Pglob( pastix_data, Pb );
234 if ( spm->glob2loc == NULL ) {
237 memcpy( &spmcpy, spm,
sizeof( spmatrix_t ) );
238 glob2loc = spm_get_glob2loc( &spmcpy );
241 glob2loc = spm->glob2loc;
247 bvec_callocate_buf_dst( comm_rhs );
265 for ( ilpe = 0; ilpe < bcsc_n; ilpe += dofi, ilp ++ ) {
266 igp = Ploc2Pglob[ ilp ];
267 ile = bvec_Pglob2loc( pastix_data, glob2loc, igp );
277 for ( j = 0; j < nrhs; j++ ) {
280 val_cnt[ c ] += dofi;
284 for ( j = 0; j < nrhs; j++ ) {
290 bvec_cexchange_data_dst( pastix_data,
PastixDirBackward, nrhs, b, ldb, Pb, glob2loc );
292 bvec_handle_comm_exit( Pb->
rhs_comm );
294 if ( spm->glob2loc == NULL ) {
297 memFree_null( idx_cnt );
298 memFree_null( val_cnt );
354 return bvec_clapmr_dst_vec2bvec( pastix_data, m, n, A, lda, PA );
357 return bvec_clapmr_dst_bvec2vec( pastix_data, m, n, A, lda, PA );
405 const spmatrix_t *spm = pastix_data->
csc;
416 assert( m == spm->gNexp );
418 assert( m == spm->nexp );
419 assert( pastix_data->
bcsc->n == Pb->
m );
420 assert( pastix_data->
bcsc->n == Pb->
ld );
428 for ( ig = 0; ig < spm->gN; ig++, ige += dofi ) {
429 dofi = ( dof > 0 ) ? dof : dofs[ ig+1 ] - dofs[ ig ];
430 ilpe = bvec_glob2Ploc( pastix_data, ig );
437 val_cnt += dofi * nrhs;
438 for ( j = 0; j < nrhs; j++ ) {
439 memcpy( pb + ilpe + j * ldpb,
445 assert( idx_cnt <= val_cnt );
447 bvec_handle_comm_init( pastix_data, Pb );
454 bvec_exchange_amount_rep( Pb->
rhs_comm );
502 const spmatrix_t *spm = pastix_data->
csc;
514 assert( Pb->
m == pastix_data->
bcsc->n );
515 assert( m == pastix_data->
csc->nexp );
518 bvec_compute_Ploc2Pglob( pastix_data, Pb );
521 data_send = comm_rhs->
data_comm + clustnum;
522 sends = &( data_send->
nsends );
541 dofi = ( dof > 0 ) ? dof : dofs[ 1 ] - dofs[ 0 ];
542 for ( ilpe = 0; ilpe < bcsc_n; ilpe += dofi, ilp ++ ) {
543 igp = Ploc2Pglob[ ilp ];
545 ige = ( dof > 0 ) ? ig * dof : dofs[ ig ];
546 dofi = ( dof > 0 ) ? dof : dofs[ ig+1 ] - dofs[ ig ];
553 for ( j = 0; j < nrhs; j++ ) {
559 bvec_cexchange_data_rep( pastix_data, nrhs, b, ldb, Pb );
561 bvec_handle_comm_exit( Pb->
rhs_comm );
618 return bvec_clapmr_rep_vec2bvec( pastix_data, m, n, A, lda, PA );
621 return bvec_clapmr_rep_bvec2vec( pastix_data, m, n, A, lda, PA );
682 pastix_print_error(
"Incorrect definition of the right hand side for in place permutation\n" );
686 assert( PA->
m == m );
687 assert( PA->
n == n );
688 assert( PA->
ld == lda );
691 assert( perm != NULL );
702 for( k = 0; k < m; k++ ) {
716 for( jj = 0; jj < n; jj++ ) {
717 tmp = A[j + jj * lda];
718 A[j + jj * lda] = A[k + jj * lda];
719 A[k + jj * lda] = tmp;
726 assert( (j != i) && (j >= 0) );
731 for( k = 0; k < m; k++ ) {
746 for( jj = 0; jj < n; jj++ ) {
747 tmp = A[j + jj * lda];
748 A[j + jj * lda] = A[i + jj * lda];
749 A[i + jj * lda] = tmp;
766 for( k = 0; k < m; k++ ) {
768 perm[k] = - perm[k] - 1;
824 const spmatrix_t *spm = pastix_data->
csc;
825 const pastix_bcsc_t *bcsc = pastix_data->
bcsc;
835 if ( solvmatr->clustnbr > 1 ) {
838 PA->
b = malloc( PA->
ld * PA->
n * pastix_size_of( PA->
flttype ) );
841 assert( m == PA->
m );
850 assert( PA->
flttype == PastixComplex32 );
851 assert( PA->
m == bcsc->n );
852 assert( PA->
n == n );
856 assert( PA->
b == A );
857 assert( PA->
ld == lda );
860 assert( PA->
b != A );
861 assert( PA->
ld == PA->
m );
866 #if defined(PASTIX_WITH_MPI)
867 if ( spm->clustnbr > 1 ) {
868 if ( spm->loc2glob != NULL ) {
873 rc = bvec_clapmr_dst( pastix_data, dir, m, n, A, lda, PA );
880 rc = bvec_clapmr_rep( pastix_data, dir, m, n, A, lda, PA );
895 memFree_null( PA->
b );
BEGIN_C_DECLS typedef int pastix_int_t
float _Complex pastix_complex32_t
static int bvec_clapmr_shm(pastix_data_t *pastix_data, pastix_dir_t dir, pastix_int_t m, pastix_int_t n, pastix_complex32_t *A, pastix_int_t lda, pastix_rhs_t PA)
Apply a row permutation to a right hand side A (LAPACK xlatmr) in the shared memory case.
int bvec_clapmr(pastix_data_t *pastix_data, pastix_dir_t dir, pastix_int_t m, pastix_int_t n, pastix_complex32_t *A, pastix_int_t lda, pastix_rhs_t PA)
Apply a row permutation to a right hand side A (LAPACK xlatmr)
pastix_int_t * send_idxbuf
bvec_data_amount_t nsends
bvec_proc_comm_t data_comm[1]
Information about the amount of data exchanged to permute the pivots.
Structure to manage communications with distributed rhs.
Informations of the data exchanged with other processes.
enum pastix_dir_e pastix_dir_t
Direction.
@ PASTIX_ERR_BADPARAMETER
pastix_int_t * orderGetExpandedPeritab(pastix_order_t *ordeptr, const spmatrix_t *spm)
This routine expand the peritab array for multi-dof matrices.
pastix_int_t * Ploc2Pglob
pastix_order_t * ordemesh
bvec_handle_comm_t * rhs_comm
pastix_coeftype_t flttype
Main PaStiX data structure.
Main PaStiX RHS structure.
Solver column block structure.