Vlasiator ebf0dd394 on dev (v5.4.0 + 1054 commits)
Loading...
Searching...
No Matches
gpu_base.hpp File Reference
#include "arch_device_api.h"
#include <stdio.h>
#include <mutex>
#include "include/splitvector/splitvec.h"
#include "include/hashinator/hashinator.h"
#include "../definitions.h"
#include "../vlasovsolver/vec.h"
#include "../velocity_mesh_parameters.h"
#include <phiprof.hpp>
Include dependency graph for gpu_base.hpp:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  ColumnOffsets
struct  GPUMemoryManager

Macros

#define THREADS_PER_MP   2048
#define REGISTERS_PER_MP   65536
#define MAXCPUTHREADS   512
#define NO_POINTER_DEVICE   0
#define DEVICE_POINTER   1
#define HOST_POINTER   2
#define SINGLE_ARG(...)
#define DEFINITIONS_HERE
#define DEFINITIONS_END
#define CREATE_UNIQUE_POINTER(object, member)
#define CREATE_SUBPOINTERS(object, member, amount)
#define ALLOCATE_GPU(object, member, bytes)
#define ALLOCATE_WITH_BUFFER(object, member, bytes, buffer)
#define HOST_ALLOCATE_GPU(object, member, bytes)
#define HOST_ALLOCATE_WITH_BUFFER(object, member, bytes, buffer)
#define SUBPOINTER_ALLOCATE(object, member, index, bytes)
#define SUBPOINTER_HOST_ALLOCATE(object, member, index, bytes)
#define SESSION_ALLOCATE(object, type, member, bytes)
#define SESSION_HOST_ALLOCATE(object, type, member, bytes)
#define ALLOCATE_GPU_ASYNC(object, member, bytes, stream)
#define SUBPOINTER_ALLOCATE_ASYNC(object, member, index, bytes, stream)
#define GET_POINTER(object, type, member)
#define GET_SUBPOINTER(object, type, member, index)
#define GET_SESSION_POINTER(object, type, member)
#define GET_SESSION_HOST_POINTER(object, type, member)
#define SET_SUBPOINTER(object, type, member, index, subPointerIndex)

Functions

static const uint INIT_VMESH_SIZE (32768/WID3)
static const uint INIT_MAP_SIZE (16 - WID)
void gpu_init_device ()
void gpu_clear_device ()
gpuStream_t gpu_getStream ()
gpuStream_t gpu_getPriorityStream ()
uint gpu_getThread ()
uint gpu_getMaxThreads ()
int gpu_getDevice ()
uint gpu_getAllocationCount ()
int gpu_reportMemory (const size_t local_cap=0, const size_t ghost_cap=0, const size_t local_size=0, const size_t ghost_size=0)
unsigned int nextPowerOfTwo (unsigned int n)
void gpu_vlasov_allocate (uint maxBlockCount)
void gpu_calculateProbeAllocation (uint maxBlockCount)
void gpu_vlasov_deallocate ()
void gpu_vlasov_allocate_perthread (uint cpuThreadID, uint maxBlockCount)
uint gpu_vlasov_getSmallestAllocation ()
void gpu_batch_allocate (uint nCells=0, uint maxNeighbours=0)
void gpu_acc_allocate (uint maxBlockCount)
void gpu_acc_allocate_perthread (uint cpuThreadID, uint firstAllocationCount, uint columnSetAllocationCount=0)
void gpu_acc_deallocate ()
void gpu_trans_allocate (cuint nAllCells=0, cuint largestVmesh=0, cuint unionSetSize=0)
void gpu_trans_deallocate ()

Variables

int gpuMultiProcessorCount
int blocksPerMP
int threadsPerMP
static const uint VLASOV_BUFFER_MINBLOCKS = 32768/WID3
static const uint VLASOV_BUFFER_MINCOLUMNS = 2000/WID
static const double BLOCK_ALLOCATION_PADDING = 1.2
static const double BLOCK_ALLOCATION_FACTOR = 1.1
static const int GPU_PROBEFLAT_N = 5
static const int TRANSLATION_BUFFER_ALLOCATION_FACTOR = 5
gpuStream_t gpuStreamList []
gpuStream_t gpuPriorityStreamList []
GPUMemoryManager gpuMemoryManager
ColumnOffsetshost_columnOffsetData
uint gpu_largest_columnCount
size_t gpu_probeFullSize
size_t gpu_probeFlattenedSize
size_t gpu_probeStride
std::vector< uint > gpu_vlasov_allocatedSize
uint gpu_acc_allocatedColumns
uint gpu_acc_foundColumnsCount

