Lines Matching refs:jac
157 PC_PCBJKOKKOS *jac = (PC_PCBJKOKKOS *)pc->data;
159 const PetscInt maxit = jac->ksp->max_it, nBlk = jac->nBlocks;
161 int Nsolves_team = jac->nsolves_team, fill_idx = 0;
162 int Nloc = jac->const_block_size; // same grids
164 PetscReal rtol = jac->ksp->rtol;
165 const PetscScalar *glb_idiag = jac->d_idiag_k->data();
166 const PetscInt *d_bid_eqOffset = jac->d_bid_eqOffset_k->data();
167 const PetscInt *d_isicol = jac->d_isicol_k->data(), *d_isrow = jac->d_isrow_k->data();
171 PetscCheck(jac->const_block_size, PetscObjectComm((PetscObject)pc), PETSC_ERR_ARG_WRONG, "Kokkos (GMRES) solver requires constant block size (but can be made to work with species ordering or N_team==1)");
178 if (!jac->rowOffsets) {
179 jac->rowOffsets = new IntView("rowOffsets", Nsolves / Nsolves_team, Nloc + 1); // same grids
180 jac->colIndices = new IntView("colIndices", Nsolves / Nsolves_team, nnz);
181 jac->batch_b = new XYType("batch rhs", Nsolves, Nloc);
182 jac->batch_x = new XYType("batch sol", Nsolves, Nloc);
183 jac->batch_values = new AMatrixValueView("batch values", Nsolves, nnz);
187 IntView &rowOffsets = *jac->rowOffsets;
188 IntView &colIndices = *jac->colIndices;
189 XYType &batch_b = *jac->batch_b;
190 XYType &batch_x = *jac->batch_x;
191 AMatrixValueView &batch_values = *jac->batch_values;
194 PetscCall(PetscInfo(pc, "\tjac->n = %d, Nloc = %d, Nsolves = %d, nnz = %d, Nsolves_team = %d, league size = %d, maxit = %d\n", (int)jac->n, Nloc, Nsolves, nnz, Nsolves_team, Nsolves / Nsolves_team, (int)maxit));
274 for (PetscInt dmIdx = 0, s = 0, head = 0; dmIdx < jac->num_dms; dmIdx += batch_sz) {
275 for (PetscInt f = 0, idx = head; f < jac->dm_Nf[dmIdx]; f++, s++, idx++) {
278 for (int bid = 0; bid < batch_sz; bid++) PetscCall(PetscPrintf(PetscObjectComm((PetscObject)A), "%3D ", handle.get_iteration_host(idx + bid * jac->dm_Nf[dmIdx])));
283 if ((ii = handle.get_iteration_host(idx + bid * jac->dm_Nf[dmIdx])) > count) count = ii;
288 head += batch_sz * jac->dm_Nf[dmIdx];
298 if (!jac->max_nits) {
300 if (handle.get_iteration_host(blkID) > jac->max_nits) {
301 jac->max_nits = handle.get_iteration_host(blkID);
312 if (jac->reason) { // -pc_bjkokkos_ksp_converged_reason
313 if (jac->batch_target == blkID) {
317 } else if (jac->batch_target == -1 && handle.get_iteration_host(blkID) >= count) {
318 jac->max_nits = count = handle.get_iteration_host(blkID);
324 if (jac->batch_target == -1 && jac->reason) {
326 PetscCall(PetscPrintf(PetscObjectComm((PetscObject)A), " Linear solve %s in %d iteration, batch %" PetscInt_FMT ", specie %" PetscInt_FMT "\n", handle.is_converged_host(mbid) ? "converged" : "diverged", jac->max_nits, mbid % batch_sz, mbid / batch_sz));
327 else PetscCall(PetscPrintf(PetscObjectComm((PetscObject)A), " Linear solve %s in %d iteration, block %" PetscInt_FMT "\n", handle.is_converged_host(mbid) ? "converged" : "diverged", jac->max_nits, mbid));