File tree Expand file tree Collapse file tree 1 file changed +4
-1
lines changed
Expand file tree Collapse file tree 1 file changed +4
-1
lines changed Original file line number Diff line number Diff line change @@ -216,7 +216,8 @@ class CuStateVecCircuitSimulator
216216 void *newDeviceStateVector;
217217 HANDLE_CUDA_ERROR (cudaMalloc ((void **)&newDeviceStateVector,
218218 stateDimension * sizeof (CudaDataType)));
219-
219+ HANDLE_CUDA_ERROR (cudaMemset (newDeviceStateVector, 0 ,
220+ stateDimension * sizeof (CudaDataType)));
220221 // Place the state data on device. Could be that
221222 // we just need the zero state, or the user could have provided one
222223 void *otherState;
@@ -283,6 +284,8 @@ class CuStateVecCircuitSimulator
283284 void *newDeviceStateVector;
284285 HANDLE_CUDA_ERROR (cudaMalloc ((void **)&newDeviceStateVector,
285286 stateDimension * sizeof (CudaDataType)));
287+ HANDLE_CUDA_ERROR (cudaMemset (newDeviceStateVector, 0 ,
288+ stateDimension * sizeof (CudaDataType)));
286289 constexpr int32_t threads_per_block = 256 ;
287290 uint32_t n_blocks =
288291 (stateDimension + threads_per_block - 1 ) / threads_per_block;
You can’t perform that action at this time.
0 commit comments