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

Prevent AttributeError: 'function' object has no attribute 'add_log_entry' on logging #72

Merged

Conversation

tomaarsen
Copy link
Contributor

Hello!

Pull request overview

  • Ensure that CUDASetup.get_instance is called in all situations.
  • Change an instance of the CUDA_RUNTIME_LIB string being used in the context of CUDASetup.

Details

In 3 places throughout the codebase, CUDASetup.get_instance is used without being called, causing:

     28         error_str = ctypes.c_char_p()
     29         cuda.cuGetErrorString(result_val, ctypes.byref(error_str))
---> 30         CUDASetup.get_instance.add_log_entry(f"CUDA exception! Error code: {error_str.value.decode()}")
     31 
     32 def get_cuda_version(cuda, cudart_path):

AttributeError: 'function' object has no attribute 'add_log_entry'

I've resolved this by calling get_instance in all cases.

Secondarily, I noticed that CUDA_RUNTIME_LIB.get_instance().add_log_entry was used once, which surprised me, as CUDA_RUNTIME_LIB is a constant string. I've replaced CUDA_RUNTIME_LIB with CUDASetup, as that seems like the intended use.

Let me know if you need anything from me at this point!

  • Tom Aarsen

@TimDettmers
Copy link
Collaborator

Thanks for the quick fix, Tom! I really need to add tests for this. I am pretty perplexed that I overlooked these simple errors.

Will deploy a new version right away. Thank you!

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