mirror of
https://github.com/ceres-solver/ceres-solver.git
synced 2026-08-29 16:40:38 +08:00
CUDA Cleanup
* All Cuda* objects now take in a ContextImpl* during construction, and save the context instead of individual handles. * Since we no longer use the legacy default stream, we need to explicitly synchronize the stream before performing GPU->CPU transfers, and CudaBuffer is responsible for such synchronization when asked to perform GPU to CPU transfers. * Remove all manual syncs and relegate syncing to CudaBuffer before performing GPU to CPU transfers. Change-Id: Ic73cb24174a1e09842827323280e90241716cc20
This commit is contained in:
@@ -81,6 +81,13 @@ class CERES_NO_EXPORT ContextImpl final : public Context {
|
||||
// 3. If the user explicitly selects a GPU in the host process before calling
|
||||
// Ceres, Ceres will use that GPU.
|
||||
|
||||
// Note on Ceres' use of CUDA Streams:
|
||||
// All operations on the GPU are performed using a single stream. This ensures
|
||||
// that the order of operations are stream-ordered, but we do not need to
|
||||
// explicitly synchronize the stream at the end of every operation. Stream
|
||||
// synchronization occurs only before GPU to CPU transfers, and is handled by
|
||||
// CudaBuffer.
|
||||
|
||||
// Initializes cuBLAS, cuSOLVER, and cuSPARSE contexts, creates an
|
||||
// asynchronous CUDA stream, and associates the stream with the contexts.
|
||||
// Returns true iff initialization was successful, else it returns false and a
|
||||
|
||||
Reference in New Issue
Block a user