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

Segmentation fault during inference with quantization #14022

Closed
nuslq opened this issue Jan 29, 2019 · 3 comments
Closed

Segmentation fault during inference with quantization #14022

nuslq opened this issue Jan 29, 2019 · 3 comments
Labels
Quantization Issues/Feature Requests related to Quantization

Comments

@nuslq
Copy link
Contributor

nuslq commented Jan 29, 2019

Note: Providing complete information in the most concise form is the best way to get help. This issue template serves as the checklist for essential information to most of the technical issues and bug reports. For non-technical issues and feature requests, feel free to present the information in what you believe is the best form.

For Q & A and discussion, please start a discussion thread at https://discuss.mxnet.io

Description

I got "Segmentation fault: 11" error when I ran the following command,

"python imagenet_inference.py --symbol-file=./model/imagenet1k-inception-bn-quantized-5batches-naive-symbol.json --param-file=./model/imagenet1k-inception-bn-quantized-0000.params --rgb-mean=123.68,116.779,103.939 --num-skipped-batches=50 --batch-size=64 --num-inference-batches=500 --dataset=./data/val_256_q90.rec --ctx=cpu --data-nthreads=1"

Please note: the model was quantized using "imagenet_gen_qsym.py" instead of "imagenet_gen_qsym_mkldnn.py"

Environment info (Required)

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.

Architecture:        x86_64
CPU op-mode(s):      32-bit, 64-bit
Byte Order:          Little Endian
CPU(s):              24
On-line CPU(s) list: 0-23
Thread(s) per core:  2
Core(s) per socket:  6
Socket(s):           2
NUMA node(s):        2
Vendor ID:           GenuineIntel
CPU family:          6
Model:               45
Model name:          Intel(R) Xeon(R) CPU E5-2620 0 @ 2.00GHz
Stepping:            7
CPU MHz:             1197.129
CPU max MHz:         2500.0000
CPU min MHz:         1200.0000
BogoMIPS:            3990.41
Virtualization:      VT-x
L1d cache:           32K
L1i cache:           32K
L2 cache:            256K
L3 cache:            15360K
NUMA node0 CPU(s):   0-5,12-17
NUMA node1 CPU(s):   6-11,18-23
Flags:               fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx pdpe1gb rdtscp lm constant_tsc arch_perfmon pebs bts rep_good nopl xtopology nonstop_tsc cpuid aperfmperf pni pclmulqdq dtes64 monitor ds_cpl vmx smx est tm2 ssse3 cx16 xtpr pdcm pcid dca sse4_1 sse4_2 x2apic popcnt tsc_deadline_timer aes xsave avx lahf_lm epb pti ssbd ibrs ibpb stibp tpr_shadow vnmi flexpriority ept vpid xsaveopt dtherm ida arat pln pts flush_l1d
----------Python Info----------
Version      : 3.7.2
Compiler     : GCC 7.3.0
Build        : ('default', 'Dec 29 2018 06:19:36')
Arch         : ('64bit', '')
------------Pip Info-----------
Version      : 18.1
Directory    : /work/anaconda3/envs/py3/lib/python3.7/site-packages/pip
----------MXNet Info-----------
Version      : 1.3.1
Directory    : /work/anaconda3/envs/py3/lib/python3.7/site-packages/mxnet
Commit Hash   : 19c501680183237d52a862e6ae1dc4ddc296305b
----------System Info----------
Platform     : Linux-4.15.0-43-generic-x86_64-with-debian-buster-sid
system       : Linux
node         : u698118817fd358.ant.amazon.com
release      : 4.15.0-43-generic
version      : #46-Ubuntu SMP Thu Dec 6 14:45:28 UTC 2018
----------Hardware Info----------
machine      : x86_64
processor    : x86_64
----------Network Test----------
Setting timeout: 10
Timing for MXNet: https://github.com/apache/incubator-mxnet, DNS: 0.0088 sec, LOAD: 0.6208 sec.
Timing for Gluon Tutorial(en): http://gluon.mxnet.io, DNS: 0.0081 sec, LOAD: 0.0679 sec.
Timing for Gluon Tutorial(cn): https://zh.gluon.ai, DNS: 0.0082 sec, LOAD: 0.1198 sec.
Timing for FashionMNIST: https://apache-mxnet.s3-accelerate.dualstack.amazonaws.com/gluon/dataset/fashion-mnist/train-labels-idx1-ubyte.gz, DNS: 0.0079 sec, LOAD: 0.1090 sec.
Timing for PYPI: https://pypi.python.org/pypi/pip, DNS: 0.0082 sec, LOAD: 0.1756 sec.
Timing for Conda: https://repo.continuum.io/pkgs/free/, DNS: 0.0080 sec, LOAD: 0.0468 sec.

Package used (Python/R/Scala/Julia):
I am using Python

For Scala user, please provide:

  1. Java version: (java -version)
  2. Maven version: (mvn -version)
  3. Scala runtime if applicable: (scala -version)

For R user, please provide R sessionInfo():

Build info (Required if built from source)

Compiler (gcc/clang/mingw/visual studio):

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

Build config:
(Paste the content of config.mk, or the build command.)

Error Message:

(Paste the complete error message, including stack trace.)
INFO:logger:batch size = 64 for inference
INFO:logger:rgb_mean = 123.68,116.779,103.939
INFO:logger:rgb_std = 1,1,1
INFO:logger:label_name = softmax_label
INFO:logger:Input data shape = (3, 224, 224)
INFO:logger:Dataset for inference: ./data/val_256_q90.rec
[14:01:27] src/io/iter_image_recordio_2.cc:170: ImageRecordIOParser2: ./data/val_256_q90.rec, use 1 threads for decoding..
INFO:logger:Loading symbol from file /work/projects/qat/incubator-mxnet-master/example/quantization/./model/imagenet1k-inception-
bn-quantized-5batches-naive-symbol.json
INFO:logger:Loading params from file /work/projects/qat/incubator-mxnet-master/example/quantization/./model/imagenet1k-inception-
bn-quantized-0000.params
INFO:logger:Skipping the first 50 batches
INFO:logger:Running model ./model/imagenet1k-inception-bn-quantized-5batches-naive-symbol.json for inference
[14:01:34] src/executor/attach_op_execs_pass.cc:335: Neither FCompute nor FComputeEx registered _contrib_quantized_pooling
[14:01:34] src/executor/attach_op_execs_pass.cc:335: Neither FCompute nor FComputeEx registered _contrib_quantized_conv
[14:01:34] src/executor/attach_op_execs_pass.cc:335: Neither FCompute nor FComputeEx registered _contrib_quantized_conv
[14:01:34] src/executor/attach_op_execs_pass.cc:335: Neither FCompute nor FComputeEx registered _contrib_quantized_pooling
[14:01:34] src/executor/attach_op_execs_pass.cc:335: Neither FCompute nor FComputeEx registered _contrib_quantized_conv
[14:01:34] src/executor/attach_op_execs_pass.cc:335: Neither FCompute nor FComputeEx registered _contrib_quantized_conv
[14:01:34] src/executor/attach_op_execs_pass.cc:335: Neither FCompute nor FComputeEx registered _contrib_quantized_conv
[14:01:34] src/executor/attach_op_execs_pass.cc:335: Neither FCompute nor FComputeEx registered _contrib_quantized_conv
[14:01:34] src/executor/attach_op_execs_pass.cc:335: Neither FCompute nor FComputeEx registered _contrib_quantized_conv
[14:01:34] src/executor/attach_op_execs_pass.cc:335: Neither FCompute nor FComputeEx registered _contrib_quantized_conv
[14:01:34] src/executor/attach_op_execs_pass.cc:335: Neither FCompute nor FComputeEx registered _contrib_quantized_pooling
[14:01:34] src/executor/attach_op_execs_pass.cc:335: Neither FCompute nor FComputeEx registered _contrib_quantized_conv
[14:01:34] src/executor/attach_op_execs_pass.cc:335: Neither FCompute nor FComputeEx registered _contrib_quantized_conv
[14:01:34] src/executor/attach_op_execs_pass.cc:335: Neither FCompute nor FComputeEx registered _contrib_quantized_conv
[14:01:34] src/executor/attach_op_execs_pass.cc:335: Neither FCompute nor FComputeEx registered _contrib_quantized_conv
[14:01:34] src/executor/attach_op_execs_pass.cc:335: Neither FCompute nor FComputeEx registered _contrib_quantized_conv
[14:01:34] src/executor/attach_op_execs_pass.cc:335: Neither FCompute nor FComputeEx registered _contrib_quantized_conv
[14:01:34] src/executor/attach_op_execs_pass.cc:335: Neither FCompute nor FComputeEx registered _contrib_quantized_conv
[14:01:34] src/executor/attach_op_execs_pass.cc:335: Neither FCompute nor FComputeEx registered _contrib_quantized_pooling
[14:01:34] src/executor/attach_op_execs_pass.cc:335: Neither FCompute nor FComputeEx registered _contrib_quantized_conv
[14:01:34] src/executor/attach_op_execs_pass.cc:335: Neither FCompute nor FComputeEx registered _contrib_quantized_conv
[14:01:34] src/executor/attach_op_execs_pass.cc:335: Neither FCompute nor FComputeEx registered _contrib_quantized_conv
[14:01:34] src/executor/attach_op_execs_pass.cc:335: Neither FCompute nor FComputeEx registered _contrib_quantized_conv
[14:01:34] src/executor/attach_op_execs_pass.cc:335: Neither FCompute nor FComputeEx registered _contrib_quantized_conv
[14:01:34] src/executor/attach_op_execs_pass.cc:335: Neither FCompute nor FComputeEx registered _contrib_quantized_conv
[14:01:34] src/executor/attach_op_execs_pass.cc:335: Neither FCompute nor FComputeEx registered _contrib_quantized_pooling
[14:01:34] src/executor/attach_op_execs_pass.cc:335: Neither FCompute nor FComputeEx registered _contrib_quantized_conv
[14:01:34] src/executor/attach_op_execs_pass.cc:335: Neither FCompute nor FComputeEx registered _contrib_quantized_conv
[14:01:34] src/executor/attach_op_execs_pass.cc:335: Neither FCompute nor FComputeEx registered _contrib_quantized_conv
[14:01:34] src/executor/attach_op_execs_pass.cc:335: Neither FCompute nor FComputeEx registered _contrib_quantized_conv
[14:01:34] src/executor/attach_op_execs_pass.cc:335: Neither FCompute nor FComputeEx registered _contrib_quantized_conv
[14:01:34] src/executor/attach_op_execs_pass.cc:335: Neither FCompute nor FComputeEx registered _contrib_quantized_conv
[14:01:34] src/executor/attach_op_execs_pass.cc:335: Neither FCompute nor FComputeEx registered _contrib_quantized_pooling
[14:01:34] src/executor/attach_op_execs_pass.cc:335: Neither FCompute nor FComputeEx registered _contrib_quantized_conv
[14:01:34] src/executor/attach_op_execs_pass.cc:335: Neither FCompute nor FComputeEx registered _contrib_quantized_conv
[14:01:34] src/executor/attach_op_execs_pass.cc:335: Neither FCompute nor FComputeEx registered _contrib_quantized_conv
[14:01:34] src/executor/attach_op_execs_pass.cc:335: Neither FCompute nor FComputeEx registered _contrib_quantized_conv
[14:01:34] src/executor/attach_op_execs_pass.cc:335: Neither FCompute nor FComputeEx registered _contrib_quantized_conv
[14:01:34] src/executor/attach_op_execs_pass.cc:335: Neither FCompute nor FComputeEx registered _contrib_quantized_conv
[14:01:34] src/executor/attach_op_execs_pass.cc:335: Neither FCompute nor FComputeEx registered _contrib_quantized_conv
[14:01:34] src/executor/attach_op_execs_pass.cc:335: Neither FCompute nor FComputeEx registered _contrib_quantized_pooling
[14:01:34] src/executor/attach_op_execs_pass.cc:335: Neither FCompute nor FComputeEx registered _contrib_quantized_conv
[14:01:34] src/executor/attach_op_execs_pass.cc:335: Neither FCompute nor FComputeEx registered _contrib_quantized_conv
[14:01:34] src/executor/attach_op_execs_pass.cc:335: Neither FCompute nor FComputeEx registered _contrib_quantized_conv
[14:01:34] src/executor/attach_op_execs_pass.cc:335: Neither FCompute nor FComputeEx registered _contrib_quantized_conv
[14:01:34] src/executor/attach_op_execs_pass.cc:335: Neither FCompute nor FComputeEx registered _contrib_quantized_conv
[14:01:34] src/executor/attach_op_execs_pass.cc:335: Neither FCompute nor FComputeEx registered _contrib_quantized_conv
[14:01:34] src/executor/attach_op_execs_pass.cc:335: Neither FCompute nor FComputeEx registered _contrib_quantized_conv
[14:01:34] src/executor/attach_op_execs_pass.cc:335: Neither FCompute nor FComputeEx registered _contrib_quantized_pooling
[14:01:34] src/executor/attach_op_execs_pass.cc:335: Neither FCompute nor FComputeEx registered _contrib_quantized_conv
[14:01:34] src/executor/attach_op_execs_pass.cc:335: Neither FCompute nor FComputeEx registered _contrib_quantized_conv
[14:01:34] src/executor/attach_op_execs_pass.cc:335: Neither FCompute nor FComputeEx registered _contrib_quantized_conv
[14:01:34] src/executor/attach_op_execs_pass.cc:335: Neither FCompute nor FComputeEx registered _contrib_quantized_conv
[14:01:34] src/executor/attach_op_execs_pass.cc:335: Neither FCompute nor FComputeEx registered _contrib_quantized_conv
[14:01:34] src/executor/attach_op_execs_pass.cc:335: Neither FCompute nor FComputeEx registered _contrib_quantized_conv
[14:01:34] src/executor/attach_op_execs_pass.cc:335: Neither FCompute nor FComputeEx registered _contrib_quantized_conv
[14:01:34] src/executor/attach_op_execs_pass.cc:335: Neither FCompute nor FComputeEx registered _contrib_quantized_pooling
[14:01:34] src/executor/attach_op_execs_pass.cc:335: Neither FCompute nor FComputeEx registered _contrib_quantized_conv
[14:01:34] src/executor/attach_op_execs_pass.cc:335: Neither FCompute nor FComputeEx registered _contrib_quantized_conv
[14:01:34] src/executor/attach_op_execs_pass.cc:335: Neither FCompute nor FComputeEx registered _contrib_quantized_conv
[14:01:34] src/executor/attach_op_execs_pass.cc:335: Neither FCompute nor FComputeEx registered _contrib_quantized_conv
[14:01:34] src/executor/attach_op_execs_pass.cc:335: Neither FCompute nor FComputeEx registered _contrib_quantized_conv
[14:01:34] src/executor/attach_op_execs_pass.cc:335: Neither FCompute nor FComputeEx registered _contrib_quantized_conv
[14:01:34] src/executor/attach_op_execs_pass.cc:335: Neither FCompute nor FComputeEx registered _contrib_quantized_pooling
[14:01:34] src/executor/attach_op_execs_pass.cc:335: Neither FCompute nor FComputeEx registered _contrib_quantized_conv
[14:01:34] src/executor/attach_op_execs_pass.cc:335: Neither FCompute nor FComputeEx registered _contrib_quantized_conv
[14:01:34] src/executor/attach_op_execs_pass.cc:335: Neither FCompute nor FComputeEx registered _contrib_quantized_conv
[14:01:34] src/executor/attach_op_execs_pass.cc:335: Neither FCompute nor FComputeEx registered _contrib_quantized_conv
[14:01:34] src/executor/attach_op_execs_pass.cc:335: Neither FCompute nor FComputeEx registered _contrib_quantized_conv
[14:01:34] src/executor/attach_op_execs_pass.cc:335: Neither FCompute nor FComputeEx registered _contrib_quantized_conv
[14:01:34] src/executor/attach_op_execs_pass.cc:335: Neither FCompute nor FComputeEx registered _contrib_quantized_pooling
[14:01:34] src/executor/attach_op_execs_pass.cc:335: Neither FCompute nor FComputeEx registered _contrib_quantized_conv
[14:01:34] src/executor/attach_op_execs_pass.cc:335: Neither FCompute nor FComputeEx registered _contrib_quantized_conv
[14:01:34] src/executor/attach_op_execs_pass.cc:335: Neither FCompute nor FComputeEx registered _contrib_quantized_conv
[14:01:34] src/executor/attach_op_execs_pass.cc:335: Neither FCompute nor FComputeEx registered _contrib_quantized_conv
[14:01:34] src/executor/attach_op_execs_pass.cc:335: Neither FCompute nor FComputeEx registered _contrib_quantized_conv
[14:01:34] src/executor/attach_op_execs_pass.cc:335: Neither FCompute nor FComputeEx registered _contrib_quantized_conv
[14:01:34] src/executor/attach_op_execs_pass.cc:335: Neither FCompute nor FComputeEx registered _contrib_quantized_conv
[14:01:34] src/executor/attach_op_execs_pass.cc:335: Neither FCompute nor FComputeEx registered _contrib_quantized_pooling
[14:01:34] src/executor/attach_op_execs_pass.cc:335: Neither FCompute nor FComputeEx registered _contrib_quantized_conv
[14:01:34] src/executor/attach_op_execs_pass.cc:335: Neither FCompute nor FComputeEx registered _contrib_quantized_pooling
[14:01:34] src/executor/attach_op_execs_pass.cc:335: Neither FCompute nor FComputeEx registered _contrib_quantized_fully_connected

