| 149 | } |
| 150 | |
| 151 | Status CudaSparse::Initialize() { |
| 152 | HandleMap* handle_map = GetHandleMapSingleton(); |
| 153 | DCHECK(handle_map); |
| 154 | mutex_lock lock(handle_map_mutex); |
| 155 | auto it = handle_map->find(cuda_stream_); |
| 156 | if (it == handle_map->end()) { |
| 157 | LOG(INFO) << "Creating CudaSparse handles for stream " << cuda_stream_; |
| 158 | // Previously unseen Cuda stream. Initialize a set of Cuda sparse library |
| 159 | // handles for it. |
| 160 | CudaSparseHandles new_handles(cuda_stream_); |
| 161 | TF_RETURN_IF_ERROR(new_handles.Initialize()); |
| 162 | it = |
| 163 | handle_map->insert(std::make_pair(cuda_stream_, std::move(new_handles))) |
| 164 | .first; |
| 165 | } |
| 166 | cusparse_handle_ = &it->second.handle(); |
| 167 | initialized_ = true; |
| 168 | return Status::OK(); |
| 169 | } |
| 170 | |
| 171 | // Macro that specializes a sparse method for all 4 standard |
| 172 | // numeric types. |
nothing calls this directly
no test coverage detected