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

Add std::array-like class #146

Merged
merged 28 commits into from
May 2, 2024
Merged

Add std::array-like class #146

merged 28 commits into from
May 2, 2024

Conversation

adayton1
Copy link
Member

@adayton1 adayton1 commented Mar 5, 2024

  • Add camp::array as a portable alternative to std::array
  • Add portable testing infrastructure
  • Register gtests with ctest for filtering (which requires CMake 3.10)

@artv3
Copy link
Member

artv3 commented Mar 6, 2024

I was recently asked if we will now expect users to call camp directly in their applications. Will we? or do we think we will add camp features under a raja namespace?

@rhornung67
Copy link
Member

I was recently asked if we will now expect users to call camp directly in their applications. Will we? or do we think we will add camp features under a raja namespace?

Perhaps, once we land on a unified RAJA Portability Suite project, we should move things we expect users to have easy access to to a 'RAJA' namespace, using aliases, etc. We should discuss as a team.

@trws
Copy link
Member

trws commented Mar 6, 2024

The traditional thing has been to wrap everything in raja namespace, but I think the big decision will be whether we do it for desul or not, and for some things here. We could make it so that camp things can be re-exported or only exported into a different namespace, but I'm not sure which is better to be honest.

@trws
Copy link
Member

trws commented Mar 6, 2024

This looks pretty slick @adayton1, let me know when you're ready for a review and discussion.

@adayton1 adayton1 changed the title Draft: Add std::array-like class Add std::array-like class May 1, 2024
@adayton1
Copy link
Member Author

adayton1 commented May 1, 2024

This looks pretty slick @adayton1, let me know when you're ready for a review and discussion.

It's ready for review!

include/camp/array.hpp Outdated Show resolved Hide resolved
test/array.cpp Outdated Show resolved Hide resolved
test/array.cpp Outdated Show resolved Hide resolved
adayton1 and others added 2 commits May 1, 2024 08:42
Co-authored-by: Jason Burmark <MrBurmark@users.noreply.github.com>
@rhornung67 rhornung67 requested a review from long58 May 1, 2024 16:22
include/camp/array.hpp Outdated Show resolved Hide resolved
include/camp/array.hpp Outdated Show resolved Hide resolved
Copy link
Member

@rhornung67 rhornung67 left a comment

Choose a reason for hiding this comment

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

A few questions about comparison operators. I may be misunderstanding something here.

include/camp/array.hpp Outdated Show resolved Hide resolved
@adayton1
Copy link
Member Author

adayton1 commented May 1, 2024

@rhornung67 @long58 I've modified the comparison operators. operator< now matches the implementation in std::lexicographical_compare (https://en.cppreference.com/w/cpp/algorithm/lexicographical_compare) and all the other operators are implemented in terms of operator< or operator=.

Alternatively, I'm not really sure if there's a benefit to having comparison operators besides == and !=. I could potentially remove the others.

using iterator = pointer;
using const_iterator = const_pointer;

// TODO: Investigate device trap
Copy link
Member

Choose a reason for hiding this comment

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

@adayton1 FWIW, we use this macro in RAJA to handle the various back-end cases https://github.com/LLNL/RAJA/blob/develop/include/RAJA/util/macros.hpp#L143

Copy link
Member Author

Choose a reason for hiding this comment

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

I will look into that, but I don't want that to hold up this pull request.

@rhornung67
Copy link
Member

@rhornung67 @long58 I've modified the comparison operators. operator< now matches the implementation in std::lexicographical_compare (https://en.cppreference.com/w/cpp/algorithm/lexicographical_compare) and all the other operators are implemented in terms of operator< or operator=.

Alternatively, I'm not really sure if there's a benefit to having comparison operators besides == and !=. I could potentially remove the others.

For consistency with std::array, I think you should keep them.

rhornung67
rhornung67 previously approved these changes May 1, 2024
Copy link
Member

@rhornung67 rhornung67 left a comment

Choose a reason for hiding this comment

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

Thank you @adayton1

@adayton1
Copy link
Member Author

adayton1 commented May 1, 2024

The Docker rocm tests are failing, I think probably because the machine doesn't have any AMD GPUs. Should I turn off the testing and just do the build? Or maybe I could try to build in a filter so only the host tests run.

I also noticed that the docker nvcc builds don't actually build with nvcc - they are host only builds.

@rhornung67
Copy link
Member

The Docker rocm tests are failing, I think probably because the machine doesn't have any AMD GPUs. Should I turn off the testing and just do the build? Or maybe I could try to build in a filter so only the host tests run.

I also noticed that the docker nvcc builds don't actually build with nvcc - they are host only builds.

I believe all of our projects that run CI on cloud services only build and do not run anything for GPU jobs. Was it running before your PR? If so, I don't know how that would work.

@adayton1
Copy link
Member Author

adayton1 commented May 1, 2024

The Docker rocm tests are failing, I think probably because the machine doesn't have any AMD GPUs. Should I turn off the testing and just do the build? Or maybe I could try to build in a filter so only the host tests run.
I also noticed that the docker nvcc builds don't actually build with nvcc - they are host only builds.

I believe all of our projects that run CI on cloud services only build and do not run anything for GPU jobs. Was it running before your PR? If so, I don't know how that would work.

Yeah, they do run tests. I'm not sure how that was working before, either. The nvcc builds were actually host only, so tests would have run fine there. But the rocm one would have been broken. For now, I've filtered out all the tests that run code on GPUs. We'll want to clean up this CI in a follow on merge request.

@adayton1 adayton1 merged commit e5a94a8 into main May 2, 2024
14 checks passed
@adayton1 adayton1 deleted the feature/dayton8/array branch May 2, 2024 15:50
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.

6 participants