fangq / mmc

Mesh-based Monte Carlo (MMC)
Other
40 stars 32 forks source link

[bug] Can't save anymore detector data under AppleM1. #102

Closed andreafarina closed 1 month ago

andreafarina commented 1 month ago

After the upgrade of photon-sharing under GPU I can't run anymore simulations with cfg.issaveexit = 1. Here is the output:

  • variant name: [MMC-OpenCL] compiled with OpenCL version [1]
  • compiled with: [RNG] xorshift128+ RNG [Seed Length] 4 initializing streams ... init complete : 0 ms Building kernel with option: -cl-mad-enable -DMCX_USE_NATIVE -DMCX_SIMPLIFY_BRANCH -DMCX_VECTOR_INDEX -DMCX_SRC_PENCIL -DUSE_ATOMIC -DMCX_SAVE_DETECTORS -DMCX_SAVE_SEED -DUSE_BLBADOUEL Kernel build log: program_source:489:19: warning: comparison of integers of different signs: 'private uint' (aka 'private unsigned int') and '__private int' [-Wsign-compare] for (i = 0; i < len; i++) { ~ ^ ~~~ program_source:611:16: warning: comparison of integers of different signs: 'private int' and 'constant uint' (aka '__constant unsigned int') [-Wsign-compare] if (r->eid <= GPU_PARAM(gcfg, normbuf)) {
    
    program_source:648:105: warning: comparison of integers of different signs: 'int' and 'unsigned int' [-Wsign-compare]
        if ((int)((r->photontimer + r->Lmove * (prop.n * R_C0) - gcfg->tstart)*GPU_PARAM(gcfg, Rtstep)) > GPU_PARAM(gcfg, maxgate) - 1) { /*exit time window*/
            ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    program_source:681:22: warning: comparison of integers of different signs: 'int' and 'unsigned int' [-Wsign-compare]
            tshift = MIN( ((int)(replaytime[r->photonid] * GPU_PARAM(gcfg, Rtstep))), GPU_PARAM(gcfg, maxgate) - 1 ) * GPU_PARAM(gcfg, framelen);
                     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    program_source:272:32: note: expanded from macro 'MIN'
    #define MIN(a,b)           ((a)<(b)?(a):(b))
                             ~ ^ ~
    program_source:683:22: warning: comparison of integers of different signs: 'int' and 'unsigned int' [-Wsign-compare]
            tshift = MIN( ((int)((r->photontimer - gcfg->tstart) * GPU_PARAM(gcfg, Rtstep))), GPU_PARAM(gcfg, maxgate) - 1 ) * GPU_PARAM(gcfg, framelen);
                     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    program_source:272:32: note: expanded from macro 'MIN'
    #define MIN(a,b)           ((a)<(b)?(a):(b))
                             ~ ^ ~
    program_source:1477:15: error: casting '__local float *' to type '__private uint *' (aka '__private unsigned int *') changes address space of pointer
            *((uint*)(ppath + GPU_PARAM(gcfg, reclen) - 1)) = r.posidx;
              ^      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    program_source:1645:71: warning: comparison of integers of different signs: '__global int' and 'unsigned int' [-Wsign-compare]
                    if (GPU_PARAM(gcfg, isextdet) && type[oldeid - 1] == GPU_PARAM(gcfg, maxmedia) + 1) {
                                                     ~~~~~~~~~~~~~~~~ ^  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

MMCLAB ERROR (11): Error: Failed to build program executable! in unit mmc_cl_host.c:498 Error from thread (0): Error: Failed to build program executable! done 169 C++ Error: MMCLAB Terminated due to exception!

Thanks a lot! Regards

Andrea