OpenLB 1.7
Loading...
Searching...
No Matches
Public Member Functions | Public Attributes | List of all members
olb::gpu::cuda::CyclicColumn< T >::Data Struct Reference

#include <column.hh>

+ Collaboration diagram for olb::gpu::cuda::CyclicColumn< T >::Data:

Public Member Functions

 Data (std::size_t count)
 
 ~Data ()
 

Public Attributes

const std::size_t size
 
std::unique_ptr< T[]> host
 
CUmemGenericAllocationHandle handle
 
CUmemAllocationProp prop {}
 
CUmemAccessDesc access {}
 
CUdeviceptr ptr
 

Detailed Description

template<typename T>
struct olb::gpu::cuda::CyclicColumn< T >::Data

Definition at line 218 of file column.hh.

Constructor & Destructor Documentation

◆ Data()

template<typename T >
olb::gpu::cuda::CyclicColumn< T >::Data::Data ( std::size_t count)
inline

Definition at line 228 of file column.hh.

228 :
229 host(new T[count] { }),
230 size(count * sizeof(T))
231 {
232 const int device = device::get();
233
234 prop.type = CU_MEM_ALLOCATION_TYPE_PINNED;
235 prop.location.type = CU_MEM_LOCATION_TYPE_DEVICE;
236 prop.location.id = device;
237 device::check(cuMemAddressReserve(&ptr, 2 * size, 0, 0, 0));
238
239 // per-population handle until cuMemMap accepts non-zero offset
240 device::check(cuMemCreate(&handle, size, &prop, 0));
241 device::check(cuMemMap(ptr, size, 0, handle, 0));
242 device::check(cuMemMap(ptr + size, size, 0, handle, 0));
243
244 access.location.type = CU_MEM_LOCATION_TYPE_DEVICE;
245 access.location.id = device;
246 access.flags = CU_MEM_ACCESS_FLAGS_PROT_READWRITE;
247 device::check(cuMemSetAccess(ptr, 2 * size, &access, 1));
248 }
std::unique_ptr< T[]> host
Definition column.hh:221

◆ ~Data()

template<typename T >
olb::gpu::cuda::CyclicColumn< T >::Data::~Data ( )
inline

Definition at line 250 of file column.hh.

250 {
251 device::check(cuMemUnmap(ptr, 2 * size));
252 device::check(cuMemRelease(handle));
253 device::check(cuMemAddressFree(ptr, 2 * size));
254 }

References olb::gpu::cuda::device::check(), and olb::gpu::cuda::CyclicColumn< T >::size().

+ Here is the call graph for this function:

Member Data Documentation

◆ access

template<typename T >
CUmemAccessDesc olb::gpu::cuda::CyclicColumn< T >::Data::access {}

Definition at line 225 of file column.hh.

225{};

◆ handle

template<typename T >
CUmemGenericAllocationHandle olb::gpu::cuda::CyclicColumn< T >::Data::handle

Definition at line 223 of file column.hh.

◆ host

template<typename T >
std::unique_ptr<T[]> olb::gpu::cuda::CyclicColumn< T >::Data::host

Definition at line 221 of file column.hh.

◆ prop

template<typename T >
CUmemAllocationProp olb::gpu::cuda::CyclicColumn< T >::Data::prop {}

Definition at line 224 of file column.hh.

224{};

◆ ptr

template<typename T >
CUdeviceptr olb::gpu::cuda::CyclicColumn< T >::Data::ptr

Definition at line 226 of file column.hh.

◆ size

template<typename T >
const std::size_t olb::gpu::cuda::CyclicColumn< T >::Data::size

Definition at line 219 of file column.hh.


The documentation for this struct was generated from the following file: