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_r388013014
##########
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:
Some users may use MXNet built with `MXNET_USE_CUDA=1` on the machine with
only CPU. In this case, the GPU random number generator is not available.
It is better to decide which device to choose in the user-side code, namely
the code of custom operators.
----------------------------------------------------------------
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