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 2020/07/29 07:38:07 UTC

[GitHub] [incubator-mxnet] access2rohit opened a new pull request #18807: [WIP]adding error message when attempting to use Large tensor with linalg_syevd

access2rohit opened a new pull request #18807:
URL: https://github.com/apache/incubator-mxnet/pull/18807


   
   ## Description ##
   (Brief description on what this PR is about)
   
   ## 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 https://mxnet-ci-doc.s3-accelerate.dualstack.amazonaws.com/PR-$PR_ID/$BUILD_ID/index.html
   - [ ] To the best of my 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 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



[GitHub] [incubator-mxnet] access2rohit commented on a change in pull request #18807: adding error message when attempting to use Large tensor with linalg_syevd

Posted by GitBox <gi...@apache.org>.
access2rohit commented on a change in pull request #18807:
URL: https://github.com/apache/incubator-mxnet/pull/18807#discussion_r461889976



##########
File path: 3rdparty/mshadow/mshadow/base.h
##########
@@ -336,6 +336,8 @@ const float kPi = 3.1415926f;
   typedef int32_t index_t;
 #endif
 
+const index_t kInt32Limit = (int64_t{1} << 31) - 1;

Review comment:
       @Zha0q1 good suggestion !

##########
File path: src/operator/tensor/la_op.h
##########
@@ -470,11 +470,14 @@ inline bool DetType(const nnvm::NodeAttrs& attrs,
 inline bool LaEigFactShape(const nnvm::NodeAttrs& attrs,
                            mxnet::ShapeVector* in_attrs,
                            mxnet::ShapeVector* out_attrs) {
+  using namespace mshadow;
   CHECK_EQ(in_attrs->size(), 1);
   CHECK_EQ(out_attrs->size(), 2);
   const mxnet::TShape& in_a = (*in_attrs)[0];
   const mxnet::TShape& out_u = (*out_attrs)[0];
   const mxnet::TShape& out_l = (*out_attrs)[1];
+  CHECK_LE(in_a.Size(), INT_MAX)

Review comment:
       is included in base.h 




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



[GitHub] [incubator-mxnet] access2rohit commented on pull request #18807: [WIP]adding error message when attempting to use Large tensor with linalg_syevd

Posted by GitBox <gi...@apache.org>.
access2rohit commented on pull request #18807:
URL: https://github.com/apache/incubator-mxnet/pull/18807#issuecomment-665198663






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



[GitHub] [incubator-mxnet] Zha0q1 commented on a change in pull request #18807: adding error message when attempting to use Large tensor with linalg_syevd

Posted by GitBox <gi...@apache.org>.
Zha0q1 commented on a change in pull request #18807:
URL: https://github.com/apache/incubator-mxnet/pull/18807#discussion_r461845972



##########
File path: 3rdparty/mshadow/mshadow/base.h
##########
@@ -336,6 +336,8 @@ const float kPi = 3.1415926f;
   typedef int32_t index_t;
 #endif
 
+const index_t kInt32Limit = (int64_t{1} << 31) - 1;

Review comment:
       what's the advantage of manually defining this over using INT_MAX in <climits>?

##########
File path: 3rdparty/mshadow/mshadow/base.h
##########
@@ -336,6 +336,8 @@ const float kPi = 3.1415926f;
   typedef int32_t index_t;
 #endif
 
+const index_t kInt32Limit = (int64_t{1} << 31) - 1;

Review comment:
       what's the advantage of manually defining this over using INT_MAX in <climits?

##########
File path: src/operator/tensor/la_op.h
##########
@@ -470,11 +470,14 @@ inline bool DetType(const nnvm::NodeAttrs& attrs,
 inline bool LaEigFactShape(const nnvm::NodeAttrs& attrs,
                            mxnet::ShapeVector* in_attrs,
                            mxnet::ShapeVector* out_attrs) {
+  using namespace mshadow;
   CHECK_EQ(in_attrs->size(), 1);
   CHECK_EQ(out_attrs->size(), 2);
   const mxnet::TShape& in_a = (*in_attrs)[0];
   const mxnet::TShape& out_u = (*out_attrs)[0];
   const mxnet::TShape& out_l = (*out_attrs)[1];
+  CHECK_LE(in_a.Size(), INT_MAX)

Review comment:
       did you include climit ?

##########
File path: src/operator/tensor/la_op.h
##########
@@ -470,11 +470,14 @@ inline bool DetType(const nnvm::NodeAttrs& attrs,
 inline bool LaEigFactShape(const nnvm::NodeAttrs& attrs,
                            mxnet::ShapeVector* in_attrs,
                            mxnet::ShapeVector* out_attrs) {
+  using namespace mshadow;

Review comment:
       this can be removed then.

##########
File path: tests/nightly/test_large_array.py
##########
@@ -1350,6 +1351,16 @@ def run_trsm(inp):
     check_batch_trsm()
 
 
+def test_linalg_errors():
+    def check_syevd_error():
+        A = get_identity_mat(LARGE_SQ_X)
+        for i in range(LARGE_SQ_X):
+            A[i,i] = 1
+        assertRaises(MXNetError, mx.nd.linalg.syevd, A)

Review comment:
       I think the error is raised when the operator is executed rather than when it's pushed. So this assertion will not catch an error. 
   
   ```
   def test_linalg_large_dim():
       def check_gemm():
           A = mx.nd.ones(shape=(1, 2**31))
           B = mx.nd.ones(shape=(1, 2**31))
           C = mx.nd.ones(shape=(1,1))
           D = mx.nd.linalg.gemm(A, B, C, transpose_b=True, alpha=2.0 , beta=10.0)
           nd.waitall()
       assertRaises(MXNetError, check_gemm)
   ```
   
   This worked for me. We need to wrap an additional layer and call nd.waitall() in that layer




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



[GitHub] [incubator-mxnet] sandeep-krishnamurthy commented on a change in pull request #18807: [WIP]adding error message when attempting to use Large tensor with linalg_syevd

Posted by GitBox <gi...@apache.org>.
sandeep-krishnamurthy commented on a change in pull request #18807:
URL: https://github.com/apache/incubator-mxnet/pull/18807#discussion_r461673524



##########
File path: 3rdparty/mshadow/mshadow/base.h
##########
@@ -336,6 +336,8 @@ const float kPi = 3.1415926f;
   typedef int32_t index_t;
 #endif
 
+const index_t kInt32Limit = (int64_t{1} << 31) - 1;

Review comment:
       Can we add a comment to make it clear where is this being used.




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



[GitHub] [incubator-mxnet] leezu merged pull request #18807: adding error message when attempting to use Large tensor with linalg_syevd

Posted by GitBox <gi...@apache.org>.
leezu merged pull request #18807:
URL: https://github.com/apache/incubator-mxnet/pull/18807


   


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



[GitHub] [incubator-mxnet] mxnet-bot commented on pull request #18807: adding error message when attempting to use Large tensor with linalg_syevd

Posted by GitBox <gi...@apache.org>.
mxnet-bot commented on pull request #18807:
URL: https://github.com/apache/incubator-mxnet/pull/18807#issuecomment-665938808


   Jenkins CI successfully triggered : [clang]


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



[GitHub] [incubator-mxnet] leezu commented on a change in pull request #18807: adding error message when attempting to use Large tensor with linalg_syevd

Posted by GitBox <gi...@apache.org>.
leezu commented on a change in pull request #18807:
URL: https://github.com/apache/incubator-mxnet/pull/18807#discussion_r462554483



##########
File path: src/operator/tensor/la_op.h
##########
@@ -470,11 +470,14 @@ inline bool DetType(const nnvm::NodeAttrs& attrs,
 inline bool LaEigFactShape(const nnvm::NodeAttrs& attrs,
                            mxnet::ShapeVector* in_attrs,
                            mxnet::ShapeVector* out_attrs) {
+  using namespace mshadow;
   CHECK_EQ(in_attrs->size(), 1);
   CHECK_EQ(out_attrs->size(), 2);
   const mxnet::TShape& in_a = (*in_attrs)[0];
   const mxnet::TShape& out_u = (*out_attrs)[0];
   const mxnet::TShape& out_l = (*out_attrs)[1];
+  CHECK_LE(in_a.Size(), INT_MAX)

Review comment:
       It's better to be explicit about your dependencies.
   
   "Avoid surprises. Avoid having to change #includes if an #included header changes. Avoid accidentally becoming dependent on implementation details and logically separate entities included in a header."
   
   https://github.com/isocpp/CppCoreGuidelines/blob/master/CppCoreGuidelines.md#Rs-implicit




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



[GitHub] [incubator-mxnet] access2rohit edited a comment on pull request #18807: [WIP]adding error message when attempting to use Large tensor with linalg_syevd

Posted by GitBox <gi...@apache.org>.
access2rohit edited a comment on pull request #18807:
URL: https://github.com/apache/incubator-mxnet/pull/18807#issuecomment-665257475


   ```
   (pytest) ubuntu@ip-172-31-90-243 ~/workspace/incubator-mxnet (err_msg) $ python -m pytest -s --exitfirst --verbose tests/nightly/test_large_array.py::test_linalg_errors
   =============================================================================================== test session starts ================================================================================================
   platform linux -- Python 3.6.10, pytest-5.3.5, py-1.8.2, pluggy-0.13.1 -- /home/ubuntu/anaconda3/envs/pytest/bin/python
   cachedir: .pytest_cache
   rootdir: /home/ubuntu/workspace/incubator-mxnet
   collected 1 item
   
   tests/nightly/test_large_array.py::test_linalg_errors PASSED
   
   ================================================================================================= warnings summary =================================================================================================
   /home/ubuntu/anaconda3/envs/pytest/lib/python3.6/site-packages/nose/importer.py:12
     /home/ubuntu/anaconda3/envs/pytest/lib/python3.6/site-packages/nose/importer.py:12: DeprecationWarning: the imp module is deprecated in favour of importlib; see the module's documentation for alternative uses
       from imp import find_module, load_module, acquire_lock, release_lock
   
   -- Docs: https://docs.pytest.org/en/latest/warnings.html
   ```


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



[GitHub] [incubator-mxnet] leezu commented on pull request #18807: adding error message when attempting to use Large tensor with linalg_syevd

Posted by GitBox <gi...@apache.org>.
leezu commented on pull request #18807:
URL: https://github.com/apache/incubator-mxnet/pull/18807#issuecomment-665938758


   @mxnet-bot run ci [clang]


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



[GitHub] [incubator-mxnet] mxnet-bot commented on pull request #18807: [WIP]adding error message when attempting to use Large tensor with linalg_syevd

Posted by GitBox <gi...@apache.org>.
mxnet-bot commented on pull request #18807:
URL: https://github.com/apache/incubator-mxnet/pull/18807#issuecomment-664994653






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