diff --git a/include/atrip/Slice.hpp b/include/atrip/Slice.hpp index 0990d42..3d12187 100644 --- a/include/atrip/Slice.hpp +++ b/include/atrip/Slice.hpp @@ -352,7 +352,7 @@ Info info; // [[file:~/cuda/atrip/atrip.org::*Attributes][Attributes:2]] DataPtr data; -#if defined(HAVE_CUDA) +#if defined(HAVE_CUDA && !defined ATRIP_SOURCES_IN_GPU) F* mpi_data; #endif // Attributes:2 ends here @@ -456,7 +456,7 @@ void unwrapAndMarkReady() { if (errorCode != MPI_SUCCESS) throw "Atrip: Unexpected error MPI ERROR"; -#if defined(HAVE_CUDA) +#if defined(HAVE_CUDA && !defined ATRIP_SOURCES_IN_GPU) // copy the retrieved mpi data to the device WITH_CHRONO("cuda:memcpy", _CHECK_CUDA_SUCCESS("copying mpi data to device", @@ -488,7 +488,7 @@ void unwrapAndMarkReady() { Slice(size_t size_) : info({}) , data(DataNullPtr) -#if defined(HAVE_CUDA) +#if defined(HAVE_CUDA && !defined ATRIP_SOURCES_IN_GPU) , mpi_data(nullptr) #endif , size(size_) diff --git a/include/atrip/SliceUnion.hpp b/include/atrip/SliceUnion.hpp index 0a44fe0..8813c23 100644 --- a/include/atrip/SliceUnion.hpp +++ b/include/atrip/SliceUnion.hpp @@ -571,12 +571,11 @@ template if (slice.info.state == Slice::Fetch) { // if-1 // TODO: do it through the slice class slice.info.state = Slice::Dispatched; -#if defined(HAVE_CUDA) -# if !defined(ATRIP_CUDA_AWARE_MPI) && defined(ATRIP_SOURCES_IN_GPU) +#if defined(HAVE_CUDA && defined ATRIP_SOURCES_IN_GPU) +# if !defined(ATRIP_CUDA_AWARE_MPI) # error "You need CUDA aware MPI to have slices on the GPU" # endif - slice.mpi_data = (F*)malloc(sizeof(F) * slice.size); - MPI_Irecv(slice.mpi_data, + MPI_Irecv((void*)slice.data, #else MPI_Irecv(slice.data, #endif