Segmentation fault: 11

Stack trace returned 10 entries:
[bt] (0) /work/anaconda3/envs/py3/lib/python3.7/site-packages/mxnet/libmxnet.so(+0x381822) [0x7fa65e7af822]
[bt] (1) /work/anaconda3/envs/py3/lib/python3.7/site-packages/mxnet/libmxnet.so(+0x368d87e) [0x7fa661abb87e]
[bt] (2) /lib/x86_64-linux-gnu/libc.so.6(+0x3ef20) [0x7fa6c57fbf20]
[bt] (3) /work/anaconda3/envs/py3/lib/python3.7/site-packages/mxnet/libmxnet.so(+0x2f3bcbe) [0x7fa661369cbe]
[bt] (4) /work/anaconda3/envs/py3/lib/python3.7/site-packages/mxnet/libmxnet.so(+0x2f3c661) [0x7fa66136a661]
[bt] (5) /work/anaconda3/envs/py3/lib/python3.7/site-packages/mxnet/libmxnet.so(+0x2f5c3d6) [0x7fa66138a3d6]
[bt] (6) /work/anaconda3/envs/py3/lib/python3.7/site-packages/mxnet/libmxnet.so(+0x2f63574) [0x7fa661391574]
[bt] (7) /work/anaconda3/envs/py3/lib/python3.7/site-packages/mxnet/libmxnet.so(+0x2f63c64) [0x7fa661391c64]
[bt] (8) /work/anaconda3/envs/py3/lib/python3.7/site-packages/mxnet/libmxnet.so(MXExecutorSimpleBind+0x2260) [0x7fa6612ed940]
[bt] (9) /work/anaconda3/envs/py3/lib/python3.7/lib-dynload/../../libffi.so.6(ffi_call_unix64+0x4c) [0x7fa6c3f63ec0]

