Copying 2D arrays to GPU of known variable width
问题 I am looking into how to copy a 2D array of variable width for each row into the GPU. int rows = 1000; int cols; int** host_matrix = malloc(sizeof(*int)*rows); int *d_array; int *length; ... Each host_matrix[i] might have a different length, which I know length[i] , and there is where the problem starts. I would like to avoid copying dummy data. Is there a better way of doing it? According to this thread, that won't be a clever way of doing it: cudaMalloc(d_array, rows*sizeof(int*)); for(int