Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

dlhandle: suppress DLL errors on Windows #2389

Merged
merged 2 commits into from
May 31, 2024
Merged

Conversation

cebtenzzre
Copy link
Member

@cebtenzzre cebtenzzre commented May 29, 2024

This PR improves handling of errors caused by a missing/broken nvcuda.dll. This is an example of what at least two users have seen when nvcuda.dll is incompatible with the CUDA runtime libraries shipped with GPT4All:
f6f704ce-e0b2-453f-b14f-d5ac378e2ca5

Without this PR

  • If nvcuda.dll, this message is printed1 and GPT4All continues without CUDA:
constructGlobalLlama: could not find Llama implementation for backend: cuda
  • If nvcuda.dll does not have a required symbol (which can be simulated by replacing it with an unrelated DLL), two error dialogs similar to the one in the screenshot will appear, this message is printed, and GPT4All continues without CUDA:
constructGlobalLlama: could not find Llama implementation for backend: cuda

With this PR

  • If nvcuda.dll is missing, you now get these warnings in the console:
Failed to load llamamodel-mainline-cuda-avxonly.dll: LoadLibraryExA failed with error 0x7e
Failed to load llamamodel-mainline-cuda.dll: LoadLibraryExA failed with error 0x7e
constructGlobalLlama: could not find Llama implementation for backend: cuda

Error 0x7e corresponds to ERROR_MOD_NOT_FOUND. This typically indicates that no NVIDIA graphics driver is installed.

  • If nvcuda.dll does not have a required symbol, you now get these warnings in the console, and no error dialog:
Failed to load llamamodel-mainline-cuda-avxonly.dll: LoadLibraryExA failed with error 0x7f
Failed to load llamamodel-mainline-cuda.dll: LoadLibraryExA failed with error 0x7f
constructGlobalLlama: could not find Llama implementation for backend: cuda

Error 0x7f corresponds to ERROR_PROC_NOT_FOUND. This typically indicates that the installed NVIDIA graphics driver is too old - in the above screenshot, it appears that the user has a version older than 441.22 from 2019.

Footnotes

  1. You can only see these messages when you modify CMakeLists.txt to build GPT4All as a console application. It may be a good idea make it possible to surface these errors to the user without requiring them to build GPT4All from source.

@cebtenzzre cebtenzzre requested a review from manyoso May 29, 2024 17:53
gpt4all-backend/dlhandle.h Outdated Show resolved Hide resolved
Sometimes the CUDA runtime cannot be loaded. Do not open an error dialog
in this case, as CUDA is an optional feature of GPT4All.

Signed-off-by: Jared Van Bortel <[email protected]>
@cebtenzzre cebtenzzre merged commit 8ba7ef4 into main May 31, 2024
11 of 22 checks passed
@cebtenzzre cebtenzzre mentioned this pull request May 31, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants