Skip to content
This repository has been archived by the owner on Nov 17, 2023. It is now read-only.

'undefined symbol: cblas_sgemm' error when running mnist example #245

Closed
sunshineatnoon opened this issue Oct 9, 2015 · 8 comments
Closed

Comments

@sunshineatnoon
Copy link

Hi, I have successfully build mxnet and install python package, but when I try to run the mnist example:

python example/mnist/mlp.py

I got this error:

Traceback (most recent call last):
  File "example/mnist/mlp.py", line 2, in <module>
    from data import mnist_iterator
  File "/home/xuetingli/Documents/dmlc/mxnet/example/mnist/data.py", line 9, in <module>
    import mxnet as mx
  File "/usr/lib/python2.7/site-packages/mxnet-0.5.0-py2.7.egg/mxnet/__init__.py", line 7, in <module>
    from .base import MXNetError
  File "/usr/lib/python2.7/site-packages/mxnet-0.5.0-py2.7.egg/mxnet/base.py", line 43, in <module>
    _LIB = _load_lib()
  File "/usr/lib/python2.7/site-packages/mxnet-0.5.0-py2.7.egg/mxnet/base.py", line 35, in _load_lib
    lib = ctypes.cdll.LoadLibrary(lib_path[0])
  File "/usr/lib64/python2.7/ctypes/__init__.py", line 438, in LoadLibrary
    return self._dlltype(name)
  File "/usr/lib64/python2.7/ctypes/__init__.py", line 360, in __init__
    self._handle = _dlopen(self._name, mode)
OSError: /usr/lib/python2.7/site-packages/mxnet-0.5.0-py2.7.egg/mxnet/libmxnet.so: undefined symbol: cblas_sgemm

I'm on CentOS 7 and I have installed blas and atblas via:

sudo yum install blas blas-devel atlas atlas-devel

Does anyone know how to solve this? Thx!

@tqchen
Copy link
Member

tqchen commented Oct 9, 2015

This is likely due to an linker error. Try to change the BLAS options in config.mk to atlas, or blas to see what works for you

@sunshineatnoon
Copy link
Author

@tqchen Do I need to change the variable USE_BLAS to the path of my atblas or do I have to add a new variable USE_BLAS_PATH to my atblas path?

@tqchen
Copy link
Member

tqchen commented Oct 10, 2015

I think only changing USE_BLAS should be fine. As lonng as the atlas is in LD_LIBRARY_PATH

@sunshineatnoon
Copy link
Author

I changed the config.mk file like this:

# choose the version of blas you want to use
# can be: mkl, blas, atlas, openblas
USE_STATIC_MKL = NONE
USE_BLAS = atlas

Then set the LD_LIBRARY_PATH to /usr/lib4/atlas
But when I rebuild mxnet, I got this error:

/usr/bin/ld: cannot find -lcblas
collect2: error: ld returned 1 exit status
make: *** [lib/libmxnet.so] Error 1

@tqchen
Copy link
Member

tqchen commented Oct 10, 2015

You might also want to set LIBRARY_PATH as well. LD_LIBRARY_PATH is used for runtime search of libraries, LIBRARY_PATH is used for compile time search

@sunshineatnoon
Copy link
Author

Tried this too, no luck:

export LIBRARY_PATH=/usr/lib64/atlas

I also tried openblas, which I installed at /usr/local/lib and /usr/local/include, this time the make command doesn't give me any error, but when running the mnist example, I still get this error:

OSError: /usr/lib/python2.7/site-packages/mxnet-0.5.0-py2.7.egg/mxnet/libmxnet.so: undefined symbol: cblas_sgemm

@sunshineatnoon
Copy link
Author

By using Openblas and running cd python; python setup.py develop --user again, now I can run the mnist example. Thanks for your help~

@raymondtay
Copy link

Hi guys, i'm using this mxnet and ran into this same incident; was wondering if there was a note on that, would be very helpful

stefanhenneking pushed a commit to stefanhenneking/mxnet that referenced this issue Jun 30, 2017
* Add MaxValue

* Fix
eric-haibin-lin pushed a commit to eric-haibin-lin/mxnet that referenced this issue Dec 2, 2017
* added ability to exclude paths from the linter

* got rid of filepath_enumerate, which was causing python linter to fail

* reverted back to using filepath_enumerate as a factored out function to avoid R0912, too-many-branches pylint error
joseph-wakeling-sociomantic added a commit to joseph-wakeling-sociomantic/mxnet that referenced this issue Jan 15, 2018
* cub 89de7ab2(89de7ab2)...05eb57fa(05eb57fa) (798 commits)
  > Merge pull request sociomantic-tsunami#1 from ptrendx/update
  > Create README.md
  > update readme.md
  > 1.7.0
  < 1.6.4 doc update (part 2)
  (...)

