Skip to content

Commit cca86c0

Browse files
committed
fixes
1 parent 67e543c commit cca86c0

6 files changed

Lines changed: 213 additions & 219 deletions

File tree

cuda_bindings/cuda/bindings/_bindings/cynvrtc.pyx.in

Lines changed: 146 additions & 148 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,6 @@ cdef int cuPythonInit() except -1 nogil:
4545
if __cuPythonInit:
4646
return 0
4747

48-
cdef void* handle
4948
with gil, __symbol_lock:
5049
{{if 'Windows' == platform.system()}}
5150
handle = load_nvidia_dynamic_lib("nvrtc")._handle_uint
@@ -623,177 +622,176 @@ cpdef dict _inspect_function_pointers():
623622
cuPythonInit()
624623
cdef dict data = {}
625624

626-
with __symbol_lock:
627-
{{if 'nvrtcGetErrorString' in found_functions}}
628-
global __nvrtcGetErrorString
629-
data["__nvrtcGetErrorString"] = <intptr_t>__nvrtcGetErrorString
630-
{{else}}
631-
data["__nvrtcGetErrorString"] = <intptr_t>0
632-
{{endif}}
625+
{{if 'nvrtcGetErrorString' in found_functions}}
626+
global __nvrtcGetErrorString
627+
data["__nvrtcGetErrorString"] = <intptr_t>__nvrtcGetErrorString
628+
{{else}}
629+
data["__nvrtcGetErrorString"] = <intptr_t>0
630+
{{endif}}
633631

634-
{{if 'nvrtcVersion' in found_functions}}
635-
global __nvrtcVersion
636-
data["__nvrtcVersion"] = <intptr_t>__nvrtcVersion
637-
{{else}}
638-
data["__nvrtcVersion"] = <intptr_t>0
639-
{{endif}}
632+
{{if 'nvrtcVersion' in found_functions}}
633+
global __nvrtcVersion
634+
data["__nvrtcVersion"] = <intptr_t>__nvrtcVersion
635+
{{else}}
636+
data["__nvrtcVersion"] = <intptr_t>0
637+
{{endif}}
640638

641-
{{if 'nvrtcGetNumSupportedArchs' in found_functions}}
642-
global __nvrtcGetNumSupportedArchs
643-
data["__nvrtcGetNumSupportedArchs"] = <intptr_t>__nvrtcGetNumSupportedArchs
644-
{{else}}
645-
data["__nvrtcGetNumSupportedArchs"] = <intptr_t>0
646-
{{endif}}
639+
{{if 'nvrtcGetNumSupportedArchs' in found_functions}}
640+
global __nvrtcGetNumSupportedArchs
641+
data["__nvrtcGetNumSupportedArchs"] = <intptr_t>__nvrtcGetNumSupportedArchs
642+
{{else}}
643+
data["__nvrtcGetNumSupportedArchs"] = <intptr_t>0
644+
{{endif}}
647645

648-
{{if 'nvrtcGetSupportedArchs' in found_functions}}
649-
global __nvrtcGetSupportedArchs
650-
data["__nvrtcGetSupportedArchs"] = <intptr_t>__nvrtcGetSupportedArchs
651-
{{else}}
652-
data["__nvrtcGetSupportedArchs"] = <intptr_t>0
653-
{{endif}}
646+
{{if 'nvrtcGetSupportedArchs' in found_functions}}
647+
global __nvrtcGetSupportedArchs
648+
data["__nvrtcGetSupportedArchs"] = <intptr_t>__nvrtcGetSupportedArchs
649+
{{else}}
650+
data["__nvrtcGetSupportedArchs"] = <intptr_t>0
651+
{{endif}}
654652

655-
{{if 'nvrtcCreateProgram' in found_functions}}
656-
global __nvrtcCreateProgram
657-
data["__nvrtcCreateProgram"] = <intptr_t>__nvrtcCreateProgram
658-
{{else}}
659-
data["__nvrtcCreateProgram"] = <intptr_t>0
660-
{{endif}}
653+
{{if 'nvrtcCreateProgram' in found_functions}}
654+
global __nvrtcCreateProgram
655+
data["__nvrtcCreateProgram"] = <intptr_t>__nvrtcCreateProgram
656+
{{else}}
657+
data["__nvrtcCreateProgram"] = <intptr_t>0
658+
{{endif}}
661659

662-
{{if 'nvrtcDestroyProgram' in found_functions}}
663-
global __nvrtcDestroyProgram
664-
data["__nvrtcDestroyProgram"] = <intptr_t>__nvrtcDestroyProgram
665-
{{else}}
666-
data["__nvrtcDestroyProgram"] = <intptr_t>0
667-
{{endif}}
660+
{{if 'nvrtcDestroyProgram' in found_functions}}
661+
global __nvrtcDestroyProgram
662+
data["__nvrtcDestroyProgram"] = <intptr_t>__nvrtcDestroyProgram
663+
{{else}}
664+
data["__nvrtcDestroyProgram"] = <intptr_t>0
665+
{{endif}}
668666

669-
{{if 'nvrtcCompileProgram' in found_functions}}
670-
global __nvrtcCompileProgram
671-
data["__nvrtcCompileProgram"] = <intptr_t>__nvrtcCompileProgram
672-
{{else}}
673-
data["__nvrtcCompileProgram"] = <intptr_t>0
674-
{{endif}}
667+
{{if 'nvrtcCompileProgram' in found_functions}}
668+
global __nvrtcCompileProgram
669+
data["__nvrtcCompileProgram"] = <intptr_t>__nvrtcCompileProgram
670+
{{else}}
671+
data["__nvrtcCompileProgram"] = <intptr_t>0
672+
{{endif}}
675673

676-
{{if 'nvrtcGetPTXSize' in found_functions}}
677-
global __nvrtcGetPTXSize
678-
data["__nvrtcGetPTXSize"] = <intptr_t>__nvrtcGetPTXSize
679-
{{else}}
680-
data["__nvrtcGetPTXSize"] = <intptr_t>0
681-
{{endif}}
674+
{{if 'nvrtcGetPTXSize' in found_functions}}
675+
global __nvrtcGetPTXSize
676+
data["__nvrtcGetPTXSize"] = <intptr_t>__nvrtcGetPTXSize
677+
{{else}}
678+
data["__nvrtcGetPTXSize"] = <intptr_t>0
679+
{{endif}}
682680

683-
{{if 'nvrtcGetPTX' in found_functions}}
684-
global __nvrtcGetPTX
685-
data["__nvrtcGetPTX"] = <intptr_t>__nvrtcGetPTX
686-
{{else}}
687-
data["__nvrtcGetPTX"] = <intptr_t>0
688-
{{endif}}
681+
{{if 'nvrtcGetPTX' in found_functions}}
682+
global __nvrtcGetPTX
683+
data["__nvrtcGetPTX"] = <intptr_t>__nvrtcGetPTX
684+
{{else}}
685+
data["__nvrtcGetPTX"] = <intptr_t>0
686+
{{endif}}
689687

690-
{{if 'nvrtcGetCUBINSize' in found_functions}}
691-
global __nvrtcGetCUBINSize
692-
data["__nvrtcGetCUBINSize"] = <intptr_t>__nvrtcGetCUBINSize
693-
{{else}}
694-
data["__nvrtcGetCUBINSize"] = <intptr_t>0
695-
{{endif}}
688+
{{if 'nvrtcGetCUBINSize' in found_functions}}
689+
global __nvrtcGetCUBINSize
690+
data["__nvrtcGetCUBINSize"] = <intptr_t>__nvrtcGetCUBINSize
691+
{{else}}
692+
data["__nvrtcGetCUBINSize"] = <intptr_t>0
693+
{{endif}}
696694

697-
{{if 'nvrtcGetCUBIN' in found_functions}}
698-
global __nvrtcGetCUBIN
699-
data["__nvrtcGetCUBIN"] = <intptr_t>__nvrtcGetCUBIN
700-
{{else}}
701-
data["__nvrtcGetCUBIN"] = <intptr_t>0
702-
{{endif}}
695+
{{if 'nvrtcGetCUBIN' in found_functions}}
696+
global __nvrtcGetCUBIN
697+
data["__nvrtcGetCUBIN"] = <intptr_t>__nvrtcGetCUBIN
698+
{{else}}
699+
data["__nvrtcGetCUBIN"] = <intptr_t>0
700+
{{endif}}
703701

704-
{{if 'nvrtcGetLTOIRSize' in found_functions}}
705-
global __nvrtcGetLTOIRSize
706-
data["__nvrtcGetLTOIRSize"] = <intptr_t>__nvrtcGetLTOIRSize
707-
{{else}}
708-
data["__nvrtcGetLTOIRSize"] = <intptr_t>0
709-
{{endif}}
702+
{{if 'nvrtcGetLTOIRSize' in found_functions}}
703+
global __nvrtcGetLTOIRSize
704+
data["__nvrtcGetLTOIRSize"] = <intptr_t>__nvrtcGetLTOIRSize
705+
{{else}}
706+
data["__nvrtcGetLTOIRSize"] = <intptr_t>0
707+
{{endif}}
710708

711-
{{if 'nvrtcGetLTOIR' in found_functions}}
712-
global __nvrtcGetLTOIR
713-
data["__nvrtcGetLTOIR"] = <intptr_t>__nvrtcGetLTOIR
714-
{{else}}
715-
data["__nvrtcGetLTOIR"] = <intptr_t>0
716-
{{endif}}
709+
{{if 'nvrtcGetLTOIR' in found_functions}}
710+
global __nvrtcGetLTOIR
711+
data["__nvrtcGetLTOIR"] = <intptr_t>__nvrtcGetLTOIR
712+
{{else}}
713+
data["__nvrtcGetLTOIR"] = <intptr_t>0
714+
{{endif}}
717715

718-
{{if 'nvrtcGetOptiXIRSize' in found_functions}}
719-
global __nvrtcGetOptiXIRSize
720-
data["__nvrtcGetOptiXIRSize"] = <intptr_t>__nvrtcGetOptiXIRSize
721-
{{else}}
722-
data["__nvrtcGetOptiXIRSize"] = <intptr_t>0
723-
{{endif}}
716+
{{if 'nvrtcGetOptiXIRSize' in found_functions}}
717+
global __nvrtcGetOptiXIRSize
718+
data["__nvrtcGetOptiXIRSize"] = <intptr_t>__nvrtcGetOptiXIRSize
719+
{{else}}
720+
data["__nvrtcGetOptiXIRSize"] = <intptr_t>0
721+
{{endif}}
724722

725-
{{if 'nvrtcGetOptiXIR' in found_functions}}
726-
global __nvrtcGetOptiXIR
727-
data["__nvrtcGetOptiXIR"] = <intptr_t>__nvrtcGetOptiXIR
728-
{{else}}
729-
data["__nvrtcGetOptiXIR"] = <intptr_t>0
730-
{{endif}}
723+
{{if 'nvrtcGetOptiXIR' in found_functions}}
724+
global __nvrtcGetOptiXIR
725+
data["__nvrtcGetOptiXIR"] = <intptr_t>__nvrtcGetOptiXIR
726+
{{else}}
727+
data["__nvrtcGetOptiXIR"] = <intptr_t>0
728+
{{endif}}
731729

732-
{{if 'nvrtcGetProgramLogSize' in found_functions}}
733-
global __nvrtcGetProgramLogSize
734-
data["__nvrtcGetProgramLogSize"] = <intptr_t>__nvrtcGetProgramLogSize
735-
{{else}}
736-
data["__nvrtcGetProgramLogSize"] = <intptr_t>0
737-
{{endif}}
730+
{{if 'nvrtcGetProgramLogSize' in found_functions}}
731+
global __nvrtcGetProgramLogSize
732+
data["__nvrtcGetProgramLogSize"] = <intptr_t>__nvrtcGetProgramLogSize
733+
{{else}}
734+
data["__nvrtcGetProgramLogSize"] = <intptr_t>0
735+
{{endif}}
738736

739-
{{if 'nvrtcGetProgramLog' in found_functions}}
740-
global __nvrtcGetProgramLog
741-
data["__nvrtcGetProgramLog"] = <intptr_t>__nvrtcGetProgramLog
742-
{{else}}
743-
data["__nvrtcGetProgramLog"] = <intptr_t>0
744-
{{endif}}
737+
{{if 'nvrtcGetProgramLog' in found_functions}}
738+
global __nvrtcGetProgramLog
739+
data["__nvrtcGetProgramLog"] = <intptr_t>__nvrtcGetProgramLog
740+
{{else}}
741+
data["__nvrtcGetProgramLog"] = <intptr_t>0
742+
{{endif}}
745743

746-
{{if 'nvrtcAddNameExpression' in found_functions}}
747-
global __nvrtcAddNameExpression
748-
data["__nvrtcAddNameExpression"] = <intptr_t>__nvrtcAddNameExpression
749-
{{else}}
750-
data["__nvrtcAddNameExpression"] = <intptr_t>0
751-
{{endif}}
744+
{{if 'nvrtcAddNameExpression' in found_functions}}
745+
global __nvrtcAddNameExpression
746+
data["__nvrtcAddNameExpression"] = <intptr_t>__nvrtcAddNameExpression
747+
{{else}}
748+
data["__nvrtcAddNameExpression"] = <intptr_t>0
749+
{{endif}}
752750

753-
{{if 'nvrtcGetLoweredName' in found_functions}}
754-
global __nvrtcGetLoweredName
755-
data["__nvrtcGetLoweredName"] = <intptr_t>__nvrtcGetLoweredName
756-
{{else}}
757-
data["__nvrtcGetLoweredName"] = <intptr_t>0
758-
{{endif}}
751+
{{if 'nvrtcGetLoweredName' in found_functions}}
752+
global __nvrtcGetLoweredName
753+
data["__nvrtcGetLoweredName"] = <intptr_t>__nvrtcGetLoweredName
754+
{{else}}
755+
data["__nvrtcGetLoweredName"] = <intptr_t>0
756+
{{endif}}
759757

760-
{{if 'nvrtcGetPCHHeapSize' in found_functions}}
761-
global __nvrtcGetPCHHeapSize
762-
data["__nvrtcGetPCHHeapSize"] = <intptr_t>__nvrtcGetPCHHeapSize
763-
{{else}}
764-
data["__nvrtcGetPCHHeapSize"] = <intptr_t>0
765-
{{endif}}
758+
{{if 'nvrtcGetPCHHeapSize' in found_functions}}
759+
global __nvrtcGetPCHHeapSize
760+
data["__nvrtcGetPCHHeapSize"] = <intptr_t>__nvrtcGetPCHHeapSize
761+
{{else}}
762+
data["__nvrtcGetPCHHeapSize"] = <intptr_t>0
763+
{{endif}}
766764

767-
{{if 'nvrtcSetPCHHeapSize' in found_functions}}
768-
global __nvrtcSetPCHHeapSize
769-
data["__nvrtcSetPCHHeapSize"] = <intptr_t>__nvrtcSetPCHHeapSize
770-
{{else}}
771-
data["__nvrtcSetPCHHeapSize"] = <intptr_t>0
772-
{{endif}}
765+
{{if 'nvrtcSetPCHHeapSize' in found_functions}}
766+
global __nvrtcSetPCHHeapSize
767+
data["__nvrtcSetPCHHeapSize"] = <intptr_t>__nvrtcSetPCHHeapSize
768+
{{else}}
769+
data["__nvrtcSetPCHHeapSize"] = <intptr_t>0
770+
{{endif}}
773771

774-
{{if 'nvrtcGetPCHCreateStatus' in found_functions}}
775-
global __nvrtcGetPCHCreateStatus
776-
data["__nvrtcGetPCHCreateStatus"] = <intptr_t>__nvrtcGetPCHCreateStatus
777-
{{else}}
778-
data["__nvrtcGetPCHCreateStatus"] = <intptr_t>0
779-
{{endif}}
772+
{{if 'nvrtcGetPCHCreateStatus' in found_functions}}
773+
global __nvrtcGetPCHCreateStatus
774+
data["__nvrtcGetPCHCreateStatus"] = <intptr_t>__nvrtcGetPCHCreateStatus
775+
{{else}}
776+
data["__nvrtcGetPCHCreateStatus"] = <intptr_t>0
777+
{{endif}}
780778

781-
{{if 'nvrtcGetPCHHeapSizeRequired' in found_functions}}
782-
global __nvrtcGetPCHHeapSizeRequired
783-
data["__nvrtcGetPCHHeapSizeRequired"] = <intptr_t>__nvrtcGetPCHHeapSizeRequired
784-
{{else}}
785-
data["__nvrtcGetPCHHeapSizeRequired"] = <intptr_t>0
786-
{{endif}}
779+
{{if 'nvrtcGetPCHHeapSizeRequired' in found_functions}}
780+
global __nvrtcGetPCHHeapSizeRequired
781+
data["__nvrtcGetPCHHeapSizeRequired"] = <intptr_t>__nvrtcGetPCHHeapSizeRequired
782+
{{else}}
783+
data["__nvrtcGetPCHHeapSizeRequired"] = <intptr_t>0
784+
{{endif}}
787785

788-
{{if 'nvrtcSetFlowCallback' in found_functions}}
789-
global __nvrtcSetFlowCallback
790-
data["__nvrtcSetFlowCallback"] = <intptr_t>__nvrtcSetFlowCallback
791-
{{else}}
792-
data["__nvrtcSetFlowCallback"] = <intptr_t>0
793-
{{endif}}
786+
{{if 'nvrtcSetFlowCallback' in found_functions}}
787+
global __nvrtcSetFlowCallback
788+
data["__nvrtcSetFlowCallback"] = <intptr_t>__nvrtcSetFlowCallback
789+
{{else}}
790+
data["__nvrtcSetFlowCallback"] = <intptr_t>0
791+
{{endif}}
794792

795-
func_ptrs = data
796-
return data
793+
func_ptrs = data
794+
return data
797795

798796
cpdef _inspect_function_pointer(str name):
799797
global func_ptrs

cuda_bindings/cuda/bindings/_internal/cufile_linux.pyx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ cdef int _check_or_init_cufile() except -1 nogil:
9696
return 0
9797

9898
cdef void* handle = NULL
99-
cdef int err, driver_ver
99+
cdef int err, driver_ver = 0
100100
with gil, __symbol_lock:
101101
# Load driver to check version
102102
handle = dlopen('libcuda.so.1', RTLD_NOW | RTLD_GLOBAL)

cuda_bindings/cuda/bindings/_internal/nvjitlink_linux.pyx

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -65,11 +65,10 @@ cdef int _check_or_init_nvjitlink() except -1 nogil:
6565
if __py_nvjitlink_init:
6666
return 0
6767

68-
cdef void* handle
69-
cdef int err, driver_ver
68+
cdef void* handle = NULL
69+
cdef int err, driver_ver = 0
7070
with gil, __symbol_lock:
7171
# Load driver to check version
72-
handle = NULL
7372
handle = dlopen('libcuda.so.1', RTLD_NOW | RTLD_GLOBAL)
7473
if handle == NULL:
7574
err_msg = dlerror()
@@ -184,8 +183,8 @@ cdef int _check_or_init_nvjitlink() except -1 nogil:
184183
handle = load_library(driver_ver)
185184
__nvJitLinkVersion = dlsym(handle, 'nvJitLinkVersion')
186185

187-
__py_nvjitlink_init = True
188-
return 0
186+
__py_nvjitlink_init = True
187+
return 0
189188

190189

191190
cdef dict func_ptrs = None

0 commit comments

Comments
 (0)