mxnet icon indicating copy to clipboard operation
mxnet copied to clipboard

Unit tests are broken on OSX with cmake build

Open stsukrov opened this issue 7 years ago • 16 comments

Description

mxnet_unit_tests are failing on OS X. Successful on Ubuntu.

Environment info (Required)

OSX gcc version 8.2.0

MXNet commit hash: (Paste the output of git rev-parse HEAD here.) 39a3bc184d37dbc64157ac4eff51078f7aacc7bd

Error Message:

For example FULLY_CONNECTED is broken

C++ exception with description "[10:08:58] 
/mxnet/3rdparty/tvm/nnvm/src/core/op.cc:55: Check failed: op != nullptr Operator FullyConnected is not registered


Stack trace returned 10 entries:
[bt] (0) 0   mxnet_unit_tests                    0x00000001094e3bae dmlc::StackTrace[abi:cxx11]() + 66
[bt] (1) 1   mxnet_unit_tests                    0x00000001094b8fa9 dmlc::LogMessageFatal::~LogMessageFatal() + 49
[bt] (2) 2   mxnet_unit_tests                    0x0000000109a2ca93 nnvm::Op::Get(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) + 185
[bt] (3) 3   mxnet_unit_tests                    0x00000001094cd689 mxnet::test::op::CoreOpExecutor<float, float>::Init(std::vector<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > > const&, std::vector<mxnet::NDArray, std::allocator<mxnet::NDArray> > const&, std::vector<mxnet::NDArray, std::allocator<mxnet::NDArray> > const&, mxnet::test::op::CoreOpExecutor<float, float> const*, std::shared_ptr<nnvm::Node>) + 509
[bt] (4) 4   mxnet_unit_tests                    0x00000001094ca3b5 bool mxnet::test::op::CoreOpExecutor<float, float>::initForward<mxnet::test::op::CoreOpProp>(mxnet::test::op::CoreOpProp const&, std::vector<int, std::allocator<int> >*) + 113
[bt] (5) 5   mxnet_unit_tests                    0x00000001094ca317 mxnet::test::op::OpInfo<mxnet::test::op::CoreOpProp, mxnet::test::op::CoreOpExecutor<float, float> > mxnet::test::op::createOpAndInfoF<mxnet::test::op::CoreOpProp, mxnet::test::op::CoreOpExecutor<float, float>, bool, std::vector<nnvm::TShape, std::allocator<nnvm::TShape> > >(std::vector<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > > const&, bool, std::vector<nnvm::TShape, std::allocator<nnvm::TShape> >) + 277
[bt] (6) 6   mxnet_unit_tests                    0x00000001094c69dd mxnet::test::OperatorRunner<mxnet::test::op::CoreOpProp, mxnet::test::op::CoreOpExecutor<float, float> >::RunGenericOperatorForward(bool, std::vector<nnvm::TShape, std::allocator<nnvm::TShape> > const&, std::vector<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > > const&, unsigned long) + 85
[bt] (7) 7   mxnet_unit_tests                    0x00000001094c3764 mxnet::test::OperatorRunner<mxnet::test::op::CoreOpProp, mxnet::test::op::CoreOpExecutor<float, float> >::RunBidirectional(bool, std::vector<nnvm::TShape, std::allocator<nnvm::TShape> > const&, std::vector<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > > const&, unsigned long) + 72
[bt] (8) 8   mxnet_unit_tests                    0x000000010956a32c FULLY_CONNECTED_ExecuteBidirectionalFullyConnected_Test::TestBody() + 562
[bt] (9) 9   mxnet_unit_tests                    0x00000001096299e2 void testing::internal::HandleSehExceptionsInMethodIfSupported<testing::Test, void>(testing::Test*, void (testing::Test::*)(), char const*) + 101

Minimum reproducible example

Provided commit.

Steps to reproduce

(Paste the commands you ran that produced the error.) cmake -DUSE_CUDA=OFF -DBLAS=apple -DUSE_OPENCV=OFF mxnet_unit_tests

What have you tried to solve it?

Nothing.

stsukrov avatar Jan 11 '19 09:01 stsukrov

Hey, this is the MXNet Label Bot. Thank you for submitting the issue! I will try and suggest some labels so that the appropriate MXNet community members can help resolve it. Here are my recommended labels: Bug

mxnet-label-bot avatar Jan 11 '19 09:01 mxnet-label-bot

@stsukrov I am trying to reproduce your error. Can you run the diagnose script to provide more environment info?

What to do:
1. Download the diagnosis script from https://raw.githubusercontent.com/apache/incubator-mxnet/master/tools/diagnose.py
2. Run the script using `python diagnose.py` and paste its output here.

@mxnet-label-bot add [Bug, Test, OSX, Backend]

zachgk avatar Jan 11 '19 22:01 zachgk

Sure!

