You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mxnet.apache.org by jx...@apache.org on 2017/08/26 18:51:36 UTC

[incubator-mxnet] branch master updated: gpu access of ndarray (#7496)

This is an automated email from the ASF dual-hosted git repository.

jxie pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-mxnet.git


The following commit(s) were added to refs/heads/master by this push:
     new 1e48e12  gpu access of ndarray (#7496)
1e48e12 is described below

commit 1e48e1238609b94cae2af3d0d72b33882b9c5a24
Author: dtmoodie <dt...@gmail.com>
AuthorDate: Sat Aug 26 14:51:34 2017 -0400

    gpu access of ndarray (#7496)
    
    * gpu access of ndarray
    
    * gpu access from C++ api
    
    * gpu access fix
    
    * Update c_api.cc
    
    * Update c_api.cc
---
 cpp-package/include/mxnet-cpp/ndarray.hpp | 1 -
 src/c_api/c_api.cc                        | 8 +-------
 2 files changed, 1 insertion(+), 8 deletions(-)

diff --git a/cpp-package/include/mxnet-cpp/ndarray.hpp b/cpp-package/include/mxnet-cpp/ndarray.hpp
index 5ed04a5..6bf2643 100644
--- a/cpp-package/include/mxnet-cpp/ndarray.hpp
+++ b/cpp-package/include/mxnet-cpp/ndarray.hpp
@@ -359,7 +359,6 @@ inline int NDArray::GetDType() const {
 
 inline const mx_float *NDArray::GetData() const {
   void *ret;
-  CHECK_NE(GetContext().GetDeviceType(), DeviceType::kGPU);
   MXNDArrayGetData(blob_ptr_->handle_, &ret);
   if (GetDType() != 0) {
     return NULL;
diff --git a/src/c_api/c_api.cc b/src/c_api/c_api.cc
index 0fe3fe3..088e208 100644
--- a/src/c_api/c_api.cc
+++ b/src/c_api/c_api.cc
@@ -437,13 +437,7 @@ int MXNDArrayGetData(NDArrayHandle handle,
   API_BEGIN();
   NDArray *arr = static_cast<NDArray*>(handle);
   if (!arr->is_none()) {
-    CHECK(arr->ctx().dev_mask() == cpu::kDevMask)
-        << "MXNDArrayGetData can only be called for NDArray on CPU";
-    const TBlob &b = arr->data();
-    CHECK(b.CheckContiguous());
-    MSHADOW_REAL_TYPE_SWITCH(arr->dtype(), DType, {
-      *out_pdata = b.FlatTo2D<cpu, DType>().dptr_;
-    });
+    *out_pdata = arr->data().dptr_;
   } else {
     *out_pdata = nullptr;
   }

-- 
To stop receiving notification emails like this one, please contact
['"commits@mxnet.apache.org" <co...@mxnet.apache.org>'].