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 2019/07/03 02:34:21 UTC

[GitHub] [incubator-mxnet] DickJC123 opened a new pull request #15449: cuda/cuDNN lib version checking. Force cuDNN v7 usage.

DickJC123 opened a new pull request #15449: cuda/cuDNN lib version checking.  Force cuDNN v7 usage.
URL: https://github.com/apache/incubator-mxnet/pull/15449
 
 
   This PR addresses two issues:
       - rnn.cc of mxnet v1.5 does not compile against cudnn v6.  This PR enforces systems that rebuild mxnet to have cudnn v7, and improves the error message for compiling against v6.
       - We are accumulating stale code that references no-longer-supported cuda/cudnn versions.  This PR provides a means for cleaning out this code.
   
   This PR introduces both runtime and compile-time cuda and cuDNN version checking.  The compile time checks are based on new macros: STATIC_ASSERT_CUDNN_VERSION_GE(min_version) and STATIC_ASSERT_CUDA_VERSION_GE(min_version).  Example usage:
   Before PR:
   ```
   #if MXNET_USE_CUDNN
   #if CUDNN_VERSION >= 7000
       <impl 1>
   #elif CUDNN_VERSION >= 6000
       <impl 2>
   #else
       LOG(FATAL) << "cuDNN too old.";
   #endif
   #endif  // MXNET_USE_CUDNN
   ```
   After PR (given the assumption that we're now requiring cuDNN v7):
   ```
   #if MXNET_USE_CUDNN
   STATIC_ASSERT_CUDNN_VERSION_GE(7000);
   <impl 1>
   #endif  // MXNET_USE_CUDNN
   
   Discussion continues in the comments section.
   ## 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)
   - [X ] 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)
   - [X ] 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
   - [X ] 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 ##
   This PR improves the compile-time message to a user trying to build MXNet 1.5 against cuDNN v6.
   Before PR, only the missing library entrypoint is mentioned:
   ```
   g++ ... -c src/operator/operator.cc -o build/src/operator/operator.o
   src/operator/rnn.cc: In function 'std::vector<mxnet::ResourceRequest> mxnet::op::RNNResourceEx(const nnvm::NodeAttrs&, int, mxnet::DispatchMode)':    src/operator/rnn.cc:179:28: error: 'kCuDNNDropoutDesc' is not a member of 'mxnet::ResourceRequest'                                                           request.emplace_back(ResourceRequest::kCuDNNDropoutDesc);
   ```
   After the PR, the error mentions the library version issue directly:
   ```
   g++ ... -c src/operator/optimizer_op.cc -o build/src/operator/optimizer_op.o
   In file included from src/operator/././operator_common.h:42:0,
                    from src/operator/./rnn-inl.h:45,
                    from src/operator/rnn.cc:29:
   src/operator/rnn.cc: In function 'std::vector<mxnet::ResourceRequest> mxnet::op::RNNResourceEx(const nnvm::NodeAttrs&, int, mxnet::DispatchMode)':
   src/operator/././../common/cuda_utils.h:467:3: error: static assertion failed: Compiled-against cuDNN version 6021 is too old, please upgrade system to version 7000 or later.
      static_assert(CUDNN_VERSION >= min_version, "Compiled-against cuDNN version " \
      ^
   src/operator/rnn.cc:175:5: note: in expansion of macro 'STATIC_ASSERT_CUDNN_VERSION_GE'
        STATIC_ASSERT_CUDNN_VERSION_GE(7000);
        ^
   src/operator/rnn.cc:180:28: error: 'kCuDNNDropoutDesc' is not a member of 'mxnet::ResourceRequest'
          request.emplace_back(ResourceRequest::kCuDNNDropoutDesc);
                               ^
   ```
   This PR provides 2 runtime checks and issues a warning:
       - when the compiled-against cuda or cuDNN library version does not match the linked-against version, and
       - when the library versions are old w.r.t. the versions tested against by the MXNet CI.
   
   I built the PR against cuda 9 and cuDNN v7.1.4.  Running any model will emit the warning:
   ```
   [01:05:03] src/common/cuda_utils.cc:50: Upgrade advisory: this mxnet has been built against cuda library version 9000, which is older than the oldest version tested by CI (10000).  Set MXNET_CUDA_VERSION_CHECKING=0 to quiet this warning.
   [01:05:03] src/common/cuda_utils.cc:89: Upgrade advisory: this mxnet has been built against cuDNN library version 7104, which is older than the oldest version tested by CI (7600).  Set MXNET_CUDNN_VERSION_CHECKING=0 to quiet this warning.
   ```
   I then upgraded cuDNN to v7.2.1 without recompiling.  The following additional message now appears when running models:
   ```
   [01:11:11] src/common/cuda_utils.cc:85: cuDNN library mismatch: linked-against version 7201 != compiled-against version 7104.  Set MXNET_CUDNN_VERSION_CHECKING=0 to quiet this warning.
   ```
   As stated, the user can choose to kill the warning messages with environment variables settings.
   

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


With regards,
Apache Git Services