Lines Matching +full:- +full:std

7 #include <algorithm> // std::remove_if(), std::find_if()
10 #include <sstream> // std::ostringstream
13 PETSC_PRAGMA_DIAGNOSTIC_IGNORED_BEGIN("-Wgnu-zero-variadic-macro-arguments")
40 if (auto &destroy = event->destroy) { in reset_()
44 …PetscAssert(!event->data, PETSC_COMM_SELF, PETSC_ERR_PLIB, "Event failed to destroy its data membe… in reset_()
45 event->dctx_id = 0; in reset_()
46 event->dctx_state = 0; in reset_()
47 event->dtype = PETSC_DEVICE_DEFAULT(); in reset_()
62 PetscCall(PetscDeviceContextGetDeviceType(dctx, &(*event)->dtype)); in PetscDeviceContextCreateEvent_Private()
83 id = PetscObjectCast(dctx)->id; in PetscDeviceContextRecordEvent_Private()
84 state = PetscObjectCast(dctx)->state; in PetscDeviceContextRecordEvent_Private()
85 // technically state can never be less than event->dctx_state (only equal) but we include in PetscDeviceContextRecordEvent_Private()
87 if ((id == event->dctx_id) && (state <= event->dctx_state)) PetscFunctionReturn(PETSC_SUCCESS); in PetscDeviceContextRecordEvent_Private()
88 if (dctx->ops->recordevent) { in PetscDeviceContextRecordEvent_Private()
92 if (PetscDefined(USE_DEBUG) && (event->dtype != PETSC_DEVICE_HOST)) { in PetscDeviceContextRecordEvent_Private()
96 …eck(event->dtype == dtype, PETSC_COMM_SELF, PETSC_ERR_ARG_INCOMP, "Event type %s does not match de… in PetscDeviceContextRecordEvent_Private()
100 event->dctx_id = id; in PetscDeviceContextRecordEvent_Private()
101 event->dctx_state = state; in PetscDeviceContextRecordEvent_Private()
111 if (!event->data) PetscFunctionReturn(PETSC_SUCCESS); in PetscDeviceContextWaitForEvent_Private()
113 const auto etype = event->dtype; in PetscDeviceContextWaitForEvent_Private()
119 if (PetscObjectCast(dctx)->id == event->dctx_id) PetscFunctionReturn(PETSC_SUCCESS); in PetscDeviceContextWaitForEvent_Private()
129 // empty-base-class optimization to kick in when debugging is disabled.
137 std::string file{};
138 std::string function{};
147 PETSC_NODISCARD std::string to_string() const noexcept in to_string()
149 std::string ret; in to_string()
151 ret = '(' + function + "() at " + file + ':' + std::to_string(line) + ')'; in to_string()
156 static std::string split_on_petsc_path_(std::string &&in) noexcept in split_on_petsc_path_()
160 if (pos == std::string::npos) pos = in.find("petsc/include"); in split_on_petsc_path_()
161 if (pos == std::string::npos) pos = 0; in split_on_petsc_path_()
165 friend std::ostream &operator<<(std::ostream &os, const PetscStackFrame &frame) in operator <<()
173 using std::swap; in swap()
190 PETSC_NODISCARD static std::string to_string() noexcept { return "(unknown)"; } in to_string()
192 friend std::ostream &operator<<(std::ostream &os, const PetscStackFrame &) noexcept in operator <<()
235 PetscFunctionReturn(event()->dctx_id); in dctx_id()
250 using dependency_type = std::vector<snapshot_type>;
270 // MarkedObjectMap::mapped_type -- Public API
280 …tackoverflow.com/questions/53408962/try-to-understand-compiler-error-message-default-member-initia…
313 …shot_type(PetscDeviceContext dctx, frame_type frame) noexcept : frame_type(std::move(frame)), even… in snapshot_type()
323 MarkedObjectMap::snapshot_type::snapshot_type(snapshot_type &&other) noexcept : frame_type(std::mov… in snapshot_type()
329 frame_type::operator=(std::move(other)); in operator =()
345 using std::swap; in swap()
359 …Code PetscGetMarkedObjectMap_Internal(std::size_t *nkeys, PetscObjectId **keys, PetscMemoryAccessM… in PetscGetMarkedObjectMap_Internal()
361 std::size_t i = 0; in PetscGetMarkedObjectMap_Internal()
369 std::size_t j = 0; in PetscGetMarkedObjectMap_Internal()
382 …e PetscRestoreMarkedObjectMap_Internal(std::size_t nkeys, PetscObjectId **keys, PetscMemoryAccessM… in PetscRestoreMarkedObjectMap_Internal()
385 for (std::size_t i = 0; i < nkeys; ++i) PetscCall(PetscFree((*dependencies)[i])); in PetscRestoreMarkedObjectMap_Internal()
393 const auto dctx_id = PetscObjectCast(dctx)->id; in PetscDeviceContextMapIterVisitor()
394 auto &&marked = CxxDataCast(dctx)->marked_objects(); in PetscDeviceContextMapIterVisitor()
406 auto &deps = mapit->second.dependencies; in PetscDeviceContextMapIterVisitor()
408 …const auto it = std::remove_if(deps.begin(), end, [&](const MarkedObjectMap::snapshot_type &obj)… in PetscDeviceContextMapIterVisitor()
430 std::ostringstream oss; in PetscDeviceContextSyncClearMap_Internal()
431 const auto mode = PetscMemoryAccessModeToString(mapit->second.mode); in PetscDeviceContextSyncClearMap_Internal()
433 …oss << "synced dctx " << PetscObjectCast(dctx)->id << ", remaining leaves for obj " << mapit->firs… in PetscDeviceContextSyncClearMap_Internal()
435 oss << "[dctx " << it->dctx_id() << ", " << mode << ' ' << it->frame() << ']'; in PetscDeviceContextSyncClearMap_Internal()
447 // clang-format off in PetscDeviceContextSyncClearMap_Internal()
448 const std::vector<CxxData::upstream_type::value_type> upstream_copy( in PetscDeviceContextSyncClearMap_Internal()
449 std::make_move_iterator(cxx_data->upstream().begin()), in PetscDeviceContextSyncClearMap_Internal()
450 std::make_move_iterator(cxx_data->upstream().end()) in PetscDeviceContextSyncClearMap_Internal()
452 // clang-format on in PetscDeviceContextSyncClearMap_Internal()
457 PetscCall(cxx_data->clear()); in PetscDeviceContextSyncClearMap_Internal()
461->id, PETSC_COMM_SELF, PETSC_ERR_PLIB, "Upstream dctx %" PetscInt64_FMT " no longer exists, now ha… in PetscDeviceContextSyncClearMap_Internal()
471 std::ostringstream oss; in PetscDeviceContextCheckNotOrphaned_Internal()
472 //const auto allow = dctx->options.allow_orphans, contained = dctx->contained; in PetscDeviceContextCheckNotOrphaned_Internal()
483 …oss << "- PetscObject (id " << mapit->first << "), intent " << PetscMemoryAccessModeToString(mapit in PetscDeviceContextCheckNotOrphaned_Internal()
484 if (std::distance(it, end) == 0) oss << " (orphaned)"; // we were the only dependency 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 …Int64_FMT " (%s) - obj %" PetscInt64_FMT " (%s): " mess, PetscObjectCast(dctx)->id, PetscObjectCas…
496 // The current mode is compatible with the previous mode (i.e. read-read) so we need only
502 const auto dctx_id = PetscObjectCast(dctx)->id; in MarkFromID_CompatibleModes()
505 …const auto it = std::find_if(object_dependencies.begin(), end, [&](const MarkedOb… in MarkFromID_CompatibleModes()
511 using std::swap; in MarkFromID_CompatibleModes()
515 …PetscAssert(CxxDataCast(dctx)->has_marked(id), PETSC_COMM_SELF, PETSC_ERR_PLIB, "PetscDeviceContex… in MarkFromID_CompatibleModes()
516 swap(it->frame(), frame); in MarkFromID_CompatibleModes()
517 PetscCall(PetscDeviceContextRecordEvent_Private(dctx, it->event())); in MarkFromID_CompatibleModes()
531 const auto dctx_id = PetscObjectCast(dctx)->id; in MarkFromID_IncompatibleModes_UpdateLastWrite()
539 if (last_dep.event()->dtype != dtype) { in MarkFromID_IncompatibleModes_UpdateLastWrite()
541 last_write = std::move(last_dep); in MarkFromID_IncompatibleModes_UpdateLastWrite()
548 using std::swap; in MarkFromID_IncompatibleModes_UpdateLastWrite()
551 if (last_dep.event()->dctx_id != dctx_id) PetscCall(cxx_data->add_mark(id)); in MarkFromID_IncompatibleModes_UpdateLastWrite()
552 …PetscAssert(cxx_data->has_marked(id), PETSC_COMM_SELF, PETSC_ERR_PLIB, "Did not find id %" PetscIn… in MarkFromID_IncompatibleModes_UpdateLastWrite()
609 PetscCallCXX(object_dependencies.emplace_back(dctx, std::move(frame))); in PetscDeviceContextMarkIntentFromID_Private()
610 PetscCall(CxxDataCast(dctx)->add_mark(id)); in PetscDeviceContextMarkIntentFromID_Private()
618 PetscDeviceContextMarkIntentFromID - Indicate a `PetscDeviceContext`s access intent to the
619 auto-dependency system
624 + dctx - The `PetscDeviceContext`
625 . id - The `PetscObjectId` to mark
626 . mode - The desired access intent
627 - name - The object name (for debug purposes, ignored in optimized builds)
645 const auto index = petscstack.currentsize > 2 ? petscstack.currentsize - 2 : 0; in PetscDeviceContextMarkIntentFromID()