larroy commented on issue #14979: [BUG] Using a package with MKL and GPU 
versions, using python to open a new process will cause an error
URL: 
https://github.com/apache/incubator-mxnet/issues/14979#issuecomment-525089264
 
 
   The crash still happening when using multiprocess.
   
   ```
   In [6]: from multiprocessing import Process
      ...: import gluonnlp as nlp
      ...: import numpy as np
      ...: from gluonnlp.data import SQuAD
      ...: from mxnet import nd,gluon
      ...: import mxnet as mx
      ...: from mxnet.gluon import nn
      ...: 
      ...: class Transform(object):
      ...:     def __init__(self):
      ...:         pass
      ...: 
      ...:     def __call__(self, record_index, question_id, question, context, 
answer_list,
      ...:                  answer_start_list):
      ...:         return np.ones((100,1)),np.ones((100,3))
      ...: 
      ...: def train():
      ...:     train_data = SQuAD('train')
      ...:     dataloader = 
gluon.data.DataLoader(train_data.transform(Transform()),batch_size=128, 
shuffle=True, num_workers=4)
      ...:     net = nn.HybridSequential()
      ...:     net.add(nn.Dense(10))
      ...:     net.initialize(mx.init.Xavier(), ctx=mx.gpu(0))
      ...:     print(net)
      ...: 
      ...: p = Process(target=train)
      ...: p.start()
      ...: p.join()
   Downloading /home/piotr/.mxnet/datasets/squad/train-v1.1.zip from 
https://apache-mxnet.s3-accelerate.dualstack.amazonaws.com/gluon/dataset/squad/train-v1.1.zip...
   
   Segmentation fault: 11
   
   Stack trace:
     [bt] (0) 
/home/piotr/mxnet/python/mxnet/../../build/libmxnet.so(+0x37ecd89) 
[0x7f8b09ab6d89]
     [bt] (1) /lib/x86_64-linux-gnu/libc.so.6(+0x3ef20) [0x7f8bda440f20]
     [bt] (2) 
/home/piotr/mxnet/build/mklml/mklml_lnx_2019.0.5.20190502/lib/libiomp5.so(+0xac19c)
 [0x7f8ac40d919c]
     [bt] (3) 
/home/piotr/mxnet/python/mxnet/../../build/libmxnet.so(mxnet::engine::OpenMP::set_reserve_cores(int)+0x81a)
 [0x7f8b09a07fda]
     [bt] (4) 
/home/piotr/mxnet/python/mxnet/../../build/libmxnet.so(mxnet::engine::ThreadedEnginePerDevice::PushToExecute(mxnet::engine::OprBlock*,
 bool)::{lambda()#2}::operator()() const+0x4f) [0x7f8b09a1659f]
     [bt] (5) 
/home/piotr/mxnet/python/mxnet/../../build/libmxnet.so(std::shared_ptr<mxnet::engine::ThreadedEnginePerDevice::ThreadWorkerBlock<(dmlc::ConcurrentQueueType)1>
 > 
mxnet::common::LazyAllocArray<mxnet::engine::ThreadedEnginePerDevice::ThreadWorkerBlock<(dmlc::ConcurrentQueueType)1>
 
>::Get<mxnet::engine::ThreadedEnginePerDevice::PushToExecute(mxnet::engine::OprBlock*,
 bool)::{lambda()#2}>(int, 
mxnet::engine::ThreadedEnginePerDevice::PushToExecute(mxnet::engine::OprBlock*, 
bool)::{lambda()#2})+0x3c2) [0x7f8b09a17cc2]
     [bt] (6) 
/home/piotr/mxnet/python/mxnet/../../build/libmxnet.so(mxnet::engine::ThreadedEnginePerDevice::PushToExecute(mxnet::engine::OprBlock*,
 bool)+0x481) [0x7f8b09a192e1]
     [bt] (7) 
/home/piotr/mxnet/python/mxnet/../../build/libmxnet.so(mxnet::engine::ThreadedEngine::Push(mxnet::engine::Opr*,
 mxnet::Context, int, bool)+0x19f) [0x7f8b09a0b50f]
     [bt] (8) 
/home/piotr/mxnet/python/mxnet/../../build/libmxnet.so(mxnet::engine::ThreadedEngine::PushAsync(std::function<void
 (mxnet::RunContext, mxnet::engine::CallbackOnComplete)>, mxnet::Context, 
std::vector<mxnet::engine::Var*, std::allocator<mxnet::engine::Var*> > const&, 
std::vector<mxnet::engine::Var*, std::allocator<mxnet::engine::Var*> > const&, 
mxnet::FnProperty, int, char const*, bool)+0x155) [0x7f8b09a08be5]
   ```

----------------------------------------------------------------
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:
[email protected]


With regards,
Apache Git Services

Reply via email to