From dev-return-5723-archive-asf-public=cust-asf.ponee.io@singa.apache.org Wed Jun 10 07:57:04 2020 Return-Path: X-Original-To: archive-asf-public@cust-asf.ponee.io Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [207.244.88.153]) by mx-eu-01.ponee.io (Postfix) with SMTP id 1B849180638 for ; Wed, 10 Jun 2020 09:57:04 +0200 (CEST) Received: (qmail 32683 invoked by uid 500); 10 Jun 2020 07:57:03 -0000 Mailing-List: contact dev-help@singa.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@singa.apache.org Delivered-To: mailing list dev@singa.apache.org Received: (qmail 32668 invoked by uid 99); 10 Jun 2020 07:57:03 -0000 Received: from ec2-52-202-80-70.compute-1.amazonaws.com (HELO gitbox.apache.org) (52.202.80.70) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 10 Jun 2020 07:57:03 +0000 From: =?utf-8?q?GitBox?= To: dev@singa.apache.org Subject: =?utf-8?q?=5BGitHub=5D_=5Bsinga=5D_nudles_commented_on_a_change_in_pull_requ?= =?utf-8?q?est_=23728=3A_Fix_create=5Fcuda=5Fgpu?= Message-ID: <159177582315.8471.1985471605936448755.asfpy@gitbox.apache.org> Date: Wed, 10 Jun 2020 07:57:03 -0000 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit In-Reply-To: References: nudles commented on a change in pull request #728: URL: https://github.com/apache/singa/pull/728#discussion_r437931959 ########## File path: python/singa/device.py ########## @@ -113,10 +113,8 @@ def create_cuda_gpu(set_default=False): a swig converted CudaGPU device. ''' assert singa.USE_CUDA, 'SINGA has not been compiled with CUDA enabled.' - devices = singa.Platform.CreateCudaGPUs(1) - if set_default: - set_default_device(devices[0]) - return devices[0] + device = create_cuda_gpu_on(0, set_default) Review comment: I think we should create a default_gpu_device attribute for the device module ```python default_gpu_device = None def create_cuda_gpu(): assert ... if default_gpu_device is None: default_gpu_device = create_cuda_gpu_on(0) return default_gpu_device ``` ---------------------------------------------------------------- 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