CFD-GO / TCLB

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

Field access checks #444

Closed llaniewski closed 1 year ago

llaniewski commented 1 year ago

This PR introduces a new mechanism for setting and testing the access policy for fields in stages.

Setting access

The AddStage has now three arguments:

Defaults

By default the actions/stages setup is:

AddStage(main="Run", name="BaseIteration", load.densities=TRUE, read.fields=TRUE, save.fields=TRUE)
AddStage(main="Init", name="BaseInit", load.densities=FALSE, read.fields=FALSE, save.fields=TRUE)
AddAction(name="Iteration", stages=c("BaseIteration"))
AddAction(name="Init", stages=c("BaseInit"))

Moreover, the default read.fields is as allowing as possible. If not specified otherwise it is assumed that stage has read access to all fields that are available to it.

Checks

The access policies are checked in each Action (series of Stages) assuming:

Exceptions

There are three mechanisms to circumvent checks:

Modifications

Some adjustments were made to models to agree with these policies. All models were tested and permissive.access=TRUE was added to the ones failing from this change. These models should be fixed to accommodate these checks. Especially d3q27_pf_velocity, as per #437.

codecov-commenter commented 1 year ago

Codecov Report

Patch coverage has no change and project coverage change: -0.02% :warning:

Comparison is base (07dd2b9) 44.10% compared to head (55c4849) 44.08%.

:exclamation: Your organization is not using the GitHub App Integration. As a result you may experience degraded service beginning May 15th. Please install the Github App Integration for your organization. Read more.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## develop #444 +/- ## =========================================== - Coverage 44.10% 44.08% -0.02% =========================================== Files 166 166 Lines 7818 7821 +3 =========================================== Hits 3448 3448 - Misses 4370 4373 +3 ``` | [Flag](https://app.codecov.io/gh/CFD-GO/TCLB/pull/444/flags?src=pr&el=flags&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=CFD-GO) | Coverage Δ | | |---|---|---| | [d2q9](https://app.codecov.io/gh/CFD-GO/TCLB/pull/444/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=CFD-GO) | `30.54% <0.00%> (-0.01%)` | :arrow_down: | | [d2q9_bc](https://app.codecov.io/gh/CFD-GO/TCLB/pull/444/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=CFD-GO) | `26.81% <0.00%> (-0.01%)` | :arrow_down: | | [d2q9_kuper](https://app.codecov.io/gh/CFD-GO/TCLB/pull/444/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=CFD-GO) | `27.51% <0.00%> (-0.01%)` | :arrow_down: | | [d3q27_PSM_NEBB](https://app.codecov.io/gh/CFD-GO/TCLB/pull/444/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=CFD-GO) | `35.71% <0.00%> (-0.02%)` | :arrow_down: | | [d3q27_pf_velocity](https://app.codecov.io/gh/CFD-GO/TCLB/pull/444/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=CFD-GO) | `30.45% <0.00%> (-0.02%)` | :arrow_down: | 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. | [Files Changed](https://app.codecov.io/gh/CFD-GO/TCLB/pull/444?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=CFD-GO) | Coverage Δ | | |---|---|---| | [src/LatticeAccess.inc.cpp.Rt](https://app.codecov.io/gh/CFD-GO/TCLB/pull/444?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=CFD-GO#diff-c3JjL0xhdHRpY2VBY2Nlc3MuaW5jLmNwcC5SdA==) | `96.42% <ø> (ø)` | | | [src/cuda.cu.Rt](https://app.codecov.io/gh/CFD-GO/TCLB/pull/444?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=CFD-GO#diff-c3JjL2N1ZGEuY3UuUnQ=) | `92.59% <0.00%> (-7.41%)` | :arrow_down: | ... and [1 file with indirect coverage changes](https://app.codecov.io/gh/CFD-GO/TCLB/pull/444/indirect-changes?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=CFD-GO)

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

llaniewski commented 1 year ago

I added feature for plotting the stages and their access to a pdf file. The plot shows the field read and write status and marks problems in red. When you run

make d3q27_pf_velocity/summary

this nice plot is generated: Screenshot_2023-08-30_16-22-16

FYI: @TravisMitchell @shkodm @mdzik