Skip to content
This repository has been archived by the owner on Nov 17, 2023. It is now read-only.

[BUGFIX] Fix Windows GPU VS 2019 build (#20206) #20207

Merged
merged 1 commit into from
Apr 30, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
67 changes: 61 additions & 6 deletions src/ndarray/ndarray_function-inl.h
Original file line number Diff line number Diff line change
Expand Up @@ -230,8 +230,62 @@ void EvalRandom<DEVICE, GaussianDistribution>(
}
}

#if defined(__CUDACC__)

template<>
void EvalRandom<gpu, GammaDistribution>(
const real_t &alpha,
const real_t &beta,
const Resource &resource,
TBlob *ret,
RunContext ctx) {
EvalRandom<cpu, GammaDistribution>(alpha, beta, resource, ret, ctx);
}

template<>
void EvalRandom<gpu, ExponentialDistribution>(
const real_t &lambda,
const real_t &dummy, // this is to satisfy the SampleOp lambda signature
const Resource &resource,
TBlob *ret,
RunContext ctx) {
EvalRandom<cpu, ExponentialDistribution>(lambda, dummy, resource, ret, ctx);
}

template<>
void EvalRandom<gpu, PoissonDistribution>(
const real_t &lambda,
const real_t &dummy, // this is to satisfy the SampleOp lambda signature
const Resource &resource,
TBlob *ret,
RunContext ctx) {
EvalRandom<cpu, PoissonDistribution>(lambda, dummy, resource, ret, ctx);
}

template<>
void EvalRandom<gpu, NegBinomialDistribution>(
const real_t &k,
const real_t &p,
const Resource &resource,
TBlob *ret,
RunContext ctx) {
EvalRandom<cpu, NegBinomialDistribution>(k, p, resource, ret, ctx);
}

template<>
void EvalRandom<DEVICE, GammaDistribution>(
void EvalRandom<gpu, GenNegBinomialDistribution>(
const real_t &mu,
const real_t &alpha,
const Resource &resource,
TBlob *ret,
RunContext ctx) {
EvalRandom<cpu, GenNegBinomialDistribution>(mu, alpha, resource, ret, ctx);
}

#else

template<>
void EvalRandom<cpu, GammaDistribution>(
const real_t &alpha,
const real_t &beta,
const Resource &resource,
Expand Down Expand Up @@ -259,9 +313,8 @@ void EvalRandom<DEVICE, GammaDistribution>(
}
}


template<>
void EvalRandom<DEVICE, ExponentialDistribution>(
void EvalRandom<cpu, ExponentialDistribution>(
const real_t &lambda,
const real_t &dummy, // this is to satisfy the SampleOp lambda signature
const Resource &resource,
Expand Down Expand Up @@ -290,7 +343,7 @@ void EvalRandom<DEVICE, ExponentialDistribution>(
}

template<>
void EvalRandom<DEVICE, PoissonDistribution>(
void EvalRandom<cpu, PoissonDistribution>(
const real_t &lambda,
const real_t &dummy, // this is to satisfy the SampleOp lambda signature
const Resource &resource,
Expand Down Expand Up @@ -319,7 +372,7 @@ void EvalRandom<DEVICE, PoissonDistribution>(
}

template<>
void EvalRandom<DEVICE, NegBinomialDistribution>(
void EvalRandom<cpu, NegBinomialDistribution>(
const real_t &k,
const real_t &p,
const Resource &resource,
Expand Down Expand Up @@ -348,7 +401,7 @@ void EvalRandom<DEVICE, NegBinomialDistribution>(
}

template<>
void EvalRandom<DEVICE, GenNegBinomialDistribution>(
void EvalRandom<cpu, GenNegBinomialDistribution>(
const real_t &mu,
const real_t &alpha,
const Resource &resource,
Expand Down Expand Up @@ -376,6 +429,8 @@ void EvalRandom<DEVICE, GenNegBinomialDistribution>(
}
}

#endif // #ifndef __CUDACC__

template<>
void Eval<DEVICE>(const real_t &rhs, TBlob *ret, RunContext ctx) {
mshadow::Stream<DEVICE> *s = ctx.get_stream<DEVICE>();
Expand Down