37 #include "order/order_internal.h"
40 #include "spm/src/common.h"
42 #if defined( PASTIX_WITH_MPI )
83 pastix_complex64_t *b,
87 pastix_complex64_t *pb = Pb->
b;
88 const spmatrix_t *spm = pastix_data->
csc;
89 pastix_bcsc_t *bcsc = pastix_data->
bcsc;
102 pastix_complex64_t *values_c;
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_zallocate_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++ ) {
147 values_c = ((pastix_complex64_t*)(data_comm->
send_valbuf)) + val_cnt[ c ];
148 memcpy( values_c, b + ile + j * ldb, dofi *
sizeof(pastix_complex64_t) );
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_complex64_t) );
159 bvec_zexchange_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 );
208 pastix_complex64_t *b,
212 pastix_complex64_t *bp = Pb->
b;
213 const spmatrix_t *spm = pastix_data->
csc;
224 pastix_complex64_t *values_c;
226 assert( Pb->
m == pastix_data->
bcsc->n );
227 assert( m == spm->nexp );
229 memset( b, 0, ldb * nrhs *
sizeof( pastix_complex64_t) );
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_zallocate_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++ ) {
278 values_c = ((pastix_complex64_t*)(data_comm->
send_valbuf)) + val_cnt[ c ];
279 memcpy( values_c, bp + ilpe + j * Pb->
ld, dofi *
sizeof(pastix_complex64_t) );
280 val_cnt[ c ] += dofi;
284 for ( j = 0; j < nrhs; j++ ) {
285 memcpy( b + ile + j * ldb, bp + ilpe + j * Pb->
ld, dofi *
sizeof(pastix_complex64_t) );
290 bvec_zexchange_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 );
349 pastix_complex64_t *A,
354 return bvec_zlapmr_dst_vec2bvec( pastix_data, m, n, A, lda, PA );
357 return bvec_zlapmr_dst_bvec2vec( pastix_data, m, n, A, lda, PA );
400 const pastix_complex64_t *b,
404 pastix_complex64_t *pb;
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,
441 dofi *
sizeof(pastix_complex64_t) );
445 assert( idx_cnt <= val_cnt );
447 bvec_handle_comm_init( pastix_data, Pb );
454 bvec_exchange_amount_rep( Pb->
rhs_comm );
495 pastix_complex64_t *b,
499 pastix_complex64_t *bp = Pb->
b;
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++ ) {
554 memcpy( b + ige + j * ldb, bp + ilpe + j * Pb->
ld, dofi *
sizeof(pastix_complex64_t) );
559 bvec_zexchange_data_rep( pastix_data, nrhs, b, ldb, Pb );
561 bvec_handle_comm_exit( Pb->
rhs_comm );
613 pastix_complex64_t *A,
618 return bvec_zlapmr_rep_vec2bvec( pastix_data, m, n, A, lda, PA );
621 return bvec_zlapmr_rep_bvec2vec( pastix_data, m, n, A, lda, PA );
672 pastix_complex64_t *A,
676 pastix_complex64_t tmp;
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;
820 pastix_complex64_t *A,
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 == PastixComplex64 );
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_zlapmr_dst( pastix_data, dir, m, n, A, lda, PA );
880 rc = bvec_zlapmr_rep( pastix_data, dir, m, n, A, lda, PA );
895 memFree_null( PA->
b );
BEGIN_C_DECLS typedef int pastix_int_t
static int bvec_zlapmr_shm(pastix_data_t *pastix_data, pastix_dir_t dir, pastix_int_t m, pastix_int_t n, pastix_complex64_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_zlapmr(pastix_data_t *pastix_data, pastix_dir_t dir, pastix_int_t m, pastix_int_t n, pastix_complex64_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.