Skip to content

Commit

Permalink
quick fix
Browse files Browse the repository at this point in the history
  • Loading branch information
multiphaseCFD committed Dec 2, 2024
1 parent 04b5309 commit 34393ed
Showing 1 changed file with 8 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ class TNCudaBase : public TensornetBase<PrecisionT, Derived> {
// of cutensornet.
}

~TNCudaBase() {}
~TNCudaBase() = default;

/**
* @brief Get the method of a derived class object.
Expand Down Expand Up @@ -207,16 +207,17 @@ class TNCudaBase : public TensornetBase<PrecisionT, Derived> {
CFP_t value_cu = cuUtil::complexToCu<ComplexT>(ComplexT{1.0, 0.0});

tensors_[0].getDataBuffer().zeroInit();
PL_CUDA_IS_SUCCESS(cudaMemcpy(
&tensors_[0].getDataBuffer().getData()[BaseType::getNumQubits() -
std::size_t{1}],
&value_cu, sizeof(CFP_t), cudaMemcpyHostToDevice));
std::size_t idx = BaseType::getNumQubits() - std::size_t{1};
std::size_t target = basisState[idx];
PL_CUDA_IS_SUCCESS(
cudaMemcpy(&tensors_[0].getDataBuffer().getData()[target],
&value_cu, sizeof(CFP_t), cudaMemcpyHostToDevice));

for (std::size_t i = 1; i < BaseType::getNumQubits(); i++) {
tensors_[i].getDataBuffer().zeroInit();
std::size_t idx = BaseType::getNumQubits() - std::size_t{1} - i;

std::size_t target = basisState[idx] == 0 ? 0 : bondDims_[i - 1];
idx = BaseType::getNumQubits() - std::size_t{1} - i;
target = basisState[idx] == 0 ? 0 : bondDims_[i - 1];

PL_CUDA_IS_SUCCESS(
cudaMemcpy(&tensors_[i].getDataBuffer().getData()[target],
Expand Down

0 comments on commit 34393ed

Please sign in to comment.