Attempts the switch to the requested scoped math mode, new_mode. Note that when false is returned, an appropriate error has already been logged.
| 189 | // Note that when false is returned, an appropriate error has already been |
| 190 | // logged. |
| 191 | bool Init(cublasMath_t new_mode) { |
| 192 | cublasStatus_t ret = cublasGetMathMode(handle_, &old_mode_); |
| 193 | if (ret != CUBLAS_STATUS_SUCCESS) { |
| 194 | LOG(ERROR) << "failed to get old cublas math mode: " << ToString(ret); |
| 195 | return ok_ = false; |
| 196 | } |
| 197 | |
| 198 | ret = cublasSetMathMode(handle_, new_mode); |
| 199 | if (ret != CUBLAS_STATUS_SUCCESS) { |
| 200 | LOG(ERROR) << "failed to set new cublas math mode: " << ToString(ret); |
| 201 | return ok_ = false; |
| 202 | } |
| 203 | return ok_ = true; |
| 204 | } |
| 205 | |
| 206 | // Switches back to the prior math mode, if the switch operation was |
| 207 | // successful in the first place. |
nothing calls this directly
no test coverage detected