Lines Matching refs:rctx
109 RevolveCTX *rctx, *rctx2; member
811 static PetscErrorCode printwhattodo(PetscViewer viewer, PetscRevolveInt whattodo, RevolveCTX *rctx,… in printwhattodo() argument
818 …PetscCall(PetscViewerASCIIPrintf(viewer, "Advance from %d to %d\n", rctx->oldcapo + shift, rctx->c… in printwhattodo()
821 …l(PetscViewerASCIIPrintf(viewer, "Store in checkpoint number %d (located in RAM)\n", rctx->check)); in printwhattodo()
830 …PetscViewerASCIIPrintf(viewer, "Restore in checkpoint number %d (located in RAM)\n", rctx->check)); in printwhattodo()
833 …(PetscViewerASCIIPrintf(viewer, "Store in checkpoint number %d (located on disk)\n", rctx->check)); in printwhattodo()
836 …etscViewerASCIIPrintf(viewer, "Restore in checkpoint number %d (located on disk)\n", rctx->check)); in printwhattodo()
845 static PetscErrorCode printwhattodo2(PetscViewer viewer, PetscRevolveInt whattodo, RevolveCTX *rctx… in printwhattodo2() argument
852 …f(viewer, "[Top Level] Advance from stride %d to stride %d\n", rctx->oldcapo + shift, rctx->capo +… in printwhattodo2()
855 …PetscCall(PetscViewerASCIIPrintf(viewer, "[Top Level] Store in checkpoint number %d\n", rctx->chec… in printwhattodo2()
864 …PetscCall(PetscViewerASCIIPrintf(viewer, "[Top Level] Restore in checkpoint number %d\n", rctx->ch… in printwhattodo2()
867 …scViewerASCIIPrintf(viewer, "[Top Level] Store in top-level checkpoint number %d\n", rctx->check)); in printwhattodo2()
870 …ViewerASCIIPrintf(viewer, "[Top Level] Restore in top-level checkpoint number %d\n", rctx->check)); in printwhattodo2()
879 static PetscErrorCode InitRevolve(PetscInt fine, PetscInt snaps, RevolveCTX *rctx) in InitRevolve() argument
888 rctx->snaps_in = rsnaps; in InitRevolve()
889 rctx->fine = rfine; in InitRevolve()
890 rctx->check = 0; in InitRevolve()
891 rctx->capo = 0; in InitRevolve()
892 rctx->reverseonestep = PETSC_FALSE; in InitRevolve()
897 static PetscErrorCode FastForwardRevolve(RevolveCTX *rctx) in FastForwardRevolve() argument
904 …whattodo = revolve_action(&rctx->check, &rctx->capo, &rctx->fine, rctx->snaps_in, &rctx->info, &rc… in FastForwardRevolve()
909 static PetscErrorCode ApplyRevolve(PetscViewer viewer, SchedulerType stype, RevolveCTX *rctx, Petsc… in ApplyRevolve() argument
915 …if (rctx->stepsleft > 0) { /* advance the solution without checkpointing anything as Revolve requi… in ApplyRevolve()
916 rctx->stepsleft--; in ApplyRevolve()
921 rctx->oldcapo = rctx->capo; in ApplyRevolve()
922 rctx->capo = localstepnum; in ApplyRevolve()
924 … (!toplevel) whattodo = revolve_action(&rctx->check, &rctx->capo, &rctx->fine, rctx->snaps_in, &rc… in ApplyRevolve()
925 …else whattodo = revolve2_action(&rctx->check, &rctx->capo, &rctx->fine, rctx->snaps_in, &rctx->inf… in ApplyRevolve()
928 if (!toplevel) PetscCall(printwhattodo(viewer, whattodo, rctx, shift)); in ApplyRevolve()
929 else PetscCall(printwhattodo2(viewer, whattodo, rctx, shift)); in ApplyRevolve()
932 if (stype == REVOLVE_ONLINE && rctx->capo >= total_steps - 1) { in ApplyRevolve()
933 revolve_turn(total_steps, &rctx->capo, &rctx->fine); in ApplyRevolve()
934 if (!toplevel) PetscCall(printwhattodo(viewer, whattodo, rctx, shift)); in ApplyRevolve()
935 else PetscCall(printwhattodo2(viewer, whattodo, rctx, shift)); in ApplyRevolve()
937 rctx->stepsleft = rctx->capo - rctx->oldcapo - 1; in ApplyRevolve()
940 rctx->reverseonestep = PETSC_TRUE; in ApplyRevolve()
943 rctx->oldcapo = rctx->capo; in ApplyRevolve()
944 … (!toplevel) whattodo = revolve_action(&rctx->check, &rctx->capo, &rctx->fine, rctx->snaps_in, &rc… in ApplyRevolve()
945 …else whattodo = revolve2_action(&rctx->check, &rctx->capo, &rctx->fine, rctx->snaps_in, &rctx->inf… in ApplyRevolve()
946 if (!toplevel) PetscCall(printwhattodo(viewer, whattodo, rctx, shift)); in ApplyRevolve()
947 else PetscCall(printwhattodo2(viewer, whattodo, rctx, shift)); in ApplyRevolve()
948 if (whattodo == 3 || whattodo == 4) rctx->reverseonestep = PETSC_TRUE; in ApplyRevolve()
949 if (whattodo == 1) rctx->stepsleft = rctx->capo - rctx->oldcapo; in ApplyRevolve()
953 rctx->oldcapo = rctx->capo; in ApplyRevolve()
954 …whattodo = revolve_action(&rctx->check, &rctx->capo, &rctx->fine, rctx->snaps_in, &rctx->info… in ApplyRevolve()
955 PetscCall(printwhattodo(viewer, whattodo, rctx, shift)); in ApplyRevolve()
956 rctx->stepsleft = rctx->capo - rctx->oldcapo - 1; in ApplyRevolve()
960 rctx->oldcapo = rctx->capo; in ApplyRevolve()
961 … (!toplevel) whattodo = revolve_action(&rctx->check, &rctx->capo, &rctx->fine, rctx->snaps_in, &rc… in ApplyRevolve()
962 …else whattodo = revolve2_action(&rctx->check, &rctx->capo, &rctx->fine, rctx->snaps_in, &rctx->inf… in ApplyRevolve()
963 if (!toplevel) PetscCall(printwhattodo(viewer, whattodo, rctx, shift)); in ApplyRevolve()
964 else PetscCall(printwhattodo2(viewer, whattodo, rctx, shift)); in ApplyRevolve()
965 if (stype == REVOLVE_ONLINE && rctx->capo >= total_steps - 1) { in ApplyRevolve()
966 revolve_turn(total_steps, &rctx->capo, &rctx->fine); in ApplyRevolve()
967 PetscCall(printwhattodo(viewer, whattodo, rctx, shift)); in ApplyRevolve()
969 rctx->stepsleft = rctx->capo - rctx->oldcapo - 1; in ApplyRevolve()
987 …PetscCall(ApplyRevolve(tj->monitor, tjsch->stype, tjsch->rctx, rtotal_steps, rstepnum, rstepnum, P… in TSTrajectoryMemorySet_ROF()
1008 tjsch->rctx->reverseonestep = PETSC_FALSE; in TSTrajectoryMemoryGet_ROF()
1017 tjsch->rctx->capo = rstepnum; in TSTrajectoryMemoryGet_ROF()
1018 tjsch->rctx->oldcapo = tjsch->rctx->capo; in TSTrajectoryMemoryGet_ROF()
1020 …evolve_action(&tjsch->rctx->check, &tjsch->rctx->capo, &tjsch->rctx->fine, tjsch->rctx->snaps_in, … in TSTrajectoryMemoryGet_ROF()
1021 PetscCall(printwhattodo(tj->monitor, whattodo, tjsch->rctx, shift)); in TSTrajectoryMemoryGet_ROF()
1023 …PetscCall(ApplyRevolve(tj->monitor, tjsch->stype, tjsch->rctx, rtotal_steps, rstepnum, rstepnum, P… in TSTrajectoryMemoryGet_ROF()
1026 …p from %d to %d (stage values already checkpointed)\n", tjsch->rctx->oldcapo, tjsch->rctx->oldcapo… in TSTrajectoryMemoryGet_ROF()
1029 if (!tjsch->rctx->reverseonestep && tjsch->rctx->stepsleft > 0) tjsch->rctx->stepsleft--; in TSTrajectoryMemoryGet_ROF()
1036 tjsch->rctx->reverseonestep = PETSC_FALSE; in TSTrajectoryMemoryGet_ROF()
1047 RevolveCTX *rctx = tjsch->rctx; in TSTrajectoryMemorySet_RON() local
1056 …PetscCall(ApplyRevolve(tj->monitor, tjsch->stype, rctx, rtotal_steps, rstepnum, rstepnum, PETSC_FA… in TSTrajectoryMemorySet_RON()
1058 if (rctx->check != stack->top + 1) { /* overwrite some non-top checkpoint in the stack */ in TSTrajectoryMemorySet_RON()
1059 PetscCall(StackFind(stack, &e, rctx->check)); in TSTrajectoryMemorySet_RON()
1089 tjsch->rctx->reverseonestep = PETSC_FALSE; in TSTrajectoryMemoryGet_RON()
1093 tjsch->rctx->capo = rstepnum; in TSTrajectoryMemoryGet_RON()
1094 tjsch->rctx->oldcapo = tjsch->rctx->capo; in TSTrajectoryMemoryGet_RON()
1096 …evolve_action(&tjsch->rctx->check, &tjsch->rctx->capo, &tjsch->rctx->fine, tjsch->rctx->snaps_in, … in TSTrajectoryMemoryGet_RON()
1098 PetscCall(printwhattodo(tj->monitor, whattodo, tjsch->rctx, shift)); in TSTrajectoryMemoryGet_RON()
1100 PetscCall(StackFind(stack, &e, tjsch->rctx->check)); in TSTrajectoryMemoryGet_RON()
1104 tjsch->rctx->oldcapo = tjsch->rctx->capo; in TSTrajectoryMemoryGet_RON()
1105 …evolve_action(&tjsch->rctx->check, &tjsch->rctx->capo, &tjsch->rctx->fine, tjsch->rctx->snaps_in, … in TSTrajectoryMemoryGet_RON()
1106 PetscCall(printwhattodo(tj->monitor, whattodo, tjsch->rctx, shift)); in TSTrajectoryMemoryGet_RON()
1107 if (whattodo == 3 || whattodo == 4) tjsch->rctx->reverseonestep = PETSC_TRUE; in TSTrajectoryMemoryGet_RON()
1108 if (whattodo == 1) tjsch->rctx->stepsleft = tjsch->rctx->capo - tjsch->rctx->oldcapo; in TSTrajectoryMemoryGet_RON()
1111 …p from %d to %d (stage values already checkpointed)\n", tjsch->rctx->oldcapo, tjsch->rctx->oldcapo… in TSTrajectoryMemoryGet_RON()
1114 if (!tjsch->rctx->reverseonestep && tjsch->rctx->stepsleft > 0) tjsch->rctx->stepsleft--; in TSTrajectoryMemoryGet_RON()
1120 tjsch->rctx->reverseonestep = PETSC_FALSE; in TSTrajectoryMemoryGet_RON()
1148 PetscCall(InitRevolve(tjsch->stride, tjsch->max_cps_ram, tjsch->rctx)); in TSTrajectoryMemorySet_TLR()
1153 PetscCall(InitRevolve(laststridesize, tjsch->max_cps_ram, tjsch->rctx)); in TSTrajectoryMemorySet_TLR()
1156 PetscCall(InitRevolve(laststridesize, tjsch->max_cps_ram, tjsch->rctx)); in TSTrajectoryMemorySet_TLR()
1162 …PetscCall(ApplyRevolve(tj->monitor, tjsch->stype, tjsch->rctx, rtotal_steps, rstepnum, rlocalstepn… in TSTrajectoryMemorySet_TLR()
1186 tjsch->rctx->reverseonestep = PETSC_FALSE; in TSTrajectoryMemoryGet_TLR()
1199 PetscCall(InitRevolve(tjsch->stride, tjsch->max_cps_ram, tjsch->rctx)); in TSTrajectoryMemoryGet_TLR()
1200 PetscCall(FastForwardRevolve(tjsch->rctx)); in TSTrajectoryMemoryGet_TLR()
1207 PetscCall(InitRevolve(tjsch->stride, tjsch->max_cps_ram, tjsch->rctx)); in TSTrajectoryMemoryGet_TLR()
1217 tjsch->rctx->capo = rstepnum; in TSTrajectoryMemoryGet_TLR()
1218 tjsch->rctx->oldcapo = tjsch->rctx->capo; in TSTrajectoryMemoryGet_TLR()
1220 …evolve_action(&tjsch->rctx->check, &tjsch->rctx->capo, &tjsch->rctx->fine, tjsch->rctx->snaps_in, … in TSTrajectoryMemoryGet_TLR()
1221 PetscCall(printwhattodo(tj->monitor, whattodo, tjsch->rctx, shift)); in TSTrajectoryMemoryGet_TLR()
1230 PetscCall(InitRevolve(tjsch->stride, tjsch->max_cps_ram, tjsch->rctx)); in TSTrajectoryMemoryGet_TLR()
1231 PetscCall(FastForwardRevolve(tjsch->rctx)); in TSTrajectoryMemoryGet_TLR()
1235 PetscCall(InitRevolve(tjsch->stride, tjsch->max_cps_ram, tjsch->rctx)); in TSTrajectoryMemoryGet_TLR()
1237 …PetscCall(ApplyRevolve(tj->monitor, tjsch->stype, tjsch->rctx, rtotal_steps, rnum, 1, PETSC_FALSE,… in TSTrajectoryMemoryGet_TLR()
1241 …\n", (stridenum - 1) * tjsch->stride + tjsch->rctx->oldcapo, (stridenum - 1) * tjsch->stride + tjs… in TSTrajectoryMemoryGet_TLR()
1257 …PetscCall(ApplyRevolve(tj->monitor, tjsch->stype, tjsch->rctx, rtotal_steps, rstepnum, rlocalstepn… in TSTrajectoryMemoryGet_TLR()
1260 … checkpointed)\n", stepnum - localstepnum + tjsch->rctx->oldcapo, stepnum - localstepnum + tjsch->… in TSTrajectoryMemoryGet_TLR()
1263 if (!tjsch->rctx->reverseonestep && tjsch->rctx->stepsleft > 0) tjsch->rctx->stepsleft--; in TSTrajectoryMemoryGet_TLR()
1270 tjsch->rctx->reverseonestep = PETSC_FALSE; in TSTrajectoryMemoryGet_TLR()
1294 …al_steps - laststridesize) PetscCall(InitRevolve(laststridesize, tjsch->max_cps_ram, tjsch->rctx)); in TSTrajectoryMemorySet_TLTR()
1300 …teps - laststridesize + 1) PetscCall(InitRevolve(laststridesize, tjsch->max_cps_ram, tjsch->rctx)); in TSTrajectoryMemorySet_TLTR()
1305 PetscCall(InitRevolve(tjsch->stride, tjsch->max_cps_ram, tjsch->rctx)); in TSTrajectoryMemorySet_TLTR()
1318 …PetscCall(ApplyRevolve(tj->monitor, tjsch->stype, tjsch->rctx, rtotal_steps, rstepnum, rlocalstepn… in TSTrajectoryMemorySet_TLTR()
1344 tjsch->rctx->reverseonestep = PETSC_FALSE; in TSTrajectoryMemoryGet_TLTR()
1393 PetscCall(InitRevolve(tjsch->stride, tjsch->max_cps_ram, tjsch->rctx)); in TSTrajectoryMemoryGet_TLTR()
1397 PetscCall(InitRevolve(tjsch->stride, tjsch->max_cps_ram, tjsch->rctx)); in TSTrajectoryMemoryGet_TLTR()
1398 PetscCall(FastForwardRevolve(tjsch->rctx)); in TSTrajectoryMemoryGet_TLTR()
1402 PetscCall(InitRevolve(tjsch->stride, tjsch->max_cps_ram, tjsch->rctx)); in TSTrajectoryMemoryGet_TLTR()
1411 PetscCall(InitRevolve(tjsch->stride, tjsch->max_cps_ram, tjsch->rctx)); in TSTrajectoryMemoryGet_TLTR()
1416 PetscCall(InitRevolve(tjsch->stride, tjsch->max_cps_ram, tjsch->rctx)); in TSTrajectoryMemoryGet_TLTR()
1417 PetscCall(FastForwardRevolve(tjsch->rctx)); in TSTrajectoryMemoryGet_TLTR()
1421 PetscCall(InitRevolve(tjsch->stride, tjsch->max_cps_ram, tjsch->rctx)); in TSTrajectoryMemoryGet_TLTR()
1428 …PetscCall(ApplyRevolve(tj->monitor, tjsch->stype, tjsch->rctx, rtotal_steps, rstepnum, 1, PETSC_FA… in TSTrajectoryMemoryGet_TLTR()
1443 tjsch->rctx->reverseonestep = PETSC_FALSE; in TSTrajectoryMemoryGet_TLTR()
1454 tjsch->rctx->capo = rstepnum; in TSTrajectoryMemoryGet_TLTR()
1455 tjsch->rctx->oldcapo = tjsch->rctx->capo; in TSTrajectoryMemoryGet_TLTR()
1457 …evolve_action(&tjsch->rctx->check, &tjsch->rctx->capo, &tjsch->rctx->fine, tjsch->rctx->snaps_in, … in TSTrajectoryMemoryGet_TLTR()
1458 PetscCall(printwhattodo(tj->monitor, whattodo, tjsch->rctx, shift)); in TSTrajectoryMemoryGet_TLTR()
1471 …PetscCall(ApplyRevolve(tj->monitor, tjsch->stype, tjsch->rctx, rtotal_steps, rstepnum, rlocalstepn… in TSTrajectoryMemoryGet_TLTR()
1474 … checkpointed)\n", stepnum - localstepnum + tjsch->rctx->oldcapo, stepnum - localstepnum + tjsch->… in TSTrajectoryMemoryGet_TLTR()
1477 if (!tjsch->rctx->reverseonestep && tjsch->rctx->stepsleft > 0) tjsch->rctx->stepsleft--; in TSTrajectoryMemoryGet_TLTR()
1484 tjsch->rctx->reverseonestep = PETSC_FALSE; in TSTrajectoryMemoryGet_TLTR()
1500 …PetscCall(ApplyRevolve(tj->monitor, tjsch->stype, tjsch->rctx, rtotal_steps, rstepnum, rstepnum, P… in TSTrajectoryMemorySet_RMS()
1509 PetscCall(DumpSingle(tj, ts, stack, tjsch->rctx->check + 1)); in TSTrajectoryMemorySet_RMS()
1525 tjsch->rctx->reverseonestep = PETSC_FALSE; in TSTrajectoryMemoryGet_RMS()
1529 tjsch->rctx->capo = rstepnum; in TSTrajectoryMemoryGet_RMS()
1530 tjsch->rctx->oldcapo = tjsch->rctx->capo; in TSTrajectoryMemoryGet_RMS()
1532 …evolve_action(&tjsch->rctx->check, &tjsch->rctx->capo, &tjsch->rctx->fine, tjsch->rctx->snaps_in, … in TSTrajectoryMemoryGet_RMS()
1533 PetscCall(printwhattodo(tj->monitor, whattodo, tjsch->rctx, shift)); in TSTrajectoryMemoryGet_RMS()
1535 restart = tjsch->rctx->capo; in TSTrajectoryMemoryGet_RMS()
1536 if (!tjsch->rctx->where) { in TSTrajectoryMemoryGet_RMS()
1538 PetscCall(LoadSingle(tj, ts, stack, tjsch->rctx->check + 1)); in TSTrajectoryMemoryGet_RMS()
1547 tjsch->rctx->oldcapo = tjsch->rctx->capo; in TSTrajectoryMemoryGet_RMS()
1548 …evolve_action(&tjsch->rctx->check, &tjsch->rctx->capo, &tjsch->rctx->fine, tjsch->rctx->snaps_in, … in TSTrajectoryMemoryGet_RMS()
1549 PetscCall(printwhattodo(tj->monitor, whattodo, tjsch->rctx, shift)); in TSTrajectoryMemoryGet_RMS()
1550 if (whattodo == 3 || whattodo == 4) tjsch->rctx->reverseonestep = PETSC_TRUE; in TSTrajectoryMemoryGet_RMS()
1551 if (whattodo == 1) tjsch->rctx->stepsleft = tjsch->rctx->capo - tjsch->rctx->oldcapo; in TSTrajectoryMemoryGet_RMS()
1554 …p from %d to %d (stage values already checkpointed)\n", tjsch->rctx->oldcapo, tjsch->rctx->oldcapo… in TSTrajectoryMemoryGet_RMS()
1557 if (!tjsch->rctx->reverseonestep && tjsch->rctx->stepsleft > 0) tjsch->rctx->stepsleft--; in TSTrajectoryMemoryGet_RMS()
1565 tjsch->rctx->reverseonestep = PETSC_FALSE; in TSTrajectoryMemoryGet_RMS()
2033 RevolveCTX *rctx, *rctx2; in TSTrajectorySetUp_Memory() local
2165 PetscCall(PetscNew(&rctx)); in TSTrajectorySetUp_Memory()
2167 rctx->snaps_in = rsnaps; /* for theta methods snaps_in=2*max_cps_ram */ in TSTrajectorySetUp_Memory()
2168 rctx->reverseonestep = PETSC_FALSE; in TSTrajectorySetUp_Memory()
2169 rctx->check = 0; in TSTrajectorySetUp_Memory()
2170 rctx->oldcapo = 0; in TSTrajectorySetUp_Memory()
2171 rctx->capo = 0; in TSTrajectorySetUp_Memory()
2172 rctx->info = 2; in TSTrajectorySetUp_Memory()
2178 rctx->fine = rfine; in TSTrajectorySetUp_Memory()
2179 tjsch->rctx = rctx; in TSTrajectorySetUp_Memory()
2180 if (tjsch->stype == REVOLVE_ONLINE) rctx->fine = -1; in TSTrajectorySetUp_Memory()
2219 PetscCall(PetscFree(tjsch->rctx)); in TSTrajectoryReset_Memory()