Initialize sources on gpus when ATRIP_SOURCES_IN_GPU
This commit is contained in:
parent
9a5a2487be
commit
4af47a0bb7
@ -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 =
|
||||
|
||||
@ -688,7 +688,7 @@ Atrip::Output Atrip::run(Atrip::Input<F> const& in) {
|
||||
#if defined(HAVE_CUDA)
|
||||
double *tupleEnergy;
|
||||
cuMemAlloc((DataPtr<double>*)&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<F> const& in) {
|
||||
cuMemcpyDtoH((void*)&host_tuple_energy,
|
||||
(DataPtr<double>)tupleEnergy,
|
||||
sizeof(double));
|
||||
#elif
|
||||
#else
|
||||
double host_tuple_energy = *tupleEnergy;
|
||||
#endif /* defined(HAVE_CUDA) */
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user