diff --git a/include/dca/linalg/util/magma_queue.hpp b/include/dca/linalg/util/magma_queue.hpp index 5f9719ef6..8c2f6a7d7 100644 --- a/include/dca/linalg/util/magma_queue.hpp +++ b/include/dca/linalg/util/magma_queue.hpp @@ -32,19 +32,20 @@ class MagmaQueue { cusparseCreate(&cusparse_handle_); int device; cudaGetDevice(&device); - magma_queue_create_from_cuda(device, stream_, cublas_handle_, - cusparse_handle_, &queue_); + magma_queue_create_from_cuda(device, stream_, cublas_handle_, cusparse_handle_, &queue_); } MagmaQueue(const MagmaQueue& rhs) = delete; MagmaQueue& operator=(const MagmaQueue& rhs) = delete; - MagmaQueue(MagmaQueue&& rhs) noexcept { - swapMembers(rhs); + MagmaQueue(MagmaQueue&& rhs) noexcept : queue_(std::move(rhs.queue_)) { + std::swap(cublas_handle_, rhs.cublas_handle_); + std::swap(cusparse_handle_, rhs.cusparse_handle_); + std::swap(queue_, rhs.queue_); } MagmaQueue& operator=(MagmaQueue&& rhs) noexcept { - swapMembers(rhs); + swap(rhs); return *this; } @@ -62,21 +63,21 @@ class MagmaQueue { // take a MagmaQueue, this makes all this code less intelligible // but less verbose. Consider this carefully. operator cudaStream_t() const { - return stream_; + return static_cast(stream_); } - + const CudaStream& getStream() const { return stream_; } - -private: - void swapMembers(MagmaQueue& rhs) noexcept { + + void swap(MagmaQueue& rhs) noexcept { std::swap(stream_, rhs.stream_); std::swap(cublas_handle_, rhs.cublas_handle_); std::swap(cusparse_handle_, rhs.cusparse_handle_); std::swap(queue_, rhs.queue_); } +private: CudaStream stream_; magma_queue_t queue_ = nullptr; cublasHandle_t cublas_handle_ = nullptr; diff --git a/include/dca/phys/dca_step/cluster_solver/ctint/accumulator/ctint_accumulator.hpp b/include/dca/phys/dca_step/cluster_solver/ctint/accumulator/ctint_accumulator.hpp index fe936c406..8e4dac51a 100644 --- a/include/dca/phys/dca_step/cluster_solver/ctint/accumulator/ctint_accumulator.hpp +++ b/include/dca/phys/dca_step/cluster_solver/ctint/accumulator/ctint_accumulator.hpp @@ -100,7 +100,7 @@ class CtintAccumulator { MatrixConfiguration configuration_; int sign_ = 0; - std::vector streams_; + std::vector streams_; linalg::util::CudaEvent event_; util::Accumulator accumulated_sign_; diff --git a/include/dca/phys/dca_step/cluster_solver/shared_tools/accumulation/tp/tp_accumulator.hpp b/include/dca/phys/dca_step/cluster_solver/shared_tools/accumulation/tp/tp_accumulator.hpp index d7c926c20..0e536acc2 100644 --- a/include/dca/phys/dca_step/cluster_solver/shared_tools/accumulation/tp/tp_accumulator.hpp +++ b/include/dca/phys/dca_step/cluster_solver/shared_tools/accumulation/tp/tp_accumulator.hpp @@ -123,8 +123,8 @@ class TpAccumulator { return 0; } - linalg::util::CudaStream* get_stream() const { - static dca::linalg::util::CudaStream mock_stream; + const linalg::util::CudaStream* get_stream() const { + static const dca::linalg::util::CudaStream mock_stream; return &mock_stream; } diff --git a/include/dca/phys/dca_step/cluster_solver/shared_tools/accumulation/tp/tp_accumulator_gpu.hpp b/include/dca/phys/dca_step/cluster_solver/shared_tools/accumulation/tp/tp_accumulator_gpu.hpp index 9ae8f81ba..51cd67b03 100644 --- a/include/dca/phys/dca_step/cluster_solver/shared_tools/accumulation/tp/tp_accumulator_gpu.hpp +++ b/include/dca/phys/dca_step/cluster_solver/shared_tools/accumulation/tp/tp_accumulator_gpu.hpp @@ -87,8 +87,8 @@ class TpAccumulator : public TpAccumulator