wkcn commented on a change in pull request #17762: Custom Operator Random
Number Generator Support
URL: https://github.com/apache/incubator-mxnet/pull/17762#discussion_r388646210
##########
File path: src/c_api/c_api.cc
##########
@@ -177,10 +177,39 @@ void CustomFComputeDispatcher(const std::string op_name,
return static_cast<void*>((*gpualloc)(size));
};
+ // MXNet random number generator lambda to be invoked by custom library
+ // custom library will use gpu rng whenever possible
+ auto rng_caller = [&](RandGenType rand_type, int seed) {
+#if MXNET_USE_CUDA
Review comment:
Agree to making a default choice : )
I think it should depend on the context of custom operator, rather that the
version (GPU or only CPU) of MXNet.
If users build a CPU custom operator and use the GPU version of MXNet, on a
machine with only CPU, it still work since the CPU random number generator is
used.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services