MaCh3 2.2.1
Reference Guide
Loading...
Searching...
No Matches
gpuUtils.cuh
Go to the documentation of this file.
1#pragma once
2
3
4// C i/o for printf and others
5#include <stdio.h>
6#include <vector>
7
8// CUDA specifics
9// Because CUDA is cuda, need to make sure we don't check C-style floats...
10#pragma GCC diagnostic push
11#pragma GCC diagnostic ignored "-Wold-style-cast"
12#include <cuda_runtime.h>
13#pragma GCC diagnostic pop
14
15#ifdef CUDA_ERROR_CHECK
16#include <helper_functions.h>
17#include <helper_cuda.h>
18#endif
19
20// Define the macros
21#define CudaSafeCall(err) __cudaSafeCall(err, __FILE__, __LINE__)
22#define CudaCheckError() __cudaCheckError(__FILE__, __LINE__)
23
25#define _BlockSize_ 1024
26
27
32
35
36
37// **************************************************
38// ERROR CHECKING ROUTINES
39// Also exist in helper_cuda.h
40// **************************************************
41
47void __cudaSafeCall( cudaError err, const char *file, const int line );
48
53void __cudaCheckError( const char *file, const int line );
54
55// *******************************************
56// Utils
57// *******************************************
58
59// *******************************************
61void checkGpuMem();
62
64void PrintNdevices();
65
67void ResetDevice();
68
71void SetDevice(const int deviceId);
72
76int GetNumGPUThreads(const int Device = 0);
77
81size_t GetL2CacheSize(const int device = 0);
82
86size_t GetMaxTexture1DSize(const int device = 0);
87
91size_t GetSharedMemoryPerBlock(const int device = 0);
size_t GetL2CacheSize(const int device=0)
KS: Get L2 cache size (in bytes) for the specified GPU device.
Definition: gpuUtils.cu:122
size_t GetMaxTexture1DSize(const int device=0)
KS: Get the maximum size for 1D textures on the specified GPU device.
Definition: gpuUtils.cu:134
void __cudaCheckError(const char *file, const int line)
Check if there's been an error.
Definition: gpuUtils.cu:18
void SetDevice(const int deviceId)
KS: Only useful if using multiple GPU.
Definition: gpuUtils.cu:85
void ResetDevice()
KS: Completely clean GPU, this is time consuming and may lead to unexpected behaviour.
Definition: gpuUtils.cu:77
void checkGpuMem()
KS: Get some fancy info about VRAM usage.
Definition: gpuUtils.cu:43
int GetNumGPUThreads(const int Device=0)
KS: Get number of GPU threads for currently used GPU.
Definition: gpuUtils.cu:102
void PrintNdevices()
KS: Get some fancy info about GPU.
Definition: gpuUtils.cu:60
void __cudaSafeCall(cudaError err, const char *file, const int line)
Check for a safe call on GPU.
Definition: gpuUtils.cu:6
size_t GetSharedMemoryPerBlock(const int device=0)
KS: Returns the maximum shared memory per block for a given GPU device.
Definition: gpuUtils.cu:146