This repository serve as a backup for my Maxwell-TD code
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

53 lines
1.5 KiB

//
// Created by ubuntu on 11/3/21.
//
#ifndef DGTD_DEBUG_HPP
#define DGTD_DEBUG_HPP
#include <unistd.h>
#include <cstdio>
#include <cstring>
#include <fstream>
#include "string"
#include "iostream"
#include "Constants.h"
void DEBUG_INFO(std::string info);
void MEM_USAGE();
void COMPARE_MATRICES(float* data_d2h, float* data, int h, int w, std::string message);
void COMPARE_MATRICES(double* data_d2h, double* data, int h, int w, std::string message);
void SYSTEM_MEM_USAGE();
void SYSTEM_VIDEO_MEM_USAGE();
#if defined(DGTD_USE_OPENCL) || defined(DGTD_USE_CUDA_OPENCL)
#include <CL/opencl.h>
std::string getErrorString(cl_int error);
#define CL_CHECK(RET) \
if(RET != CL_SUCCESS) { \
std::cerr << "OpenCL error " << getErrorString(RET) << " on line " << __LINE__ << std::endl; \
assert(false); \
}
#endif
#if defined (DGTD_USE_CUDA) || defined(DGTD_USE_CUDA_OPENCL)
#define CH_CUDA_SAFE_CALL( call) { \
cudaError err = call; \
if( cudaSuccess != err) { \
fprintf(stderr, "Cuda error in file '%s' in line %i : %s.\n", \
__FILE__, __LINE__, cudaGetErrorString( err) ); \
exit(EXIT_FAILURE); \
} \
}
#define CUDA_SAFE_CALL(call) CH_CUDA_SAFE_CALL(call)
#endif
#if defined (DGTD_USE_CUDA) || defined(DGTD_USE_CUDA_OPENCL)
void CUDA_MEM_USAGE();
#endif
#endif //DGTD_DEBUG_HPP