I have several files for the application when processing images. Since the number of rows and columns for an image does not change when performing some image processing algorithm, I tried to put these values โโin read-only memory. My application looks like this:
Imageproc.cuh
... ... __constant__ int c_rows; __constant__ int c_cols; #ifdef __cplusplus extern "C" { #endif ... ... #ifdef __cplusplus } #endif
Imageproc.cu
... ... int algorithm(float *a, const int rows, const int cols){ ... ... checkCudaError(cudaMemcpyToSymbol(&c_rows, &rows, sizeof(int))); checkCudaError(cudaMemcpyToSymbol(&c_cols, &cols, sizeof(int))); dim3 block(T, T); dim3 grid(cols/T+1, rows/T+1); kernel<<<grid, block>>>( ... ); ... ... }
It compiles well, but when I try to run the program, I get invalid device symbol cudaMemcpyToSymbol(&c_rows, &rows, sizeof(int))
Can I put these variables in read-only memory or what am I missing?
source share