PSCF v1.1
GpuTypes.h
1#ifndef PSPG_GPU_TYPES_H
2#define PSPG_GPU_TYPES_H
3
4#include <cufft.h>
5#include <stdio.h>
6#include <iostream>
7
8namespace Pscf {
9namespace Pspg {
10
11//#define SINGLE_PRECISION
12#define DOUBLE_PRECISION
13
14#ifdef SINGLE_PRECISION
15typedef cufftReal cudaReal;
16typedef cufftComplex cudaComplex;
17typedef cufftReal hostReal;
18typedef cufftComplex hostComplex;
19#else
20#ifdef DOUBLE_PRECISION
21typedef cufftDoubleReal cudaReal;
22typedef cufftDoubleComplex cudaComplex;
23typedef cufftDoubleReal hostReal;
24typedef cufftDoubleComplex hostComplex;
25#endif
26#endif
27
28#define gpuErrchk(ans) { gpuAssert((ans), __FILE__, __LINE__);}
29inline void gpuAssert(cudaError_t code, const char *file, int line, bool abort=true)
30{
31 if (code != cudaSuccess)
32 {
33 fprintf(stderr,"GPUassert: %s %s %d\n", cudaGetErrorString(code), file, line);
34 if(abort) exit(code);
35 }
36}
37
38}
39}
40#endif
C++ namespace for polymer self-consistent field theory (PSCF).