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

Method setMemoryManagerPinned

src/backend/opencl/device_manager.cpp:412–429  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

410}
411
412void DeviceManager::setMemoryManagerPinned(
413 std::unique_ptr<MemoryManagerBase> newMgr) {
414 std::lock_guard<std::mutex> l(mutex);
415 // It's possible we're setting a pinned memory manager and the default
416 // memory manager still hasn't been initialized, so initialize it anyways so
417 // we don't inadvertently reset to it when we first call
418 // pinnedMemoryManager()
419 pinnedMemoryManager();
420 // Calls shutdown() on the existing memory manager.
421 if (pinnedMemManager) { pinnedMemManager->shutdownAllocator(); }
422 // Set the backend pinned memory manager for this new manager to register
423 // native functions correctly.
424 pinnedMemManager = std::move(newMgr);
425 std::unique_ptr<opencl::AllocatorPinned> deviceMemoryManager(
426 new opencl::AllocatorPinned());
427 pinnedMemManager->setAllocator(std::move(deviceMemoryManager));
428 pinnedMemManager->initialize();
429}
430
431void DeviceManager::resetMemoryManagerPinned() {
432 // 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