Macro Definition Documentation

◆ ALLOCATE_GPU

#define ALLOCATE_GPU ( object,
member,
bytes )
Value:
object.allocate(object.member, bytes)

Definition at line 403 of file gpu_base.hpp.

◆ ALLOCATE_GPU_ASYNC

#define ALLOCATE_GPU_ASYNC ( object,
member,
bytes,
stream )
Value:
object.allocateAsync(object.member, bytes, stream)

Definition at line 643 of file gpu_base.hpp.

◆ ALLOCATE_WITH_BUFFER

#define ALLOCATE_WITH_BUFFER ( object,
member,
bytes,
buffer )
Value:
object.allocateWithBuffer(object.member, bytes, buffer)

Definition at line 429 of file gpu_base.hpp.

◆ CREATE_SUBPOINTERS

#define CREATE_SUBPOINTERS ( object,
member,
amount )
Value:
object.createSubPointers(object.member, amount)

Definition at line 322 of file gpu_base.hpp.

◆ CREATE_UNIQUE_POINTER

#define CREATE_UNIQUE_POINTER ( object,
member )
Value:
object.createPointer(object.member)

Definition at line 296 of file gpu_base.hpp.

◆ DEFINITIONS_END

#define DEFINITIONS_END

Definition at line 290 of file gpu_base.hpp.

◆ DEFINITIONS_HERE

#define DEFINITIONS_HERE

Definition at line 288 of file gpu_base.hpp.

◆ DEVICE_POINTER

#define DEVICE_POINTER   1

Definition at line 276 of file gpu_base.hpp.

◆ GET_POINTER

#define GET_POINTER ( object,
type,
member )
Value:
object.getPointer<type>(object.member)

Definition at line 809 of file gpu_base.hpp.

◆ GET_SESSION_HOST_POINTER

#define GET_SESSION_HOST_POINTER ( object,
type,
member )
Value:
object.getSessionHostPointer<type>(object.member)

Definition at line 853 of file gpu_base.hpp.

◆ GET_SESSION_POINTER

#define GET_SESSION_POINTER ( object,
type,
member )
Value:
object.getSessionPointer<type>(object.member)

Definition at line 833 of file gpu_base.hpp.

◆ GET_SUBPOINTER

#define GET_SUBPOINTER ( object,
type,
member,
index )
Value:
object.getSubPointer<type>(object.member, index)
#define index(i, j, k)

Definition at line 819 of file gpu_base.hpp.

◆ HOST_ALLOCATE_GPU

#define HOST_ALLOCATE_GPU ( object,
member,
bytes )
Value:
object.hostAllocate(object.member, bytes)

Definition at line 455 of file gpu_base.hpp.

◆ HOST_ALLOCATE_WITH_BUFFER

#define HOST_ALLOCATE_WITH_BUFFER ( object,
member,
bytes,
buffer )
Value:
object.hostAllocateWithBuffer(object.member, bytes, buffer)

Definition at line 481 of file gpu_base.hpp.

◆ HOST_POINTER

#define HOST_POINTER   2

Definition at line 277 of file gpu_base.hpp.

◆ MAXCPUTHREADS

#define MAXCPUTHREADS   512

Definition at line 73 of file gpu_base.hpp.

◆ NO_POINTER_DEVICE

#define NO_POINTER_DEVICE   0

Definition at line 275 of file gpu_base.hpp.

◆ REGISTERS_PER_MP

#define REGISTERS_PER_MP   65536

Definition at line 45 of file gpu_base.hpp.

◆ SESSION_ALLOCATE

#define SESSION_ALLOCATE ( object,
type,
member,
bytes )
Value:
object.sessionAllocate<type>(object.member, bytes)

Definition at line 557 of file gpu_base.hpp.

◆ SESSION_HOST_ALLOCATE

