Simulator data typesΒΆ
Data types can be used to customize the OpenCL kernel of the Monte Carlo simulator. The following 4 data types of the kernel can be customized:
Default integer types
Photon packet accumulator types
Floating point types and computational precision
Photon packet counter types
McCnt32- 32-bit unsigned integer counterMcCnt64- 64-bit unsigned integer counter
The 4 data types are passed to the xopto:mcml.mc.Mc()
constructor as an instance of xopto.mcbase.mctypes.McDataTypes.
Even though any combination of the 4 data types can be used, the preconfigured
sets of data types will be likely sufficient for the vast majority of
applications:
xopto.mcbase.mctypes.McDataTypesSingle- default set of types (single precision floating-point arithmetics, 32-bit photon packet counter)xopto.mcbase.mctypes.McDataTypesSingleCnt64(single precision floating-point arithmetics, 64-bit photon packet counter)xopto.mcbase.mctypes.McDataTypesDouble(double precision floating-point arithmetics, 32-bit photon packet counter)xopto.mcbase.mctypes.McDataTypesDoubleCnt64(double precision floating-point arithmetics, 64-bit photon packet counter)
Note
The 32-bit photon packet weight accumulators
McAccu32 should be avoided, since they can
overflow even for simulations with a small number of photon packets.
Single precision floating-point arithmetics
McFloat should be sufficient for most
application. Note that double precision floating-point arithmetics
McDouble is significantly slower
on GPU devices.
If more that 4,294,967,295 photon packets need to be simulated in a single run
of the Monte Carlo simulator, use a 64-bit photon packet counter
McCnt64. The performance penalty will depend
on the OpenCL device support for 64-bit atomic operations
(cl_khr_int64_base_atomics
OpenCL extension)