NAMD
Classes | Macros | Functions
CudaPmeSolverUtil.h File Reference
#include <stdio.h>
#include <cuda.h>
#include <cufft.h>
#include "PmeSolverUtil.h"
#include "CudaUtils.h"
#include "CudaPmeSolverUtilKernel.h"

Go to the source code of this file.

Classes

class  CudaFFTCompute
 
class  CudaPmeKSpaceCompute
 
class  CudaPmeRealSpaceCompute
 
class  CudaPmeTranspose
 

Macros

#define cufftCheck(stmt)
 

Functions

void writeComplexToDisk (const float2 *d_data, const int size, const char *filename, cudaStream_t stream)
 
void writeHostComplexToDisk (const float2 *h_data, const int size, const char *filename)
 
void writeRealToDisk (const float *d_data, const int size, const char *filename, cudaStream_t stream)
 

Macro Definition Documentation

#define cufftCheck (   stmt)
Value:
do { \
cufftResult err = stmt; \
if (err != CUFFT_SUCCESS) { \
char msg[128]; \
sprintf(msg, "%s in file %s, function %s\n", #stmt,__FILE__,__FUNCTION__); \
cudaDie(msg); \
} \
} while(0)
if(ComputeNonbondedUtil::goMethod==2)
void cudaDie(const char *msg, cudaError_t err=cudaSuccess)
Definition: CudaUtils.C:9

Definition at line 17 of file CudaPmeSolverUtil.h.

Referenced by CudaFFTCompute::backward(), CudaFFTCompute::forward(), and CudaFFTCompute::~CudaFFTCompute().

Function Documentation

void writeComplexToDisk ( const float2 d_data,
const int  size,
const char *  filename,
cudaStream_t  stream 
)

Definition at line 14 of file CudaPmeSolverUtil.C.

References cudaCheck, stream, x, and y.

14  {
15  fprintf(stderr, "writeComplexToDisk %d %s\n", size, filename);
16  float2* h_data = new float2[size];
17  copy_DtoH<float2>(d_data, h_data, size, stream);
18  cudaCheck(cudaStreamSynchronize(stream));
19  FILE *handle = fopen(filename, "w");
20  for (int i=0;i < size;i++)
21  fprintf(handle, "%f %f\n", h_data[i].x, h_data[i].y);
22  fclose(handle);
23  delete [] h_data;
24 }
__thread cudaStream_t stream
gridSize y
#define cudaCheck(stmt)
Definition: CudaUtils.h:79
gridSize x
void writeHostComplexToDisk ( const float2 h_data,
const int  size,
const char *  filename 
)

Definition at line 26 of file CudaPmeSolverUtil.C.

References x, and y.

26  {
27  FILE *handle = fopen(filename, "w");
28  for (int i=0;i < size;i++)
29  fprintf(handle, "%f %f\n", h_data[i].x, h_data[i].y);
30  fclose(handle);
31 }
gridSize y
gridSize x
void writeRealToDisk ( const float *  d_data,
const int  size,
const char *  filename,
cudaStream_t  stream 
)

Definition at line 33 of file CudaPmeSolverUtil.C.

References cudaCheck, and stream.

33  {
34  fprintf(stderr, "writeRealToDisk %d %s\n", size, filename);
35  float* h_data = new float[size];
36  copy_DtoH<float>(d_data, h_data, size, stream);
37  cudaCheck(cudaStreamSynchronize(stream));
38  FILE *handle = fopen(filename, "w");
39  for (int i=0;i < size;i++)
40  fprintf(handle, "%f\n", h_data[i]);
41  fclose(handle);
42  delete [] h_data;
43 }
__thread cudaStream_t stream
#define cudaCheck(stmt)
Definition: CudaUtils.h:79