ecmwf-ifs / loki

Freely programmable source-to-source translation for Fortran
https://sites.ecmwf.int/docs/loki/
Apache License 2.0
22 stars 11 forks source link

CLOUDSC low-level GPU (transpilation) via Loki (CUF/CUDA) #328

Open MichaelSt98 opened 1 month ago

MichaelSt98 commented 1 month ago

Still work in progress ...

Corresponding CLOUDSC branch nams-cloudsc-low-level-GPU

Build via cloudsc-bundle build --clean --arch=arch/ecmwf/hpc2020/nvhpc/22.11 --with-loki --with-gpu --with-cuda

New modes/binaries:

Furthermore, usage of pipelines:

SCCLowLevelCufParametrise = partial(
    Pipeline, classes=(
        SCCBaseTransformation,
        SCCDevectorTransformation,
        SCCDemoteTransformation,
        SCCRevectorTransformation,
        LowerBlockIndexTransformation,
        InjectBlockIndexTransformation,
        LowerBlockLoopTransformation,
        SccLowLevelLaunchConfiguration,
        SccLowLevelDataOffload,
        ParametriseTransformation
    )
)

SCCLowLevelCufHoist = partial(
    Pipeline, classes=(
        SCCBaseTransformation,
        SCCDevectorTransformation,
        SCCDemoteTransformation,
        SCCRevectorTransformation,
        LowerBlockIndexTransformation,
        InjectBlockIndexTransformation,
        LowerBlockLoopTransformation,
        SccLowLevelLaunchConfiguration,
        SccLowLevelDataOffload,
        HoistTemporaryArraysAnalysis,
        HoistTemporaryArraysDeviceAllocatableTransformation
    )
)

SCCLowLevelParametrise = partial(
    Pipeline, classes=(
        InlineTransformation,
        GlobalVariableAnalysis,
        GlobalVarHoistTransformation,
        DerivedTypeArgumentsTransformation,
        SCCBaseTransformation,
        SCCDevectorTransformation,
        SCCDemoteTransformation,
        SCCRevectorTransformation,
        LowerBlockIndexTransformation,
        InjectBlockIndexTransformation,
        LowerBlockLoopTransformation,
        SccLowLevelLaunchConfiguration,
        SccLowLevelDataOffload,
        ParametriseTransformation
    )
)

SCCLowLevelHoist = partial(
    Pipeline, classes=(
        InlineTransformation,
        GlobalVariableAnalysis,
        GlobalVarHoistTransformation,
        DerivedTypeArgumentsTransformation,
        SCCBaseTransformation,
        SCCDevectorTransformation,
        SCCDemoteTransformation,
        SCCRevectorTransformation,
        LowerBlockIndexTransformation,
        InjectBlockIndexTransformation,
        LowerBlockLoopTransformation,
        SccLowLevelLaunchConfiguration,
        SccLowLevelDataOffload,
        HoistTemporaryArraysAnalysis,
        HoistTemporaryArraysPragmaOffloadTransformation
    )
)
github-actions[bot] commented 1 month ago

Documentation for this branch can be viewed at https://sites.ecmwf.int/docs/loki/328/index.html

codecov[bot] commented 4 weeks ago

Codecov Report

Attention: Patch coverage is 92.64943% with 91 lines in your changes missing coverage. Please review.

Project coverage is 95.20%. Comparing base (a39336b) to head (0665ded).

Files Patch % Lines
loki/transformations/single_column/scc_cuf.py 88.98% 39 Missing :warning:
loki/transformations/single_column/base.py 29.72% 26 Missing :warning:
loki/transformations/transpile/fortran_c.py 94.48% 7 Missing :warning:
loki/backend/cgen.py 92.20% 6 Missing :warning:
loki/backend/cppgen.py 92.45% 4 Missing :warning:
...oki/transformations/single_column/scc_low_level.py 87.87% 4 Missing :warning:
loki/tools/util.py 80.00% 2 Missing :warning:
...oki/transformations/block_index_transformations.py 98.44% 2 Missing :warning:
loki/backend/cudagen.py 98.80% 1 Missing :warning:
Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #328 +/- ## ========================================== - Coverage 95.25% 95.20% -0.06% ========================================== Files 170 173 +3 Lines 36258 37055 +797 ========================================== + Hits 34539 35277 +738 - Misses 1719 1778 +59 ``` | [Flag](https://app.codecov.io/gh/ecmwf-ifs/loki/pull/328/flags?src=pr&el=flags&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=ecmwf-ifs) | Coverage Δ | | |---|---|---| | [lint_rules](https://app.codecov.io/gh/ecmwf-ifs/loki/pull/328/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=ecmwf-ifs) | `96.39% <ø> (ø)` | | | [loki](https://app.codecov.io/gh/ecmwf-ifs/loki/pull/328/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=ecmwf-ifs) | `95.18% <92.64%> (-0.06%)` | :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=ecmwf-ifs#carryforward-flags-in-the-pull-request-comment) to find out more.

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

MichaelSt98 commented 4 days ago

Thank you for the review @reuterbal! I have no objections to your comments and want to apologise for the large PR... However, it seems that you have no general objections regarding the implementation/splitting of transformation/etc.

I'll tackle your comments and see whether I can split up the PR into multiple smaller PRs.