my program is reporting me an invalid texture reference on the last line of my attached code.
The problem only occurs with Ubuntu 10.10 and the newest SDK (3.2).
Excatly the same code was working with Ubuntu 10.04 and SDK 3.0 on the same computer!
I am unable to reproduce this problem. I tried on two different RHEL Linux system (one 32-bit, the other 64-bit). Here is the exact code I ran:
#include <stdio.h>
#include <stdlib.h>
// Macro to catch CUDA errors in CUDA runtime calls
#define CUDA_SAFE_CALL(call) \
do { \
cudaError_t err = call; \
if (cudaSuccess != err) { \
fprintf (stderr, "Cuda error in file '%s' in line %i : %s.\n",\
__FILE__, __LINE__, cudaGetErrorString(err) ); \
exit(EXIT_FAILURE); \
} \
} while (0)
// declare texture reference for 1D float texture
texture<float, 1, cudaReadModeElementType> sTexGrayLevelLUT;
int main (void)
{
cudaArray *s_pDeviceArrayGrayTable;
// allocate array
cudaChannelFormatDesc channelDesc = cudaCreateChannelDesc(32, 0, 0, 0, cudaChannelFormatKindFloat);
CUDA_SAFE_CALL(cudaMallocArray( &s_pDeviceArrayGrayTable, &channelDesc, 256));
// set texture parameters
sTexGrayLevelLUT.addressMode[0] = cudaAddressModeClamp;
sTexGrayLevelLUT.filterMode = cudaFilterModeLinear;
sTexGrayLevelLUT.normalized = true; // access with normalized texture coordinates
CUDA_SAFE_CALL(cudaBindTextureToArray( sTexGrayLevelLUT, s_pDeviceArrayGrayTable, channelDesc));
return EXIT_SUCCESS;
}
I assume you have already double-checked that you have no files from the previous release sitting around, and all the paths are pointing to the correct directories?
Because the cuda toolkit installer doesn’t touch any of the normal system paths (well unless you do something stupid like tell it to), all you need to do is
rm -fr /usr/local/cuda
or wherever you installed it, and the job should be done.
Personally, I don’t “uninstall” older toolkits, I just keep them installed in different directories and use the excellent Modules system, which lets me do this:
avidday@cuda:~$ module avail cuda
----------------------------------------------------- /opt/env/Modules/3.2.7/modulefiles ------------------------------------------------------
cuda/2.3 cuda/3.0 cuda/3.0b cuda/3.1 cuda/3.2(default) cuda/3.2rc
avidday@cuda:~$ module load cuda/2.3
avidday@cuda:~$ echo $LD_LIBRARY_PATH
/opt/cuda-2.3/lib64:/opt/cuda-2.3/cudaprof/bin
avidday@cuda:~$ nvcc --version
nvcc: NVIDIA (R) Cuda compiler driver
Copyright (c) 2005-2009 NVIDIA Corporation
Built on Thu_Jul_30_09:24:36_PDT_2009
Cuda compilation tools, release 2.3, V0.2.1221
avidday@cuda:~$ module switch cuda/2.3 cuda/3.2
avidday@cuda:~$ echo $LD_LIBRARY_PATH
/opt/cuda-3.2/lib64:/opt/cuda-3.2/computeprof/bin
avidday@cuda:~$ nvcc --version
nvcc: NVIDIA (R) Cuda compiler driver
Copyright (c) 2005-2010 NVIDIA Corporation
Built on Wed_Nov__3_16:16:57_PDT_2010
Cuda compilation tools, release 3.2, V0.2.1221
Which is fantastic for regression testing and maintaining legacy builds while ensuring that you can’t ever pick up cruft from older toolkits or build with wrong compilers, etc.
Ok I finally found the error. I generated a library for all cuda_code and used a flag to compile for a specific architecture with 1.3 capabilities.
-arch=“sm_13”, but this computer has only a 1.1 compatible card. The usage of this flag and the upgrade of my system happened in the same time period, thats why I thought that I have some trouble with the new version.