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

fix clang-tidy warnings #468

Merged
merged 22 commits into from
Feb 9, 2024
Merged

fix clang-tidy warnings #468

merged 22 commits into from
Feb 9, 2024

Conversation

BenWibking
Copy link
Collaborator

Description

This fixes many clang-tidy warnings thoughout the code. Most of them had to do with unnecessary header includes or const issues. No outputs should change at the bitwise level.

Related issues

N/A

Checklist

Before this pull request can be reviewed, all of these tasks should be completed. Denote completed tasks with an x inside the square brackets [ ] in the Markdown source below:

  • I have added a description (see above).
  • I have added a link to any related issues see (see above).
  • I have read the Contributing Guide.
  • I have added tests for any new physics that this PR adds to the code.
  • I have tested this PR on my local computer and all tests pass.
  • I have manually triggered the GPU tests with the magic comment /azp run.
  • I have requested a reviewer for this PR.

@BenWibking
Copy link
Collaborator Author

/azp run

Copy link

Azure Pipelines successfully started running 4 pipeline(s).

@BenWibking
Copy link
Collaborator Author

The HIP failure looks like an AMD compiler bug.

Copy link
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

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

clang-tidy made some suggestions

There were too many comments to post at once. Showing the first 10 out of 25. Check the log or trigger a new build to see more.

src/interpolate.cpp Outdated Show resolved Hide resolved
src/interpolate.cpp Outdated Show resolved Hide resolved
src/interpolate.cpp Outdated Show resolved Hide resolved
src/interpolate.cpp Outdated Show resolved Hide resolved
src/root_finding.hpp Outdated Show resolved Hide resolved
src/root_finding.hpp Outdated Show resolved Hide resolved
src/root_finding.hpp Outdated Show resolved Hide resolved
src/root_finding.hpp Outdated Show resolved Hide resolved
src/root_finding.hpp Outdated Show resolved Hide resolved
src/root_finding.hpp Outdated Show resolved Hide resolved
markkrumholz
markkrumholz previously approved these changes Dec 10, 2023
@BenWibking
Copy link
Collaborator Author

There are lots of unexpected test failures. I'll dismiss the review and re-request a review when those are all fixed.

@BenWibking BenWibking marked this pull request as draft December 10, 2023 17:24
@BenWibking BenWibking changed the title fix clang-tidy warnings WIP: fix clang-tidy warnings Dec 11, 2023
@BenWibking
Copy link
Collaborator Author

/azp run

Copy link

Azure Pipelines successfully started running 4 pipeline(s).

@BenWibking
Copy link
Collaborator Author

Ok, now the only remaining issue appears to be this ROCm compiler bug:

In file included from /tmp/bwibking/_work/1/s/extern/amrex/Src/Base/AMReX_MultiFab.H:7:
In file included from /tmp/bwibking/_work/1/s/extern/amrex/Src/Base/AMReX_FArrayBox.H:6:
In file included from /tmp/bwibking/_work/1/s/extern/amrex/Src/Base/AMReX_BaseFab.H:19:
In file included from /tmp/bwibking/_work/1/s/extern/amrex/Src/Base/AMReX_Utility.H:15:
In file included from /tmp/bwibking/_work/1/s/extern/amrex/Src/Base/AMReX_Random.H:8:
In file included from /tmp/bwibking/_work/1/s/extern/amrex/Src/Base/AMReX_RandomEngine.H:11:
In file included from /opt/rocm-5.7.0/include/hiprand/hiprand.hpp:35:
In file included from /opt/rocm-5.7.0/include/hiprand/hiprand_kernel.h:64:
/opt/rocm-5.7.0/include/hiprand/hiprand_kernel_hcc.h:128:19: error: reference to 'detail' is ambiguous
    static_assert(detail::is_any_of<StateType,
                  ^
/opt/rocm-5.7.0/include/hiprand/hiprand_kernel_hcc.h:68:11: note: candidate found by name lookup is 'detail'
namespace detail {
          ^
/tmp/bwibking/_work/1/s/extern/amrex/Src/Base/AMReX_GpuComplex.H:425:11: note: candidate found by name lookup is 'amrex::detail'
namespace detail
          ^

@BenWibking
Copy link
Collaborator Author

Merging this is blocked on fixing a Microphysics issue (due to an underlying ROCm issue): AMReX-Astro/Microphysics#1406

@BenWibking
Copy link
Collaborator Author

/azp run

Copy link

Azure Pipelines successfully started running 4 pipeline(s).

@BenWibking BenWibking changed the title WIP: fix clang-tidy warnings [WIP] fix clang-tidy warnings Dec 15, 2023
@psharda
Copy link
Contributor

psharda commented Dec 20, 2023

I am hoping this will also ensure the clang-tidy test passes for #368

@BenWibking
Copy link
Collaborator Author

BenWibking commented Dec 20, 2023

I am hoping this will also ensure the clang-tidy test passes for #368

We need Microphysics to avoid using namespace amrex before this PR will work on AMD.

Also, I think your clang-tidy issue is unrelated (unfortunately).

@psharda
Copy link
Contributor

psharda commented Feb 1, 2024

Hopefully, once #517 is merged, the AMD tests will also pass.

@BenWibking
Copy link
Collaborator Author

Depends on AMReX-Astro/Microphysics#1474.

@BenWibking
Copy link
Collaborator Author

/azp run

Copy link

Azure Pipelines successfully started running 5 pipeline(s).

AMREX_GPU_MANAGED GpuArray<Real, Physics_Traits<Channel>::numPassiveScalars> s_inflow{}; // NOLINT(cppcoreguidelines-avoid-non-const-global-variables)
#if 0 // workaround AMDGPU compiler bug
Real rho0 = NAN; // NOLINT(cppcoreguidelines-avoid-non-const-global-variables)
Real u0 = NAN; // NOLINT(cppcoreguidelines-avoid-non-const-global-variables)

Check notice

Code scanning / CodeQL

Short global name Note

Poor global variable name 'u0'. Prefer longer, descriptive names for globals (eg. kMyGlobalConstant, not foo).
#if 0 // workaround AMDGPU compiler bug
Real rho0 = NAN; // NOLINT(cppcoreguidelines-avoid-non-const-global-variables)
Real u0 = NAN; // NOLINT(cppcoreguidelines-avoid-non-const-global-variables)
Real s0 = NAN; // NOLINT(cppcoreguidelines-avoid-non-const-global-variables)

Check notice

Code scanning / CodeQL

Short global name Note

Poor global variable name 's0'. Prefer longer, descriptive names for globals (eg. kMyGlobalConstant, not foo).
@BenWibking BenWibking marked this pull request as ready for review February 9, 2024 01:27
@BenWibking BenWibking changed the title [WIP] fix clang-tidy warnings fix clang-tidy warnings Feb 9, 2024
@BenWibking
Copy link
Collaborator Author

It's fixed now.

@BenWibking
Copy link
Collaborator Author

/azp run

Copy link

Azure Pipelines successfully started running 5 pipeline(s).

@BenWibking
Copy link
Collaborator Author

Fixed missing std:: in planck_integral.hpp. Re-running tests...

@BenWibking
Copy link
Collaborator Author

/azp run

Copy link

Azure Pipelines successfully started running 5 pipeline(s).

@psharda
Copy link
Contributor

psharda commented Feb 9, 2024

/azp run

Copy link

Azure Pipelines successfully started running 5 pipeline(s).

src/EOS.hpp Show resolved Hide resolved
@BenWibking BenWibking added this pull request to the merge queue Feb 9, 2024
Merged via the queue into development with commit 2d863d6 Feb 9, 2024
18 checks passed
@BenWibking BenWibking deleted the BenWibking/clang-tidy-1 branch February 9, 2024 21:01
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.

3 participants