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

Run test_omp_target_offload with multiple environment vars set #262

Merged

Conversation

tob2
Copy link
Collaborator

@tob2 tob2 commented Jan 22, 2021

Currently, 5.0/program_control/test_omp_target_offload.c is a bit pointless as it requires that OMP_TARGET_OFFLOAD is set, which is usually not the case.

As discussed in pull #240, it cannot be set after program start.

This patch runs the once-compiled program three times. It seems to work okay, but I am not sure whether it messes up any diagnostic postprocessing.

  • sys/scripts/run_test.sh: Permit passing an environment variable.
  • Makefile (test_omp_target_offload.c.run, test_omp_target_offload.c.runonly):
    Run trice with env OMP_TARGET_OFFLOAD set to DEFAULT, MANDATORY, DISABLED.

@tob2
Copy link
Collaborator Author

tob2 commented Jan 22, 2021

@spophale , @jhdavis8 , and @tmh97: Does this make sense – or could it be done more sensible?

I think one item which probably should be improved is the dependency of "run" – it simply requires now all input files instead of only the one required. There are probably more issues.

@jhdavis8 jhdavis8 self-assigned this Jan 22, 2021
@jhdavis8 jhdavis8 added enhancement New feature or request infrastructure Relevant to testing infrastructure labels Jan 22, 2021
@jhdavis8
Copy link
Contributor

@tob2 This looks good to me. I want to double-check that it will interact OK with the results collection, there might be some overwrite/naming issues with the output files. Also, is there a way to do this with a bash FOR, to reduce the repetition?

For the run dependencies: If I understand your suggestion correctly, I believe the SOURCES option, if specified, will change the run rule dependency list to be just the listed files.

@tob2 tob2 force-pushed the target_offload_env branch from 6a0d02d to 72af402 Compare January 22, 2021 21:00
@tob2
Copy link
Collaborator Author

tob2 commented Jan 22, 2021

I have now moved it to the Bash script using --iter-env; I think it looks cleaner. As it simply runs the script multiple times before printing the PASS/FAIL line, it should work with all reporting scripts.

NOTE: I forced-pushed the new version. The previous version is at SOLLVE/sollve_vv@master...tob2:target_offload_env-orig

The make output now looks as follows. ("PASS" is placed between the other logs as STDERR is unbuffered contrary to STDOUT.)

running: bin/test_omp_target_offload.c.run 
sys/scripts/run_test.sh --iter-env OMP_TARGET_OFFLOAD MANDATORY,DISABLE,DEFAULT bin/test_omp_target_offload.c.o 1 | tee -a logs/test_omp_target_offload.c.log && echo "PASS" > _ompvv_temp_result_.exitstatus.5173 || echo "FAIL" > _ompvv_temp_result_.exitstatus.5173
test_omp_target_offload.c.o:

[OMPVV_INFO: test_omp_target_offload.c:54] Test is running on host.
[OMPVV_INFO: test_omp_target_offload.c:94] OMP_TARGET_OFFLOAD has been set to MANDATORY
test_omp_target_offload.c.o: PASS. exit code: 0
[OMPVV_INFO: test_omp_target_offload.c:96] The value of errors is 0.
[OMPVV_RESULT: test_omp_target_offload.c] Test passed on the host.

[OMPVV_INFO: test_omp_target_offload.c:54] Test is running on host.
[OMPVV_WARNING: test_omp_target_offload.c:92] OMP_TARGET_OFFLOAD has been set to DISABLED
[OMPVV_INFO: test_omp_target_offload.c:96] The value of errors is 0.
[OMPVV_RESULT: test_omp_target_offload.c] Test passed on the host.

[OMPVV_INFO: test_omp_target_offload.c:54] Test is running on host.
[OMPVV_INFO: test_omp_target_offload.c:94] OMP_TARGET_OFFLOAD has been set to DEFAULT
[OMPVV_INFO: test_omp_target_offload.c:96] The value of errors is 0.
[OMPVV_RESULT: test_omp_target_offload.c] Test passed on the host.

[Re-committed + fixed ↑ as I had a typo in of the "DISABLED" (missing tailing 'D' in one place).]

@tob2 tob2 force-pushed the target_offload_env branch from 72af402 to 202381f Compare January 22, 2021 21:47
@tob2
Copy link
Collaborator Author

tob2 commented Jan 22, 2021

One question: Currently, it only checks DEFAULT, MANDATORY, DISABLED; should it also check 'unset'?

@tob2
Copy link
Collaborator Author

tob2 commented Jan 27, 2021

Early ping

