c - cudaMalloc runtime error -
i have problem executing following code on host , not sure going wrong. understanding need allocate enough memory store contents of textdata textlength in size on device, malloc sizeof(char) * textlength should give me enough space, use cudamemcpy copy of values textdata allocated space on device. exception reads "access violation reading location 0x000000000501f80400" memory address of cutextarray on device.
texture<char, cudatexturetype1d, cudareadmodeelementtype> textdataref; int textlength = 10000000 cudaarray *cutextarray; checkcudaerrors (cudamalloc(&cutextarray, sizeof(char)*textlength)); checkcudaerrors(cudamemcpy(cutextarray, textdata, sizeof(char)*textlength, cudamemcpyhosttodevice)); checkcudaerrors(cudabindtexturetoarray(textdataref, cutextarray, textdataref.channeldesc));
i cannot use cudamallocarray data big buffer - maximum of 8192 bytes
exception here seems crash @ binding texture array snippet of code inside cuda_runtime.h:
well turns out can stay away entire array nonsense using standard char pointer reference , different binding call working. extremely simple stuff, bit odd wasn't answerable.
//allocate memory checkcudaerrors( cudamalloc(&d_textdata, sizeof(char) * textlength) ); //copy host device checkcudaerrors( cudamemcpy(d_textdata, textdata, sizeof(char)* textlength, cudamemcpyhosttodevice)); //bind reference block of memory checkcudaerrors ( cudabindtexture(null,&textextref,d_textdata,&textextref.channeldesc, sizeof(char) * textlength ) );
lookup values using
tex1dfetch(textextref,k+index)