rapidsai / raft

RAFT contains fundamental widely-used algorithms and primitives for machine learning and information retrieval. The algorithms are CUDA-accelerated and form building blocks for more easily writing high performance applications.
https://docs.rapids.ai/api/raft/stable/
Apache License 2.0
737 stars 188 forks source link

[BUG] handle_t destructor throws exceptions #71

Open zbjornson opened 3 years ago

zbjornson commented 3 years ago

Describe the bug

The raft::handle_t destructor calls destroy_resources(), which can throw a variety of exceptions. It's hard/impossible to catch those if stack unwinding is in progress. I see a TODO to use NO_THROW and enable logging, but personally I don't like to see log messages about failed dtors due to a previous error.

https://github.com/rapidsai/raft/blob/d1e04a85eb701265b1d757db00eb6de4c488438d/cpp/include/raft/handle.hpp#L222-L223

Is it necessary to check the destroy calls at all?

Example code that terminates ```cpp inline void transpose(raft::handle_t& handle, float* out, float* in, size_t n_rows, size_t n_cols) { const float alpha = 1.0f; const float beta = 0.0f; const int lda = n_rows; const int ldb = n_cols; const int ldc = lda; DeviceBuffer garbage(1); auto tStatus = raft::linalg::cublasgeam(handle.get_cublas_handle(), CUBLAS_OP_T, CUBLAS_OP_N, n_cols, n_rows, &alpha, in, lda, &beta, garbage.Data(), ldb, out, ldc, handle.get_stream()); if (tStatus != CUBLAS_STATUS_SUCCESS) throw std::runtime_error(raft::linalg::detail::cublas_error_to_string(tStatus)); } ```
github-actions[bot] commented 3 years ago

This issue has been marked rotten due to no recent activity in the past 90d. Please close this issue if no further response or action is needed. Otherwise, please respond with a comment indicating any updates or changes to the original issue and/or confirm this issue still needs to be addressed.

github-actions[bot] commented 3 years ago

This issue has been marked stale due to no recent activity in the past 30d. Please close this issue if no further response or action is needed. Otherwise, please respond with a comment indicating any updates or changes to the original issue and/or confirm this issue still needs to be addressed. This issue will be marked rotten if there is no activity in the next 60d.