Invalid Texture working with different version of ubuntu

Hi,

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!

texture<float, 1, cudaReadModeElementType> sTexGrayLevelLUT;

// allocate array
// declare texture reference for 1D float texture
cudaChannelFormatDesc channelDesc = cudaCreateChannelDesc(32, 0, 0, 0, cudaChannelFormatKindFloat);
CHECK_ERROR_CODE(cudaMallocArray( &s_pDeviceArrayGrayTable, &channelDesc, 256));
CHECK_CUDA_ERROR();

// set texture parameters
sTexGrayLevelLUT.addressMode[0] = cudaAddressModeClamp;
sTexGrayLevelLUT.filterMode = cudaFilterModeLinear;
sTexGrayLevelLUT.normalized = true; // access with normalized texture coordinates
CHECK_ERROR_CODE(cudaBindTextureToArray( sTexGrayLevelLUT, s_pDeviceArrayGrayTable, channelDesc));

Did some texture functions change in 3.2 or do I make an error somewhere that wasn’t punished in the old version 3.0?

Thanks for any help,
Benny

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?

btw, What is the right way to un-install an older CUDA Toolkit in Linux?

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.

Thank you Aviday.

I too use a similar method but not as sophisticated as you. I just a soft-link /usr/local/cuda to point to different versions of toolkit.

But I had a doubt as to who is installing “/usr/lib/libcuda.so.1”. Today, I realized that it is the “driver” installation that does this.

Unlike windows where the toolkit provides both cuda and cudart along with the toolkit,

Thanks for your time,

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.

Sorry for the inconvenience.