* dlpack ()...a6e09b5(a6e09b5) (1 commits)
  > Change order of device_type/id in Context (sociomantic-tsunami#11)

* dmlc-core a6c5701(a6c5701)...87b7ffa(87b7ffa) (54 commits)
  > add SetEnv (apache#322)
  > Fix a bug in seek/tell on Windows (apache#318)
  > Fixes apache#303: added recurse_directories to InputSplit::Create (apache#310)
  > Type name error (apache#316)
  > Small param bug (apache#315)
  (...)

* mshadow c037b06(c037b06)...2d7780c(2d7780c) (42 commits)
  > [CMAKE][ARM] Change USE_SSE to SUPPORT_MSSE2 to it uses the autodetected presence of sse compiler flag from the parent project (see PR apache#8395) (apache#303)
  > Makes repeated setting of gpu rng seed produce repeatable sequences. (apache#304)
  > Add USE_SSE which propagates into MSHADOW_USE_SSE in cmake (apache#302)
  > fix range (apache#301)
  > fix for random seed generation (apache#300)
  (...)

* nnvm b279286(b279286)...e4a138a(e4a138a) (139 commits)
  > [TVM] upgrade to latest version (apache#263)
  > Added support for CoreML Permute layers (apache#262)
  > [CMPL] Add Support for Other Data Types (apache#252)
  > fix onnx conv2d_transpose loading (apache#245)
  > [FIX] Fix from_mxnet for multiple outputs symbol (apache#247)
  (...)

* ps-lite v1+118(acdb698)...v1+123(2ce8b9a) (2 commits)
  > Merge pull request apache#117 from madjam/listen-interface
  > Merge pull request apache#109 from b0noI/master
joseph-wakeling-sociomantic added a commit to joseph-wakeling-sociomantic/mxnet that referenced this issue Jan 15, 2018
Fixes sociomantic-tsunami#11

* cub 89de7ab2(89de7ab2)...05eb57fa(05eb57fa) (798 commits)
  > Merge pull request sociomantic-tsunami#1 from ptrendx/update
  > Create README.md
  > update readme.md
  > 1.7.0
  < 1.6.4 doc update (part 2)
  (...)

* dlpack ()...a6e09b5(a6e09b5) (1 commits)
  > Change order of device_type/id in Context (sociomantic-tsunami#11)

* cub 89de7ab2(89de7ab2)...05eb57fa(05eb57fa) (798 commits)
  > Merge pull request sociomantic-tsunami#1 from ptrendx/update
  > Create README.md
  > update readme.md
  > 1.7.0
  < 1.6.4 doc update (part 2)
  (...)

* dlpack ()...a6e09b5(a6e09b5) (1 commits)
  > Change order of device_type/id in Context (sociomantic-tsunami#11)

* dmlc-core a6c5701(a6c5701)...87b7ffa(87b7ffa) (54 commits)
  > add SetEnv (apache#322)
  > Fix a bug in seek/tell on Windows (apache#318)
  > Fixes apache#303: added recurse_directories to InputSplit::Create (apache#310)
  > Type name error (apache#316)
  > Small param bug (apache#315)
  (...)

* mshadow c037b06(c037b06)...2d7780c(2d7780c) (42 commits)
  > [CMAKE][ARM] Change USE_SSE to SUPPORT_MSSE2 to it uses the autodetected presence of sse compiler flag from the parent project (see PR apache#8395) (apache#303)
  > Makes repeated setting of gpu rng seed produce repeatable sequences. (apache#304)
  > Add USE_SSE which propagates into MSHADOW_USE_SSE in cmake (apache#302)
  > fix range (apache#301)
  > fix for random seed generation (apache#300)
  (...)

* nnvm b279286(b279286)...e4a138a(e4a138a) (139 commits)
  > [TVM] upgrade to latest version (apache#263)
  > Added support for CoreML Permute layers (apache#262)
  > [CMPL] Add Support for Other Data Types (apache#252)
  > fix onnx conv2d_transpose loading (apache#245)
  > [FIX] Fix from_mxnet for multiple outputs symbol (apache#247)
  (...)

* ps-lite v1+118(acdb698)...v1+123(2ce8b9a) (2 commits)
  > Merge pull request apache#117 from madjam/listen-interface
  > Merge pull request apache#109 from b0noI/master
eric-haibin-lin pushed a commit to eric-haibin-lin/mxnet that referenced this issue Apr 4, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants