From commits-return-30095-archive-asf-public=cust-asf.ponee.io@mxnet.incubator.apache.org Tue Apr 3 19:56:44 2018 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 [140.211.11.3]) by mx-eu-01.ponee.io (Postfix) with SMTP id 1576D18064D for ; Tue, 3 Apr 2018 19:56:43 +0200 (CEST) Received: (qmail 66080 invoked by uid 500); 3 Apr 2018 17:56:43 -0000 Mailing-List: contact commits-help@mxnet.incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@mxnet.incubator.apache.org Delivered-To: mailing list commits@mxnet.incubator.apache.org Received: (qmail 66070 invoked by uid 99); 3 Apr 2018 17:56:43 -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; Tue, 03 Apr 2018 17:56:43 +0000 From: GitBox To: commits@mxnet.apache.org Subject: [GitHub] piiswrong commented on a change in pull request #10354: Expose the number of GPUs. Message-ID: <152277820269.19298.1211288348246355085.gitbox@gitbox.apache.org> Date: Tue, 03 Apr 2018 17:56:42 -0000 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit piiswrong commented on a change in pull request #10354: Expose the number of GPUs. URL: https://github.com/apache/incubator-mxnet/pull/10354#discussion_r178910455 ########## File path: include/mxnet/base.h ########## @@ -316,6 +321,19 @@ inline Context Context::GPU(int32_t dev_id) { return Create(kGPU, dev_id); } +inline int32_t Context::GetGPUCount() { +#if MXNET_USE_CUDA + int32_t count; + cudaError_t e = cudaGetDeviceCount(&count); + if (e != cudaSuccess) { + return 0; + } + return count; +#else + return 0; Review comment: use LOG(FALTA) << "xxx" ---------------------------------------------------------------- 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