From 6043f5a714a2229816f47c144b4cf04ccedc8f72 Mon Sep 17 00:00:00 2001 From: Seunghoon Lee Date: Fri, 17 May 2024 13:43:55 +0900 Subject: [PATCH] zluda support cudaMallocAsync --- installer.py | 7 +++++-- modules/zluda_installer.py | 14 +++++++++----- 2 files changed, 14 insertions(+), 7 deletions(-) diff --git a/installer.py b/installer.py index 14bb64a80..2406ccf19 100644 --- a/installer.py +++ b/installer.py @@ -498,13 +498,15 @@ def check_torch(): error = None from modules import zluda_installer try: + if args.reinstall_zluda: + zluda_installer.uninstall() if args.use_zluda_dnn: if zluda_installer.check_dnn_dependency(): zluda_installer.enable_dnn() else: log.warning("Couldn't find the required dependency of ZLUDA DNN.") - zluda_installer.install() - zluda_path = zluda_installer.find() + zluda_path = zluda_installer.get_path() + zluda_installer.install(zluda_path) zluda_installer.make_copy(zluda_path) except Exception as e: error = e @@ -1062,6 +1064,7 @@ def add_args(parser): group.add_argument('--skip-env', default = os.environ.get("SD_SKIPENV",False), action='store_true', help = "Skips setting of env variables during startup, default: %(default)s") group.add_argument('--experimental', default = os.environ.get("SD_EXPERIMENTAL",False), action='store_true', help = "Allow unsupported versions of libraries, default: %(default)s") group.add_argument('--reinstall', default = os.environ.get("SD_REINSTALL",False), action='store_true', help = "Force reinstallation of all requirements, default: %(default)s") + group.add_argument('--reinstall-zluda', default = os.environ.get("SD_REINSTALL_ZLUDA",False), action='store_true', help = "Force reinstallation of ZLUDA, default: %(default)s") group.add_argument('--test', default = os.environ.get("SD_TEST",False), action='store_true', help = "Run test only and exit") group.add_argument('--version', default = False, action='store_true', help = "Print version information") group.add_argument('--ignore', default = os.environ.get("SD_IGNORE",False), action='store_true', help = "Ignore any errors and attempt to continue") diff --git a/modules/zluda_installer.py b/modules/zluda_installer.py index 992568add..f9fb2ad93 100644 --- a/modules/zluda_installer.py +++ b/modules/zluda_installer.py @@ -11,13 +11,14 @@ RELEASE = f"rel.{os.environ.get('ZLUDA_HASH', '11cc5844514f93161e0e74387f04e2c53 DLL_MAPPING = { 'cublas.dll': 'cublas64_11.dll', 'cusparse.dll': 'cusparse64_11.dll', + 'cudart.dll': 'cudart64_110.dll', 'nvrtc.dll': 'nvrtc64_112_0.dll', } -HIP_TARGETS = ['rocblas.dll', 'rocsolver.dll', 'hiprtc0507.dll',] +HIP_TARGETS = ['amdhip64.dll', 'rocblas.dll', 'rocsolver.dll', 'hiprtc0507.dll',] ZLUDA_TARGETS = ('nvcuda.dll', 'nvml.dll',) -def find() -> str: +def get_path() -> str: return os.path.abspath(os.environ.get('ZLUDA', '.zluda')) @@ -45,9 +46,7 @@ def enable_dnn() -> None: HIP_TARGETS.append('MIOpen.dll') -def install() -> None: - zluda_path = find() - +def install(zluda_path: os.PathLike) -> None: if os.path.exists(zluda_path): return @@ -64,6 +63,11 @@ def install() -> None: os.remove('_zluda') +def uninstall() -> None: + if os.path.exists('.zluda'): + shutil.rmtree('.zluda') + + def make_copy(zluda_path: os.PathLike) -> None: for k, v in DLL_MAPPING.items(): if not os.path.exists(os.path.join(zluda_path, v)):