diff --git a/include/atrip/SliceUnion.hpp b/include/atrip/SliceUnion.hpp index bd04709..0a44fe0 100644 --- a/include/atrip/SliceUnion.hpp +++ b/include/atrip/SliceUnion.hpp @@ -418,6 +418,22 @@ template LOG(0,"Atrip") << "INIT SliceUnion: " << name << "\n"; +#if defined(ATRIP_SOURCES_IN_GPU) + for (auto& ptr: sources) { + const CUresult sourceError = + cuMemAlloc(&ptr, sizeof(F) * sliceSize); + if (ptr == 0UL) { + throw "UNSUFICCIENT MEMORY ON THE GRAPHIC CARD FOR SOURCES"; + } + if (sourceError != CUDA_SUCCESS) { + std::stringstream s; + s << "Error allocating memory for sources " + << "code " << sourceError << "\n"; + throw s.str(); + } + } +#endif + for (auto& ptr: sliceBuffers) { #if defined(HAVE_CUDA) const CUresult error = diff --git a/src/atrip/Atrip.cxx b/src/atrip/Atrip.cxx index e63e9c5..54c68a0 100644 --- a/src/atrip/Atrip.cxx +++ b/src/atrip/Atrip.cxx @@ -688,7 +688,7 @@ Atrip::Output Atrip::run(Atrip::Input const& in) { #if defined(HAVE_CUDA) double *tupleEnergy; cuMemAlloc((DataPtr*)&tupleEnergy, sizeof(double)); -#elif +#else double _tupleEnergy(0.); double *tupleEnergy = &_tupleEnergy; #endif /* defined(HAVE_CUDA) */ @@ -727,7 +727,7 @@ Atrip::Output Atrip::run(Atrip::Input const& in) { cuMemcpyDtoH((void*)&host_tuple_energy, (DataPtr)tupleEnergy, sizeof(double)); -#elif +#else double host_tuple_energy = *tupleEnergy; #endif /* defined(HAVE_CUDA) */