Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PoolAllocator improvement #481

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

MichaelSt98
Copy link
Collaborator

@MichaelSt98 MichaelSt98 commented Jan 28, 2025

improvement so that stack size calculation and incrementing guarantees 8 byte alignment.

With this,

    ISTSZ = (C_SIZEOF(REAL(1, kind=JPRB))*NPROMA + 13*C_SIZEOF(REAL(1, kind=JPRB))*NLEV*NPROMA + 5*C_SIZEOF(REAL(1, kind=JPRB)) &
    & *NLEV*NPROMA*NCLV + C_SIZEOF(REAL(1, kind=JPRB))*NPROMA*NCLV) / C_SIZEOF(REAL(1, kind=JPRB))
    IF (.not.(MOD(C_SIZEOF(REAL(1, kind=JPRB))*NPROMA + 13*C_SIZEOF(REAL(1, kind=JPRB))*NLEV*NPROMA + 5*C_SIZEOF(REAL(1,  &
    & kind=JPRB))*NLEV*NPROMA*NCLV + C_SIZEOF(REAL(1, kind=JPRB))*NPROMA*NCLV, C_SIZEOF(REAL(1, kind=JPRB))) == 0)) ISTSZ = ISTSZ &
    &  + 1

becomes:

    ISTSZ = ISHFT(7 + C_SIZEOF(REAL(1, kind=JPRB))*NPROMA + C_SIZEOF(REAL(1, kind=JPRB))*NLEV*NPROMA, -3) + 12*ISHFT(7 +  &
    & C_SIZEOF(REAL(1, kind=JPRB))*NLEV*NPROMA, -3) + 4*ISHFT(7 + C_SIZEOF(REAL(1, kind=JPRB))*NLEV*NPROMA*NCLV, -3) + ISHFT(7 +  &
    & C_SIZEOF(REAL(1, kind=JPRB))*NPROMA*NCLV + C_SIZEOF(REAL(1, kind=JPRB))*NLEV*NPROMA*NCLV, -3)

Further,

    YLSTACK_L = YLSTACK_L + KLON*(KLEV + 1)*C_SIZEOF(REAL(1, kind=JPRB))
    IP_ZTP1 = YLSTACK_L
    YLSTACK_L = YLSTACK_L + KLON*KLEV*C_SIZEOF(REAL(1, kind=JPRB))
    IP_ZLI = YLSTACK_L
    YLSTACK_L = YLSTACK_L + KLON*KLEV*C_SIZEOF(REAL(1, kind=JPRB))

becomes:

    YLSTACK_L = YLSTACK_L + ISHFT(ISHFT(KLON*(KLEV + 1)*C_SIZEOF(REAL(1, kind=JPRB)) + 7, -3), 3)
    IP_ZTP1 = YLSTACK_L
    YLSTACK_L = YLSTACK_L + ISHFT(ISHFT(KLON*KLEV*C_SIZEOF(REAL(1, kind=JPRB)) + 7, -3), 3)
    IP_ZLI = YLSTACK_L
    YLSTACK_L = YLSTACK_L + ISHFT(ISHFT(KLON*KLEV*C_SIZEOF(REAL(1, kind=JPRB)) + 7, -3), 3)

and for cray_ptr_loc_rhs=True

    IP_ZICEFRAC = LOC(ZSTACK(YLSTACK_L))
    YLSTACK_L = YLSTACK_L + KLON*KLEV
    IP_ZQX = LOC(ZSTACK(YLSTACK_L))
    YLSTACK_L = YLSTACK_L + KLON*KLEV*NCLV

becomes:

    IP_ZICEFRAC = LOC(ZSTACK(YLSTACK_L))
    YLSTACK_L = YLSTACK_L + ISHFT(KLON*KLEV*C_SIZEOF(REAL(1, kind=JPRB)) + 7, -3)
    IP_ZQX = LOC(ZSTACK(YLSTACK_L))
    YLSTACK_L = YLSTACK_L + ISHFT(KLON*KLEV*NCLV*C_SIZEOF(REAL(1, kind=JPRB)) + 7, -3)

@MichaelSt98 MichaelSt98 force-pushed the nams-pool-allocator-improvements branch from 23eda32 to e79d1da Compare January 28, 2025 09:48
Copy link

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

Copy link

codecov bot commented Jan 28, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 96.17%. Comparing base (48c5cbf) to head (e79d1da).

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #481      +/-   ##
==========================================
- Coverage   96.17%   96.17%   -0.01%     
==========================================
  Files         224      224              
  Lines       40386    40336      -50     
==========================================
- Hits        38842    38793      -49     
+ Misses       1544     1543       -1     
Flag Coverage Δ
lint_rules 96.39% <ø> (ø)
loki 96.16% <100.00%> (-0.01%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@MichaelSt98 MichaelSt98 marked this pull request as ready for review January 28, 2025 10:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant