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 2017/11/17 22:12:37 UTC

[GitHub] anirudh2290 opened a new issue #8699: Temporary workspace for operators can only be allocated once

anirudh2290 opened a new issue #8699: Temporary workspace for operators can only be allocated once
URL: https://github.com/apache/incubator-mxnet/issues/8699
 
 
   ## Description
   Temporary workspace in operator can only be allocated once. This becomes a problem if you have some computed values based on which you need to allocate more memory. For my particular case, I am trying to compute the number of non zero columns for a csr matrix so that I can only allocate the required memory before launching the kernel. There are two steps here. First step requires me to allocate a temp workspace to store true values corresponding to non zero columns. The second step requires me to use this total number of non zero columns to allocate the second temp space.
   
   MXNet commit hash:
   399ac038da885ff3dce8e43bcbdf76bb62522e73
   
   ## Steps to reproduce
   
   In src/resource.cc, if the new size is greater than currently allocated temp workspace size it frees the current temp workspace and allocates the new one. Otherwise it reuses the first one. This means that there is no way to create two temp workspaces where the second one is bigger than the first. 
   
   Is there any specific reason for this behavior? Is there any plan to fix it?
   ```
   inline void* GetSpace(size_t size) {
     if (handle.size >= size) return handle.dptr;
     if (handle.size != 0) {
        Storage::Get()->DirectFree(handle);
     }
     handle = Storage::Get()->Alloc(size, ctx);
     return handle.dptr;
   }
   ```
   

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