Flag existing and new compiler warnings with GitHub Action#3200
Flag existing and new compiler warnings with GitHub Action#3200NickSzapiro-NOAA wants to merge 22 commits into
Conversation
Removed condition for pull request event in check-warnings job.
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
| name: Check New Compiler Warnings | ||
| runs-on: ubuntu-24.04 | ||
| needs: [Spack] | ||
| if: (success() || failure()) # && github.event_name == 'pull_request' |
There was a problem hiding this comment.
Is this line needed at all? It seems like if success or failure covers most (all?) circumstances.
There was a problem hiding this comment.
So the job waits for Spack to finish (whether Spack succeeds or fails)
There was a problem hiding this comment.
In the past, I've used needs: for that purpose, which you already have there. 🤔 Does the conditional bring something additional? Like, would the warning check not run if the Spack step failed, and so you're trying to also capture that? Could you use if: always() or something similar (I think always() would have it run even if the Spack step were cancelled, which doesn't make sense, but there may be another option)?
There was a problem hiding this comment.
Yes, we can still check the compile logs for warnings even if the Spack build fails
https://docs.github.com/en/actions/reference/workflows-and-actions/workflow-syntax#example-not-requiring-successful-dependent-jobs
I think if: always() is similar but doesn't care if job is cancel vs. success vs. fail
https://docs.github.com/en/actions/reference/workflows-and-actions/expressions#status-check-functions
Thanks for reviewing @gspetro-NOAA , especially as I'm learning as I go here
|
fyi, I tested this with changing the CICE branch to CICE-Consortium/main and the warnings were incorrectly lumped into the existing "legacy" category |
…ub/scripts/check_build_compile_warnings.py
|
This now seems to work ok @gspetro-NOAA ... flagged test warnings in CICE and ccpp-physics as new (by recursing down the .gitmodules for changed lines). I didn't run full RTs as changes are all in CI, except for adding |
|
@NickSzapiro-NOAA In the description, you point to a closed PR "for what a developer might see" but I don't see anything there? The CI compile job is just the S2SWA, which does not use PDLIB for WW3, so we're missing any compiler warnings that might be triggered there. Is that right? |
|
Thanks @DeniseWorthen , sorry about that. I've updated the PR description with two more recent examples
That's right. You're also right that it only covers a few ccpp-physics suites too. I'm thinking the first use case is as a tool that once a PR's RT logs show increased number of warnings for any test(s), developer or CMs can then identify them by changing application, if needed. It's at least better than in #2810 (comment) We still need the more enforceable solution of turning warnings into errors and then add exceptions for some in the mean time |
|
Thanks for posting what a developer would see. Do you know whether "unused variable" is problematic for NCO? And also, we're going on the assumption that GNU (CI) compiles are "stricter" than non-GNU, right? So we'd hopefully be ahead of the game when it comes to a non-GNU compile. |
I don't see such details in the standards. The current
That's what I found ... Intel warnings were a subset of the GNU ones. |
|
@gspetro-NOAA Nick and I discussed that the current CI is using a compile (S2SWA) that does not track any opn configuration; and it is the opn standards that require no warnings. So it makes sense to us that the CI compile something that exercises one or more opn confgs. The Is that doable? |
I love the idea! @AlexanderRichert-NOAA is the one who put together the original CI with S2SWA, so he may be better able to comment on whether that needs to stay, how doable it is to switch it or to add another task that does track operational configs, and whether he could do it or whether I/EPIC should look into it. |
|
My two cents is that I chose the S2SWA configuration just as a way to exercise the various dependencies etc., but I don't think there's any special reason to stay with that compared with testing more operationally relevant setups. |
|
It was pretty straightforward to figure out how to add the HAFS build but I give up on the gfsv17 case; that requires PDLIB, which requires SCOTCH and I ended up down a rabbity hole of AI misdirection. I also don't really understand why we have to build the entire stack all the time and why the common-build-cache isn't getting used. This is what I added for hafs: |
|
It looks like most packages are being pulled from the build cache, but ESMF and MAPL were rebuilt and I'm not sure why. There may be some possible workarounds, but hopefully soon we can default to running with a container image with everything preinstalled. |
|
After some rounds in ci/package.py with AI, GFS s2sw+pdlib builds in this branch: I don't know if you want to take a look @AlexanderRichert-NOAA but it looks hacky to me |
|
Yeah I see what you mean... Ideally the flag settings would be taken care of by scotch's own cmake configuration, and if not that then by WW3's FindSCOTCH.cmake. If you don't add the new logic, does the build fail or is it not a viable executable? Also, https://github.com/NickSzapiro-NOAA/ufs-weather-model/blob/test_warnings_ghaction_gfs/ci/package.py restricts the scotch version. Is that necessary? |
|
I was iterating for the compile not to fail with errors @AlexanderRichert-NOAA . I have not tested the validity of the executable ... fwiw, for compiler warnings I don't know that we actually need the different options to be able to run together "scientifically". But, forcing static As for scotch version, I think Spack concretized and built Scotch 7.0.6. While wavewatch added the #ifdef SCOTCH_707 logic, apparently the SCOTCHF_ API change was actually in 7.0.5 so there's a mismatch in that exact version. It may be more worth sorting out scotch-related issues for wavewatch pdlib and eventually mpas-a options |
|
Tagging @mingchen-NOAA @JessicaMeixner-NOAA ... could it be that the scotch API change (needed for pdlib) is in v7.0.5 (not 7.0.7)? |
|
I think WW3 can/should be modified to use CMake-built scotch instead of FindSCOTCH.cmake. Here are my tweaks to ci/package.py based on the head of develop, let me know if you'd like this as a branch/PR: |
|
@AlexanderRichert-NOAA - I'm not a cmake expert, so I will trust your expertise if you think we should be updating our CMake build for scotch. If you submit a PR to WW3, we'll test and make sure it works for our non-UFS use cases as well. We can also update the 7.0.6 -> 7.0.5 for the API changes to make that clearer. |
|
@AlexanderRichert-NOAA Your changes look cleaner and this builds Is the best solution to fix this in wavewatch? Instead of https://github.com/NOAA-EMC/WW3/blob/dev/ufs-weather-model/model/src/CMakeLists.txt#L179-L189 I guess change the "DSCOTCH_707" too |
|
Glad it worked, and yes, that makes a lot of sense as far as how to update WW3. I think having the "CONFIG REQUIRED" piece makes sense if the desire is to also keep FindSCOTCH.cmake in order to use non-CMake based versions of Scotch. On the other hand, if WW3 will only ever use CMake-based versions (7.x onward, I believe), then I think it makes sense to remove FindSCOTCH.cmake from WW3 altogether and update the target names as you've done there. @JessicaMeixner-NOAA what are your thoughts on whether there's value in keeping FindSCOTCH.cmake as a fallback vs. scrapping it and just supporting Scotch 7.x+? |
|
I'm concerned about supporting WW3 users that are not UFS or NOAA users. I'd like to see a PR and ask a few others to test if we're going to make a major change. In terms of versions of SCOTCH, I had no issues before just moving to the latest version but we had issues between WCOSS2 versions and other machines - so it was actually best to support the multiple versions. SCOTCH 7.0.0 is from 2021, so I think moving to 7.0 or higher is fine -but I think at least for now we'd want to have the switch for the 7.0.5 version update. |
|
It seems better to have the changes upstream. If it's helpful for community, here is also an untested updated FindSCOTCH.cmake in WW3: |
|
@NickSzapiro-NOAA - I've tested your WW3 changes and have no issues with them on our machines. The next step is to make a PR to develop so that we can ensure we are not breaking things for WW3 community members that are not "UFS". I'm hopeful to have something by the end of the week and feedback next week. |
Commit Queue Requirements:
test_changes.listindicates which tests, if any, are changed by this PR. Committest_changes.list, even if it is empty.Description:
We're looking for a friendlier way of iterating with developers to reduce compiler warnings, towards better code quality and EE2 requirements. Here is a go at this via custom GitHub Action to flag existing and new compiler warnings for s2swa application in GNU debug mode. These complement the tracking of the number of warnings on supported platforms via the regression test platform logs.
This PR introduces a lightweight Python parser that reads Spack CI build logs, checks the Git diff, and leverages built-in GitHub Action commands to print warnings and annotate the PR.
Some examples for what a developer may see are:
Commit Message:
Priority:
Git Tracking
UFSWM:
Sub component Pull Requests:
UFSWM Blocking Dependencies:
Documentation:
Changes
Regression Test Changes (Please commit test_changes.list):
Input data Changes:
Library Changes/Upgrades:
Testing Log: