Vlasiator ebf0dd394 on dev (v5.4.0 + 1054 commits)
Loading...
Searching...
No Matches
arch_device_hip.h File Reference
#include <hip/hip_runtime.h>
#include <hipcub/hipcub.hpp>
#include <hipcub/device/device_radix_sort.hpp>
#include <omp.h>
Include dependency graph for arch_device_hip.h:

Go to the source code of this file.

Classes

class  arch::buf< T >

Namespaces

namespace  arch

Macros

#define gpuGetLastError   hipGetLastError
#define gpuGetErrorString   hipGetErrorString
#define gpuPeekAtLastError   hipPeekAtLastError
#define gpuSetDevice   hipSetDevice
#define gpuGetDevice   hipGetDevice
#define gpuGetDeviceCount   hipGetDeviceCount
#define gpuGetDeviceProperties   hipGetDeviceProperties
#define gpuDeviceGetAttribute   hipDeviceGetAttribute
#define gpuDeviceSynchronize   hipDeviceSynchronize
#define gpuDeviceReset   hipDeviceReset
#define gpuCpuDeviceId   hipCpuDeviceId
#define gpuMemGetInfo   hipMemGetInfo
#define gpuDevAttrMaxBlocksPerMultiprocessor   hipDeviceAttributeMaxBlocksPerMultiProcessor
#define gpuFree   hipFree
#define gpuFreeHost   hipHostFree
#define gpuFreeAsync(ptr, stream)
#define gpuMalloc   hipMalloc
#define gpuMallocHost   hipHostMalloc
#define gpuMallocAsync   hipMallocAsync
#define gpuMallocManaged   hipMallocManaged
#define gpuHostAlloc   hipHostMalloc
#define gpuHostAllocPortable   hipHostAllocPortable
#define gpuMemcpy   hipMemcpy
#define gpuMemcpyAsync   hipMemcpyAsync
#define gpuMemset   hipMemset
#define gpuMemsetAsync   hipMemsetAsync
#define gpuMemAdviseSetAccessedBy   hipMemAdviseSetAccessedBy
#define gpuMemAdviseSetPreferredLocation   hipMemAdviseSetPreferredLocation
#define gpuMemAttachSingle   hipMemAttachSingle
#define gpuMemAttachGlobal   hipMemAttachGlobal
#define gpuMemPrefetchAsync   hipMemPrefetchAsync
#define gpuStreamCreate   hipStreamCreate
#define gpuHostRegister   hipHostRegister
#define gpuHostRegisterPortable   hipHostRegisterPortable
#define gpuStreamDestroy   hipStreamDestroy
#define gpuStreamWaitEvent   hipStreamWaitEvent
#define gpuStreamSynchronize   hipStreamSynchronize
#define gpuStreamAttachMemAsync   hipStreamAttachMemAsync
#define gpuDeviceGetStreamPriorityRange   hipDeviceGetStreamPriorityRange
#define gpuStreamCreateWithPriority   hipStreamCreateWithPriority
#define gpuStreamDefault   hipStreamDefault
#define gpuEventCreate   hipEventCreate
#define gpuEventCreateWithFlags   hipEventCreateWithFlags
#define gpuEventDestroy   hipEventDestroy
#define gpuEventQuery   hipEventQuery
#define gpuEventRecord   hipEventRecord
#define gpuEventSynchronize   hipEventSynchronize
#define gpuEventElapsedTime   hipEventElapsedTime
#define gpuError_t   hipError_t
#define gpuSuccess   hipSuccess
#define gpuStream_t   hipStream_t
#define gpuDeviceProp   hipDeviceProp_t
#define gpuEvent_t   hipEvent_t
#define gpuEventDefault   hipEventDefault
#define gpuEventBlockingSync   hipEventBlockingSync
#define gpuEventDisableTiming   hipEventDisableTiming
#define gpuMemcpyKind   hipMemcpyKind
#define gpuMemcpyDeviceToHost   hipMemcpyDeviceToHost
#define gpuMemcpyHostToDevice   hipMemcpyHostToDevice
#define gpuMemcpyDeviceToDevice   hipMemcpyDeviceToDevice
#define gpuMemcpyHostToHost   hipMemcpyHostToHost
#define gpuMemcpyToSymbol   hipMemcpyToSymbol
#define gpuKernelBallot(mask, input)
#define gpuKernelAny(mask, input)
#define gpuKernelShfl(input, source, mask)
#define gpuKernelShflDown(val, offset)
#define gpuWarpSync()
#define ARCH_LOOP_LAMBDA   [=] __host__ __device__
#define ARCH_INNER_BODY2(i, j, aggregate)
#define ARCH_INNER_BODY3(i, j, k, aggregate)
#define ARCH_INNER_BODY4(i, j, k, l, aggregate)
#define HIPCUB_STDERR
#define ARCH_BLOCKSIZE_R   512
#define ARCH_BLOCKSIZE_R_SMALL   64
#define GPUTHREADS   (64)
#define WARPSPERBLOCK   (16)
#define FULL_MASK   0xffffffffffffffff
#define CHK_ERR(err)

Functions

static void hip_error (hipError_t err, const char *file, int line)
__device__ static __forceinline__ void arch::atomicMax (double *address, double val2)
__device__ static __forceinline__ void arch::atomicMin (double *address, double val2)
__device__ static __forceinline__ void arch::atomicMax (float *address, float val2)
__device__ static __forceinline__ void arch::atomicMin (float *address, float val2)
__host__ static __forceinline__ void arch::device_mempool_check (uint64_t threshold_new)
__host__ static __forceinline__ void * arch::allocate (size_t bytes)
__host__ static __forceinline__ void * arch::allocate (size_t bytes, hipStream_t stream)
template<typename T>
__host__ static __forceinline__ void arch::free (T *ptr)
template<typename T>
__host__ static __forceinline__ void arch::free (T *ptr, hipStream_t stream)
template<typename T>
static __forceinline__ void arch::memcpy_h2d (T *dst, T *src, size_t bytes)
template<typename T>
static __forceinline__ void arch::memcpy_h2d (T *dst, T *src, size_t bytes, hipStream_t stream)
template<typename T>
static __forceinline__ void arch::memcpy_d2h (T *dst, T *src, size_t bytes)
template<typename T>
static __forceinline__ void arch::memcpy_d2h (T *dst, T *src, size_t bytes, hipStream_t stream)
template<typename T>
static __forceinline__ void arch::host_register (T *ptr, size_t bytes)
template<typename T>
static __forceinline__ void arch::host_unregister (T *ptr)
template<typename Lambda, typename T>
__device__ static __forceinline__ void arch::lambda_eval (const uint(&idx)[1], T *__restrict__ thread_data, Lambda loop_body)
template<typename Lambda, typename T>
__device__ static __forceinline__ void arch::lambda_eval (const uint(&idx)[2], T *__restrict__ thread_data, Lambda loop_body)
template<typename Lambda, typename T>
__device__ static __forceinline__ void arch::lambda_eval (const uint(&idx)[3], T *__restrict__ thread_data, Lambda loop_body)
template<typename Lambda, typename T>
__device__ static __forceinline__ void arch::lambda_eval (const uint(&idx)[4], T *__restrict__ thread_data, Lambda loop_body)
template<uint NDim, typename Lambda, typename T>
__device__ static __forceinline__ void arch::loop_eval (const uint idx_glob, const uint *__restrict__ lims, T *__restrict__ thread_data, Lambda loop_body)
template<uint Blocksize, reduce_op Op, uint NDim, uint NReduStatic, typename Lambda, typename T>
static __global__ void arch::__launch_bounds__ (ARCH_BLOCKSIZE_R) reduction_kernel(Lambda loop_body
 arch::if (Op==reduce_op::null)
 arch::for (uint i=0;i< n_reductions;i++)
 arch::if (idx_glob< n_total)
template<reduce_op Op, uint NReduStatic, uint NDim, typename Lambda, typename T>
static __forceinline__ void arch::parallel_reduce_driver (const uint(&limits)[NDim], Lambda loop_body, T *sum, const uint n_redu_dynamic)

Variables

hipStream_t gpuStreamList []

Macro Definition Documentation

◆ ARCH_BLOCKSIZE_R

#define ARCH_BLOCKSIZE_R   512

Definition at line 104 of file arch_device_hip.h.

◆ ARCH_BLOCKSIZE_R_SMALL

#define ARCH_BLOCKSIZE_R_SMALL   64

Definition at line 105 of file arch_device_hip.h.

◆ ARCH_INNER_BODY2

#define ARCH_INNER_BODY2 ( i,
j,
aggregate )

Definition at line 96 of file arch_device_hip.h.

◆ ARCH_INNER_BODY3

#define ARCH_INNER_BODY3 ( i,
j,
k,
aggregate )

Definition at line 97 of file arch_device_hip.h.

◆ ARCH_INNER_BODY4

#define ARCH_INNER_BODY4 ( i,
j,
k,
l,
aggregate )

Definition at line 98 of file arch_device_hip.h.

◆ ARCH_LOOP_LAMBDA

#define ARCH_LOOP_LAMBDA   [=] __host__ __device__

Definition at line 95 of file arch_device_hip.h.

◆ CHK_ERR

#define CHK_ERR ( err)
Value:
(hip_error(err, __FILE__, __LINE__))
static void hip_error(hipError_t err, const char *file, int line)

Definition at line 119 of file arch_device_hip.h.

◆ FULL_MASK

#define FULL_MASK   0xffffffffffffffff

Definition at line 114 of file arch_device_hip.h.

◆ gpuCpuDeviceId

#define gpuCpuDeviceId   hipCpuDeviceId

Definition at line 24 of file arch_device_hip.h.

◆ gpuDevAttrMaxBlocksPerMultiprocessor

#define gpuDevAttrMaxBlocksPerMultiprocessor   hipDeviceAttributeMaxBlocksPerMultiProcessor

Definition at line 27 of file arch_device_hip.h.

◆ gpuDeviceGetAttribute

#define gpuDeviceGetAttribute   hipDeviceGetAttribute

Definition at line 21 of file arch_device_hip.h.

◆ gpuDeviceGetStreamPriorityRange

#define gpuDeviceGetStreamPriorityRange   hipDeviceGetStreamPriorityRange

Definition at line 57 of file arch_device_hip.h.

◆ gpuDeviceProp

#define gpuDeviceProp   hipDeviceProp_t

Definition at line 74 of file arch_device_hip.h.

◆ gpuDeviceReset

#define gpuDeviceReset   hipDeviceReset

Definition at line 23 of file arch_device_hip.h.

◆ gpuDeviceSynchronize

#define gpuDeviceSynchronize   hipDeviceSynchronize

Definition at line 22 of file arch_device_hip.h.

◆ gpuError_t

#define gpuError_t   hipError_t

Definition at line 70 of file arch_device_hip.h.

◆ gpuEvent_t

#define gpuEvent_t   hipEvent_t

Definition at line 76 of file arch_device_hip.h.

◆ gpuEventBlockingSync

#define gpuEventBlockingSync   hipEventBlockingSync

Definition at line 78 of file arch_device_hip.h.

◆ gpuEventCreate

#define gpuEventCreate   hipEventCreate

Definition at line 61 of file arch_device_hip.h.

◆ gpuEventCreateWithFlags

#define gpuEventCreateWithFlags   hipEventCreateWithFlags

Definition at line 62 of file arch_device_hip.h.

◆ gpuEventDefault

#define gpuEventDefault   hipEventDefault

Definition at line 77 of file arch_device_hip.h.

◆ gpuEventDestroy

#define gpuEventDestroy   hipEventDestroy

Definition at line 63 of file arch_device_hip.h.

◆ gpuEventDisableTiming

#define gpuEventDisableTiming   hipEventDisableTiming

Definition at line 79 of file arch_device_hip.h.

◆ gpuEventElapsedTime

#define gpuEventElapsedTime   hipEventElapsedTime

Definition at line 67 of file arch_device_hip.h.

◆ gpuEventQuery

#define gpuEventQuery   hipEventQuery

Definition at line 64 of file arch_device_hip.h.

◆ gpuEventRecord

#define gpuEventRecord   hipEventRecord

Definition at line 65 of file arch_device_hip.h.

◆ gpuEventSynchronize

#define gpuEventSynchronize   hipEventSynchronize

Definition at line 66 of file arch_device_hip.h.

◆ gpuFree

#define gpuFree   hipFree

Definition at line 29 of file arch_device_hip.h.

◆ gpuFreeAsync

#define gpuFreeAsync ( ptr,
stream )
Value:
hipFree(ptr)

Definition at line 31 of file arch_device_hip.h.

◆ gpuFreeHost

#define gpuFreeHost   hipHostFree

Definition at line 30 of file arch_device_hip.h.

◆ gpuGetDevice

#define gpuGetDevice   hipGetDevice

Definition at line 18 of file arch_device_hip.h.

◆ gpuGetDeviceCount

#define gpuGetDeviceCount   hipGetDeviceCount

Definition at line 19 of file arch_device_hip.h.

◆ gpuGetDeviceProperties

#define gpuGetDeviceProperties   hipGetDeviceProperties

Definition at line 20 of file arch_device_hip.h.

◆ gpuGetErrorString

#define gpuGetErrorString   hipGetErrorString

Definition at line 14 of file arch_device_hip.h.

◆ gpuGetLastError

#define gpuGetLastError   hipGetLastError

Definition at line 13 of file arch_device_hip.h.

◆ gpuHostAlloc

#define gpuHostAlloc   hipHostMalloc

Definition at line 36 of file arch_device_hip.h.

◆ gpuHostAllocPortable

#define gpuHostAllocPortable   hipHostAllocPortable

Definition at line 37 of file arch_device_hip.h.

◆ gpuHostRegister

#define gpuHostRegister   hipHostRegister

Definition at line 50 of file arch_device_hip.h.

◆ gpuHostRegisterPortable

#define gpuHostRegisterPortable   hipHostRegisterPortable

Definition at line 51 of file arch_device_hip.h.

◆ gpuKernelAny

#define gpuKernelAny ( mask,
input )
Value:
__any(input)

Definition at line 89 of file arch_device_hip.h.

◆ gpuKernelBallot

#define gpuKernelBallot ( mask,
input )
Value:
__ballot(input)

Definition at line 88 of file arch_device_hip.h.

◆ gpuKernelShfl

#define gpuKernelShfl ( input,
source,
mask )
Value:
__shfl(input, source)

Definition at line 90 of file arch_device_hip.h.

◆ gpuKernelShflDown

#define gpuKernelShflDown ( val,
offset )
Value:
__shfl_down(val, offset)

Definition at line 91 of file arch_device_hip.h.

◆ gpuMalloc

#define gpuMalloc   hipMalloc

Definition at line 32 of file arch_device_hip.h.

◆ gpuMallocAsync

#define gpuMallocAsync   hipMallocAsync

Definition at line 34 of file arch_device_hip.h.

◆ gpuMallocHost

#define gpuMallocHost   hipHostMalloc

Definition at line 33 of file arch_device_hip.h.

◆ gpuMallocManaged

#define gpuMallocManaged   hipMallocManaged

Definition at line 35 of file arch_device_hip.h.

◆ gpuMemAdviseSetAccessedBy

#define gpuMemAdviseSetAccessedBy   hipMemAdviseSetAccessedBy

Definition at line 43 of file arch_device_hip.h.

◆ gpuMemAdviseSetPreferredLocation

#define gpuMemAdviseSetPreferredLocation   hipMemAdviseSetPreferredLocation

Definition at line 44 of file arch_device_hip.h.

◆ gpuMemAttachGlobal

#define gpuMemAttachGlobal   hipMemAttachGlobal

Definition at line 46 of file arch_device_hip.h.

◆ gpuMemAttachSingle

#define gpuMemAttachSingle   hipMemAttachSingle

Definition at line 45 of file arch_device_hip.h.

◆ gpuMemcpy

#define gpuMemcpy   hipMemcpy

Definition at line 38 of file arch_device_hip.h.

◆ gpuMemcpyAsync

#define gpuMemcpyAsync   hipMemcpyAsync

