McCode icon indicating copy to clipboard operation
McCode copied to clipboard

Consider reintroducing MCNUM where possible

Open willend opened this issue 1 year ago • 4 comments

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 avatar Oct 17 '22 09:10 willend

(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 avatar Oct 17 '22 09:10 willend

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). -DUSEFLOATS enables 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 avatar Oct 17 '22 12:10 willend

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

willend avatar Oct 17 '22 16:10 willend

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).

willend avatar Oct 17 '22 18:10 willend