McStasMcXtrace / McCode

The home of the McStas (neutrons) and McXtrace (x-rays) Monte-Carlo ray-tracing instrument simulation codes.
https://github.com/McStasMcXtrace/McCode/wiki
GNU General Public License v3.0
77 stars 54 forks source link

Consider reintroducing MCNUM where possible #1292

Open willend opened 1 year ago

willend commented 1 year ago

With MCNUM in place "everywhere" in the code (with a default of double) we could easily allow to replace with single-precision.

This could allow certain demeaning problems to also run on smaller system, e.g. "gamer"-GPU's with a few Gigs of VRAM.

willend commented 1 year ago

(An easy start would be to allow to define the base type of the DArray's to be float rather than double, requires very little code.)

willend commented 1 year ago

https://github.com/McStasMcXtrace/McCode/tree/mccode-3-USEFLOATS is a prototype that allows to create histograms (for monitors) and particle array data in single precision (e.g. for use on GPU's). -DUSEFLOATSenables it.

A few consequence-edits are pending in e.g. read_table-lib:

"./WOFSANS_v2_gpu.c", line 7327: warning: argument of type "double *" is incompatible with parameter of type "float *"
                        NULL, Table.data, NULL,
                              ^

"./WOFSANS_v2_gpu.c", line 7334: warning: argument of type "double *" is incompatible with parameter of type "float *"
                        NULL, Table.data, NULL,
                              ^
willend commented 1 year ago

MPI merging is not fully functional https://github.com/McStasMcXtrace/McCode/commit/190af8e2c4f6cca8f401b54e7cb6c96e674dbcad

willend commented 1 year ago

With the last commit 649536dcd4b72dfc69542d100f67c47c793435db merge is functional.

Some consequence-edits must be done in Monitor_nD-lib (base type is double everywhere, needs the darrbase define).