yzhliu commented on a change in pull request #16100: Infra for tvm op runtime 
dispatch
URL: https://github.com/apache/incubator-mxnet/pull/16100#discussion_r325356720
 
 

 ##########
 File path: python/mxnet/libinfo.py
 ##########
 @@ -110,5 +110,36 @@ def find_include_path():
                                ' or ' + src_incl_path + '\n')
 
 
+def find_conf_path(prefix='tvmop'):
+    """Find TVM op config files.
+
+    Returns
+    -------
+    conf_path : string
+        Path to the config files.
+    """
+    conf_from_env = os.environ.get('MXNET_CONF_PATH')
+    if conf_from_env:
+        if os.path.isfile(conf_from_env):
+            if not os.path.isabs(conf_from_env):
+                logging.warning("MXNET_CONF_PATH should be an absolute path, 
instead of: %s",
+                                conf_from_env)
+            else:
+                return conf_from_env
+        else:
+            logging.warning("MXNET_CONF_PATH '%s' doesn't exist", 
conf_from_env)
+
+    curr_path = os.path.dirname(os.path.abspath(os.path.expanduser(__file__)))
+    makefile_path = os.path.join(curr_path, '../../')
+    cmake_build_path = os.path.join(curr_path, '../../build/')
+    candidates_path = [makefile_path, cmake_build_path]
+    candidates_path = [p + prefix + '.conf' for p in candidates_path]
+    conf_path = [p for p in candidates_path if os.path.exists(p) and 
os.path.isfile(p)]
+    if len(conf_path) == 0:
+        raise RuntimeError('Cannot find the TVM op config.\n' +
+                           'List of candidates:\n' + 
str('\n'.join(candidates_path)))
 
 Review comment:
   can we fallback to default behavior if config file is missing?

----------------------------------------------------------------
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:
[email protected]


With regards,
Apache Git Services

Reply via email to