Definition at line 39 of file arch_device_hip.h.

◆ gpuMemcpyDeviceToDevice

#define gpuMemcpyDeviceToDevice   hipMemcpyDeviceToDevice

Definition at line 84 of file arch_device_hip.h.

◆ gpuMemcpyDeviceToHost

#define gpuMemcpyDeviceToHost   hipMemcpyDeviceToHost

Definition at line 82 of file arch_device_hip.h.

◆ gpuMemcpyHostToDevice

#define gpuMemcpyHostToDevice   hipMemcpyHostToDevice

Definition at line 83 of file arch_device_hip.h.

◆ gpuMemcpyHostToHost

#define gpuMemcpyHostToHost   hipMemcpyHostToHost

Definition at line 85 of file arch_device_hip.h.

◆ gpuMemcpyKind

#define gpuMemcpyKind   hipMemcpyKind

Definition at line 81 of file arch_device_hip.h.

◆ gpuMemcpyToSymbol

#define gpuMemcpyToSymbol   hipMemcpyToSymbol

Definition at line 86 of file arch_device_hip.h.

◆ gpuMemGetInfo

#define gpuMemGetInfo   hipMemGetInfo

Definition at line 25 of file arch_device_hip.h.

◆ gpuMemPrefetchAsync

#define gpuMemPrefetchAsync   hipMemPrefetchAsync

Definition at line 47 of file arch_device_hip.h.

◆ gpuMemset

#define gpuMemset   hipMemset

Definition at line 40 of file arch_device_hip.h.

◆ gpuMemsetAsync

#define gpuMemsetAsync   hipMemsetAsync

Definition at line 41 of file arch_device_hip.h.

◆ gpuPeekAtLastError

#define gpuPeekAtLastError   hipPeekAtLastError

Definition at line 15 of file arch_device_hip.h.

◆ gpuSetDevice

#define gpuSetDevice   hipSetDevice

Definition at line 17 of file arch_device_hip.h.

◆ gpuStream_t

#define gpuStream_t   hipStream_t

Definition at line 73 of file arch_device_hip.h.

◆ gpuStreamAttachMemAsync

#define gpuStreamAttachMemAsync   hipStreamAttachMemAsync

Definition at line 56 of file arch_device_hip.h.

◆ gpuStreamCreate

#define gpuStreamCreate   hipStreamCreate

Definition at line 49 of file arch_device_hip.h.

◆ gpuStreamCreateWithPriority

#define gpuStreamCreateWithPriority   hipStreamCreateWithPriority

Definition at line 58 of file arch_device_hip.h.

◆ gpuStreamDefault

#define gpuStreamDefault   hipStreamDefault

Definition at line 59 of file arch_device_hip.h.

◆ gpuStreamDestroy

#define gpuStreamDestroy   hipStreamDestroy

Definition at line 53 of file arch_device_hip.h.

◆ gpuStreamSynchronize

#define gpuStreamSynchronize   hipStreamSynchronize

Definition at line 55 of file arch_device_hip.h.

◆ gpuStreamWaitEvent

#define gpuStreamWaitEvent   hipStreamWaitEvent

Definition at line 54 of file arch_device_hip.h.

◆ gpuSuccess

#define gpuSuccess   hipSuccess

Definition at line 71 of file arch_device_hip.h.

◆ GPUTHREADS

#define GPUTHREADS   (64)

Definition at line 109 of file arch_device_hip.h.

◆ gpuWarpSync

#define gpuWarpSync ( )
Value:
((void)0)

Definition at line 92 of file arch_device_hip.h.

◆ HIPCUB_STDERR

#define HIPCUB_STDERR

Definition at line 101 of file arch_device_hip.h.

◆ WARPSPERBLOCK

#define WARPSPERBLOCK   (16)

Definition at line 112 of file arch_device_hip.h.

Function Documentation

◆ hip_error()

void hip_error ( hipError_t err,
const char * file,
int line )
inlinestatic

Definition at line 120 of file arch_device_hip.h.

Variable Documentation

◆ gpuStreamList

hipStream_t gpuStreamList[]
extern

Definition at line 51 of file gpu_base.cpp.