[cuda][win] add win cuda version check and cuda setting FAQ (#140)

* [win][cuda] add cuda version check on windows

* [docs][win] add cuda setting FAQ

* [docs][win] add cuda setting FAQ
This commit is contained in:
DefTruth
2022-08-22 15:35:58 +08:00
committed by GitHub
parent e35d6dcfd4
commit 1ac1c35e95
2 changed files with 38 additions and 2 deletions

View File

@@ -56,9 +56,10 @@ def add_cuda_shared_lib_dir_windows():
# paths. User should set it manually if the
# cuda toolkit is not locate in the default
# path we assume.
base_url = "https://github.com/PaddlePaddle/FastDeploy/blob/"
default_cuda_dir = get_default_cuda_directory()
default_cuda_version = os.path.basename(default_cuda_dir) # v11.2
cuda_shared_lib_dir = os.path.join(default_cuda_dir, "bin")
# TODO: add FAQ docs reference.
if not os.path.exists(cuda_shared_lib_dir):
# try to get cuda directory from user's local env
custom_cuda_dir = "NOTFOUNDED"
@@ -72,8 +73,20 @@ def add_cuda_shared_lib_dir_windows():
logging.warnings.warn(f"\n--- FastDeploy was built with gpu, \
\n--- but the default cuda directory does not exists. \
\n--- Please setup one of {custom_cuda_envs} manually, \
\n--- this path should look like: {default_cuda_dir}")
\n--- this path should look like: {default_cuda_dir}. \
\n--- Check FAQ: {base_url + 'develop/docs/FAQ.md'}")
return
# check cuda version
custom_cuda_version = os.path.basename(custom_cuda_dir) # v11.2
if default_cuda_version != custom_cuda_version:
logging.warnings.warn(
f"\n--- FastDeploy was built with CUDA version {default_cuda_version}, \
\n--- but found custom CUDA version {custom_cuda_version} at {custom_cuda_dir} \
\n--- Please setup one of {custom_cuda_envs} manually, \
\n--- this path should look like: {default_cuda_dir}. \
\n--- Check FAQ: {base_url + 'develop/docs/FAQ.md'}")
return
# path to cuda dlls
cuda_shared_lib_dir = os.path.join(custom_cuda_dir, "bin")
add_dll_search_dir(cuda_shared_lib_dir)
print(f"[FastDeploy][CUDA]: Found valid cuda directroy and added it: -> {cuda_shared_lib_dir}")