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

Fixed clang serial compiler error in kokkos controller construction #31

Merged
merged 4 commits into from
Feb 14, 2024

Conversation

PrestonH2O
Copy link
Contributor

@PrestonH2O PrestonH2O commented Feb 13, 2024

Parameter pack expansion in the construct function in KokkosController was happening backwards (as a comment noted) with g++ but this behavior was not guaranteed since C++ does not enforce the order of a functions arguments are evaluated. Clang was traversing the pack in forward order causing extent_sizes to be loaded backwards with that compiler. The behavior has been adjusted to force forward order no matter the compiler and create_view has been adjusted to handle forward order accordingly.
See for more: https://stackoverflow.com/questions/42047795/order-of-parameter-pack-expansion

Should we get rid of testClangMinimal now that we don't need it? It's function is handled by testSetField in main tests anyway.

I also added a new test that ensures the dims are loaded in the correct order.

One more thing to note is that LogicTests does actually fail randomly. It seems to fail about 50% of the time for a reason I have not looked into yet. Let me know if I should.

Parameter pack expansion in the construct function in KokkosController was happening backwards (as a comment noted) with g++ but this behavior was not guarenteed since C++ does not guarentee the order of a functions arguments are evaluated. If the expressions to a function all consume data from a stream, you can get behavior where objects are read in the wrong order. Clang was traversing the pack in forward order causing extent_sizes to be loaded backwards with that compiler. The behavior has been adjusted to force forward order no matter the compiler and create_view has been adjusted to handle forward order accordingly. See for more: https://stackoverflow.com/questions/42047795/order-of-parameter-pack-expansion
Copy link
Contributor

@cwsmith cwsmith left a comment

Choose a reason for hiding this comment

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

Looks good. Thank you.

In this sentence of the PR description, “If the expressions to a function all consume data from a stream, you can get behavior where objects are read in the wrong order.”

  • I don’t understood what ‘stream’ means in this context. If we know, then we should clarify.

  • If we keep this statement: if this is a copy-paste from a SO post then we should cite the source and put it in quotes.

src/KokkosController.hpp Outdated Show resolved Hide resolved
src/KokkosController.hpp Outdated Show resolved Hide resolved
@PrestonH2O
Copy link
Contributor Author

Looks good. Thank you.

In this sentence of the PR description, “If the expressions to a function all consume data from a stream, you can get behavior where objects are read in the wrong order.”

  • I don’t understood what ‘stream’ means in this context. If we know, then we should clarify.
  • If we keep this statement: if this is a copy-paste from a SO post then we should cite the source and put it in quotes.

Okay I removed it because honestly I wasn't exactly sure what was meant by stream either. Best guess is that it was referencing some kind of I/O stream since the function in the post is called read_all(). I think the bug explanation is perfectly clear without the line anyway.

@PrestonH2O
Copy link
Contributor Author

I have made the requested changes. Please advise on these two points:

Should we get rid of testClangMinimal now that we don't need it? It's function is handled by testSetField in main tests anyway.

One more thing to note is that LogicTests does actually fail randomly. It seems to fail about 50% of the time for a reason I have not looked into yet. Let me know if I should. (This should probably be its own issue, no?)

@cwsmith
Copy link
Contributor

cwsmith commented Feb 14, 2024

@PrestonH2O Thank you. Yes; please remove testClangMinimal and create a new issue for the failing LogicTests.

Copy link
Contributor

@cwsmith cwsmith left a comment

Choose a reason for hiding this comment

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

these need to be removed

add_executable(ClangTests test/testClangMinimal.cpp)
target_link_libraries(ClangTests PRIVATE meshFields)

Copy link

Package Line Rate Complexity Health
meshFields.src 99% 0
meshFields.test 96% 0
Summary 97% (873 / 896) 0

@cwsmith cwsmith changed the title Fixed clang compiler error Fixed clang serial compiler error in kokkos controller construction Feb 14, 2024
@cwsmith cwsmith merged commit 862efbd into main Feb 14, 2024
1 of 6 checks passed
@cwsmith cwsmith deleted the minimal-Clang-Error branch February 14, 2024 20:18
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