1
0
mirror of https://github.com/paboyle/Grid.git synced 2024-09-20 09:15:38 +01:00

interface cleanup

This commit is contained in:
Christoph Lehner 2020-05-03 08:58:32 -04:00
parent 949be9605c
commit 38532753f4

View File

@ -50,6 +50,14 @@ void accelerator_inline conformable(GridBase *lhs,GridBase *rhs)
assert(lhs == rhs); assert(lhs == rhs);
} }
////////////////////////////////////////////////////////////////////////////
// Advise for memory management
////////////////////////////////////////////////////////////////////////////
enum LatticeAcceleratorAdvise {
AdviseInfrequentUse = 0x1 // Advise that the data is used infrequently. This can
// significantly influence performance of bulk storage.
};
//////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////
// Minimal base class containing only data valid to access from accelerator // Minimal base class containing only data valid to access from accelerator
// _odata will be a managed pointer in CUDA // _odata will be a managed pointer in CUDA
@ -77,12 +85,12 @@ public:
else grid = _grid; else grid = _grid;
}; };
// Advise that the data is used infrequently. This can accelerator_inline void Advise(int advise) {
// significantly influence performance of bulk storage.
accelerator_inline void AdviseInfrequentUse() {
#ifdef GRID_NVCC #ifdef GRID_NVCC
#ifndef __CUDA_ARCH__ // only on host #ifndef __CUDA_ARCH__ // only on host
cudaMemAdvise(_odata,_odata_size*sizeof(vobj),cudaMemAdviseSetPreferredLocation,cudaCpuDeviceId); if (advise & AdviseInfrequentUse) {
cudaMemAdvise(_odata,_odata_size*sizeof(vobj),cudaMemAdviseSetPreferredLocation,cudaCpuDeviceId);
}
#endif #endif
#endif #endif
}; };