You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@singa.apache.org by GitBox <gi...@apache.org> on 2020/06/13 02:28:01 UTC

[GitHub] [singa] nudles commented on pull request #728: Fix create_cuda_gpu and linting error

nudles commented on pull request #728:
URL: https://github.com/apache/singa/pull/728#issuecomment-643555875


   How about this solution:
   1. one gpu --- one device instance --- one graph. 
      if we want to reuse the device for another model, we have to reset the device instance to clear all existing data structures on the device (including both tensors and ops)
   ```cpp
   // device.h
   Class Device(){
   
   void reset() ;
   }
   ```
   
   2. override the del function to call the reset function only.
   
   3. create a list of device instances
   ```python
   # device.py
   global_device_list = {}
   def create_gpu_device():
       create the gpu device and put it into global_device_list or return global_device_list[0]
   
   def create_gpu_on(idx):
      create the gpu device and put it into global_device_list or return global_device_list[idx]
   ```
   


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