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

Method setMemoryManagerPinned

src/backend/cuda/device_manager.cpp:419–436  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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