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/09/11 13:09:11 UTC

[GitHub] [incubator-mxnet] matteosal opened a new issue #16143: Failure of MKL-DNN Convolution from C API

matteosal opened a new issue #16143: Failure of MKL-DNN Convolution from C API
URL: https://github.com/apache/incubator-mxnet/issues/16143
 
 
   ## Description
   With MKL-DNN, getting the output of a Convolution operator using the C API can trigger this error: 
   ```
   [14:52:08] src/ndarray/ndarray.cc:757: Check failed: !IsMKLDNNData(): We can't generate TBlob for MKLDNN data. Please use Reorder2Default() to generate a new NDArray first
   ```
   
   ## Environment info (Required)
   
   ```
   ----------Python Info----------
   Version      : 3.7.2
   Compiler     : GCC 7.3.0
   Build        : ('default', 'Dec 29 2018 06:19:36')
   Arch         : ('64bit', '')
   ------------Pip Info-----------
   Version      : 19.0.1
   Directory    : /opt/Anaconda/lib/python3.7/site-packages/pip
   ----------MXNet Info-----------
   Version      : 1.5.0
   Directory    : /home/matteo/Git/mxnet/python/mxnet
   Commit hash file "/home/matteo/Git/mxnet/python/mxnet/COMMIT_HASH" not found. Not installed from pre-built package or built from source.
   Library      : ['/home/matteo/Git/mxnet/python/mxnet/../../lib/libmxnet.so']
   Build features:
   ✖ CUDA
   ✖ CUDNN
   ✖ NCCL
   ✖ CUDA_RTC
   ✖ TENSORRT
   ✔ CPU_SSE
   ✔ CPU_SSE2
   ✔ CPU_SSE3
   ✔ CPU_SSE4_1
   ✔ CPU_SSE4_2
   ✖ CPU_SSE4A
   ✔ CPU_AVX
   ✖ CPU_AVX2
   ✖ OPENMP
   ✖ SSE
   ✔ F16C
   ✔ JEMALLOC
   ✖ BLAS_OPEN
   ✔ BLAS_ATLAS
   ✖ BLAS_MKL
   ✖ BLAS_APPLE
   ✖ LAPACK
   ✔ MKLDNN
   ✖ OPENCV
   ✖ CAFFE
   ✖ PROFILER
   ✖ DIST_KVSTORE
   ✖ CXX14
   ✖ INT64_TENSOR_SIZE
   ✖ SIGNAL_HANDLER
   ✖ DEBUG
   ----------System Info----------
   Platform     : Linux-4.15.0-55-generic-x86_64-with-debian-buster-sid
   system       : Linux
   node         : mongolius
   release      : 4.15.0-55-generic
   version      : #60-Ubuntu SMP Tue Jul 2 18:22:20 UTC 2019
   ----------Hardware Info----------
   machine      : x86_64
   processor    : x86_64
   Architecture:        x86_64
   CPU op-mode(s):      32-bit, 64-bit
   Byte Order:          Little Endian
   CPU(s):              8
   On-line CPU(s) list: 0-7
   Thread(s) per core:  2
   Core(s) per socket:  4
   Socket(s):           1
   NUMA node(s):        1
   Vendor ID:           GenuineIntel
   CPU family:          6
   Model:               94
   Model name:          Intel(R) Core(TM) i7-6700HQ CPU @ 2.60GHz
   Stepping:            3
   CPU MHz:             2700.253
   CPU max MHz:         3500,0000
   CPU min MHz:         800,0000
   BogoMIPS:            5184.00
   Virtualization:      VT-x
   L1d cache:           32K
   L1i cache:           32K
   L2 cache:            256K
   L3 cache:            6144K
   NUMA node0 CPU(s):   0-7
   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 art arch_perfmon pebs bts rep_good nopl xtopology nonstop_tsc cpuid aperfmperf tsc_known_freq pni pclmulqdq dtes64 monitor ds_cpl vmx est tm2 ssse3 sdbg fma cx16 xtpr pdcm pcid sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand lahf_lm abm 3dnowprefetch cpuid_fault epb invpcid_single pti ssbd ibrs ibpb stibp tpr_shadow vnmi flexpriority ept vpid fsgsbase tsc_adjust bmi1 hle avx2 smep bmi2 erms invpcid rtm mpx rdseed adx smap clflushopt intel_pt xsaveopt xsavec xgetbv1 xsaves dtherm ida arat pln pts hwp hwp_notify hwp_act_window hwp_epp md_clear flush_l1d
   ----------Network Test----------
   Setting timeout: 10
   Timing for MXNet: https://github.com/apache/incubator-mxnet, DNS: 0.0117 sec, LOAD: 0.8935 sec.
   Timing for Gluon Tutorial(en): http://gluon.mxnet.io, DNS: 0.0599 sec, LOAD: 2.1901 sec.
   Timing for Gluon Tutorial(cn): https://zh.gluon.ai, DNS: 0.1028 sec, LOAD: 0.9832 sec.
   Timing for FashionMNIST: https://apache-mxnet.s3-accelerate.dualstack.amazonaws.com/gluon/dataset/fashion-mnist/train-labels-idx1-ubyte.gz, DNS: 0.0657 sec, LOAD: 1.2597 sec.
   Timing for PYPI: https://pypi.python.org/pypi/pip, DNS: 0.0380 sec, LOAD: 0.8543 sec.
   Timing for Conda: https://repo.continuum.io/pkgs/free/, DNS: 0.0395 sec, LOAD: 0.4625 sec.
   ```
   
   Package used: C API
   
   ## Build info
   
   Compiler: gcc
   
   MXNet commit hash: 
   
   Build config: plain config.mk with `USE_OPENCV=0`
   
   ## Error Message:
   ```
   [15:00:11] src/ndarray/ndarray.cc:757: Check failed: !IsMKLDNNData(): We can't generate TBlob for MKLDNN data. Please use Reorder2Default() to generate a new NDArray first
   Stack trace:
     [bt] (0) libmxnet.so(dmlc::LogMessageFatal::~LogMessageFatal()+0x43) [0x7f34bcc3dac3]
     [bt] (1) libmxnet.so(mxnet::NDArray::SetTBlob() const+0x2fc) [0x7f34bf350f4c]
     [bt] (2) libmxnet.so(MXNDArrayGetData+0x2d) [0x7f34bfaa208d]
     [bt] (3) ./tblob(+0xe65) [0x55e8d2164e65]
     [bt] (4) /lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0xe7) [0x7f34bc294b97]
     [bt] (5) ./tblob(+0xa3a) [0x55e8d2164a3a]
   ```
   
   ## Minimum reproducible example
   ```
   #include <stdio.h>
   
   #include "mxnet/c_api.h"
   #include "nnvm/c_api.h"
   
   int main() {
   
     /* Create symbol variables */
     SymbolHandle in_sym;
     SymbolHandle w_sym;
     SymbolHandle b_sym;
     MXSymbolCreateVariable("in", &in_sym);
     MXSymbolCreateVariable("w", &w_sym);
     MXSymbolCreateVariable("b", &b_sym);
   
     /* Create convolution op */
     OpHandle op;
     NNGetOpHandle("Convolution", &op);
     SymbolHandle sym;
     const char *keys1[2] = {"kernel", "num_filter"};
     const char *vals[2] = {"(1,1)", "40"};
     MXSymbolCreateAtomicSymbol(op, 2, keys1, vals, &sym);
   
     /* Compose op and variables */
     const char **keys2 = NULL;
     SymbolHandle vars[3] = {in_sym, w_sym, b_sym};
   
     MXSymbolCompose(sym, "Conv", 3, keys2, vars);
   
     /* Create NDArrays for arguments */
     int dev_type = 1;
     int dev_id = 0; 
   
     mx_uint in_shape[4] = {1, 3, 30, 30};
     NDArrayHandle in_arg_arr;
     MXNDArrayCreateEx(in_shape, 4, dev_type, dev_id, 0, 0, &in_arg_arr);
     mx_uint w_shape[4] = {40, 3, 1, 1};
     NDArrayHandle w_arg_arr;
     MXNDArrayCreateEx(w_shape, 4, dev_type, dev_id, 0, 0, &w_arg_arr);
     mx_uint b_shape[1] = {40};
     NDArrayHandle b_arg_arr;
     MXNDArrayCreateEx(b_shape, 1, dev_type, dev_id, 0, 0, &b_arg_arr);
   
     /* Create and bind executor */
     ExecutorHandle ex;
     NDArrayHandle arg[3] = {in_arg_arr, w_arg_arr, b_arg_arr};
     NDArrayHandle grad[3] = {NULL, NULL, NULL};
     NDArrayHandle *aux = NULL;
     mx_uint req[3] = {1, 1, 1};
     MXExecutorBind(sym, dev_type, dev_id, 3, arg, grad, req, 0, aux, &ex);
   
     /* Get executor output handle */
     mx_uint out_size;
     NDArrayHandle *out_arr_p;
     MXExecutorOutputs(ex, &out_size, &out_arr_p);
     NDArrayHandle out_arr = *out_arr_p;
   
     /* Forward */
     MXExecutorForward(ex, 0);
   
     /* Read output */
     MXNDArrayWaitToRead(out_arr);
     void *data;
     if(MXNDArrayGetData(out_arr, &data) != 0)
   	printf("%s\n", MXGetLastError());
     else
       printf("Ok!\n");
   
     return 0;
   }
   ```
   
   ## Steps to reproduce
   Running the above standalone C program triggers the mentioned error. The error is not triggered if the output has less than 40 channels, or the if the line `MXNDArrayWaitToRead(out_arr);` is commented out.
   I haven't been able of reproducing this error with the Python interface.

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