Whenever I run my script that contains those lines:
char ** gpu_reads;
HANDLE_ERROR(cudaMalloc((void **)&gpu_reads, inputDim * sizeof(char *)));
for(i=0; i<inputDim; i++) {
HANDLE_ERROR(cudaMalloc((void **)&(gpu_reads[i]), (READS_LENGTH + 1) * sizeof(char)));
}
for(i=0; i<inputDim; i++) {
HANDLE_ERROR(cudaMemcpy(gpu_reads[i], reads[i], sizeof(char) * (READS_LENGTH + 1), cudaMemcpyHostToDevice));
}
The second line returns an "unknown error". I tried different allocation in my program (this was the first one) but none of them worked.
The purpose of those lines is simply allocating an array (of length fixed by user, using the variable inputDim of strings (of fixed length).
I tried different version (i.e. using only 3 pointers, 1 pointer...) but none seems to work...
Any ideas?
The full code is available at my GitHub repository, where many allocation are made.
(void **)?(READS_LENGTH * inputDim)bytes in a single chunk and you will never have to struggle with broken loops.