From 6a8cce0a3bc7dd5a2a7cd22f5aa7377afb6761d5 Mon Sep 17 00:00:00 2001 From: Shuli Shu <08cnbj@gmail.com> Date: Wed, 23 Aug 2023 19:11:08 -0700 Subject: [PATCH] add docstring --- .../src/algorithms/ObservablesGPUMPI.hpp | 5 ++--- .../src/simulator/StateVectorCudaMPI.hpp | 1 - pennylane_lightning_gpu/src/util/CSRMatrix.hpp | 11 +++++++---- 3 files changed, 9 insertions(+), 8 deletions(-) diff --git a/pennylane_lightning_gpu/src/algorithms/ObservablesGPUMPI.hpp b/pennylane_lightning_gpu/src/algorithms/ObservablesGPUMPI.hpp index d99431ba..fdaefc15 100644 --- a/pennylane_lightning_gpu/src/algorithms/ObservablesGPUMPI.hpp +++ b/pennylane_lightning_gpu/src/algorithms/ObservablesGPUMPI.hpp @@ -364,9 +364,8 @@ class HamiltonianGPUMPI final : public ObservableGPUMPI { for (size_t term_idx = 0; term_idx < coeffs_.size(); term_idx++) { DevTag dt_local(sv.getDataBuffer().getDevTag()); dt_local.refresh(); - StateVectorCudaMPI tmp( - dt_local, sv.getNumGlobalQubits(), sv.getNumLocalQubits(), - sv.getData()); + StateVectorCudaMPI tmp(dt_local, sv.getNumGlobalQubits(), + sv.getNumLocalQubits(), sv.getData()); obs_[term_idx]->applyInPlace(tmp); scaleAndAddC_CUDA(std::complex{coeffs_[term_idx], 0.0}, tmp.getData(), buffer.getData(), tmp.getLength(), diff --git a/pennylane_lightning_gpu/src/simulator/StateVectorCudaMPI.hpp b/pennylane_lightning_gpu/src/simulator/StateVectorCudaMPI.hpp index 4de7efe1..d8efa764 100644 --- a/pennylane_lightning_gpu/src/simulator/StateVectorCudaMPI.hpp +++ b/pennylane_lightning_gpu/src/simulator/StateVectorCudaMPI.hpp @@ -959,7 +959,6 @@ class StateVectorCudaMPI const index_type *csrOffsets_ptr, const index_type csrOffsets_size, const index_type *columns_ptr, const std::complex *values_ptr, const index_type numNNZ) { - if (mpi_manager_.getRank() == 0) { PL_ABORT_IF_NOT(static_cast(csrOffsets_size - 1) == (size_t{1} << this->getTotalNumQubits()), diff --git a/pennylane_lightning_gpu/src/util/CSRMatrix.hpp b/pennylane_lightning_gpu/src/util/CSRMatrix.hpp index 59856d46..78a60ddf 100644 --- a/pennylane_lightning_gpu/src/util/CSRMatrix.hpp +++ b/pennylane_lightning_gpu/src/util/CSRMatrix.hpp @@ -61,9 +61,10 @@ template class CSRMatrix { * @brief Convert a global CSR (Compressed Sparse Row) format matrix into * local blocks. This operation should be conducted on the rank 0. * + * @tparam Precision Floating-point precision type. * @tparam index_type Integer type used as indices of the sparse matrix. - * @param num_row_blocks Number of local blocks per global row. - * @param num_col_blocks Number of local blocks per global column. + * @param mpi_manager MPIManager object. + * @param num_rows Number of rows of the CSR matrix. * @param csrOffsets_ptr Pointer to the array of row offsets of the sparse * matrix. Array of size csrOffsets_size. * @param columns_ptr Pointer to the array of column indices of the sparse @@ -147,8 +148,11 @@ auto splitCSRMatrix(MPIManager &mpi_manager, const size_t &num_rows, /** * @brief Scatter a CSR (Compressed Sparse Row) format matrix. * + * @tparam Precision Floating-point precision type. * @tparam index_type Integer type used as indices of the sparse matrix. - * @param matrix CSR (Compressed Sparse Row) format matrix. + * @param mpi_manager MPIManager object. + * @param matrix CSR (Compressed Sparse Row) format matrix vector. + * @param local_num_rows Number of rows of local CSR matrix. * @param root Root rank of the scatter operation. */ template @@ -156,7 +160,6 @@ auto scatterCSRMatrix(MPIManager &mpi_manager, std::vector> &matrix, size_t local_num_rows, size_t root) -> CSRMatrix { - // Bcast num_rows and num_cols size_t num_col_blocks = mpi_manager.getSize(); std::vector nnzs;