#define SESSION_HOST_ALLOCATE ( object,
type,
member,
bytes )
Value:
object.sessionHostAllocate<type>(object.member, bytes)

Definition at line 600 of file gpu_base.hpp.

◆ SET_SUBPOINTER

#define SET_SUBPOINTER ( object,
type,
member,
index,
subPointerIndex )
Value:
object.setSubPointer<type>(object.member, index, subPointerIndex)

Definition at line 879 of file gpu_base.hpp.

◆ SINGLE_ARG

#define SINGLE_ARG ( ...)
Value:
__VA_ARGS__

Definition at line 280 of file gpu_base.hpp.

◆ SUBPOINTER_ALLOCATE

#define SUBPOINTER_ALLOCATE ( object,
member,
index,
bytes )
Value:
object.subPointerAllocate(object.member, index, bytes)

Definition at line 507 of file gpu_base.hpp.

◆ SUBPOINTER_ALLOCATE_ASYNC

#define SUBPOINTER_ALLOCATE_ASYNC ( object,
member,
index,
bytes,
stream )
Value:
object.subPointerAllocateAsync(object.member, index, bytes, stream)

Definition at line 669 of file gpu_base.hpp.

◆ SUBPOINTER_HOST_ALLOCATE

#define SUBPOINTER_HOST_ALLOCATE ( object,
member,
index,
bytes )
Value:
object.subPointerHostAllocate(object.member, index, bytes)

Definition at line 534 of file gpu_base.hpp.

◆ THREADS_PER_MP

#define THREADS_PER_MP   2048

Definition at line 42 of file gpu_base.hpp.

Function Documentation

◆ gpu_acc_allocate()

void gpu_acc_allocate ( uint maxBlockCount)

Definition at line 537 of file gpu_base.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ gpu_acc_allocate_perthread()

void gpu_acc_allocate_perthread ( uint cpuThreadID,
uint firstAllocationCount,
uint columnSetAllocationCount = 0 )

Definition at line 567 of file gpu_base.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ gpu_acc_deallocate()

void gpu_acc_deallocate ( )

Definition at line 556 of file gpu_base.cpp.

Here is the caller graph for this function:

◆ gpu_batch_allocate()

void gpu_batch_allocate ( uint nCells,
uint maxNeighbours )

Allocation and deallocation for pointers used by batch operations in block adjustment

Definition at line 462 of file gpu_base.cpp.

Here is the caller graph for this function:

◆ gpu_calculateProbeAllocation()

void gpu_calculateProbeAllocation ( uint maxBlockCount)

Definition at line 359 of file gpu_base.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ gpu_clear_device()

void gpu_clear_device ( )

Definition at line 229 of file gpu_base.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ gpu_getAllocationCount()

uint gpu_getAllocationCount ( )

Definition at line 259 of file gpu_base.cpp.

Here is the caller graph for this function:

◆ gpu_getDevice()

int gpu_getDevice ( )

Definition at line 253 of file gpu_base.cpp.

Here is the caller graph for this function:

◆ gpu_getMaxThreads()

uint gpu_getMaxThreads ( )

Definition at line 84 of file gpu_base.cpp.

Here is the caller graph for this function:

◆ gpu_getPriorityStream()

gpuStream_t gpu_getPriorityStream ( )

Definition at line 248 of file gpu_base.cpp.

Here is the call graph for this function:

◆ gpu_getStream()

gpuStream_t gpu_getStream ( )

Definition at line 244 of file gpu_base.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ gpu_getThread()

uint gpu_getThread ( )

Definition at line 77 of file gpu_base.cpp.

Here is the caller graph for this function:

◆ gpu_init_device()

void gpu_init_device ( )

Definition at line 103 of file gpu_base.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ gpu_reportMemory()

int gpu_reportMemory ( const size_t local_cap = 0,
const size_t ghost_cap = 0,
const size_t local_size = 0,
const size_t ghost_size = 0 )

Definition at line 266 of file gpu_base.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ gpu_trans_allocate()

void gpu_trans_allocate ( cuint nAllCells = 0,
cuint largestVmesh = 0,
cuint unionSetSize = 0 )

Definition at line 607 of file gpu_base.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ gpu_trans_deallocate()

void gpu_trans_deallocate ( )

Definition at line 663 of file gpu_base.cpp.

