From aeec2a46fd1dc14b19e835911d7157c39dcdf205 Mon Sep 17 00:00:00 2001 From: Tom Shen Date: Sat, 24 Apr 2021 00:53:50 +0800 Subject: [PATCH] [BUGFIX] Fix Windows GPU VS2019 build (#20206) --- src/ndarray/ndarray_function-inl.h | 64 ++++++++++++++++++++++++++++-- 1 file changed, 60 insertions(+), 4 deletions(-) diff --git a/src/ndarray/ndarray_function-inl.h b/src/ndarray/ndarray_function-inl.h index 6ac586acd99c..d5bc62ec4771 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( +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( + 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, @@ -261,7 +315,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, @@ -290,7 +344,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 +373,7 @@ void EvalRandom( } template<> -void EvalRandom( +void EvalRandom( const real_t &k, const real_t &p, const Resource &resource, @@ -376,6 +430,8 @@ void EvalRandom( } } +#endif // #ifndef __CUDACC__ + template<> void Eval(const real_t &rhs, TBlob *ret, RunContext ctx) { mshadow::Stream *s = ctx.get_stream();