Skip to content

Commit b0ea7d0

Browse files
EuclidDivisionLemmavgvassilev
authored andcommitted
Add custom derivative functions that take a size_t
1 parent 0337a65 commit b0ea7d0

1 file changed

Lines changed: 20 additions & 1 deletion

File tree

include/clad/Differentiator/KokkosBuiltins.h

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,12 @@
55
#ifndef CLAD_DIFFERENTIATOR_KOKKOSBUILTINS_H
66
#define CLAD_DIFFERENTIATOR_KOKKOSBUILTINS_H
77

8+
#include "clad/Differentiator/Differentiator.h"
89
#include <Kokkos_Core.hpp>
10+
#include <Kokkos_ExecPolicy.hpp>
911
#include <cstddef>
1012
#include <string>
1113
#include <type_traits>
12-
#include "clad/Differentiator/Differentiator.h"
1314

1415
namespace clad::custom_derivatives {
1516
namespace class_functions {
@@ -734,6 +735,24 @@ void parallel_for_pushforward(
734735
parallel_for_pushforward(::std::string("anonymous_parallel_for"), policy,
735736
functor, ::std::string(""), d_policy, d_functor);
736737
}
738+
template <typename FunctorType>
739+
void parallel_for_pushforward(const size_t range, const FunctorType& functor,
740+
size_t d_range, const FunctorType& d_functor) {
741+
parallel_for_pushforward(
742+
::std::string("anonymous_parallel_for"),
743+
::Kokkos::RangePolicy<size_t>(0, range), functor, ::std::string(""),
744+
::Kokkos::RangePolicy<size_t>(0, d_range), d_functor);
745+
}
746+
747+
template <typename FunctorType>
748+
void parallel_for_pushforward(const ::std::string& str, size_t range,
749+
const FunctorType& functor,
750+
const ::std::string& d_str, size_t d_range,
751+
const FunctorType& d_functor) {
752+
parallel_for_pushforward(
753+
str, ::Kokkos::RangePolicy<size_t>(0, range), functor, d_str,
754+
::Kokkos::RangePolicy<size_t>(0, d_range), d_functor);
755+
}
737756
template <typename Policy, class FunctorType> // alternative signature
738757
void parallel_for_pushforward(Policy policy, const FunctorType& functor,
739758
const ::std::string& str, Policy d_policy,

0 commit comments

Comments
 (0)