| 146 | } |
| 147 | |
| 148 | unique_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 | |
| 170 | unique_handle<cusparseHandle_t> *cusparseManager(const int deviceId) { |
| 171 | thread_local unique_handle<cusparseHandle_t> |
no test coverage detected