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:

  1. Default integer types

  2. Photon packet accumulator types

  3. Floating point types and computational precision

    • McFloat - single precision floating-point

    • McDouble - double precision floating-point

  4. Photon packet counter types

    • McCnt32 - 32-bit unsigned integer counter

    • McCnt64 - 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:

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)