jwfromm opened a new issue #9974: DataLoader with workers not compatible with 
ImageRecordDataset
URL: https://github.com/apache/incubator-mxnet/issues/9974
 
 
   ## Description
   Using a DataLoader with a non-zero number of workers on a ImageRecordDataset 
crashes. Being able to have multiple workers is essential to high speed 
training, and is supported when using ImageRecordIters, so it should be 
possible with DataLoaders, which have a much nicer API.
   
   ## Environment info (Required)
   
   ```
   ----------Python Info----------
   Version      : 3.6.4
   Compiler     : GCC 7.2.0
   Build        : ('default', 'Jan 16 2018 18:10:19')
   Arch         : ('64bit', '')
   ------------Pip Info-----------
   Version      : 9.0.1
   Directory    : /opt/conda/envs/pytorch-py3.6/lib/python3.6/site-packages/pip
   ----------MXNet Info-----------
   Version      : 1.1.0
   Directory    : 
/opt/conda/envs/pytorch-py3.6/lib/python3.6/site-packages/mxnet
   Commit Hash   : 07a83a0325a3d782513a04f47d711710972cb144
   ----------System Info----------
   Platform     : Linux-4.13.0-32-generic-x86_64-with-debian-stretch-sid
   system       : Linux
   node         : 243bb3cedee3
   release      : 4.13.0-32-generic
   version      : #35~16.04.1-Ubuntu SMP Thu Jan 25 10:13:43 UTC 2018
   ----------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):                12
   On-line CPU(s) list:   0-11
   Thread(s) per core:    2
   Core(s) per socket:    6
   Socket(s):             1
   NUMA node(s):          1
   Vendor ID:             GenuineIntel
   CPU family:            6
   Model:                 79
   Model name:            Intel(R) Core(TM) i7-6850K CPU @ 3.60GHz
   Stepping:              1
   CPU MHz:               3600.001
   CPU max MHz:           4000.0000
   CPU min MHz:           1200.0000
   BogoMIPS:              7200.00
   Virtualization:        VT-x
   Hypervisor vendor:     vertical
   Virtualization type:   full
   L1d cache:             32K
   L1i cache:             32K
   L2 cache:              256K
   L3 cache:              15360K
   NUMA node0 CPU(s):     0-11
   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 est tm2 
ssse3 sdbg fma cx16 xtpr pdcm pcid dca sse4_1 sse4_2 x2apic movbe popcnt 
tsc_deadline_timer aes xsave avx f16c rdrand lahf_lm abm 3dnowprefetch 
cpuid_fault epb cat_l3 cdp_l3 invpcid_single pti intel_ppin intel_pt tpr_shadow 
vnmi flexpriority ept vpid fsgsbase tsc_adjust bmi1 hle avx2 smep bmi2 erms 
invpcid rtm cqm rdt_a rdseed adx smap xsaveopt cqm_llc cqm_occup_llc 
cqm_mbm_total cqm_mbm_local dtherm ida arat pln pts
   ----------Network Test----------
   Setting timeout: 10
   Timing for MXNet: https://github.com/apache/incubator-mxnet, DNS: 0.0254 
sec, LOAD: 0.5580 sec.
   Timing for Gluon Tutorial(en): http://gluon.mxnet.io, DNS: 0.1541 sec, LOAD: 
0.0660 sec.
   Timing for Gluon Tutorial(cn): https://zh.gluon.ai, DNS: 0.1920 sec, LOAD: 
0.1901 sec.
   Timing for FashionMNIST: 
https://apache-mxnet.s3-accelerate.dualstack.amazonaws.com/gluon/dataset/fashion-mnist/train-labels-idx1-ubyte.gz,
 DNS: 0.1562 sec, LOAD: 1.5483 sec.
   Timing for PYPI: https://pypi.python.org/pypi/pip, DNS: 0.0516 sec, LOAD: 
0.1203 sec.
   Timing for Conda: https://repo.continuum.io/pkgs/free/, DNS: 0.0299 sec, 
LOAD: 0.0624 sec.
   
   ```
   
   Package used (Python/R/Scala/Julia):
   I'm using Python 3.6
   
   ## Build info (Required if built from source)
   Pip Install
   
   ## Error Message:
   ```
   Process Process-1:
   Traceback (most recent call last):
     File 
"/opt/conda/envs/pytorch-py3.6/lib/python3.6/multiprocessing/process.py", line 
258, in _bootstrap
       self.run()
     File 
"/opt/conda/envs/pytorch-py3.6/lib/python3.6/multiprocessing/process.py", line 
93, in run
       self._target(*self._args, **self._kwargs)
     File 
"/opt/conda/envs/pytorch-py3.6/lib/python3.6/site-packages/mxnet/gluon/data/dataloader.py",
 line 119, in worker_loop
       batch = batchify_fn([dataset[i] for i in samples])
     File 
"/opt/conda/envs/pytorch-py3.6/lib/python3.6/site-packages/mxnet/gluon/data/dataloader.py",
 line 119, in <listcomp>
       batch = batchify_fn([dataset[i] for i in samples])
     File 
"/opt/conda/envs/pytorch-py3.6/lib/python3.6/site-packages/mxnet/gluon/data/vision/datasets.py",
 line 284, in __getitem__
       record = super(ImageRecordDataset, self).__getitem__(idx)
     File 
"/opt/conda/envs/pytorch-py3.6/lib/python3.6/site-packages/mxnet/gluon/data/dataset.py",
 line 180, in __getitem__
       return self._record.read_idx(self._record.keys[idx])
     File 
"/opt/conda/envs/pytorch-py3.6/lib/python3.6/site-packages/mxnet/recordio.py", 
line 265, in read_idx
       return self.read()
     File 
"/opt/conda/envs/pytorch-py3.6/lib/python3.6/site-packages/mxnet/recordio.py", 
line 163, in read
       ctypes.byref(size)))
     File 
"/opt/conda/envs/pytorch-py3.6/lib/python3.6/site-packages/mxnet/base.py", line 
146, in check_call
       raise MXNetError(py_str(_LIB.MXGetLastError()))
   mxnet.base.MXNetError: [00:59:29] src/recordio.cc:65: Check failed: 
header[0] == RecordIOWriter::kMagic Invalid RecordIO File
   
   Stack trace returned 10 entries:
   [bt] (0) 
/opt/conda/envs/pytorch-py3.6/lib/python3.6/site-packages/mxnet/libmxnet.so(+0x2a9e78)
 [0x7fa348419e78]
   [bt] (1) 
/opt/conda/envs/pytorch-py3.6/lib/python3.6/site-packages/mxnet/libmxnet.so(+0x29531f3)
 [0x7fa34aac31f3]
   [bt] (2) 
/opt/conda/envs/pytorch-py3.6/lib/python3.6/site-packages/mxnet/libmxnet.so(MXRecordIOReaderReadRecord+0x1e)
 [0x7fa34a54c67e]
   [bt] (3) 
/opt/conda/envs/pytorch-py3.6/lib/python3.6/lib-dynload/../../libffi.so.6(ffi_call_unix64+0x4c)
 [0x7fa38c088ec0]
   [bt] (4) 
/opt/conda/envs/pytorch-py3.6/lib/python3.6/lib-dynload/../../libffi.so.6(ffi_call+0x22d)
 [0x7fa38c08887d]
   [bt] (5) 
/opt/conda/envs/pytorch-py3.6/lib/python3.6/lib-dynload/_ctypes.cpython-36m-x86_64-linux-gnu.so(_ctypes_callproc+0x2ce)
 [0x7fa38c29ddee]
   [bt] (6) 
/opt/conda/envs/pytorch-py3.6/lib/python3.6/lib-dynload/_ctypes.cpython-36m-x86_64-linux-gnu.so(+0x12825)
 [0x7fa38c29e825]
   [bt] (7) 
/opt/conda/envs/pytorch-py3.6/bin/python(_PyObject_FastCallDict+0x8b) 
[0x5556015941bb]
   [bt] (8) /opt/conda/envs/pytorch-py3.6/bin/python(+0x19cd3e) [0x555601621d3e]
   [bt] (9) 
/opt/conda/envs/pytorch-py3.6/bin/python(_PyEval_EvalFrameDefault+0x30a) 
[0x55560164619a]
   ```
   ## Minimum reproducible example
   ```
   # Assumes you have a ImageRecord to read from
   test = 
mx.gluon.data.vision.datasets.ImageRecordDataset("/data/imagenet/val.rec")
   test_data = mx.gluon.data.DataLoader(test, batch_size=64, num_workers=2)
   for data, label in test_data:
       print(data)
       break
   ```
   
   ## Steps to reproduce
   Run the above code.
   
   ## What have you tried to solve it?
   Would require changes to how ImageRecordDatasets access the records.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to