Exemple #1
0
def setup_env():
    num_concurrent_streams = Config.get("compiler", "cuda",
                                        "max_concurrent_streams")
    if 'ORT_USE_STREAMS' in os.environ:
        ONNXRuntimeCUDA.use_streams = _env2bool(os.environ["ORT_USE_STREAMS"])
        if ONNXRuntimeCUDA.use_streams:
            log.info("Using streams with ORT (experimental)")
            if num_concurrent_streams == 0:
                log.info("Setting compiler.cuda.max_concurrent_streams to 8")
                Config.set("compiler",
                           "cuda",
                           "max_concurrent_streams",
                           value=8)
            elif num_concurrent_streams == -1:
                ONNXRuntimeCUDA.use_streams = False
    else:
        if num_concurrent_streams != -1:
            log.info("Setting compiler.cuda.max_concurrent_streams to -1")
            Config.set("compiler", "cuda", "max_concurrent_streams", value=-1)
        ONNXRuntimeCUDA.use_streams = False
    ONNXRuntimeCUDA.max_concurrent_streams = Config.get(
        "compiler", "cuda", "max_concurrent_streams")
Exemple #2
0
 def get_bool(self, *key_hierarchy):
     from dace.config import _env2bool
     res = self.get(*key_hierarchy)
     if isinstance(res, bool):
         return res
     return _env2bool(str(res))