You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mxnet.apache.org by GitBox <gi...@apache.org> on 2018/06/22 14:41:00 UTC

[GitHub] wenyangchu opened a new pull request #11361: [WIP, meant for discussion for now] Determinism - option to choose only determinisitc algorithm

wenyangchu opened a new pull request #11361: [WIP, meant for discussion for now] Determinism - option to choose only determinisitc algorithm
URL: https://github.com/apache/incubator-mxnet/pull/11361
 
 
   ## Description ##
   This pull request tries to let users have option to select determinisic algorithms.
   There are three algorithms are not determinisic accoring to cudnn sdk devement
   
   https://docs.nvidia.com/deeplearning/sdk/cudnn-developer-guide/index.html#reproducibility
    
   2.5. Reproducibility (determinism)
   By design, most of cuDNN's routines from a given version generate the same bit-wise results across runs when executed on GPUs with the same architecture and the same number of SMs. However, bit-wise reproducibility is not guaranteed across versions, as the implementation of a given routine may change. With the current release, the following routines do not guarantee reproducibility because they use atomic operations:
   
   cudnnConvolutionBackwardFilter when CUDNN_CONVOLUTION_BWD_FILTER_ALGO_0 or CUDNN_CONVOLUTION_BWD_FILTER_ALGO_3 is used
   cudnnConvolutionBackwardData when CUDNN_CONVOLUTION_BWD_DATA_ALGO_0 is used
   cudnnPoolingBackward when CUDNN_POOLING_MAX is used
   cudnnSpatialTfSamplerBackward
    
   Solution here convers the first 3 except cudnnSpatialTfSamplerBackward:
   
   - Add deterministic parameter (default = False) to Maxpooling
   nn.MaxPool2D(pool_size=(3,3), strides=(2,2)  ,deterministic=True)
   
   - Add env parameters to select Deterministic algorithms for Conv back propagation algorithm
   os.environ["MXNET_CUDNN_AUTOTUNE_DEFAULT"] = "3"
   
   #Value of 1 chooses the best algo in a limited workspace
   #Value of 2 chooses the fastest algo whose memory requirements may be larger than the default workspace threshold
   #Value of 3 choose the Determinisitc best algo in a limited workspace
   #Value of 4 chooses the Determinisitc fastest algo whose memory requirements may be larger than the default workspace threshold
   
   I did manual test, so automatic tests still need to be added.
   
   **The problem of this solution is that cudnn still can select different deterministic algorithms and they do not give the exactly same results between algorithms. 
   Propose to add extra varaibles to force algortithm selection....**
   
   ******************the following is not filled, after this can be a good solution for everyone***************
   
   
   ## Checklist ##
   ### Essentials ###
   Please feel free to remove inapplicable items for your PR.
   - [ ] The PR title starts with [MXNET-$JIRA_ID], where $JIRA_ID refers to the relevant [JIRA issue](https://issues.apache.org/jira/projects/MXNET/issues) created (except PRs with tiny changes)
   - [ ] Changes are complete (i.e. I finished coding on this PR)
   - [ ] All changes have test coverage:
   - Unit tests are added for small changes to verify correctness (e.g. adding a new operator)
   - Nightly tests are added for complicated/long-running ones (e.g. changing distributed kvstore)
   - Build tests will be added for build configuration changes (e.g. adding a new build option with NCCL)
   - [ ] Code is well-documented: 
   - For user-facing API changes, API doc string has been updated. 
   - For new C++ functions in header files, their functionalities and arguments are documented. 
   - For new examples, README.md is added to explain the what the example does, the source of the dataset, expected performance on test set and reference to the original paper if applicable
   - Check the API doc at http://mxnet-ci-doc.s3-accelerate.dualstack.amazonaws.com/PR-$PR_ID/$BUILD_ID/index.html
   - [ ] To the my best knowledge, examples are either not affected by this change, or have been fixed to be compatible with this change
   
   ### Changes ###
   - [ ] Feature1, tests, (and when applicable, API doc)
   - [ ] Feature2, tests, (and when applicable, API doc)
   
   ## Comments ##
   - If this change is a backward incompatible change, why must this change be made.
   - Interesting edge cases to note here
   

----------------------------------------------------------------
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:
users@infra.apache.org


With regards,
Apache Git Services