szha commented on a change in pull request #19209:
URL: https://github.com/apache/incubator-mxnet/pull/19209#discussion_r492979125



##########
File path: src/resource.cc
##########
@@ -428,37 +486,28 @@ void* Resource::get_host_space_internal(size_t size) 
const {
 void Resource::get_cudnn_dropout_desc(
     cudnnDropoutDescriptor_t *dropout_desc,
     mshadow::Stream<gpu> *stream,
-    const float dropout, uint64_t seed,
+    const float dropout,
     const std::string &name) const {
 
   CHECK_EQ(req.type, ResourceRequest::kCuDNNDropoutDesc);
   auto state_space = static_cast<resource::SpaceAllocator*>(ptr_);
   CHECK_EQ(state_space->ctx.dev_id, stream->dev_id)
-    << "The device id of cuDNN dropout state space doesn't match that from 
stream.";
-  CUDNN_CALL(cudnnCreateDropoutDescriptor(dropout_desc));
+    << "The device id of cudnn dropout state space doesn't match that from 
stream.";
   if (dropout <= 0) {
     CUDNN_CALL(cudnnSetDropoutDescriptor(*dropout_desc, stream->dnn_handle_,
                                          dropout,
                                          nullptr,
                                          0, seed));
-  } else if (!state_space->handle.size) {
-    // not initialized yet.
-    size_t dropout_state_size;
-    CUDNN_CALL(cudnnDropoutGetStatesSize(stream->dnn_handle_, 
&dropout_state_size));
-    // reserve GPU space
-    Storage::Get()->DirectFree(Storage::Get()->Alloc(dropout_state_size, 
state_space->ctx));
-    CUDNN_CALL(cudnnSetDropoutDescriptor(*dropout_desc, stream->dnn_handle_,
-                                         dropout,
-                                         
state_space->GetSpace(dropout_state_size, name),
-                                         dropout_state_size, seed));
   } else {
+    CHECK(state_space->handle.size > 0)
+      << "CUDNN dropout descriptor was not initialized yet!";
     // cudnnRestoreDropoutDescriptor() introduced with cuDNN v7
     STATIC_ASSERT_CUDNN_VERSION_GE(7000);
     CUDNN_CALL(cudnnRestoreDropoutDescriptor(*dropout_desc, 
stream->dnn_handle_,
                                              dropout,
                                              state_space->handle.dptr,
                                              state_space->handle.size,
-                                             seed));
+                                             0));

Review comment:
       does the seed not matter?

##########
File path: tests/python/gpu/test_gluon_gpu.py
##########
@@ -647,3 +647,31 @@ def test_gemms_true_fp16():
     assert_almost_equal(ref_results.asnumpy(), results_trueFP16.asnumpy(),
                         atol=atol, rtol=rtol)
 
+@with_seed()
+def test_cudnn_dropout_reproducibility():

Review comment:
       @assert_raises_cudnn_not_satisfied?




----------------------------------------------------------------
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]


Reply via email to