From 3a63c2139f66b63a6d559f33655f792e9ee6e729 Mon Sep 17 00:00:00 2001 From: Tom Shen Date: Fri, 30 Apr 2021 22:31:18 +0800 Subject: [PATCH] [BUGFIX] Fix Windows GPU VS2019 build (#20206) (#20207) Co-authored-by: Tom Shen --- src/ndarray/ndarray_function-inl.h | 67 +++++++++++++++++++++++++++--- 1 file changed, 61 insertions(+), 6 deletions(-) diff --git a/src/ndarray/ndarray_function-inl.h b/src/ndarray/ndarray_function-inl.h index 6ac586acd99c..beb40c73b8ad 100644 --- a/src/ndarray/ndarray_function-inl.h +++ b/src/ndarray/ndarray_function-inl.h @@ -230,8 +230,62 @@ void EvalRandom( } } +#if defined(__CUDACC__) + +template<> +void EvalRandom( + const real_t &alpha, + const real_t &beta, + const Resource &resource, + TBlob *ret, + RunContext ctx) { + EvalRandom(alpha, beta, resource, ret, ctx); +} + +template<> +void EvalRandom( + const real_t &lambda, + const real_t &dummy, // this is to satisfy the SampleOp lambda signature + const Resource &resource, + TBlob *ret, + RunContext ctx) { + EvalRandom(lambda, dummy, resource, ret, ctx); +} + +template<> +void EvalRandom( + const real_t &lambda, + const real_t &dummy, // this is to satisfy the SampleOp lambda signature + const Resource &resource, + TBlob *ret, + RunContext ctx) { + EvalRandom(lambda, dummy, resource, ret, ctx); +} + +template<> +void EvalRandom( + const real_t &k, + const real_t &p, + const Resource &resource, + TBlob *ret, + RunContext ctx) { + EvalRandom(k, p, resource, ret, ctx); +} + template<> -void EvalRandom( +void EvalRandom( + const real_t &mu, + const real_t &alpha, + const Resource &resource, + TBlob *ret, + RunContext ctx) { + EvalRandom(mu, alpha, resource, ret, ctx); +} + +#else + +template<> +void EvalRandom( const real_t &alpha, const real_t &beta, const Resource &resource, @@ -259,9 +313,8 @@ void EvalRandom( } } - template<> -void EvalRandom( +void EvalRandom( const real_t &lambda, const real_t &dummy, // this is to satisfy the SampleOp lambda signature const Resource &resource, @@ -290,7 +343,7 @@ void EvalRandom( } template<> -void EvalRandom( +void EvalRandom( const real_t &lambda, const real_t &dummy, // this is to satisfy the SampleOp lambda signature const Resource &resource, @@ -319,7 +372,7 @@ void EvalRandom( } template<> -void EvalRandom( +void EvalRandom( const real_t &k, const real_t &p, const Resource &resource, @@ -348,7 +401,7 @@ void EvalRandom( } template<> -void EvalRandom( +void EvalRandom( const real_t &mu, const real_t &alpha, const Resource &resource, @@ -376,6 +429,8 @@ void EvalRandom( } } +#endif // #ifndef __CUDACC__ + template<> void Eval(const real_t &rhs, TBlob *ret, RunContext ctx) { mshadow::Stream *s = ctx.get_stream();