[J3] (SC22WG5.6289) WG5 letter ballot 1 on Fortran 2018 interpretations
anton.shterenlikht at hpe.com
Sun Oct 4 11:07:12 EDT 2020
Yes No Number Title
-Y- --- F18/001 ACOSH principal value specification is wrong
-Y- --- F18/002 Internal procedures in generic interface blocks
-Y- --- F18/003 Pointer association of component of non-definable selector
-Y- --- F18/004 Program execution sequence with failed images
-Y- --- F18/005 Does INPUT_UNIT really identify the same unit as *?
-Y- --- F18/006 Connection of INPUT_UNIT on different images
-Y- --- F18/008 Contradictory assumed-rank requirements
-Y- --- F18/009 Bad examples in IEEE_ARITHMETIC functions
-Y- --- F18/010 Categories of pure procedures
-Y- --- F18/011 Categories of elemental procedures
-Y- --- F18/012 Internal procedure in a generic interface
-Y- --- F18/013 TEAM_NUMBER arguments and intrinsic function are ambiguous
-Y- --- F18/014 Type of OPERATION arguments to the REDUCE intrinsic
-C- --- F18/015 Example in C.6.8 is wrong
-Y- --- F18/016 Host association changes in Fortran 2018
-Y- --- F18/017 Final subroutine invocation order
-Y- --- F18/018 Public namelist and private variable
I have 2 comments on this example code.
21 ! Keep 1% spare images if we have a lot, just 1 if 10-199 images,
22 ! 0 if <10.
23 images_spare = MAX(NUM_IMAGES()/100,0,MIN(NUM_IMAGES()-10,1))
There are 2 problems with this comment and with this code:
1. If NUM_IMAGES() returns 10, images_spare will be 0, not 1.
Only when NUM_IMAGES() is 11, will images_spare becomes 1.
Either the comment must be changed,
or the code should be changed to "MIN(NUM_IMAGES()-9,1)".
2. The use of ",0" in the middle of the expression
does not achieve anything, and is only confusing.
The output of NUM_IMAGES() is non-negative,
hence NUM_IMAGES()/100 is non-negative,
so the result of the expression is unchanged
if that ",0" is removed:
images_spare = MAX( NUM_IMAGES()/100, MIN(NUM_IMAGES()-10,1) )
I prefer to rewrite this line explicitly as:
images_spare = 0
if ( NUM_IMAGES() .GE. 10 ) images_spare = 1
if ( NUM_IMAGES() .GE. 200 ) images_spare = NUM_IMAGES()/100
The example is very complex already - no need to overcomplicate
Variable name "team_number" is a poor choice because we
have intrinsic function TEAM_NUMBER.
It would be more clear to use this intrinsic in line 88,
88 IF (team_number == 1) THEN
88 IF ( TEAM_NUMBER() == 1) THEN
and give the variable a different name, e.g. "tnum" or "team_num".
More information about the J3