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 Val class similar to ValLoc #1582

Open
MrBurmark opened this issue Dec 15, 2023 · 3 comments
Open

Add Val class similar to ValLoc #1582

MrBurmark opened this issue Dec 15, 2023 · 3 comments
Assignees
Labels
API/usability feature reviewed Mark with this label when issue has been discussed by team

Comments

@MrBurmark
Copy link
Member

Add Val class similar to ValLoc so we can have a .min method like what the legacy reducers have.

@MrBurmark
Copy link
Member Author

Through discussion we have decided to move toward changes to the API to bring the operator into the lambda argument to improve type safety.

  DATA_TYPE maxinit = big_max;
  DATA_TYPE max(max_init);

  // RefOp<DATA_TYPE, OPERATION>;
  // using RefLocOp<DATA_TYPE, Index_Type, OPERATION> = RefOp<ValLoc<DATA_TYPE, Index_Type>, OPERATION>;

  template < typename DATA_TYPE >
  using MaxRef = RefOp<DATA_TYPE, RAJA::operators::maximum>;

  RAJA::forall<EXEC_POLICY>(seg, 
    RAJA::expt::Reduce(MaxRef(maxinit)),
    RAJA::expt::Reduce<RAJA::operators::maximum>(&max),
    [=] RAJA_HOST_DEVICE(IDX_TYPE idx, MaxRef<DATA_TYPE> mi, DATA_TYPE &m) {
      mi.max(working_array[idx]);
      mi.min(...); // error (SFINAE)
      m  = RAJA_MAX(working_array[idx], m);
  });

@MrBurmark
Copy link
Member Author

We might want to unify the ValLoc and ValueLoc classes.

@MrBurmark
Copy link
Member Author

We might want to SFINAE out the operators based on an operator template arg. For example Val<double, RAJA::min> only has the min operator and += is disabled.

@rhornung67 rhornung67 added the reviewed Mark with this label when issue has been discussed by team label Mar 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
API/usability feature reviewed Mark with this label when issue has been discussed by team
Projects
None yet
Development

No branches or pull requests

3 participants