CFD-GO / TCLB

TCLB - Templated MPI+CUDA/CPU Lattice Boltzmann code
https://tclb.io
GNU General Public License v3.0
180 stars 71 forks source link

Introduction of storage types #413

Closed llaniewski closed 1 year ago

llaniewski commented 1 year ago

Description

This PR introduces the way to select a type for storing fields. This way TCLB can (for example) compute in double precision, but store only half precision floats.

Usage

One can select the storage type through ./configure script with:

./configure --with-storage=float

The avaliable options are: half, half-shift, float, float-shift, double. The shift options makes TCLB save a shifted value of the field.

Shift

The implementation allows one to store in the memory only the difference between the value of field and some constant. The constant is defined in the Dynamics.R with the shift= argument:

AddDensity( name="f[1]", dx= 1, dy= 0, group="f",shift=2/18)

This, compiled with 'half-shift' causes the following behavior:

Half-precision

Half precision is currently only supported on the GPU architecture.

Tests

This PR also introduces compilation tests for all combination of storage types.

codecov-commenter commented 1 year ago

Codecov Report

Base: 32.44% // Head: 32.46% // Increases project coverage by +0.02% :tada:

Coverage data is based on head (f41fa45) compared to base (7d42765). Patch coverage: 53.33% of modified lines in pull request are covered.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## develop #413 +/- ## =========================================== + Coverage 32.44% 32.46% +0.02% =========================================== Files 154 154 Lines 6402 6404 +2 =========================================== + Hits 2077 2079 +2 Misses 4325 4325 ``` | Flag | Coverage Δ | | |---|---|---| | d2q9 | `30.40% <38.46%> (+0.02%)` | :arrow_up: | | d2q9_bc | `26.62% <38.46%> (+0.02%)` | :arrow_up: | | d2q9_kuper | `27.48% <53.33%> (+0.02%)` | :arrow_up: | Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=CFD-GO#carryforward-flags-in-the-pull-request-comment) to find out more. | [Impacted Files](https://codecov.io/gh/CFD-GO/TCLB/pull/413?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=CFD-GO) | Coverage Δ | | |---|---|---| | [src/Global.h.Rt](https://codecov.io/gh/CFD-GO/TCLB/pull/413/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=CFD-GO#diff-c3JjL0dsb2JhbC5oLlJ0) | `50.00% <ø> (ø)` | | | [src/Lattice.h.Rt](https://codecov.io/gh/CFD-GO/TCLB/pull/413/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=CFD-GO#diff-c3JjL0xhdHRpY2UuaC5SdA==) | `57.14% <ø> (ø)` | | | [src/cross.h](https://codecov.io/gh/CFD-GO/TCLB/pull/413/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=CFD-GO#diff-c3JjL2Nyb3NzLmg=) | `100.00% <ø> (ø)` | | | [src/LatticeContainer.inc.cpp.Rt](https://codecov.io/gh/CFD-GO/TCLB/pull/413/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=CFD-GO#diff-c3JjL0xhdHRpY2VDb250YWluZXIuaW5jLmNwcC5SdA==) | `60.67% <25.00%> (ø)` | | | [src/Lattice.cu.Rt](https://codecov.io/gh/CFD-GO/TCLB/pull/413/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=CFD-GO#diff-c3JjL0xhdHRpY2UuY3UuUnQ=) | `46.98% <50.00%> (ø)` | | | [src/LatticeAccess.inc.cpp.Rt](https://codecov.io/gh/CFD-GO/TCLB/pull/413/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=CFD-GO#diff-c3JjL0xhdHRpY2VBY2Nlc3MuaW5jLmNwcC5SdA==) | `60.86% <66.66%> (+3.72%)` | :arrow_up: | Help us with your feedback. Take ten seconds to tell us [how you rate us](https://about.codecov.io/nps?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=CFD-GO). Have a feature suggestion? [Share it here.](https://app.codecov.io/gh/feedback/?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=CFD-GO)

:umbrella: View full report at Codecov.
:loudspeaker: Do you have feedback about the report comment? Let us know in this issue.