MCPcopy Create free account
hub / github.com/arrayfire/arrayfire / setMemoryManagerPinned

Method setMemoryManagerPinned

src/backend/oneapi/device_manager.cpp:262–279  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

260}
261
262void DeviceManager::setMemoryManagerPinned(
263 std::unique_ptr<MemoryManagerBase> newMgr) {
264 std::lock_guard<std::mutex> l(mutex);
265 // It's possible we're setting a pinned memory manager and the default
266 // memory manager still hasn't been initialized, so initialize it anyways so
267 // we don't inadvertently reset to it when we first call
268 // pinnedMemoryManager()
269 pinnedMemoryManager();
270 // Calls shutdown() on the existing memory manager.
271 if (pinnedMemManager) { pinnedMemManager->shutdownAllocator(); }
272 // Set the backend pinned memory manager for this new manager to register
273 // native functions correctly.
274 pinnedMemManager = std::move(newMgr);
275 std::unique_ptr<oneapi::AllocatorPinned> deviceMemoryManager(
276 new oneapi::AllocatorPinned());
277 pinnedMemManager->setAllocator(std::move(deviceMemoryManager));
278 pinnedMemManager->initialize();
279}
280
281void DeviceManager::resetMemoryManagerPinned() {
282 // Replace with default memory manager

Callers 1

setMemoryManagerPinnedFunction · 0.45

Calls 3

shutdownAllocatorMethod · 0.80
setAllocatorMethod · 0.80
initializeMethod · 0.45

Tested by

no test coverage detected