You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tvm.apache.org by GitBox <gi...@apache.org> on 2022/04/20 09:10:50 UTC

[GitHub] [tvm] leandron commented on a diff in pull request #11063: [TVMC] Add configuration json files to the Python package

leandron commented on code in PR #11063:
URL: https://github.com/apache/tvm/pull/11063#discussion_r853909424


##########
python/tvm/driver/tvmc/config_options.py:
##########
@@ -21,8 +21,47 @@
 """
 import os
 import json
+
+from tvm._ffi import libinfo
 from tvm.driver.tvmc import TVMCException
 
+CONFIGS_JSON_DIR = None
+
+
+class ConfigsJsonNotFoundError(TVMCException):
+    """Raised when the JSON configs dirtree cannot be found."""
+
+
+def get_configs_json_dir() -> str:
+    """Find the 'configs' directory, containing the JSON files used to configure tvmc
+    with persistent argument settings.
+
+    Returns
+    -------
+    str :
+        The path to the 'configs' directory
+    """
+    global CONFIGS_JSON_DIR
+    if CONFIGS_JSON_DIR is None:
+        candidate_paths = []
+        candidate_paths.extend(libinfo.find_lib_path())
+        # When running from source, the configs directory will be located one directory above the
+        # native libraries, so covering that case.
+        candidate_paths.extend(
+            [os.path.abspath(os.path.join(lib_path, "..")) for lib_path in libinfo.find_lib_path()]
+        )
+        for path in candidate_paths:
+            print(f"{path}")

Review Comment:
   🤦 



-- 
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.

To unsubscribe, e-mail: commits-unsubscribe@tvm.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org