-
Notifications
You must be signed in to change notification settings - Fork 35
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
Consistent definition of explicit constants in BLAS calls + warnings removal(explicit type conversion in gpnorm, format W=>D+7, unused statement function) #44
Conversation
src/trans/internal/tpm_pol.F90
Outdated
DA(KKN,KKM)=SQRT( (REAL(2*KKN+1,JPRD)*REAL(KKN-KKM,JPRD)& | ||
&*REAL(KKN+KKM,JPRD))& | ||
&/ REAL(2*KKN-1,JPRD) ) | ||
!DA(KKN,KKM)=SQRT( (REAL(2*KKN+1,JPRD)*REAL(KKN-KKM,JPRD)& |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shall we just delete this? You're right, it doesn't seem to be used at all.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we wait for a second opinion or should I give it a go ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm always nervous about modifying code that is almost as old as I am. Let's see what @marsdeno thinks.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It definitely looks pretty safe to me to be deleted!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
Apart from my comment above, this looks ready for merging. |
Some CI suites are failing but that looks like another problem... |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nothing to say on changes from JPRB to JPRM/JPRD, but while you're there, would it make sense to look at other precision-related things in this file? Things I see looking at file are
- calls to REAL() conversion routine with JPRB kind request, when we know whether it should be JPRM or JPRD (for ex. l.890)
- calls to NINT(xx,JPRB) look rather strange to me, shouldn't that be e.g. JPIB?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
NINT(xx, JPRB) does not make sense to me, especially since assigned values (at least following are of integer(kind=JPIM) (always 32bit integer).
INTEGER(KIND=JPIM) :: M_ORDER =0 ! M of original matrix
INTEGER(KIND=JPIM) :: N_ORDER =0 ! N of original matrix
INTEGER(KIND=JPIM) :: N_CMAX =0 ! Max number of columns in each submatrix at level 0
INTEGER(KIND=JPIM) :: N_LEVELS =0 ! Max level in dyadic hierarchy
INTEGER(KIND=JPIM) :: IBETALEN_MAX=0 ! Max workspace for one level of interim results "beta"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The REAL()
call on line 890 seems to be correct because ZVECOUT
is JPRB
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As for NINT
, it seems to do the following currently:
1. Round real number to nearest integer, returning a real number.
2. Implicit type conversion to integer.
3. Assign to integer.
when indeed it could be shortened to:
1. Round real number to nearest integer, returning an integer.
2. Assign to integer.
Presumably replacing the JPRB with JPIB will fix this, as Olivier suggests.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shall we leave it all for a separate PR, or we extend this one ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well unless I misunderstand @marsdeno's point about REAL() conversions, the only thing outstanding is the NINT calls. If you could change those to use JPIM with one more commit on this PR, I think we're ready for merging!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The
REAL()
call on line 890 seems to be correct becauseZVECOUT
isJPRB
.
My comment here was rather that we know from the code that in this particular instance, JPRB is in fact single precision.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well unless I misunderstand @marsdeno's point about REAL() conversions, the only thing outstanding is the NINT calls. If you could change those to use JPIM with one more commit on this PR, I think we're ready for merging!
The REAL() thing is not very important, I think, but it is similar in nature to the original point being addressed, regarding replacing JPRB by JPRM/JPRD in places where we know what it is.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I understand now. It's because on this line we are inside an IF branch which is only entered when LLDOUBLE = .FALSE.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@samhatfield @marsdeno this two issues are now corrected. We still have a type incompatibility in BLAS calls, e.g.
Users/napz/Codes/ectrans-typefix/src/trans/internal/ledir_mod.F90:170:53:
141 | CALL DGEMM('T','N',ILA,KIFC,KDGLU,1.0_JPRD,S%FA(KMLOC)%RPNMA,KDGLU,&
| 2
......
170 | CALL DGEMM('T','N',ILA,KIFC,KDGLU,1.0_JPRD,ZRPNMA,KDGLU,&
| 1
Warning: Type mismatch between actual argument at (1) and actual argument at (2) (REAL(8)/REAL(4)).
If I understood correctly, @marsdeno you are already correcting it elsewhere, so we leave it alone for now.
I like all new changes since my last review except the last commit 629a65f The types of
Even if not executed due to |
I have no strong feelings on this one way or the other... |
Fair enough, I can see your point about counterintuitive, although I'm not sure about the situation with conversion instructions actually being any different. |
Me neither really. Can stay as is in the PR if Olivier likes it. |
Hmm, if I understand correctly, the conversion instructions would be generated in the inactive path only, and with the current (explicit: JPRM or JPRD) form the code seems better readable to me. @marsdeno @samhatfield ? |
@wdeconinck @marsdeno @samhatfield just to make clear, I expect one of you to mercifully merge it if its ready. |
@wdeconinck could I be given rights to merge pull requests? |
… SP calls (instead of JPRB). Explicit type cast of JPRD to JPRB is added in gpnorm MIN/MAX calls to remove compilation warning of NVHPC
…tpm_pol commented out.
5513b86
to
17e876f
Compare
Thanks @piotrows for this cleanup! |
[like] Olivier Marsden reacted to your message:
…________________________________
From: Willem Deconinck ***@***.***>
Sent: Thursday, November 30, 2023 8:53:05 AM
To: ecmwf-ifs/ectrans ***@***.***>
Cc: Olivier Marsden ***@***.***>; Mention ***@***.***>
Subject: Re: [ecmwf-ifs/ectrans] Consistent definition of explicit constants in BLAS calls + warnings removal(explicit type conversion in gpnorm, format W=>D+7, unused statement function) (PR #44)
Thanks @piotrows<https://github.com/piotrows> for this cleanup!
—
Reply to this email directly, view it on GitHub<#44 (comment)>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/AJ4E3JJCMYY43XZ4M3KF5JDYHBCPDAVCNFSM6AAAAAA7P5YCMWVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQMZTGM2DCOJVGE>.
You are receiving this because you were mentioned.Message ID: ***@***.***>
|
Aiming at the larger changes incoming with the CP/DP PR, this PR performs some tidy-up:
and removes compiler warnings through
Code tested on ATOS with gcc,intel,nvhpc and on the WSL workstation with gcc,intel,nvhpc, as well as clang/gfortran on Mac ARM. I've noticed that some tests are failing under Intel 2024 on WSL Ubuntu workstation.