Invalid resource handle error in pycuda code
When running CUDA code, the following error occurs:
File "/mnt/lustre/demo/extract_disp_newtopo/face_registration-master/code/poisson.py", line 147, in blend_gs_cuda
block = (1024, 1, 1))
File "/mnt/lustre/miniconda3/envs/pycuda/lib/python3.6/site-packages/pycuda/driver.py", line 436, in function_call
func._set_block_shape(*block)
pycuda._driver.LogicError: cuFuncSetBlockShape failed: invalid resource handle
Solution:
find the CUDA function part with the problem:
mod = SourceModule("""
#include <stdint.h>
__global__ void construct_b(
const uint8_t* src, const int16_t* u, const int16_t* v,
float* b,
int pix_num, int size
)
You can add any sentence in the following code before the function declaration
src = torch.cuda.ByteTensor(8)# Fill in the numbers at will, and the matrix is also fine, but the data type should be consistent with the data type in C++
b = torch.cuda.FloatTensor(9)
The complete code is as follows:
src = torch.cuda.ByteTensor(8)
mod = SourceModule("""
#include <stdint.h>
__global__ void construct_b(
const uint8_t* src, const int16_t* u, const int16_t* v,
float* b,
int pix_num, int size
)
The specific reason is unknown because it occurs occasionally.
Read More:
- [Solved] USB: usb_device_handle_win.cc:1049 Failed to read descriptor from node connection…
- [Solved] RuntimeError: cublas runtime error : resource allocation failed at
- [Solved] unknown error: Chrome failed to start: exited abnormally (Driver info: chromedriver=2.36.540471
- Pytorch: How to Handle error warning conda.gateways.disk.delete:unlink_or_rename_to_trash(140)
- [Solved] Pycharm paddle Error: Error: (External) CUDA error(35), CUDA driver version is insufficient for CUDA
- Python Error: OSError: cannot open resource [How to Solve]
- [Solved] Failed to install PIP for MacOS, prompt: syntax error: invalid syntax
- Invalid python sd, Fatal Python error: init_fs_encoding: failed to get the Python cod [How to Solve]
- [Solved] PyTorch Caught RuntimeError in DataLoader worker process 0和invalid argument 0: Sizes of tensors mus
- [ONNXRuntimeError] : 10 : INVALID_Graph loading model error
- Python Pandas Typeerror: invalid type comparison
- [Solved] pytorch loss.backward() Error: RuntimeError: Function AddBackward0 returned an invalid gradient at index 1…
- [Solved] yolo Error: IndexError: invalid index to scalar variable.
- RuntimeError: Invalid DISPLAY variable [How to Solve]
- [Solved] error in REfO setup command: use_2to3 is invalid.
- [Solved] Django Access to the backend error: Invalid block tag on line 98: ‘trans‘, expected ‘elif , ‘else‘或‘ endif. Did you forget
- Mxnet Export onnx Symbol and params files provided are invalid
- [Solved] Python WARNING: Ignoring invalid distribution -umpy
- [Solved] Can’t reconnect until invalid transaction is rolled back
- [Solved] Python operate Kafka error: SyntaxError: invalid syntax