CUDA Networks
vector_copy.cu
Go to the documentation of this file.
1 /**
2  * @file vector_copy.cu
3  * @brief Implementation of the copy method for vectors.
4  */
5 
6 #include "vector.h"
7 #include <cuda_runtime.h>
8 
9 /**
10  * @brief Creates a deep copy of the vector.
11  * @return A new Vector object with the same content as the original.
12  */
14  // Create a new vector with the same number of rows
15  Vector result(rows);
16 
17  // Copy the data from the current vector to the new vector
18  cudaMemcpy(result.d_data, d_data, rows * sizeof(double), cudaMemcpyDeviceToDevice);
19 
20  // Return the new vector
21  return result;
22 }
Represents a vector with GPU-accelerated operations.
Definition: vector.h:13
Vector copy() const
Creates a deep copy of the vector.
Definition: vector_copy.cu:13
Defines the Vector class for GPU-accelerated vector operations.