Monte Carlo eXtreme (MCX)
mcx_core.h
Go to the documentation of this file.
1 /***************************************************************************/
25 /***************************************************************************/
31 #ifndef _MCEXTREME_GPU_LAUNCH_H
32 #define _MCEXTREME_GPU_LAUNCH_H
33 
34 #include "mcx_utils.h"
35 
36 #ifdef __cplusplus
37 extern "C" {
38 #endif
39 
40 
41 #define ABS(a) ((a)<0?-(a):(a))
49 #define MAX_ACCUM 1000.f
50 
51 #define ROULETTE_SIZE 10.f
53 #ifdef MCX_DEBUG
54 #define GPUDEBUG(x) printf x
55 #else
56 #define GPUDEBUG(x)
57 #endif
58 
59 typedef float4 MCXpos;
61 typedef struct __align__(16) SplitVoxel {
62  unsigned char issplit;
63  unsigned char lower;
64  unsigned char upper;
65  unsigned char isupper;
66 } SVox;
67 
68 typedef struct __align__(16) StokesVector {
69  float i;
70  float q;
71  float u;
72  float v;
73 } Stokes;
74 
75 typedef struct __align__(16) MCXSplit {
76  SVox sv;
77  float3 rp;
78  float3 nv;
79 } MCXsp;
80 
81 typedef struct __align__(16) MCXDir {
82  float x;
83  float y;
84  float z;
85  float nscat;
86 } MCXdir;
87 
88 typedef struct __align__(16) MCXTimer {
89  float pscat;
90  float t;
91  float pathlen;
92  float ndone;
93 } MCXtime;
94 
95 typedef union __align__(16) GPosition {
96  MCXpos d;
97  float4 v;
98  float f[4];
99 } Gpos;
100 
101 typedef union __align__(16) GDirection {
102  MCXdir d;
103  float4 v;
104  float f[4];
105 } Gdir;
106 
107 typedef union __align__(16) GLength {
108  MCXtime d;
109  float4 v;
110  float f[4];
111 } Glen;
112 
113 typedef union __align__(16) GProperty {
114  Medium d; /*defined in mcx_utils.h*/
115  float4 v;
116  float f[4];
117 } Gprop;
118 
119 typedef unsigned char uchar;
120 
127 typedef struct __align__(16) KernelParams {
128  float3 vsize;
129  float minstep;
130  float twin0;
131  float twin1;
132  float tmax;
133  float oneoverc0;
134  unsigned int save2pt;
135  unsigned int doreflect;
136  unsigned int dorefint;
137  unsigned int savedet;
138  float Rtstep;
139  float4 ps;
140  float4 c0;
141  float4 s0;
142  float3 maxidx;
143  uint4 dimlen;
144  uint3 cp0;
145  uint3 cp1;
146  uint2 cachebox;
147  float minenergy;
148  float skipradius2;
149  float minaccumtime;
150  int srctype;
151  float4 srcparam1;
152  float4 srcparam2;
153  int voidtime;
154  unsigned int maxdetphoton;
155  unsigned int maxmedia;
156  unsigned int detnum;
157  unsigned int maxpolmedia;
158  unsigned int maxgate;
159  unsigned int idx1dorig;
160  unsigned int mediaidorig;
161  unsigned int isatomic;
162  unsigned int maxvoidstep;
163  unsigned int issaveseed;
164  unsigned int issaveref;
165  unsigned int isspecular;
166  unsigned int seedoffset;
167  int seed;
168  unsigned int outputtype;
169  int threadphoton;
170  int oddphotons;
171  int faststep;
172  unsigned int debuglevel;
173  unsigned int savedetflag;
174  unsigned int reclen;
175  unsigned int partialdata;
176  unsigned int w0offset;
177  unsigned int mediaformat;
178  unsigned int maxjumpdebug;
179  unsigned int gscatter;
180  unsigned int is2d;
181  int replaydet;
182  unsigned int srcnum;
183  unsigned int nphase;
184  float omega;
185  unsigned char bc[12];
186 } MCXParam;
187 
188 void mcx_run_simulation(Config* cfg, GPUInfo* gpu);
189 int mcx_list_gpu(Config* cfg, GPUInfo** info);
190 
191 #ifdef __cplusplus
192 }
193 #endif
194 
195 #endif
196 
#define float3(a, b, c)
Definition: mcx_core.cu:82
Definition: mcx_utils.h:158
Definition: mcx_utils.h:78
MCX configuration header.
void mcx_run_simulation(Config *cfg, GPUInfo *gpu)
Master host code for the MCX simulation kernel (!!!Important!!!)
Definition: mcx_core.cu:2472
#define float4(a, b, c, d)
Definition: mcx_core.cu:83
#define uint4(a, b, c, d)
Definition: mcx_core.cu:79
int mcx_list_gpu(Config *cfg, GPUInfo **info)
Utility function to query GPU info and set active GPU.
Definition: mcx_core.cu:2363
Definition: mcx_utils.h:135
struct __align__(16) SplitVoxel
Simulation constant parameters stored in the constant memory.
Definition: mcx_core.h:61
const char outputtype[]
Definition: mcx_utils.c:141
#define uint2(a, b)
Definition: mcx_core.cu:77
float4 MCXpos
Definition: mcx_core.h:59
#define uint3(a, b, c)
Definition: mcx_core.cu:78