----------Python Info---------- Version : 3.7.1 Compiler : Clang 4.0.1 (tags/RELEASE_401/final) Build : ('default', 'Dec 14 2018 13:28:58') Arch : ('64bit', '') ------------Pip Info----------- Version : 18.1 Directory : /anaconda3/lib/python3.7/site-packages/pip ----------MXNet Info----------- No MXNet installed. ----------System Info---------- Platform : Darwin-17.7.0-x86_64-i386-64bit system : Darwin node : f018986aae72.ant.amazon.com release : 17.7.0 version : Darwin Kernel Version 17.7.0: Fri Nov 2 20:43:16 PDT 2018; root:xnu-4570.71.17~1/RELEASE_X86_64 ----------Hardware Info---------- machine : x86_64 processor : i386 b'machdep.cpu.brand_string: Intel(R) Core(TM) i7-8559U CPU @ 2.70GHz' b'machdep.cpu.features: FPU VME DE PSE TSC MSR PAE MCE CX8 APIC SEP MTRR PGE MCA CMOV PAT PSE36 CLFSH DS ACPI MMX FXSR SSE SSE2 SS HTT TM PBE SSE3 PCLMULQDQ DTES64 MON DSCPL VMX EST TM2 SSSE3 FMA CX16 TPR PDCM SSE4.1 SSE4.2 x2APIC MOVBE POPCNT AES PCID XSAVE OSXSAVE SEGLIM64 TSCTMR AVX1.0 RDRAND F16C' b'machdep.cpu.leaf7_features: SMEP ERMS RDWRFSGS TSC_THREAD_OFFSET BMI1 AVX2 BMI2 INVPCID SMAP RDSEED ADX IPT SGX FPU_CSDS MPX CLFSOPT' b'machdep.cpu.extfeatures: SYSCALL XD 1GBPAGE EM64T LAHF LZCNT PREFETCHW RDTSCP TSCI' ----------Network Test---------- Setting timeout: 10 Timing for MXNet: https://github.com/apache/incubator-mxnet, DNS: 0.0399 sec, LOAD: 0.5149 sec. Timing for Gluon Tutorial(en): http://gluon.mxnet.io, DNS: 0.0531 sec, LOAD: 0.8945 sec. Timing for Gluon Tutorial(cn): https://zh.gluon.ai, DNS: 0.0419 sec, LOAD: 0.7381 sec. Timing for FashionMNIST: https://apache-mxnet.s3-accelerate.dualstack.amazonaws.com/gluon/dataset/fashion-mnist/train-labels-idx1-ubyte.gz, DNS: 0.0500 sec, LOAD: 1.2152 sec. Timing for PYPI: https://pypi.python.org/pypi/pip, DNS: 0.0408 sec, LOAD: 0.6765 sec. Timing for Conda: https://repo.continuum.io/pkgs/free/, DNS: 0.0384 sec, LOAD: 0.4789 sec.

stsukrov avatar Feb 07 '19 13:02 stsukrov

@zachgk Any feedback?

stsukrov avatar Feb 18 '19 08:02 stsukrov

HI @stsukrov Can you try running the unit test using latest pull from master branch and git stash all your changes. This way we can establish if there is some local change thats causing the issue. FullyConnected layer should not be giving such an error.

access2rohit avatar Feb 19 '19 18:02 access2rohit

@access2rohit

Hi!

What I did:

  1. Pulled the last version of the mxnet
  2. cmake -DUSE_CUDA=OFF -DBLAS=apple -DCMAKE_C_COMPILER="/usr/local/bin/gcc-8" -DCMAKE_CXX_COMPILER="/usr/local/bin/g++-8" -DMKLDNN_THREADING="OMP:COMP" -DUSE_OPENCV=OFF ..
  3. cd tests
  4. ./mxnet_unit_tests --gtest_filter=FULLY_CONNECTED*

Got the output: Note: Google Test filter = FULLY_CONNECTED* [==========] Running 2 tests from 1 test case. [----------] Global test environment set-up. [----------] 2 tests from FULLY_CONNECTED [ RUN ] FULLY_CONNECTED.ExecuteBidirectionalFullyConnected unknown file: Failure C++ exception with description "[15:21:55] /Users/stsukrov/workspace/incubator-mxnet/3rdparty/tvm/nnvm/src/core/op.cc:55: Check failed: op != nullptr Operator FullyConnected is not registered

Stack trace returned 2 entries: [bt] (0) 0 mxnet_unit_tests 0x000000010abedaa0 dmlc::StackTraceabi:cxx11 + 64 [bt] (1) 1 libstdc++.6.dylib 0x000000010b895020 vtable for std::__cxx11::basic_stringbuf<char, std::char_traits, std::allocator > + 16

" thrown in the test body. [ FAILED ] FULLY_CONNECTED.ExecuteBidirectionalFullyConnected (6 ms) [ RUN ] FULLY_CONNECTED.FullyConnectedTimingCPU unknown file: Failure C++ exception with description "[15:21:55] /Users/stsukrov/workspace/incubator-mxnet/3rdparty/tvm/nnvm/src/core/op.cc:55: Check failed: op != nullptr Operator FullyConnected is not registered

