#include <cuda_runtime.h>
#include <vector>
#include <cstdarg>
#include "cufft.h"
#include "LsqQuadraticFit.h"
Go to the source code of this file.
§ CUBOTH
#define CUBOTH __device__ __host__ |
Kernel is callable from both device and host code.
Definition at line 16 of file gpu_utils.h.
§ CUDA_SUPPORTED_FUNC
#define CUDA_SUPPORTED_FUNC __device__ __host__ |
§ CheckCUDAError() [1/3]
void CheckCUDAError |
( |
cufftResult_t |
err | ) |
|
|
inline |
Definition at line 36 of file gpu_utils.h.
38 if (err != CUFFT_SUCCESS) {
40 throw std::runtime_error(
SPrintf(
"CUDA error: CUFFT failed (%d)\n",err));
void outputTotalGPUMemUse(std::string info="")
std::string SPrintf(const char *fmt,...)
§ CheckCUDAError() [2/3]
void CheckCUDAError |
( |
cudaError_t |
err | ) |
|
|
inline |
Definition at line 44 of file gpu_utils.h.
46 if (err != cudaSuccess) {
47 const char* errstr = cudaGetErrorString(err);
48 throw std::runtime_error(
SPrintf(
"CUDA error: %s\n" ,errstr).c_str());
std::string SPrintf(const char *fmt,...)
§ CheckCUDAError() [3/3]
Definition at line 52 of file gpu_utils.h.
54 cudaError_t err = cudaGetLastError();
55 if (err != cudaSuccess) {
56 const char* errstr = cudaGetErrorString(err);
void dbgprintf(const char *fmt,...)
§ DbgCopyResult() [1/2]
void DbgCopyResult |
( |
device_vec< float2 > |
src, |
|
|
std::vector< std::complex< float > > & |
dst |
|
) |
| |
|
inline |
§ DbgCopyResult() [2/2]
void DbgCopyResult |
( |
device_vec< float > |
src, |
|
|
std::vector< float > & |
dst |
|
) |
| |
|
inline |
§ dbgCUDAErrorCheck()
void dbgCUDAErrorCheck |
( |
cudaError_t |
e | ) |
|
|
inline |
§ DbgOutputVectorToFile()
void DbgOutputVectorToFile |
( |
std::string |
loc, |
|
|
device_vec< float > & |
src, |
|
|
bool |
append |
|
) |
| |
|
inline |
§ outputTotalGPUMemUse()
void outputTotalGPUMemUse |
( |
std::string |
info = "" | ) |
|
|
inline |
Definition at line 18 of file gpu_utils.h.
23 cudaError_t cuda_status = cudaMemGetInfo( &free_byte, &total_byte );
24 if ( cudaSuccess != cuda_status ){
25 dbgprintf(
"Error: cudaMemGetInfo fails, %s \n", cudaGetErrorString(cuda_status) );
28 double free_db = (double)free_byte;
29 double total_db = (double)total_byte;
30 double used_db = total_db - free_db;
31 dbgprintf(
"%sused = %2.2f MB, free = %2.2f MB, total = %2.2f MB\n",
32 info !=
"" ? (info+
": ").c_str() :
"",
33 used_db/1024.0/1024.0, free_db/1024.0/1024.0, total_db/1024.0/1024.0);
void dbgprintf(const char *fmt,...)