Lines Matching defs:i

13   PetscInt        i, N = C->cmap->N, bs = C->rmap->bs, n;
22 for (i = 0; i < ov; ++i) PetscCall(MatIncreaseOverlap_MPIBAIJ_Once(C, imax, is_new));
23 for (i = 0; i < imax; i++) {
24 PetscCall(ISDestroy(&is[i]));
25 PetscCall(ISGetLocalSize(is_new[i], &n));
26 PetscCall(ISGetIndices(is_new[i], &idx));
27 PetscCall(ISCreateBlock(PetscObjectComm((PetscObject)is_new[i]), bs, n, idx, PETSC_COPY_VALUES, &is[i]));
28 PetscCall(ISDestroy(&is_new[i]));
82 for (PetscInt i = 0; i < imax; i++) {
83 PetscCall(ISGetIndices(is[i], &idx[i]));
84 PetscCall(ISGetLocalSize(is[i], &n[i]));
90 for (PetscInt i = 0; i < imax; i++) {
92 idx_i = idx[i];
93 len = n[i];
112 for (PetscMPIInt i = 0; i < size; i++) {
113 if (w1[i]) {
114 w2[i] = 1;
116 } /* there exists a message to proc i */
120 for (PetscMPIInt i = 0, j = 0; i < size; i++) {
121 if (w1[i]) {
122 pa[j] = i;
128 for (PetscMPIInt i = 0; i < nrqs; i++) {
129 PetscMPIInt j = pa[i];
147 for (PetscMPIInt i = 0; i < nrqs; i++) {
148 PetscMPIInt j = pa[i];
157 for (PetscMPIInt i = 0; i < nrqs; i++) {
158 PetscMPIInt j = pa[i];
168 for (PetscInt i = 0; i < imax; i++) {
169 table[i] = t_p + (Mbs / PETSC_BITS_PER_BYTE + 1) * i;
170 data[i] = d_p + (Mbs)*i;
179 for (PetscInt i = 0; i < imax; i++) {
181 n_i = n[i];
182 table_i = table[i];
183 idx_i = idx[i];
184 data_i = data[i];
185 isz_i = isz[i];
203 outdat_j[2 * k - 1] = i;
206 isz[i] = isz_i;
212 for (PetscMPIInt i = 0; i < nrqs; ++i) {
213 PetscMPIInt j = pa[i];
214 PetscCallMPI(MPIU_Isend(outdat[j], w1[j], MPIU_INT, j, tag1, comm, s_waits1 + i));
218 for (PetscInt i = 0; i < imax; ++i) PetscCall(ISRestoreIndices(is[i], idx + i));
222 for (PetscInt i = 0; i < imax; ++i) {
223 PetscCall(PetscCommDuplicate(PetscObjectComm((PetscObject)is[i]), &iscomms[i], NULL));
224 PetscCall(ISDestroy(&is[i]));
252 for (PetscMPIInt i = 0; i < nrqr; ++i) {
253 proc = onodes1[i];
254 PetscCall(PetscMPIIntCast(isz1[i], &rw1[proc]));
266 for (PetscMPIInt i = 0; i < nrqr; ++i) {
267 PetscMPIInt j = onodes1[i];
268 PetscCallMPI(MPIU_Isend(xdata[i], isz1[i], MPIU_INT, j, tag2, comm, s_waits2 + i));
280 for (PetscMPIInt i = 0; i < nrqs; ++i) {
302 for (PetscInt i = 0; i < imax; ++i) {
303 PetscCall(ISCreateGeneral(iscomms[i], isz[i], data[i], PETSC_COPY_VALUES, is + i));
304 PetscCall(PetscCommDestroy(&iscomms[i]));
349 PetscInt *bi, *bj, *garray, i, j, k, row, *data_i, isz_i;
355 ai = a->i;
357 bi = b->i;
361 for (i = 0; i < imax; i++) {
362 data_i = data[i];
363 table_i = table[i];
364 isz_i = isz[i];
365 for (j = 0, max = isz[i]; j < max; j++) {
380 isz[i] = isz_i;
398 For better efficiency perhaps we should malloc separately each xdata[i],
409 PetscInt rstart, cstart, *ai, *aj, *bi, *bj, *garray, i, j, k;
419 ai = a->i;
421 bi = b->i;
425 for (i = 0, ct = 0, total_sz = 0; i < nrqr; ++i) {
426 rbuf_i = rbuf[i];
443 for (i = 0; i < nrqr; i++) { /* for easch mesg from proc i */
444 rbuf_i = rbuf[i];
449 for (j = 1; j <= rbuf_0; j++) { /* for each IS from proc i*/
464 for (ctr = 1; ctr <= i; ctr++) xdata[ctr] = xdata[ctr - 1] + isz1[ctr - 1];
466 xdata[i][ct2++] = row;
471 row = xdata[i][k] - rstart;
485 for (ctr = 1; ctr <= i; ctr++) xdata[ctr] = xdata[ctr - 1] + isz1[ctr - 1];
487 xdata[i][ct2++] = val;
504 for (ctr = 1; ctr <= i; ctr++) xdata[ctr] = xdata[ctr - 1] + isz1[ctr - 1];
506 xdata[i][ct2++] = val;
512 xdata[i][2 * j] = ct2 - oct2; /* Undo the vector isz1 and use only a var*/
513 xdata[i][2 * j - 1] = rbuf_i[2 * j - 1];
515 xdata[i][0] = rbuf_0;
516 if (i + 1 < nrqr) xdata[i + 1] = xdata[i] + ct2;
517 isz1[i] = ct2; /* size of each message */
528 PetscInt nmax, nstages, i, pos, max_no, N = C->cmap->N, bs = C->rmap->bs;
539 for (i = 0; i < ismax; i++) {
540 if (isrow[i] != iscol[i]) flg[0] = PETSC_FALSE;
552 for (i = 0; i < ismax; i++) {
553 iscol_block[i] = isrow_block[i];
554 PetscCall(PetscObjectReference((PetscObject)iscol_block[i]));
582 for (i = 0, pos = 0; i < nstages; i++) {
604 for (i = 0; i < ismax; i++) {
605 PetscCall(ISDestroy(&isrow_block[i]));
606 PetscCall(ISDestroy(&iscol_block[i]));
644 PetscInt nzA, nzB, *a_i = a->i, *b_i = b->i, *a_j = a->j, *b_j = b->j, ctmp, imark, *cworkA, *cworkB;
657 for (PetscInt i = 0; i < ismax; i++) {
658 PetscCall(ISSorted(iscol[i], &issorted[i]));
659 if (!issorted[i]) iscsorted = issorted[i]; /* columns are not sorted! */
660 PetscCall(ISSorted(isrow[i], &issorted[i]));
663 PetscCall(ISIdentity(iscol[i], &colflag));
664 PetscCall(ISGetLocalSize(iscol[i], &ncol[i]));
666 if (colflag && ncol[i] == c->Nbs) {
667 allcolumns[i] = PETSC_TRUE;
668 icol[i] = NULL;
670 allcolumns[i] = PETSC_FALSE;
671 PetscCall(ISGetIndices(iscol[i], &icol[i]));
675 PetscCall(ISIdentity(isrow[i], &colflag));
676 PetscCall(ISGetLocalSize(isrow[i], &nrow[i]));
677 if (colflag && nrow[i] == c->Mbs) {
678 allrows[i] = PETSC_TRUE;
679 irow[i] = NULL;
681 allrows[i] = PETSC_FALSE;
682 PetscCall(ISGetIndices(isrow[i], &irow[i]));
688 for (PetscInt i = 0; i < ismax; i++) {
689 subc = (Mat_SeqBAIJ *)submats[i]->data;
691 PetscCheck(subc->mbs == nrow[i] && subc->nbs == ncol[i], PETSC_COMM_SELF, PETSC_ERR_ARG_SIZ, "Cannot reuse matrix. wrong size");
697 submats[i]->factortype = C->factortype;
718 allcolumns[i] = smat_i->allcolumns;
719 allrows[i] = smat_i->allrows;
720 row2proc[i] = smat_i->row2proc;
721 rmap[i] = smat_i->rmap;
722 cmap[i] = smat_i->cmap;
757 for (PetscInt i = 0; i < ismax; i++) {
758 jmax = nrow[i];
759 irow_i = irow[i];
762 row2proc[i] = row2proc_i;
764 if (issorted[i]) proc = 0;
766 if (!issorted[i]) proc = 0;
767 if (allrows[i]) row = j;
787 for (PetscMPIInt i = 0; i < size; i++) {
788 if (w1[i]) {
789 w2[i] = 1;
791 } /* there exists a message to proc i */
794 for (PetscMPIInt i = 0, j = 0; i < size; i++) {
795 if (w1[i]) pa[j++] = i;
799 for (PetscMPIInt i = 0; i < nrqs; i++) {
800 PetscMPIInt j = pa[i];
822 for (PetscMPIInt i = 0; i < nrqs; i++) {
823 PetscMPIInt j = pa[i];
831 for (PetscMPIInt i = 0; i < nrqs; i++) {
832 PetscMPIInt j = pa[i];
840 for (PetscInt i = 0; i < ismax; i++) {
841 row2proc_i = row2proc[i];
843 irow_i = irow[i];
844 jmax = nrow[i];
847 if (allrows[i]) row = j;
864 sbuf1_j[2 * k - 1] = i;
871 for (PetscMPIInt i = 0; i < nrqs; ++i) {
872 PetscMPIInt j = pa[i];
873 PetscCallMPI(MPIU_Isend(sbuf1[j], w1[j], MPIU_INT, j, tag0, comm, s_waits1 + i));
880 for (PetscMPIInt i = 1; i < nrqs; ++i) rbuf2[i] = rbuf2[i - 1] + w1[pa[i - 1]];
881 for (PetscMPIInt i = 0; i < nrqs; ++i) {
882 PetscMPIInt j = pa[i];
883 PetscCallMPI(MPIU_Irecv(rbuf2[i], w1[j], MPIU_INT, j, tag2, comm, r_waits2 + i));
892 for (PetscMPIInt i = 0; i < nrqr; ++i) {
893 req_size[i] = 0;
894 rbuf1_i = rbuf1[i];
896 end = olengths1[i];
897 PetscCall(PetscMalloc1(end, &sbuf2[i]));
898 sbuf2_i = sbuf2[i];
903 req_size[i] += ncols;
905 req_source1[i] = onodes1[i];
907 sbuf2_i[0] = req_size[i];
910 PetscCallMPI(MPIU_Isend(sbuf2_i, end, MPIU_INT, req_source1[i], tag2, comm, s_waits2 + i));
922 for (PetscMPIInt i = 0; i < nrqs; ++i) {
923 PetscCall(PetscMalloc1(rbuf2[i][0], &rbuf3[i]));
924 req_source2[i] = pa[i];
925 PetscCallMPI(MPIU_Irecv(rbuf3[i], rbuf2[i][0], MPIU_INT, req_source2[i], tag3, comm, r_waits3 + i));
938 for (PetscMPIInt i = 0; i < nrqr; i++) jcnt += req_size[i];
940 for (PetscMPIInt i = 1; i < nrqr; i++) sbuf_aj[i] = sbuf_aj[i - 1] + req_size[i - 1];
944 for (PetscMPIInt i = 0; i < nrqr; i++) {
945 rbuf1_i = rbuf1[i];
946 sbuf_aj_i = sbuf_aj[i];
950 kmax = rbuf1[i][2 * j];
972 PetscCallMPI(MPIU_Isend(sbuf_aj_i, req_size[i], MPIU_INT, req_source1[i], tag3, comm, s_waits3 + i));
978 for (PetscInt i = 0; i < ismax; i++) {
979 if (!allcolumns[i]) {
980 PetscCall(PetscHMapICreateWithSize(ncol[i], cmap + i));
982 jmax = ncol[i];
983 icol_i = icol[i];
984 cmap_i = cmap[i];
985 for (PetscInt j = 0; j < jmax; j++) PetscCall(PetscHMapISet(cmap[i], icol_i[j] + 1, j + 1));
986 } else cmap[i] = NULL;
989 for (PetscInt i = 0; i < ismax; i++) {
990 if (!allcolumns[i]) {
991 PetscCall(PetscCalloc1(c->Nbs, &cmap[i]));
992 jmax = ncol[i];
993 icol_i = icol[i];
994 cmap_i = cmap[i];
996 } else cmap[i] = NULL;
1002 for (PetscInt i = 0; i < ismax; i++) jcnt += nrow[i];
1005 for (PetscInt i = 1; i < ismax; i++) lens[i] = PetscSafePointerPlusOffset(lens[i - 1], nrow[i - 1]);
1008 for (PetscInt i = 0; i < ismax; i++) {
1009 row2proc_i = row2proc[i];
1010 jmax = nrow[i];
1011 if (!allcolumns[i]) cmap_i = cmap[i];
1012 irow_i = irow[i];
1013 lens_i = lens[i];
1015 if (allrows[i]) row = j;
1030 if (!allcolumns[i]) {
1057 for (PetscInt i = 0; i < ismax; i++) {
1058 if (!allrows[i]) {
1060 PetscCall(PetscHMapICreateWithSize(nrow[i], rmap + i));
1061 irow_i = irow[i];
1062 jmax = nrow[i];
1064 if (allrows[i]) {
1065 PetscCall(PetscHMapISet(rmap[i], j + 1, j + 1));
1067 PetscCall(PetscHMapISet(rmap[i], irow_i[j] + 1, j + 1));
1071 PetscCall(PetscCalloc1(c->Mbs, &rmap[i]));
1072 rmap_i = rmap[i];
1073 irow_i = irow[i];
1074 jmax = nrow[i];
1076 if (allrows[i]) rmap_i[j] = j;
1080 } else rmap[i] = NULL;
1135 for (PetscInt i = 0; i < ismax; i++) {
1140 PetscCall(MatCreate(PETSC_COMM_SELF, submats + i));
1141 PetscCall(MatSetSizes(submats[i], nrow[i] * bs_tmp, ncol[i] * bs_tmp, PETSC_DETERMINE, PETSC_DETERMINE));
1143 PetscCall(MatSetType(submats[i], sym ? ((PetscObject)A)->type_name : MATSEQBAIJ));
1144 PetscCall(MatSeqBAIJSetPreallocation(submats[i], bs_tmp, 0, lens[i]));
1145 PetscCall(MatSeqSBAIJSetPreallocation(submats[i], bs_tmp, 0, lens[i])); /* this subroutine is used by SBAIJ routines */
1149 subc = (Mat_SeqBAIJ *)submats[i]->data;
1152 smat_i->destroy = submats[i]->ops->destroy;
1153 submats[i]->ops->destroy = MatDestroySubMatrix_SeqBAIJ;
1154 submats[i]->factortype = C->factortype;
1156 smat_i->id = i;
1174 smat_i->allcolumns = allcolumns[i];
1175 smat_i->allrows = allrows[i];
1177 smat_i->row2proc = row2proc[i];
1178 smat_i->rmap = rmap[i];
1179 smat_i->cmap = cmap[i];
1234 for (PetscMPIInt i = 0; i < nrqs; ++i) {
1235 PetscCall(PetscMalloc1(rbuf2[i][0] * bs2, &rbuf4[i]));
1236 PetscCallMPI(MPIU_Irecv(rbuf4[i], rbuf2[i][0] * bs2, MPIU_SCALAR, req_source2[i], tag4, comm, r_waits4 + i));
1242 for (PetscMPIInt i = 0; i < nrqr; i++) jcnt += req_size[i];
1244 for (PetscMPIInt i = 1; i < nrqr; i++) sbuf_aa[i] = sbuf_aa[i - 1] + req_size[i - 1] * bs2;
1248 for (PetscMPIInt i = 0; i < nrqr; i++) {
1249 rbuf1_i = rbuf1[i];
1250 sbuf_aa_i = sbuf_aa[i];
1279 PetscCallMPI(MPIU_Isend(sbuf_aa_i, req_size[i] * bs2, MPIU_SCALAR, req_source1[i], tag4, comm, s_waits4 + i));
1285 for (PetscInt i = 0; i < ismax; i++) {
1286 row2proc_i = row2proc[i];
1287 subc = (Mat_SeqBAIJ *)submats[i]->data;
1290 imat_i = subc->i;
1293 if (!allcolumns[i]) cmap_i = cmap[i];
1294 rmap_i = rmap[i];
1295 irow_i = irow[i];
1296 jmax = nrow[i];
1298 if (allrows[i]) row = j;
1313 if (allrows[i]) {
1331 if (!allcolumns[i]) {
1430 imat_i = subc->i;
1487 for (PetscInt i = 0; i < ismax; i++) {
1488 subc = (Mat_SeqBAIJ *)submats[i]->data;
1491 imat_i = subc->i;
1493 if (allcolumns[i]) continue;
1495 jmax = nrow[i];
1518 for (PetscInt i = 0; i < ismax; i++) {
1519 if (!allrows[i]) PetscCall(ISRestoreIndices(isrow[i], irow + i));
1520 if (!allcolumns[i]) PetscCall(ISRestoreIndices(iscol[i], icol + i));
1523 for (PetscInt i = 0; i < ismax; i++) {
1524 PetscCall(MatAssemblyBegin(submats[i], MAT_FINAL_ASSEMBLY));
1525 PetscCall(MatAssemblyEnd(submats[i], MAT_FINAL_ASSEMBLY));
1537 for (PetscMPIInt i = 0; i < nrqs; ++i) PetscCall(PetscFree(rbuf4[i]));