madlib-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From GitBox <>
Subject [GitHub] [madlib] khannaekta commented on a change in pull request #455: DL: Add new helper function for gpu_configuration
Date Wed, 06 Nov 2019 23:20:52 GMT
khannaekta commented on a change in pull request #455: DL: Add new helper function for gpu_configuration

 File path: src/ports/postgres/modules/deep_learning/madlib_keras_gpu_info.py_in
 @@ -0,0 +1,203 @@
+# coding=utf-8
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+@file madlib_keras_gpu_info.py_in
+@brief GPU configuration helper function
+@namespace madlib_keras_gpu_info
+import plpy
+from utilities.utilities import is_platform_pg
+from utilities.utilities import unique_string
+import subprocess
+import os
+class OutputInfoSchema:
+    INFO_TABLE = unique_string(desp='gpu_info')
+    SEG_ID_COL = 'gp_seg_id'
+    GPU_DESCR_COL = 'gpu_descr'
+class Source:
+    NVIDIA = 'nvidia'
+    TENSORFLOW = 'tensorflow'
+class GPUInfoFunctions:
+    @staticmethod
+    def get_gpu_info_from_nvidia():
+        """
+        This function will run only on segment(s). Make sure not to run any non
+        select plpy execute.
+        :return: list of gpu descriptions as returned by nvidia-smi -L.
+        """
+        try:
+            return subprocess.check_output(["nvidia-smi", "-L"]).splitlines()
+        except OSError:  # Handle case when nvidia-smi is not found
+            return []
 Review comment:
    I think in addition to returning an empty array, we should also add a warning, suggesting
to use the function with tensorflow, else the user might not know if there are no GPUs attached
to the hosts or if `nvidia-smi` was not found  

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:

With regards,
Apache Git Services

View raw message