Skip to content

Commit

Permalink
Remove ArborX_DetailsKokkosExtMinMaxOperations.hpp
Browse files Browse the repository at this point in the history
Kokkos supports all its functions since 3.7
  • Loading branch information
aprokop committed Sep 7, 2023
1 parent 245ad52 commit 6b12c25
Show file tree
Hide file tree
Showing 12 changed files with 44 additions and 126 deletions.
8 changes: 4 additions & 4 deletions src/details/ArborX_DetailsBruteForceImpl.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -99,10 +99,10 @@ struct BruteForceImpl
int primitive_start = primitives_per_team *
(teamMember.league_rank() % n_primitive_tiles);

int predicates_in_this_team = KokkosExt::min(
predicates_per_team, n_predicates - predicate_start);
int primitives_in_this_team = KokkosExt::min(
primitives_per_team, n_primitives - primitive_start);
int predicates_in_this_team =
Kokkos::min(predicates_per_team, n_predicates - predicate_start);
int primitives_in_this_team =
Kokkos::min(primitives_per_team, n_primitives - primitive_start);

ScratchPredicateType scratch_predicates(teamMember.team_scratch(0),
predicates_per_team);
Expand Down
5 changes: 2 additions & 3 deletions src/details/ArborX_DetailsDistributedTreeImpl.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
#include <ArborX_Box.hpp>
#include <ArborX_DetailsDistributor.hpp>
#include <ArborX_DetailsHappyTreeFriends.hpp>
#include <ArborX_DetailsKokkosExtMinMaxOperations.hpp>
#include <ArborX_DetailsKokkosExtScopedProfileRegion.hpp>
#include <ArborX_DetailsKokkosExtViewHelpers.hpp>
#include <ArborX_DetailsPriorityQueue.hpp>
Expand Down Expand Up @@ -400,7 +399,7 @@ void DistributedTreeImpl<DeviceType>::reassessStrategy(
"ArborX::DistributedTree::query::most_distant_neighbor_so_far",
Kokkos::RangePolicy<ExecutionSpace>(space, 0, n_queries),
KOKKOS_LAMBDA(int i) {
using KokkosExt::max;
using Kokkos::max;
farthest_distances(i) = 0.;
for (int j = offset(i); j < offset(i + 1); ++j)
farthest_distances(i) = max(farthest_distances(i), distances(j));
Expand Down Expand Up @@ -895,7 +894,7 @@ void DistributedTreeImpl<DeviceType>::filterResults(
"ArborX::DistributedTree::query::discard_results",
Kokkos::RangePolicy<ExecutionSpace>(space, 0, n_queries),
KOKKOS_LAMBDA(int q) {
using KokkosExt::min;
using Kokkos::min;
new_offset(q) =
min(offset(q + 1) - offset(q), getK(Access::get(queries, q)));
});
Expand Down
13 changes: 6 additions & 7 deletions src/details/ArborX_DetailsMortonCode.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
#ifndef ARBORX_DETAILS_MORTON_CODE_UTILS_HPP
#define ARBORX_DETAILS_MORTON_CODE_UTILS_HPP

#include <ArborX_DetailsKokkosExtMinMaxOperations.hpp> // min. max
#include <ArborX_GeometryTraits.hpp>

#include <Kokkos_Core.hpp> // abort
Expand Down Expand Up @@ -289,8 +288,8 @@ KOKKOS_INLINE_FUNCTION unsigned int morton32(Point const &p)
constexpr int DIM = GeometryTraits::dimension_v<Point>;
constexpr unsigned N = 1u << (DIM == 1 ? 31 : 32 / DIM);

using KokkosExt::max;
using KokkosExt::min;
using Kokkos::max;
using Kokkos::min;

unsigned int r = 0;
for (int d = 0; d < DIM; ++d)
Expand All @@ -310,8 +309,8 @@ KOKKOS_INLINE_FUNCTION unsigned long long morton64(Point const &p)
constexpr int DIM = GeometryTraits::dimension_v<Point>;
constexpr unsigned long long N = (1llu << (63 / DIM));

using KokkosExt::max;
using KokkosExt::min;
using Kokkos::max;
using Kokkos::min;

unsigned long long r = 0;
for (int d = 0; d < DIM; ++d)
Expand All @@ -334,8 +333,8 @@ KOKKOS_INLINE_FUNCTION unsigned long long morton64(Point const &p)
// direction).
constexpr unsigned N = (1u << 31);

using KokkosExt::max;
using KokkosExt::min;
using Kokkos::max;
using Kokkos::min;

// Have to use double as float is not sufficient to represent large
// integers, which would result in some missing bins.
Expand Down
5 changes: 2 additions & 3 deletions src/details/ArborX_DetailsMutualReachabilityDistance.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
#include <ArborX_AccessTraits.hpp>
#include <ArborX_DetailsAlgorithms.hpp>
#include <ArborX_DetailsHappyTreeFriends.hpp>
#include <ArborX_DetailsKokkosExtMinMaxOperations.hpp>
#include <ArborX_Predicates.hpp>

namespace ArborX
Expand All @@ -39,7 +38,7 @@ struct MaxDistance
{
size_type const i = value.index;
size_type const j = getData(predicate);
using KokkosExt::max;
using Kokkos::max;
auto const distance_ij =
distance(Access::get(_primitives, i), Access::get(_primitives, j));
// NOTE using knowledge that each nearest predicate traversal is performed
Expand Down Expand Up @@ -88,7 +87,7 @@ struct MutualReachability
KOKKOS_FUNCTION value_type operator()(size_type i, size_type j,
value_type distance_ij) const
{
using KokkosExt::max;
using Kokkos::max;
return max({_core_distances(i), _core_distances(j), distance_ij});
}
};
Expand Down
7 changes: 3 additions & 4 deletions src/details/ArborX_DetailsWeightedEdge.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,7 @@
#ifndef ARBORX_DETAILS_WEIGHTED_EDGE_HPP
#define ARBORX_DETAILS_WEIGHTED_EDGE_HPP

#include <ArborX_DetailsKokkosExtMinMaxOperations.hpp>

#include <Kokkos_Core.hpp> // min, max
#include <Kokkos_Macros.hpp>

namespace ArborX::Details
Expand All @@ -35,14 +34,14 @@ struct WeightedEdge
{
return (lhs.weight < rhs.weight);
}
using KokkosExt::min;
using Kokkos::min;
auto const lhs_min = min(lhs.source, lhs.target);
auto const rhs_min = min(rhs.source, rhs.target);
if (lhs_min != rhs_min)
{
return (lhs_min < rhs_min);
}
using KokkosExt::max;
using Kokkos::max;
auto const lhs_max = max(lhs.source, lhs.target);
auto const rhs_max = max(rhs.source, rhs.target);
return (lhs_max < rhs_max);
Expand Down
5 changes: 2 additions & 3 deletions src/details/ArborX_MinimumSpanningTree.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
#include <ArborX_AccessTraits.hpp>
#include <ArborX_DetailsKokkosExtArithmeticTraits.hpp>
#include <ArborX_DetailsKokkosExtBitManipulation.hpp>
#include <ArborX_DetailsKokkosExtMinMaxOperations.hpp>
#include <ArborX_DetailsKokkosExtViewHelpers.hpp>
#include <ArborX_DetailsMutualReachabilityDistance.hpp>
#include <ArborX_DetailsTreeNodeLabeling.hpp>
Expand Down Expand Up @@ -361,7 +360,7 @@ void updateLowerBounds(ExecutionSpace const &space, Labels const &labels,
Kokkos::parallel_for(
"ArborX::MST::update_lower_bounds",
Kokkos::RangePolicy<ExecutionSpace>(space, 0, n), KOKKOS_LAMBDA(int i) {
using KokkosExt::max;
using Kokkos::max;
auto component = labels(i);
auto const &edge = component_out_edges(component);
lower_bounds(i) = max(lower_bounds(i), edge.weight);
Expand Down Expand Up @@ -433,7 +432,7 @@ struct UpdateComponentsAndEdges
}
// The component's edge is bidirectional, uniquely resolve the bidirectional
// edge
return KokkosExt::min(component, next_component);
return Kokkos::min(component, next_component);
}

KOKKOS_FUNCTION auto computeFinalComponent(int component) const
Expand Down
10 changes: 5 additions & 5 deletions src/geometry/ArborX_Box.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@
#define ARBORX_BOX_HPP

#include <ArborX_DetailsKokkosExtArithmeticTraits.hpp>
#include <ArborX_DetailsKokkosExtMinMaxOperations.hpp>
#include <ArborX_GeometryTraits.hpp>
#include <ArborX_Point.hpp>

#include <Kokkos_Core.hpp> // min, max
#include <Kokkos_Macros.hpp>
#include <Kokkos_ReductionIdentity.hpp>

Expand Down Expand Up @@ -59,8 +59,8 @@ struct Box

KOKKOS_FUNCTION Box &operator+=(Box const &other)
{
using KokkosExt::max;
using KokkosExt::min;
using Kokkos::max;
using Kokkos::min;

for (int d = 0; d < 3; ++d)
{
Expand All @@ -72,8 +72,8 @@ struct Box

KOKKOS_FUNCTION Box &operator+=(Point const &point)
{
using KokkosExt::max;
using KokkosExt::min;
using Kokkos::max;
using Kokkos::min;

for (int d = 0; d < 3; ++d)
{
Expand Down
11 changes: 6 additions & 5 deletions src/geometry/ArborX_DetailsAlgorithms.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,10 @@

#include <ArborX_Box.hpp>
#include <ArborX_DetailsKokkosExtArithmeticTraits.hpp>
#include <ArborX_DetailsKokkosExtMinMaxOperations.hpp> // min, max
// min, max
#include <ArborX_GeometryTraits.hpp>

#include <Kokkos_Core.hpp> // min, max
#include <Kokkos_Macros.hpp>
#include <Kokkos_MathematicalFunctions.hpp> // isfinite

Expand Down Expand Up @@ -235,7 +236,7 @@ struct distance<PointTag, SphereTag, Point, Sphere>
{
KOKKOS_FUNCTION static float apply(Point const &point, Sphere const &sphere)
{
using KokkosExt::max;
using Kokkos::max;
return max(Details::distance(point, sphere.centroid()) - sphere.radius(),
0.f);
}
Expand Down Expand Up @@ -280,7 +281,7 @@ struct distance<SphereTag, BoxTag, Sphere, Box>
{
KOKKOS_FUNCTION static float apply(Sphere const &sphere, Box const &box)
{
using KokkosExt::max;
using Kokkos::max;

float distance_center_box = Details::distance(sphere.centroid(), box);
return max(distance_center_box - sphere.radius(), 0.f);
Expand Down Expand Up @@ -326,8 +327,8 @@ struct expand<BoxTag, SphereTag, Box, Sphere>
{
KOKKOS_FUNCTION static void apply(Box &box, Sphere const &sphere)
{
using KokkosExt::max;
using KokkosExt::min;
using Kokkos::max;
using Kokkos::min;

constexpr int DIM = GeometryTraits::dimension_v<Box>;
for (int d = 0; d < DIM; ++d)
Expand Down
10 changes: 5 additions & 5 deletions src/geometry/ArborX_HyperBox.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@
#define ARBORX_HYPERBOX_HPP

#include <ArborX_DetailsKokkosExtArithmeticTraits.hpp>
#include <ArborX_DetailsKokkosExtMinMaxOperations.hpp>
#include <ArborX_GeometryTraits.hpp>
#include <ArborX_HyperPoint.hpp>

#include <Kokkos_Core.hpp> // min, max
#include <Kokkos_Macros.hpp>
#include <Kokkos_ReductionIdentity.hpp>

Expand Down Expand Up @@ -68,8 +68,8 @@ struct Box
std::enable_if_t<GeometryTraits::is_box<OtherBox>{}> * = nullptr>
KOKKOS_FUNCTION auto &operator+=(OtherBox const &other)
{
using KokkosExt::max;
using KokkosExt::min;
using Kokkos::max;
using Kokkos::min;

for (int d = 0; d < DIM; ++d)
{
Expand All @@ -83,8 +83,8 @@ struct Box
std::enable_if_t<GeometryTraits::is_point<Point>{}> * = nullptr>
KOKKOS_FUNCTION auto &operator+=(Point const &point)
{
using KokkosExt::max;
using KokkosExt::min;
using Kokkos::max;
using Kokkos::min;

for (int d = 0; d < DIM; ++d)
{
Expand Down
8 changes: 4 additions & 4 deletions src/geometry/ArborX_KDOP.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -155,8 +155,8 @@ struct KDOP : private Details::KDOP_Directions<k>
}
KOKKOS_FUNCTION KDOP &operator+=(Point const &p)
{
using KokkosExt::max;
using KokkosExt::min;
using Kokkos::max;
using Kokkos::min;
for (int i = 0; i < n_directions; ++i)
{
auto const proj_i = Details::project(p, this->directions()[i]);
Expand Down Expand Up @@ -203,8 +203,8 @@ struct KDOP : private Details::KDOP_Directions<k>
}
KOKKOS_FUNCTION KDOP &operator+=(KDOP const &other)
{
using KokkosExt::max;
using KokkosExt::min;
using Kokkos::max;
using Kokkos::min;
for (int i = 0; i < n_directions; ++i)
{
_min_values[i] = min(_min_values[i], other._min_values[i]);
Expand Down
10 changes: 5 additions & 5 deletions src/geometry/ArborX_Ray.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -408,15 +408,15 @@ bool intersection(Ray const &ray,
bool bc_intersect = rayEdgeIntersect(B_star, C_star, t_bc);
if (bc_intersect)
{
tmin = KokkosExt::min(tmin, t_bc);
tmax = KokkosExt::max(tmax, t_bc);
tmin = Kokkos::min(tmin, t_bc);
tmax = Kokkos::max(tmax, t_bc);
}
float t_ca = inf;
bool ca_intersect = rayEdgeIntersect(C_star, A_star, t_ca);
if (ca_intersect)
{
tmin = KokkosExt::min(tmin, t_ca);
tmax = KokkosExt::max(tmax, t_ca);
tmin = Kokkos::min(tmin, t_ca);
tmax = Kokkos::max(tmax, t_ca);
}

if (ab_intersect || bc_intersect || ca_intersect)
Expand Down Expand Up @@ -552,7 +552,7 @@ overlapDistance(Ray const &ray, Geometry const &geometry, float &length,
if (intersection(ray, geometry, tmin, tmax) && (tmin <= tmax && tmax >= 0))
{
// Overlap [tmin, tmax] with [0, +inf)
tmin = KokkosExt::max(0.f, tmin);
tmin = Kokkos::max(0.f, tmin);
// As direction is normalized,
// |(o + tmax*d) - (o + tmin*d)| = tmax - tmin
length = tmax - tmin;
Expand Down
78 changes: 0 additions & 78 deletions src/kokkos_ext/ArborX_DetailsKokkosExtMinMaxOperations.hpp

This file was deleted.

0 comments on commit 6b12c25

Please sign in to comment.