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

Function cusolverManager

src/backend/cuda/platform.cpp:148–168  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

146}
147
148unique_handle<cusolverDnHandle_t> *cusolverManager(const int deviceId) {
149 thread_local unique_handle<cusolverDnHandle_t>
150 handles[DeviceManager::MAX_DEVICES];
151 thread_local once_flag initFlags[DeviceManager::MAX_DEVICES];
152 call_once(initFlags[deviceId], [&] {
153 handles[deviceId].create();
154 // TODO(pradeep) When multiple streams per device
155 // is added to CUDA backend, move the cublasSetStream
156 // call outside of call_once scope.
157 CUSOLVER_CHECK(
158 cusolverDnSetStream(handles[deviceId], getStream(deviceId)));
159 });
160 // TODO(pradeep) prior to this change, stream was being synced in get solver
161 // handle because of some cusolver bug. Re-enable that if this change
162 // doesn't work and sovler tests fail.
163 // https://gist.github.com/shehzan10/414c3d04a40e7c4a03ed3c2e1b9072e7
164 // cuSolver Streams patch:
165 // CUDA_CHECK(cudaStreamSynchronize(getStream(deviceId)));
166
167 return &handles[deviceId];
168}
169
170unique_handle<cusparseHandle_t> *cusparseManager(const int deviceId) {
171 thread_local unique_handle<cusparseHandle_t>

Callers 2

~DeviceManagerMethod · 0.85
solverDnHandleFunction · 0.85

Calls 2

getStreamFunction · 0.70
createMethod · 0.45

Tested by

no test coverage detected