I am writing a library that uses a surface (for re-fetching and recording textures) to improve performance:
...
surface<void, 2> my_surf2D;
...
The target platform's GPU has the ability to compute 2.0, and I can compile my code with:
nvcc -arch=sm_20 ...
and it works great.
The problem is that I am trying to develop and debug a library on my laptop with an NVIDIA ION GPU with computing power of 1.1 (I would also like my library to be backward compatible). I know that this architecture does not support surfaces, so I used nvcc macros in my device code to define alternative code for this old architecture:
#if (__CUDA_ARCH__ < 200)
#warning using kernel for CUDA ARCH < 2.0
...
temp_array[...] = tex3D(my_tex,X,Y,Z+0.5f);
#else
...
surf2Dwrite( tex3D(my_tex,X,Y,Z+0.5f), my_surf2D, ix*4, iy,cudaBoundaryModeTrap);
#endif
The problem is that when I do:
nvcc -gencode arch=compute_11,code=sm_11
:
ptxas PTX/myLibrary.ptx, line 1784; fatal : Parsing error near '.surf': syntax error
PTX, , :
.surf .u32 _ZN16LIB_15my_surf2DE;
:
#ifdef __CUDACC__
#if __CUDA_ARCH__ < 200
#warning skipping surface declaration for nvcc trajectory
#else
surface ...
#endif
#else
#warning keeping surface declaration by default
surface ...
#endif
: undefined - cuda . ?
, , - , , .