@spophale
Copy link
Collaborator

In the test we do capture if the value is not set. The 5.0 spec only recognizes DEFAULT, MANDATORY, DISABLED and the language suggests that OMP_TARGET_OFFLOAD must be one of those.

TODO: We add an error if it is not set.

Thanks @tob2 !

@jhdavis8 jhdavis8 added awaiting testing Test looks good but has not been verified. under discussion PR is on hold pending further discussion and removed awaiting testing Test looks good but has not been verified. labels Feb 1, 2021
@jhdavis8
Copy link
Contributor

jhdavis8 commented Feb 2, 2021

I tested this out. Looks like the way our results generation works causes all the results from the three runs to be merged into one result, with the final pass/fail decision based on the outcome of the last run (I need to check this further to see exactly what is going on, it could be that it needs all three to pass in order to pass).

We need to discuss what the expected behavior should be in terms of the website results. Should the website show three rows per compiler/system for this test? If so, right now there is no way to distinguish the environment variable settings on the website. Or, should it just show PASS/FAIL based on whether or not all three runs pass? The latter is my preference.

TL;DR this does basically work with our full infrastructure, but we should discuss what exactly we want to do on the website with this. @spophale @tmh97

@tob2
Copy link
Collaborator Author

tob2 commented Feb 10, 2021

We need to discuss what the expected behavior should be in terms of the website results. [... ]TL;DR this does basically work with our full infrastructure, but we should discuss what exactly we want to do on the website with this. @spophale @tmh97

@jhdavis8 – any news?

@jhdavis8
Copy link
Contributor

Yes, we did discuss it last meeting, I forgot to mention here what we decided. We're thinking it would work best to create three separate test files, one for each setting, each with one unique run rule in the Makefile. That way the online results are clear about which environment settings fail/pass, since the test names will indicate which setting was used.

Pull Req. OpenMP-Validation-and-Verification#262
* sys/scripts/run_test.sh: Add --env argument.
* Makefile (%.c.run, %.c.runonly): Automatically set environment
  variable based on the test-case name (test_<envname>_env_<val>.c).
* tests/5.0/program_control/test_omp_target_offload.c: Renamed ...
  tests/5.0/program_control/test_omp_target_offload_env_DEFAULT.c: to this;
  add 'EXPECTED_POLICY' #define and check that the env var matches.
* tests/5.0/program_control/test_omp_target_offload_env_DISABLED.c: New;
  #define EXPECTED_POLICY and include the _DEFAULT file.
* tests/5.0/program_control/test_omp_target_offload_env_MANDATORY.c:
  Likewise.
@tob2 tob2 force-pushed the target_offload_env branch from 202381f to 710d534 Compare February 11, 2021 12:29
@tob2
Copy link
Collaborator Author

tob2 commented Feb 11, 2021

We're thinking it would work best to create three separate test files, one for each setting, each with one unique run rule in the Makefile.

Like this new version?

@spophale
Copy link
Collaborator

LGTM.
@jhdavis8 will you be able to test this ?

* tests/5.0/program_control/test_omp_target_offload_env_DEFAULT.c:
  Remove unused variable, fixed OMPVV_ERROR_IF fmt string usage.
@tob2
Copy link
Collaborator Author

tob2 commented Feb 11, 2021

  • Last commit: Fixed two small issues: passing an enum to %s did not make sense + removed a compiler warning (unused var).
  • I wonder whether a OMPVV_TEST_AND_SET(errors, policy!=EXPECTED_POLICY); should be added in addition.
  • BTW: I tested it with GCC mainline (GCC 11), albeit on a system without an offloading device.

@jhdavis8 jhdavis8 removed the under discussion PR is on hold pending further discussion label Feb 15, 2021
@jhdavis8
Copy link
Contributor

@spophale just tested on Summit. Works as expected.

@jhdavis8 jhdavis8 added the ready PR is ready for review label Feb 15, 2021
@spophale spophale merged commit 2920b47 into OpenMP-Validation-and-Verification:master Feb 16, 2021
@tob2 tob2 deleted the target_offload_env branch February 16, 2021 15:04
@tmh97
Copy link
Contributor

tmh97 commented Jun 9, 2022

Hey @tob2 , I realized some of the changes we pushed into the makefile broke the ability to run .c files using make ... compile followed bymake ... run

Specifically the lines 350-368 as noted in this issue #400

It seems the makefile error is thrown on line 358.

Any thoughts on what may be the issue? I'll continue to look into this but figured it was worth asking

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request infrastructure Relevant to testing infrastructure ready PR is ready for review
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants