diff --git a/cuda_bindings/examples/0_Introduction/simple_zero_copy.py b/cuda_bindings/examples/0_Introduction/simple_zero_copy.py index 72c5fe8b701..0fa11ebec94 100644 --- a/cuda_bindings/examples/0_Introduction/simple_zero_copy.py +++ b/cuda_bindings/examples/0_Introduction/simple_zero_copy.py @@ -69,7 +69,9 @@ def main(): # Get the device selected by the user or default to 0, and then set it. if check_cmd_line_flag("device="): - device_count = cudart.cudaGetDeviceCount() + # cudaGetDeviceCount returns (cudaError_t, count); comparing the raw + # tuple against an int below raises TypeError. + device_count = check_cuda_errors(cudart.cudaGetDeviceCount()) idev = int(get_cmd_line_argument_int("device=")) if idev >= device_count or idev < 0: diff --git a/cuda_bindings/examples/3_CUDA_Features/global_to_shmem_async_copy.py b/cuda_bindings/examples/3_CUDA_Features/global_to_shmem_async_copy.py index 9a2ec3dec3b..475bb33e581 100644 --- a/cuda_bindings/examples/3_CUDA_Features/global_to_shmem_async_copy.py +++ b/cuda_bindings/examples/3_CUDA_Features/global_to_shmem_async_copy.py @@ -799,6 +799,11 @@ def matrix_multiply(dims_a, dims_b, kernel_number): grid_shared_state_kernel = cudart.dim3() grid_shared_state_kernel.x = dims_b.x / threads_shared_state_kernel.x grid_shared_state_kernel.y = dims_a.y / threads_shared_state_kernel.x + # C++ dim3 defaults every component to 1; cudart.dim3 wraps a + # zero-initialised struct, so .z must be set explicitly or the two + # cuLaunchKernel calls below pass gridDimZ=0 and fail with + # CUDA_ERROR_INVALID_VALUE. + grid_shared_state_kernel.z = 1 print(f"Running kernel = {kernel_number} - {kernel_names[kernel_number.value]}") # Create and start timer