From d20485ef4cdffcda0ec92ba79e3ea0912eb52910 Mon Sep 17 00:00:00 2001
From: Rafael Ravedutti <rafaelravedutti@gmail.com>
Date: Sat, 2 Apr 2022 02:38:04 +0200
Subject: [PATCH] Fix CUDA device functions

Signed-off-by: Rafael Ravedutti <rafaelravedutti@gmail.com>
---
 runtime/devices/cuda.hpp | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/runtime/devices/cuda.hpp b/runtime/devices/cuda.hpp
index a9ae18d..873f040 100644
--- a/runtime/devices/cuda.hpp
+++ b/runtime/devices/cuda.hpp
@@ -1,16 +1,16 @@
 #include <cuda_runtime.h>
 #include <iostream>
 //---
-#include "pairs.hpp"
+#include "../pairs.hpp"
 
 #pragma once
 
-#define CUDA_ASSERT(a) { pairs::cuda_assert((a), __LINE__, __FILE__); }
+#define CUDA_ASSERT(a) { pairs::cuda_assert((a), __FILE__, __LINE__); }
 
 namespace pairs {
 
 inline void cuda_assert(cudaError_t err, const char *file, int line) {
-    if(cuda != cudaSuccess) {
+    if(err != cudaSuccess) {
         std::cerr << file << ":" << line << ": " << cudaGetErrorString(err) << std::endl;
         exit(-1);
     }
@@ -29,11 +29,11 @@ __host__ __device__ void *device_realloc(void *ptr, size_t size) {
     return new_ptr;
 }
 
-__host__ void copy_to_device(void *h_ptr, const void *d_ptr, size_t count) {
+__host__ void copy_to_device(const void *h_ptr, void *d_ptr, size_t count) {
     CUDA_ASSERT(cudaMemcpy(d_ptr, h_ptr, count, cudaMemcpyHostToDevice));
 }
 
-__host__ void copy_to_host(void *d_ptr, const void *h_ptr, size_t count) {
+__host__ void copy_to_host(const void *d_ptr, void *h_ptr, size_t count) {
     CUDA_ASSERT(cudaMemcpy(h_ptr, d_ptr, count, cudaMemcpyDeviceToHost));
 }
 
-- 
GitLab