Stack trace returned 2 entries: [bt] (0) 0 mxnet_unit_tests 0x000000010abedaa0 dmlc::StackTraceabi:cxx11 + 64 [bt] (1) 1 libstdc++.6.dylib 0x000000010b895020 vtable for std::__cxx11::basic_stringbuf<char, std::char_traits, std::allocator > + 16

" thrown in the test body. [ FAILED ] FULLY_CONNECTED.FullyConnectedTimingCPU (0 ms) [----------] 2 tests from FULLY_CONNECTED (6 ms total)

[----------] Global test environment tear-down [==========] 2 tests from 1 test case ran. (6 ms total) [ PASSED ] 0 tests. [ FAILED ] 2 tests, listed below: [ FAILED ] FULLY_CONNECTED.ExecuteBidirectionalFullyConnected [ FAILED ] FULLY_CONNECTED.FullyConnectedTimingCPU

2 FAILED TESTS

Is something wrong?

stsukrov avatar Feb 22 '19 15:02 stsukrov

@stsukrov Your build instructions are different than specified here: http://mxnet.incubator.apache.org/versions/master/install/osx_setup.html

Can you provide more details as to why are they different?

access2rohit avatar Feb 28 '19 17:02 access2rohit

@access2rohit We currently have both make and cmake build systems that we use and the install instructions could use either depending on the page. We have cmake instructions at https://mxnet.incubator.apache.org/versions/master/install/build_from_source.html.

zachgk avatar Feb 28 '19 19:02 zachgk

Yup. That's the build instructions listed for tests folder.

Feel free to provide me with instructions on building a working test for mac with make. cmake build for mac is still undoubtedly broken.

stsukrov avatar Feb 28 '19 20:02 stsukrov

@zachgk Thanks for the link. @stsukrov If you want to use CMAKE only you can try instructions here: https://mxnet.incubator.apache.org/versions/master/install/build_from_source.html#recommended-for-systems-with-non-intel-cpus for MacOS and for MAKE you can try the previous link that I shared. For now it would be better that we stick to the instructions given on the MXNet website.

@apeforest Can you also share how you build MXNet in MacOS and run unittests. That could be helpful

access2rohit avatar Feb 28 '19 22:02 access2rohit

CLion uses CMake, so we cannot ignore it completely.

I'm not even sure, that the default make makes tests. Last time, I found none. Let me double check it today

stsukrov avatar Mar 01 '19 07:03 stsukrov

Rebuild the test with

make make test ./mxnet_unit_tests --gtest_filter=FULLY_CONNECTED*

Confirming to be successfull with make. So the issue is cmake

@mxnet-label-bot add [cmake]

Note: Google Test filter = FULLY_CONNECTED*
[==========] Running 2 tests from 1 test case.
[----------] Global test environment set-up.
[----------] 2 tests from FULLY_CONNECTED
[ RUN      ] FULLY_CONNECTED.ExecuteBidirectionalFullyConnected
[       OK ] FULLY_CONNECTED.ExecuteBidirectionalFullyConnected (2 ms)
[ RUN      ] FULLY_CONNECTED.FullyConnectedTimingCPU
Timing: 5 iterations of 10 calls, shape = [1,1,28,28], [250,784] = 784 items 
Fully connected CPU:  Timing [Forward] 0.85 ms, avg: 0.017 ms X 50 passes

Timing: 5 iterations of 10 calls, shape = [50,3,18,32], [250,1728] = 86,400 items 
Fully connected CPU:  Timing [Forward] 18.186 ms, avg: 0.36372 ms X 50 passes

[       OK ] FULLY_CONNECTED.FullyConnectedTimingCPU (2997 ms)
[----------] 2 tests from FULLY_CONNECTED (2999 ms total)

[----------] Global test environment tear-down
[==========] 2 tests from 1 test case ran. (2999 ms total)
[  PASSED  ] 2 tests.

stsukrov avatar Mar 01 '19 16:03 stsukrov

Updated the issue so that impact is clear

stsukrov avatar Mar 01 '19 16:03 stsukrov

Confirmed. I build with

cp make/osx.mk config.mk
make -j8
nosetests -v tests/python/unittest

All tests passed.

----------------------------------------------------------------------
Ran 743 tests in 2718.366s

OK (SKIP=36)

apeforest avatar Mar 01 '19 18:03 apeforest

We were actually talking about c++ tests

stsukrov avatar Mar 01 '19 21:03 stsukrov

This issue has been fixed in CMake. I have verified in CLion on MacOS 10.13.6

[----------] Global test environment tear-down
[==========] 74 tests from 16 test suites ran. (796139 ms total)
[  PASSED  ] 74 tests.

  YOU HAVE 1 DISABLED TEST


Process finished with exit code 0

apeforest avatar Jul 08 '19 21:07 apeforest