Lines Matching refs:dctx
56 static PetscErrorCode PetscDeviceContextCreateEvent_Private(PetscDeviceContext dctx, PetscEvent *ev… in PetscDeviceContextCreateEvent_Private() argument
59 PetscValidDeviceContext(dctx, 1); in PetscDeviceContextCreateEvent_Private()
62 PetscCall(PetscDeviceContextGetDeviceType(dctx, &(*event)->dtype)); in PetscDeviceContextCreateEvent_Private()
63 PetscTryTypeMethod(dctx, createevent, *event); in PetscDeviceContextCreateEvent_Private()
75 static PetscErrorCode PetscDeviceContextRecordEvent_Private(PetscDeviceContext dctx, PetscEvent eve… in PetscDeviceContextRecordEvent_Private() argument
81 PetscValidDeviceContext(dctx, 1); in PetscDeviceContextRecordEvent_Private()
83 id = PetscObjectCast(dctx)->id; in PetscDeviceContextRecordEvent_Private()
84 state = PetscObjectCast(dctx)->state; in PetscDeviceContextRecordEvent_Private()
88 if (dctx->ops->recordevent) { in PetscDeviceContextRecordEvent_Private()
95 PetscCall(PetscDeviceContextGetDeviceType(dctx, &dtype)); in PetscDeviceContextRecordEvent_Private()
98 PetscUseTypeMethod(dctx, recordevent, event); in PetscDeviceContextRecordEvent_Private()
105 static PetscErrorCode PetscDeviceContextWaitForEvent_Private(PetscDeviceContext dctx, PetscEvent ev… in PetscDeviceContextWaitForEvent_Private() argument
108 PetscValidDeviceContext(dctx, 1); in PetscDeviceContextWaitForEvent_Private()
116 PetscCall(PetscDeviceContextGetDeviceType(dctx, &dtype)); in PetscDeviceContextWaitForEvent_Private()
119 if (PetscObjectCast(dctx)->id == event->dctx_id) PetscFunctionReturn(PETSC_SUCCESS); in PetscDeviceContextWaitForEvent_Private()
120 PetscTryTypeMethod(dctx, waitforevent, event); in PetscDeviceContextWaitForEvent_Private()
299 inline PetscEvent MarkedObjectMap::snapshot_type::init_event_(PetscDeviceContext dctx) noexcept in init_event_() argument
304 PetscCallAbort(PETSC_COMM_SELF, PetscDeviceContextCreateEvent_Private(dctx, &event)); in init_event_()
305 PetscCallAbort(PETSC_COMM_SELF, PetscDeviceContextRecordEvent_Private(dctx, event)); in init_event_()
313 …napshot_type(PetscDeviceContext dctx, frame_type frame) noexcept : frame_type(std::move(frame)), e… in snapshot_type() argument
336 PetscErrorCode MarkedObjectMap::snapshot_type::ensure_event(PetscDeviceContext dctx) noexcept in ensure_event() argument
339 if (PetscUnlikely(!event_)) PetscCall(PetscDeviceContextCreateEvent_Private(dctx, &event_)); in ensure_event()
391 static PetscErrorCode PetscDeviceContextMapIterVisitor(PetscDeviceContext dctx, T &&callback) noexc… in PetscDeviceContextMapIterVisitor() argument
393 const auto dctx_id = PetscObjectCast(dctx)->id; in PetscDeviceContextMapIterVisitor()
394 auto &&marked = CxxDataCast(dctx)->marked_objects(); in PetscDeviceContextMapIterVisitor()
421 PetscErrorCode PetscDeviceContextSyncClearMap_Internal(PetscDeviceContext dctx) in PetscDeviceContextSyncClearMap_Internal() argument
427 …PetscCall(PetscDeviceContextMapIterVisitor(dctx, [&](map_iterator mapit, dep_iterator it, dep_iter… in PetscDeviceContextSyncClearMap_Internal()
433 …oss << "synced dctx " << PetscObjectCast(dctx)->id << ", remaining leaves for obj " << mapit->firs… in PetscDeviceContextSyncClearMap_Internal()
446 const auto cxx_data = CxxDataCast(dctx); in PetscDeviceContextSyncClearMap_Internal()
469 PetscErrorCode PetscDeviceContextCheckNotOrphaned_Internal(PetscDeviceContext dctx) in PetscDeviceContextCheckNotOrphaned_Internal() argument
479 …PetscCall(PetscDeviceContextMapIterVisitor(dctx, [&](map_iterator mapit, dep_iterator it, dep_iter… in PetscDeviceContextCheckNotOrphaned_Internal()
489 …PetscObjectCast(dctx)->name ? PetscObjectCast(dctx)->name : "unnamed", PetscObjectCast(dctx)->id, … in PetscDeviceContextCheckNotOrphaned_Internal()
490 PetscCall(CxxDataCast(dctx)->clear()); in PetscDeviceContextCheckNotOrphaned_Internal()
494 …dctx, "dctx %" PetscInt64_FMT " (%s) - obj %" PetscInt64_FMT " (%s): " mess, PetscObjectCast(dctx)…
500 …_CompatibleModes(MarkedObjectMap::mapped_type &marked, PetscDeviceContext dctx, PetscObjectId id, … in MarkFromID_CompatibleModes() argument
502 const auto dctx_id = PetscObjectCast(dctx)->id; in MarkFromID_CompatibleModes()
515 …PetscAssert(CxxDataCast(dctx)->has_marked(id), PETSC_COMM_SELF, PETSC_ERR_PLIB, "PetscDeviceContex… in MarkFromID_CompatibleModes()
517 PetscCall(PetscDeviceContextRecordEvent_Private(dctx, it->event())); in MarkFromID_CompatibleModes()
524 … event = marked.last_write.event()) PetscCall(PetscDeviceContextWaitForEvent_Private(dctx, event)); in MarkFromID_CompatibleModes()
529 …_UpdateLastWrite(MarkedObjectMap::mapped_type &marked, PetscDeviceContext dctx, PetscObjectId id, … in MarkFromID_IncompatibleModes_UpdateLastWrite() argument
531 const auto dctx_id = PetscObjectCast(dctx)->id; in MarkFromID_IncompatibleModes_UpdateLastWrite()
538 PetscCall(PetscDeviceContextGetDeviceType(dctx, &dtype)); in MarkFromID_IncompatibleModes_UpdateLastWrite()
546 const auto cxx_data = CxxDataCast(dctx); in MarkFromID_IncompatibleModes_UpdateLastWrite()
562 PetscCall(last_dep.ensure_event(dctx)); in MarkFromID_IncompatibleModes_UpdateLastWrite()
563 PetscCall(PetscDeviceContextRecordEvent_Private(dctx, last_dep.event())); in MarkFromID_IncompatibleModes_UpdateLastWrite()
573 …ncompatibleModes(MarkedObjectMap::mapped_type &marked, PetscDeviceContext dctx, PetscObjectId id, … in MarkFromID_IncompatibleModes() argument
583 …for (const auto &dep : object_dependencies) PetscCall(PetscDeviceContextWaitForEvent_Private(dctx,… in MarkFromID_IncompatibleModes()
585 …old_mode)) PetscCall(MarkFromID_IncompatibleModes_UpdateLastWrite(marked, dctx, id, mode, frame, n… in MarkFromID_IncompatibleModes()
594 static PetscErrorCode PetscDeviceContextMarkIntentFromID_Private(PetscDeviceContext dctx, PetscObje… in PetscDeviceContextMarkIntentFromID_Private() argument
602 …PetscCall(MarkFromID_CompatibleModes(marked, dctx, id, mode, frame, name, &update_object_dependenc… in PetscDeviceContextMarkIntentFromID_Private()
604 …PetscCall(MarkFromID_IncompatibleModes(marked, dctx, id, mode, frame, name, &update_object_depende… in PetscDeviceContextMarkIntentFromID_Private()
609 PetscCallCXX(object_dependencies.emplace_back(dctx, std::move(frame))); in PetscDeviceContextMarkIntentFromID_Private()
610 PetscCall(CxxDataCast(dctx)->add_mark(id)); in PetscDeviceContextMarkIntentFromID_Private()
642 PetscErrorCode PetscDeviceContextMarkIntentFromID(PetscDeviceContext dctx, PetscObjectId id, PetscM… in PetscDeviceContextMarkIntentFromID() argument
656 PetscCall(PetscDeviceContextGetOptionalNullContext_Internal(&dctx)); in PetscDeviceContextMarkIntentFromID()
659 PetscCall(PetscLogEventBegin(DCONTEXT_Mark, dctx, nullptr, nullptr, nullptr)); in PetscDeviceContextMarkIntentFromID()
660 …PetscCall(PetscDeviceContextMarkIntentFromID_Private(dctx, id, mode, MarkedObjectMap::snapshot_typ… in PetscDeviceContextMarkIntentFromID()
661 PetscCall(PetscLogEventEnd(DCONTEXT_Mark, dctx, nullptr, nullptr, nullptr)); in PetscDeviceContextMarkIntentFromID()