Here is the caller graph for this function:

◆ gpu_vlasov_allocate()

void gpu_vlasov_allocate ( uint maxBlockCount)

Definition at line 335 of file gpu_base.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ gpu_vlasov_allocate_perthread()

void gpu_vlasov_allocate_perthread ( uint cpuThreadID,
uint maxBlockCount )

Definition at line 421 of file gpu_base.cpp.

Here is the caller graph for this function:

◆ gpu_vlasov_deallocate()

void gpu_vlasov_deallocate ( )

Definition at line 401 of file gpu_base.cpp.

Here is the caller graph for this function:

◆ gpu_vlasov_getSmallestAllocation()

uint gpu_vlasov_getSmallestAllocation ( )

Definition at line 410 of file gpu_base.cpp.

Here is the caller graph for this function:

◆ INIT_MAP_SIZE()

const uint INIT_MAP_SIZE ( 16 - WID)
static

◆ INIT_VMESH_SIZE()

const uint INIT_VMESH_SIZE ( 32768/ WID3)
static
Here is the caller graph for this function:

◆ nextPowerOfTwo()

unsigned int nextPowerOfTwo ( unsigned int n)

Definition at line 92 of file gpu_base.cpp.

Here is the caller graph for this function:

Variable Documentation

◆ BLOCK_ALLOCATION_FACTOR

const double BLOCK_ALLOCATION_FACTOR = 1.1
static

Definition at line 61 of file gpu_base.hpp.

◆ BLOCK_ALLOCATION_PADDING

const double BLOCK_ALLOCATION_PADDING = 1.2
static

Definition at line 60 of file gpu_base.hpp.

◆ blocksPerMP

int blocksPerMP
extern

Definition at line 43 of file gpu_base.cpp.

◆ gpu_acc_allocatedColumns

uint gpu_acc_allocatedColumns
extern

◆ gpu_acc_foundColumnsCount

uint gpu_acc_foundColumnsCount
extern

◆ gpu_largest_columnCount

uint gpu_largest_columnCount
extern

Definition at line 75 of file gpu_base.cpp.

◆ GPU_PROBEFLAT_N

const int GPU_PROBEFLAT_N = 5
static

Definition at line 65 of file gpu_base.hpp.

◆ gpu_probeFlattenedSize

size_t gpu_probeFlattenedSize

Definition at line 897 of file gpu_base.hpp.

◆ gpu_probeFullSize

size_t gpu_probeFullSize
extern

Definition at line 57 of file gpu_base.cpp.

◆ gpu_probeStride

size_t gpu_probeStride

Definition at line 897 of file gpu_base.hpp.

◆ gpu_vlasov_allocatedSize

std::vector<uint> gpu_vlasov_allocatedSize
extern

Definition at line 69 of file gpu_base.cpp.

◆ gpuMemoryManager

GPUMemoryManager gpuMemoryManager
extern

Definition at line 64 of file gpu_base.cpp.

◆ gpuMultiProcessorCount

int gpuMultiProcessorCount
extern

Definition at line 42 of file gpu_base.cpp.

◆ gpuPriorityStreamList

gpuStream_t gpuPriorityStreamList[]
extern

Definition at line 52 of file gpu_base.cpp.

◆ gpuStreamList

gpuStream_t gpuStreamList[]
extern

Definition at line 51 of file gpu_base.cpp.

◆ host_columnOffsetData

ColumnOffsets* host_columnOffsetData
extern

Definition at line 55 of file gpu_base.cpp.

◆ threadsPerMP

int threadsPerMP
extern

Definition at line 44 of file gpu_base.cpp.

◆ TRANSLATION_BUFFER_ALLOCATION_FACTOR

const int TRANSLATION_BUFFER_ALLOCATION_FACTOR = 5
static

Definition at line 71 of file gpu_base.hpp.

◆ VLASOV_BUFFER_MINBLOCKS

const uint VLASOV_BUFFER_MINBLOCKS = 32768/WID3
static

Definition at line 56 of file gpu_base.hpp.

◆ VLASOV_BUFFER_MINCOLUMNS

const uint VLASOV_BUFFER_MINCOLUMNS = 2000/WID
static

Definition at line 57 of file gpu_base.hpp.