cjolivier01 commented on issue #9366: Refactor dropout operator to use ParallelRandom generator and also react deterministically when seeding URL: https://github.com/apache/incubator-mxnet/pull/9366#issuecomment-357777259 actually i misspoke before ? this just generates bernoulli distributions which aren?t useful elsewhere. On Mon, Jan 15, 2018 at 12:00 PM Eric Junyuan Xie <notificati...@github.com> wrote: > *@piiswrong* commented on this pull request. > ------------------------------ > > In src/operator/nn/dropout-inl.h > <https://github.com/apache/incubator-mxnet/pull/9366#discussion_r161605173> > : > > > +#if defined(USE_MKL) && defined(_OPENMP) > + static void BernoulliGenerate(common::random::RandGenerator<cpu, DType> gen, > + int n, double p, int* r) { > + typename RandGenerator<xpu, DType>::Impl genImpl(&gen, 1); > + const int seed = 17 + genImpl.rand() % 4096; // NOLINT(runtime/threadsafe_fn) > + const int nthr = engine::OpenMP::Get()->GetRecommendedOMPThreadCount(); > +#pragma omp parallel num_threads(nthr) > + { > + const int ithr = omp_get_thread_num(); > + const int avg_amount = (n + nthr - 1) / nthr; > + const int my_offset = ithr * avg_amount; > + const int my_amount = std::min(my_offset + avg_amount, n) - my_offset; > + if (my_amount > 0) { > + VSLStreamStatePtr stream; > + vslNewStream(&stream, VSL_BRNG_MCG31, seed + my_offset); > + vslSkipAheadStream(stream, my_offset); > > can we move this to Resource::ParallelRandom so that all rngs are fast > when using mkl? > > ? > You are receiving this because you authored the thread. > Reply to this email directly, view it on GitHub > <https://github.com/apache/incubator-mxnet/pull/9366#pullrequestreview-88921209>, > or mute the thread > <https://github.com/notifications/unsubscribe-auth/AKts_Znp14CveFEx4Iwugbgkt7DTY-y8ks5tK65igaJpZM4RYofS> > . >
---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services