Skip to content

Conversation

@alisterj1138
Copy link
Collaborator

@alisterj1138 alisterj1138 commented Mar 4, 2025

Hello! Here are several updates and fixes for the tests. I did my best to keep the commits as independent and granular as possible, so if you want, you can hopefully cherry pick them without issue.

Most of the changes are fairly minor, here's a list of the ones that aren't:

  • factoring out devtest from many F90 tests -- this reduces code duplication; the very first commit in this PR is the base one for this change, some of the commits that come after depend on it, but I made a note in the commit messages (edit to add: I forgot that this also factors out the "is_possible" function, so the refactor of the atomic tests also depends on this commit)
  • a major refactor of the F90 atomic tests -- there was a lot of code duplication here, and all these tests followed the same pattern, so they've been rewritten with preprocessor macros (if you could go through each of these files, I'd appreciate it, there was a lot of copy-paste going on and I want to be sure everything got edited correctly)
  • major edits to declare_copyin/create.F90 -- the tests seemed to be expecting a separate module file, but I couldn't figure out how to make the testing harness do that, so these have been edited to contain the module, as well as other misc bug fixes

If you have questions about any of these edits, please let me know! Thanks again for this test suite!

…t fine grained enough for a very strict test
… is column-major; also updating devtest usage
@alisterj1138 alisterj1138 marked this pull request as ready for review March 4, 2025 17:52
@andrewkallai
Copy link

@alisterj1138
The first step taken to review these tests has been to run each test (185 out of the 190 files) with NVHPC version 25.3.
The results of this test run were collected on a UDEL system and are posted at this link:
https://github.com/ajarmusch/OpenACC-Results-Viewer
Apparently 6 tests fail to pass at runtime, and 2 do not compile.
I would consider relooking into those 8 as to why they do not pass.
In the meantime, I have run the applicable tests with the gcc compiler, and I am cross checking any pass/fail counts with our own previous test run.
I am going through the tests individually as well to see which ones I can say look good from reviewing the spec and the runtime result.

@alisterj1138
Copy link
Collaborator Author

Great, thank you!

I looked at the 8 failures and they're all ones we know about and are tracking -- they're expected failures with 25.3.

Please let me know if you have any questions!

@andrewkallai
Copy link

andrewkallai commented Jun 12, 2025

@alisterj1138
When compiling atomic_capture_expr_and_x_assign.F90 with gfortran (GNU Fortran (GCC) 15.1.0):

gfortran -fopenacc -cpp -lm -foffload='-lm' -o /global/u2/a/andrewka/my_fork/OpenACCV-V/build/atomic_capture_expr_and_x_assign.F90 /global/u2/a/andrewka/my_fork/OpenACCV-V/Tests/atomic_capture_expr_and_x_assign.F90

/global/u2/a/andrewka/my_fork/OpenACCV-V/Tests/common.Fh:63:29:
   63 |       if (.NOT. done(j) .AND. b(j) .eq. tmp) then
      |                             1
Error: Logicals at (1) must be compared with .eqv. instead of .eq.
/global/u2/a/andrewka/my_fork/OpenACCV-V/Tests/common.Fh:77:6:

   77 |   if (current .eq. final) then
      |      1
Error: Logicals at (1) must be compared with .eqv. instead of .eq.
/global/u2/a/andrewka/my_fork/OpenACCV-V/Tests/atomic_template.Fh:198:20:

  198 |         totals(i) = ATOMIC_OP(a(i, j), totals(i))
      |                    1
Error: !$OMP ATOMIC assignment operator must be binary +, *, -, /, .AND., .OR., .EQV. or .NEQV. at (1)

The compiler does not accept the logic comparison with .eq. and wants .eqv. to be used in common.Fh
It also does not want = to be used in atomic_template.Fh.

For Cray Fortran : Version 18.0.0:

ftn -h acc,noomp -h msgs -o /global/u2/a/andrewka/my_fork/OpenACCV-V/build/atomic_capture_expr_and_x_assign.F90/atomic_capture_expr_and_x_assign.F900 /global/u2/a/andrewka/my_fork/OpenACCV-V/Tests/atomic_capture_expr_and_x_assign.F90


ftn-303 ftn: ERROR VERIFY_ATOMIC_SEQUENCE, File = common.Fh, Line = 63, Column = 36 
  Data type LOGICAL is not allowed with LOGICAL for the operation "eq".


ftn-303 ftn: ERROR VERIFY_ATOMIC_SEQUENCE, File = common.Fh, Line = 77, Column = 15 
  Data type LOGICAL is not allowed with LOGICAL for the operation "eq".


ftn-807 ftn: ERROR TEST1, File = atomic_template.Fh, Line = 198, Column = 21 
  The statement following an OpenMP ATOMIC directive must contain the LHS scalar variable and an operator or expression on the RHS.


ftn-805 ftn: ERROR TEST1, File = atomic_template.Fh, Line = 201, Column = 19 
  The ATOMIC CAPTURE directive must be followed by a specified statement order consisting of update:capture, capture:update or capture:write.

The nvfortran compiler does not yield these errors.

I would recommend the changes which gfortran and ftn suggest should be applied to the .Fh files in order to ensure that correct fortran syntax is being used.
Consulting reference documentation such as here for Cray Fortran I think is most helpful for figuring out the reason why these are syntax errors.

@alisterj1138
Copy link
Collaborator Author

Thanks for checking these fixes! I've fixed the headers to use .EQV./.NEQV. instead. I was able to test with gfortran and I'm fairly confident they should be good now. (There was also a typo/bug in one of the defines, so I fixed that too.)

There were also a couple tests that needed the same fix (many thanks to one of my coworkers for spotting them), so I included that fix as well.

#define MIN_X_EXPR_LIST 1004

#if ATOMIC_OPTYPE == EXPR_PLUS_X
#define ATOMIC_OP(a, b) (a + b)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
#define ATOMIC_OP(a, b) (a + b)
#define ATOMIC_OP(a, b) a + b

and all other associated ADD expressions

#if ATOMIC_OPTYPE == EXPR_PLUS_X
#define ATOMIC_OP(a, b) (a + b)
#elif ATOMIC_OPTYPE == EXPR_MINUS_X
#define ATOMIC_OP(a, b) (a - b)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
#define ATOMIC_OP(a, b) (a - b)
#define ATOMIC_OP(a, b) a - b

and all other associated MINUS expressions

#elif ATOMIC_OPTYPE == EXPR_MINUS_X
#define ATOMIC_OP(a, b) (a - b)
#elif ATOMIC_OPTYPE == EXPR_TIMES_X
#define ATOMIC_OP(a, b) (a * b)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
#define ATOMIC_OP(a, b) (a * b)
#define ATOMIC_OP(a, b) a * b

and all other associated TIMES expressions

#elif ATOMIC_OPTYPE == EXPR_TIMES_X
#define ATOMIC_OP(a, b) (a * b)
#elif ATOMIC_OPTYPE == EXPR_DIVIDED_X
#define ATOMIC_OP(a, b) (a / b)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
#define ATOMIC_OP(a, b) (a / b)
#define ATOMIC_OP(a, b) a / b

and all other associated DIVIDE expressions

@andrewkallai
Copy link

@alisterj1138
I have reviewed the files, please look through the comments at your convenience.

@alisterj1138
Copy link
Collaborator Author

I'm starting to go through all the comments today (thank you for going through everything so thoroughly!), I'll mark them resolved as I fix them and push the commit(s) once I'm done with everything.

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.

2 participants