diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 0c1689bde..27fb8b2a8 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -748,7 +748,7 @@ jobs: if: ${{ failure() }} uses: mxschmitt/action-tmate@v3 # When debugging increase to a suitable value! - timeout-minutes: ${{ github.event.pull_request && 1 || 20 }} + timeout-minutes: ${{ github.event.pull_request && 20 || 20 }} - name: Prepare code coverage report if: ${{ success() && (matrix.coverage == true) }} run: | diff --git a/include/clad/Differentiator/BuiltinDerivatives.h b/include/clad/Differentiator/BuiltinDerivatives.h index d7dd9d859..af6950945 100644 --- a/include/clad/Differentiator/BuiltinDerivatives.h +++ b/include/clad/Differentiator/BuiltinDerivatives.h @@ -13,6 +13,7 @@ namespace custom_derivatives{} #include "clad/Differentiator/ArrayRef.h" #include "clad/Differentiator/CladConfig.h" +#include #include namespace clad { @@ -139,32 +140,34 @@ CUDA_HOST_DEVICE void fma_pullback(T1 a, T2 b, T3 c, T4 d_y, *d_c += d_y; } -template -CUDA_HOST_DEVICE ValueAndPushforward -min_pushforward(const T& a, const T& b, const T& d_a, const T& d_b) { +template +CUDA_HOST_DEVICE ValueAndPushforward +min_pushforward(const T1& a, const T2& b, const T1& d_a, const T2& d_b) { return {::std::min(a, b), a < b ? d_a : d_b}; } -template -CUDA_HOST_DEVICE ValueAndPushforward -max_pushforward(const T& a, const T& b, const T& d_a, const T& d_b) { +template +CUDA_HOST_DEVICE ValueAndPushforward +max_pushforward(const T1& a, const T2& b, const T1& d_a, const T2& d_b) { return {::std::max(a, b), a < b ? d_b : d_a}; } -template -CUDA_HOST_DEVICE void min_pullback(const T& a, const T& b, U d_y, - clad::array_ref d_a, - clad::array_ref d_b) { +template +CUDA_HOST_DEVICE void min_pullback(const T1& a, const T2& b, U d_y, + clad::array_ref d_a, + clad::array_ref d_b) { if (a < b) *d_a += d_y; else *d_b += d_y; } -template -CUDA_HOST_DEVICE void max_pullback(const T& a, const T& b, U d_y, - clad::array_ref d_a, - clad::array_ref d_b) { +template +CUDA_HOST_DEVICE void max_pullback(const T1& a, const T2& b, U d_y, + clad::array_ref d_a, + clad::array_ref d_b) { if (a < b) *d_b += d_y; else @@ -172,19 +175,20 @@ CUDA_HOST_DEVICE void max_pullback(const T& a, const T& b, U d_y, } #if __cplusplus >= 201703L -template -CUDA_HOST_DEVICE ValueAndPushforward -clamp_pushforward(const T& v, const T& lo, const T& hi, const T& d_v, - const T& d_lo, const T& d_hi) { +template +CUDA_HOST_DEVICE ValueAndPushforward +clamp_pushforward(const T1& v, const T2& lo, const T3& hi, const T1& d_v, + const T2& d_lo, const T3& d_hi) { return {::std::clamp(v, lo, hi), v < lo ? d_lo : hi < v ? d_hi : d_v}; } -template -CUDA_HOST_DEVICE void clamp_pullback(const T& v, const T& lo, const T& hi, +template +CUDA_HOST_DEVICE void clamp_pullback(const T1& v, const T2& lo, const T3& hi, const U& d_y, - clad::array_ref d_v, - clad::array_ref d_lo, - clad::array_ref d_hi) { + clad::array_ref d_v, + clad::array_ref d_lo, + clad::array_ref d_hi) { if (v < lo) *d_lo += d_y; else if (hi < v)