template <typename Dtype>
void caffe_copy(const int N, const Dtype *X, Dtype *Y);
+void caffe_copy(const size_t N, const void *X, void *Y);
+
template <typename Dtype>
void caffe_set(const int N, const Dtype alpha, Dtype *X);
void caffe_gpu_set(const int N, const Dtype alpha, Dtype *X);
template <typename Dtype>
-void caffe_gpu_copy(const int N, const Dtype *X, Dtype *Y);
-
-template <typename Dtype>
void caffe_add_scalar(const int N, const Dtype alpha, Dtype *X);
template <typename Dtype>
}
template <>
-void caffe_copy<float>(const int N, const float* X, float* Y) {
+void caffe_copy<int>(const int N, const int* X, int* Y) {
if (X != Y) {
- cblas_scopy(N, X, 1, Y, 1);
+ CUDA_CHECK(cudaMemcpy(Y, X, sizeof(int) * N, cudaMemcpyDefault));
}
}
template <>
-void caffe_copy<double>(const int N, const double* X, double* Y) {
+void caffe_copy<unsigned int>(const int N, const unsigned int* X,
+ unsigned int* Y) {
if (X != Y) {
- cblas_dcopy(N, X, 1, Y, 1);
+ CUDA_CHECK(cudaMemcpy(Y, X, sizeof(unsigned int) * N, cudaMemcpyDefault));
}
}
template <>
-void caffe_gpu_copy<float>(const int N, const float* X, float* Y) {
+void caffe_copy<float>(const int N, const float* X, float* Y) {
if (X != Y) {
- CUBLAS_CHECK(cublasScopy(Caffe::cublas_handle(), N, X, 1, Y, 1));
+ CUDA_CHECK(cudaMemcpy(Y, X, sizeof(float) * N, cudaMemcpyDefault));
}
}
template <>
-void caffe_gpu_copy<double>(const int N, const double* X, double* Y) {
+void caffe_copy<double>(const int N, const double* X, double* Y) {
+ CUDA_CHECK(cudaMemcpy(Y, X, sizeof(double) * N, cudaMemcpyDefault));
+}
+
+void caffe_copy(const size_t N, const void* X, void* Y) {
if (X != Y) {
- CUBLAS_CHECK(cublasDcopy(Caffe::cublas_handle(), N, X, 1, Y, 1));
+ CUDA_CHECK(cudaMemcpy(Y, X, N, cudaMemcpyDefault));
}
}