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
struct  CudaPmeKSpaceCompute::EnergyVirial
class  CudaPmeRealSpaceCompute
class  CudaPmeTranspose

Defines

#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)


Define 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)

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, x, and y.

00014                                                                                                          {
00015   fprintf(stderr, "writeComplexToDisk %d %s\n", size, filename);
00016   float2* h_data = new float2[size];
00017   copy_DtoH<float2>(d_data, h_data, size, stream);
00018   cudaCheck(cudaStreamSynchronize(stream));
00019   FILE *handle = fopen(filename, "w");
00020   for (int i=0;i < size;i++)
00021     fprintf(handle, "%f %f\n", h_data[i].x, h_data[i].y);
00022   fclose(handle);
00023   delete [] h_data;
00024 }

void writeHostComplexToDisk ( const float2 h_data,
const int  size,
const char *  filename 
)

Definition at line 26 of file CudaPmeSolverUtil.C.

References x, and y.

00026                                                                                         {
00027   FILE *handle = fopen(filename, "w");
00028   for (int i=0;i < size;i++)
00029     fprintf(handle, "%f %f\n", h_data[i].x, h_data[i].y);
00030   fclose(handle);
00031 }

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.

00033                                                                                                      {
00034   fprintf(stderr, "writeRealToDisk %d %s\n", size, filename);
00035   float* h_data = new float[size];
00036   copy_DtoH<float>(d_data, h_data, size, stream);
00037   cudaCheck(cudaStreamSynchronize(stream));
00038   FILE *handle = fopen(filename, "w");
00039   for (int i=0;i < size;i++)
00040     fprintf(handle, "%f\n", h_data[i]);
00041   fclose(handle);
00042   delete [] h_data;
00043 }


Generated on Sat Sep 23 01:17:16 2017 for NAMD by  doxygen 1.4.7