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

Function nnManager

src/backend/cuda/platform.cpp:110–137  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

108
109#ifdef WITH_CUDNN
110unique_handle<cudnnHandle_t> *nnManager(const int deviceId) {
111 thread_local unique_handle<cudnnHandle_t>
112 cudnnHandles[DeviceManager::MAX_DEVICES];
113 thread_local once_flag initFlags[DeviceManager::MAX_DEVICES];
114
115 auto *handle = &cudnnHandles[deviceId];
116 cudnnStatus_t error = CUDNN_STATUS_SUCCESS;
117 call_once(initFlags[deviceId], [handle, &error] {
118 auto getLogger = [&] { return spdlog::get("platform"); };
119 AF_TRACE("Initializing cuDNN");
120 error = static_cast<cudnnStatus_t>(handle->create());
121
122 // Not throwing an AF_ERROR here because we are in a lambda that could
123 // be executing on another thread;
124 if (!(*handle)) { getLogger()->error("Error initalizing cuDNN"); }
125 });
126 if (error) {
127 string error_msg = fmt::format(
128 "Error initializing cuDNN({}): {}.",
129 static_cast<std::underlying_type<cudnnStatus_t>::type>(error),
130 errorString(error));
131 AF_ERROR(error_msg, AF_ERR_RUNTIME);
132 }
133 CUDNN_CHECK(getCudnnPlugin().cudnnSetStream(cudnnHandles[deviceId],
134 getStream(deviceId)));
135
136 return handle;
137}
138#endif
139
140unique_ptr<PlanCache> &cufftManager(const int deviceId) {

Callers 2

~DeviceManagerMethod · 0.85
nnHandleFunction · 0.85

Calls 5

getLoggerFunction · 0.70
errorStringFunction · 0.70
getStreamFunction · 0.70
getFunction · 0.50
createMethod · 0.45

Tested by

no test coverage detected