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

cuLibraryLoadData raises TypeError: 'int' object is not iterable #73

Closed
leofang opened this issue Jul 5, 2024 · 2 comments
Closed

cuLibraryLoadData raises TypeError: 'int' object is not iterable #73

leofang opened this issue Jul 5, 2024 · 2 comments
Labels
bug Something isn't working P0 High priority - Must do!

Comments

@leofang
Copy link
Member

leofang commented Jul 5, 2024

This line is wrong:
https://github.com/NVIDIA/cuda-python/blob/b88592ae51c35af3bf1399a48d2180a6d9cec5cc/cuda/cuda.pyx.in#L21417
numJitOptions is an int, so it cannot be iterated over. What's should have been there in the zip is jitOptions.

@leofang leofang added the bug Something isn't working label Jul 5, 2024
@github-actions github-actions bot added the triage Needs the team's attention label Jul 5, 2024
@leofang
Copy link
Member Author

leofang commented Jul 9, 2024

I confirm this simple patch would make it work:

diff --git a/cuda/cuda.pyx.in b/cuda/cuda.pyx.in
index 74f49d9..e46ea4b 100644
--- a/cuda/cuda.pyx.in
+++ b/cuda/cuda.pyx.in
@@ -21414,12 +21414,12 @@ def cuLibraryLoadData(code, jitOptions : Optional[List[CUjit_option]], jitOption
     ccode = utils.HelperInputVoidPtr(code)
     cdef void* ccode_ptr = <void*><void_ptr>ccode.cptr
     cdef vector[ccuda.CUjit_option] cjitOptions = [pyjitOptions.value for pyjitOptions in (jitOptions)]
-    pylist = [utils.HelperCUjit_option(pyoptions, pyoptionValues) for pyoptions, pyoptionValues in zip(numJitOptions, jitOptionsValues)]
+    pylist = [utils.HelperCUjit_option(pyoptions, pyoptionValues) for pyoptions, pyoptionValues in zip(jitOptions, jitOptionsValues)]
     cdef utils.InputVoidPtrPtrHelper voidStarHelperjitOptionsValues = utils.InputVoidPtrPtrHelper(pylist)
     if numJitOptions > len(jitOptions): raise RuntimeError("List is too small: " + str(len(jitOptions)) + " < " + str(numJitOptions))
     if numJitOptions > len(jitOptionsValues): raise RuntimeError("List is too small: " + str(len(jitOptionsValues)) + " < " + str(numJitOptions))
     cdef vector[ccuda.CUlibraryOption] clibraryOptions = [pylibraryOptions.value for pylibraryOptions in (libraryOptions)]
-    pylist = [utils.HelperCUlibraryOption(pyoptions, pyoptionValues) for pyoptions, pyoptionValues in zip(numLibraryOptions, libraryOptionValues)]
+    pylist = [utils.HelperCUlibraryOption(pyoptions, pyoptionValues) for pyoptions, pyoptionValues in zip(libraryOptions, libraryOptionValues)]
     cdef utils.InputVoidPtrPtrHelper voidStarHelperlibraryOptionValues = utils.InputVoidPtrPtrHelper(pylist)
     if numLibraryOptions > len(libraryOptions): raise RuntimeError("List is too small: " + str(len(libraryOptions)) + " < " + str(numLibraryOptions))
     if numLibraryOptions > len(libraryOptionValues): raise RuntimeError("List is too small: " + str(len(libraryOptionValues)) + " < " + str(numLibraryOptions))
@@ -46813,4 +46813,4 @@ def sizeof(objType):
     {{if True}}
     if objType == VdpOutputSurface:
         return sizeof(ccuda.VdpOutputSurface){{endif}}
-    raise TypeError("Unknown type: " + str(objType))
\ No newline at end of file
+    raise TypeError("Unknown type: " + str(objType))

@leofang leofang added P0 High priority - Must do! and removed triage Needs the team's attention labels Jul 9, 2024
@vzhurba01
Copy link
Collaborator

Fixed with 12.6 release, closing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working P0 High priority - Must do!
Projects
None yet
Development

No branches or pull requests

2 participants