#include <gpu.h>
Definition at line 36 of file gpu.h.
◆ GPU()
GPU::GPU |
( |
int |
device = 0 , |
|
|
int |
stream = 0 |
|
) |
| |
|
inlineexplicit |
Definition at line 38 of file gpu.h.
41 m_streamId(
stream), m_stream(
nullptr),
HW(unsigned parallelUnits)
◆ ~GPU()
Definition at line 32 of file gpu.cpp.
35 auto s = (cudaStream_t*)m_stream;
37 delete (cudaStream_t*)m_stream;
◆ device()
int GPU::device |
( |
| ) |
const |
|
inline |
Definition at line 46 of file gpu.h.
◆ getCudaVersion()
int GPU::getCudaVersion |
( |
| ) |
|
◆ getDeviceCount()
int GPU::getDeviceCount |
( |
| ) |
|
|
static |
◆ getUUID()
std::string GPU::getUUID |
( |
| ) |
const |
|
inlinevirtual |
Reimplemented from HW.
Definition at line 90 of file gpu.h.
virtual std::string getUUID() const
check(nparam, nf, nfsr, &Linfty, nineq, nineqn, neq, neqn, ncsrl, ncsrn, mode, &modem, eps, bgbnd, param)
◆ isGpuPointer()
bool GPU::isGpuPointer |
( |
const void * |
p | ) |
|
Definition at line 153 of file gpu.cpp.
154 cudaPointerAttributes attr;
155 if (cudaPointerGetAttributes(&attr, p) == cudaErrorInvalidValue) {
159 #if defined(CUDART_VERSION) && CUDART_VERSION >= 10000 160 return (cudaMemoryTypeDevice == attr.type) || (cudaMemoryTypeManaged == attr.type);
162 return cudaMemoryTypeDevice == attr.memoryType;
◆ isMemoryLocked()
bool GPU::isMemoryLocked |
( |
const void * |
h_mem | ) |
|
|
inlineoverridevirtual |
Implements HW.
Definition at line 112 of file gpu.h.
static bool isMemoryPinned(const void *h_mem)
◆ isMemoryPinned()
bool GPU::isMemoryPinned |
( |
const void * |
h_mem | ) |
|
|
static |
Definition at line 140 of file gpu.cpp.
141 cudaPointerAttributes attr;
142 if (cudaPointerGetAttributes(&attr, h_mem) != cudaSuccess) {
146 #if defined(CUDART_VERSION) && CUDART_VERSION >= 10000 147 return (cudaMemoryTypeHost == attr.type) || (cudaMemoryTypeManaged == attr.type);
149 return cudaMemoryTypeHost == attr.memoryType;
◆ isSet()
bool GPU::isSet |
( |
| ) |
const |
|
inline |
Definition at line 95 of file gpu.h.
◆ lastFreeBytes()
size_t GPU::lastFreeBytes |
( |
| ) |
const |
|
inlinevirtual |
Reimplemented from HW.
Definition at line 59 of file gpu.h.
virtual size_t lastFreeBytes() const
check(nparam, nf, nfsr, &Linfty, nineq, nineqn, neq, neqn, ncsrl, ncsrn, mode, &modem, eps, bgbnd, param)
◆ lastUsedBytes()
size_t GPU::lastUsedBytes |
( |
| ) |
const |
|
inlinevirtual |
Reimplemented from HW.
Definition at line 69 of file gpu.h.
virtual size_t lastUsedBytes() const
check(nparam, nf, nfsr, &Linfty, nineq, nineqn, neq, neqn, ncsrl, ncsrn, mode, &modem, eps, bgbnd, param)
◆ lockMemory()
void GPU::lockMemory |
( |
const void * |
h_mem, |
|
|
size_t |
bytes |
|
) |
| |
|
inlineoverridevirtual |
Implements HW.
Definition at line 104 of file gpu.h.
static void pinMemory(const void *h_mem, size_t bytes, unsigned int flags=0)
◆ peekLastError()
void GPU::peekLastError |
( |
| ) |
const |
Definition at line 87 of file gpu.cpp.
check(nparam, nf, nfsr, &Linfty, nineq, nineqn, neq, neqn, ncsrl, ncsrn, mode, &modem, eps, bgbnd, param)
◆ pinMemory()
void GPU::pinMemory |
( |
const void * |
h_mem, |
|
|
size_t |
bytes, |
|
|
unsigned int |
flags = 0 |
|
) |
| |
|
static |
Definition at line 92 of file gpu.cpp.
98 assert(0 == cudaHostRegisterDefault);
100 if (0 != ((
size_t)h_mem % 4096)) {
105 gpuErrchk(cudaHostRegister(const_cast<void*>(h_mem), bytes, flags));
#define REPORT_ERROR(nerr, ErrormMsg)
static bool isMemoryPinned(const void *h_mem)
◆ set()
Reimplemented from HW.
Definition at line 50 of file gpu.cpp.
55 m_stream =
new cudaStream_t;
56 gpuErrchk(cudaStreamCreate((cudaStream_t*)m_stream));
static void setDevice(int device)
void peekLastError() const
◆ setDevice()
void GPU::setDevice |
( |
int |
device | ) |
|
|
static |
◆ stream()
void* GPU::stream |
( |
| ) |
const |
|
inline |
Definition at line 50 of file gpu.h.
check(nparam, nf, nfsr, &Linfty, nineq, nineqn, neq, neqn, ncsrl, ncsrn, mode, &modem, eps, bgbnd, param)
◆ streamId()
int GPU::streamId |
( |
| ) |
const |
|
inline |
Definition at line 55 of file gpu.h.
◆ synch()
void GPU::synch |
( |
| ) |
const |
|
virtual |
Implements HW.
Definition at line 129 of file gpu.cpp.
131 auto stream = (cudaStream_t*)m_stream;
check(nparam, nf, nfsr, &Linfty, nineq, nineqn, neq, neqn, ncsrl, ncsrn, mode, &modem, eps, bgbnd, param)
◆ synchAll()
void GPU::synchAll |
( |
| ) |
const |
|
virtual |
Implements HW.
Definition at line 124 of file gpu.cpp.
check(nparam, nf, nfsr, &Linfty, nineq, nineqn, neq, neqn, ncsrl, ncsrn, mode, &modem, eps, bgbnd, param)
◆ totalBytes()
size_t GPU::totalBytes |
( |
| ) |
const |
|
inlinevirtual |
Reimplemented from HW.
Definition at line 64 of file gpu.h.
virtual size_t totalBytes() const
check(nparam, nf, nfsr, &Linfty, nineq, nineqn, neq, neqn, ncsrl, ncsrn, mode, &modem, eps, bgbnd, param)
◆ unlockMemory()
void GPU::unlockMemory |
( |
const void * |
h_mem | ) |
|
|
inlineoverridevirtual |
Implements HW.
Definition at line 108 of file gpu.h.
static void unpinMemory(const void *h_mem)
◆ unpinMemory()
void GPU::unpinMemory |
( |
const void * |
h_mem | ) |
|
|
static |
Definition at line 108 of file gpu.cpp.
110 auto err = cudaHostUnregister(const_cast<void*>(h_mem));
111 if (cudaErrorHostMemoryNotRegistered == err) {
◆ updateMemoryInfo()
void GPU::updateMemoryInfo |
( |
| ) |
|
|
virtual |
Implements HW.
Definition at line 82 of file gpu.cpp.
check(nparam, nf, nfsr, &Linfty, nineq, nineqn, neq, neqn, ncsrl, ncsrn, mode, &modem, eps, bgbnd, param)
The documentation for this class was generated from the following files:
- xmipp/libraries/reconstruction_cuda/gpu.h
- xmipp/libraries/reconstruction_cuda/gpu.cpp