singa-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From GitBox <...@apache.org>
Subject [GitHub] [singa] nudles commented on pull request #728: Fix create_cuda_gpu and linting error
Date Sat, 13 Jun 2020 02:28:01 GMT

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



Mime
View raw message