Initialize sources on gpus when ATRIP_SOURCES_IN_GPU

This commit is contained in:
Ania Brown
2023-01-23 14:21:51 +01:00
committed by Alejandro Gallo
parent 9a5a2487be
commit 4af47a0bb7
2 changed files with 18 additions and 2 deletions

View File

@@ -418,6 +418,22 @@ template <typename F=double>
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 =