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/01/25 01:22:25 UTC

[GitHub] eric-haibin-lin commented on a change in pull request #13980: Use CPUPinned context in ImageRecordIOParser2

eric-haibin-lin commented on a change in pull request #13980: Use CPUPinned context in ImageRecordIOParser2
URL: https://github.com/apache/incubator-mxnet/pull/13980#discussion_r250838355
 
 

 ##########
 File path: src/io/iter_image_recordio_2.cc
 ##########
 @@ -285,9 +285,10 @@ inline bool ImageRecordIOParser2<DType>::ParseNext(DataBatch *out) {
     shape_vec.push_back(param_.label_width);
     TShape label_shape(shape_vec.begin(), shape_vec.end());
 
-    out->data.at(0) = NDArray(data_shape, Context::CPU(0), false,
+    auto dev_id = param_.device_id;
+    out->data.at(0) = NDArray(data_shape, Context::CPUPinned(dev_id), false,
       mshadow::DataType<DType>::kFlag);
-    out->data.at(1) = NDArray(label_shape, Context::CPU(0), false,
+    out->data.at(1) = NDArray(label_shape, Context::CPUPinned(dev_id), false,
 
 Review comment:
   cpu pinned ctx increases memory usage on GPUs. Can we also provide -1 as an option to use CPU(0) as the context? 

----------------------------------------------------------------
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:
users@infra.apache.org


With regards,
Apache Git Services