Minimum reproducible example

(If you are using your own code, please provide a short script that reproduces the error. Otherwise, please provide link to the existing example.)

https://github.com/apache/incubator-mxnet/tree/master/example/quantization

Steps to reproduce

(Paste the commands you ran that produced the error.)

  1. python imagenet_gen_qsym.py --model=imagenet1k-inception-bn --num-calib-batches=5 --calib-mode=naive
    (Note: This command worked fine)
  2. python imagenet_inference.py --symbol-file=./model/imagenet1k-inception-bn-quantized-5batches-naive-symbol.json --param-file=./model/imagenet1k-inception-bn-quantized-0000.params --rgb-mean=123.68,116.779,103.939 --num-skipped-batches=50 --batch-size=64 --num-inference-batches=500 --dataset=./data/val_256_q90.rec --ctx=cpu --data-nthreads=1
    (Note: This command stopped and returned error)

What have you tried to solve it?

@eric-haibin-lin eric-haibin-lin added the Quantization Issues/Feature Requests related to Quantization label Jan 29, 2019
@ZhennanQin
Copy link
Contributor

@nuslq log indicates that there's no implementation for quantized convolution. MXNet quantization flow only works for either CUDA or MKLDNN build. As you are using MXNet without CUDA, so I assume you want to run with CPU. You can try MXNet with MKLDNN and use imagenet_gen_qsym_mkldnn.py instead.

@pengzhao-intel
Copy link
Contributor

Thanks @ZhennanQin :)

@nuslq you can refer https://github.com/apache/incubator-mxnet/tree/master/example/quantization#1
Feel free to ping us for any question

@eric-haibin-lin
Copy link
Member

closing this for now. please feel free to comment/reopen if you come across this issue again

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Quantization Issues/Feature Requests related to Quantization
Projects
None yet
Development

No branches or pull requests

4 participants