My program starts 2 threads - Thread A (for input) and B (for processing). I also have a pair of pointers to 2 buffers, so when Thread A has finished copying data to Buffer 1, Thread B starts processing Buffer 1, and Thread A starts copying data to Buffer 2. Then, when Buffer 2 is full, copies of Thread A data to buffer 1 and stream B process buffer 2, etc.
My problem arises when I try to execute cudaMemcpy Buffer [] in d_Buffer (which was previously cudaMalloc'd on the main thread, i.e. before creating the stream. Buffer [] was also malloc'd on the main thread). I get the error "wrong argument", but I have no idea what is an invalid argument.
I have reduced my program to a single-threaded program, but still use 2 buffers. That is, copying and processing occur one after another, and not simultaneously. The cudaMemcpy line is exactly the same as the dual-line one. A single-threaded program works great.
I am not sure where the error is.
Thanks.
Regards, Rayne
source share