Compiling SDK on Ubuntu 9.10 (Karmic)

Hi

I’m trying to compile the SDK, but the process is only successful up to a point… I’m using GCC/G++ 4.2. As far as I know I’ve installed the toolkit and sdc successfully. I’ve also exported the relevant paths to the $PATH and $LD_LIBRARY variables.

If anyone could shed any light onto this particular error, I’d be most grateful.

Cheers

Luke

These are the final lines of output from make:

make -C src/dwtHaar1D/
make[1]: Entering directory /home/luke/NVIDIA_GPU_Computing_SDK/C/src/dwtHaar1D' make[1]: Leaving directory /home/luke/NVIDIA_GPU_Computing_SDK/C/src/dwtHaar1D’
make -C src/nbody/
make[1]: Entering directory /home/luke/NVIDIA_GPU_Computing_SDK/C/src/nbody' In file included from nbody.cpp:37: bodysystemcuda.h:35: error: ‘getArray’ declared as a ‘virtual’ field bodysystemcuda.h:35: error: expected ‘;’ before ‘(’ token bodysystemcuda.h:36: error: ‘BodyArray’ has not been declared In file included from bodysystemcuda.h:73, from nbody.cpp:37: bodysystemcuda_impl.h: In constructor ‘BodySystemCUDA<T>::BodySystemCUDA(int, bool)’: bodysystemcuda_impl.h:68: error: class ‘BodySystemCUDA<T>’ does not have any field named ‘BodySystem’ bodysystemcuda_impl.h: In constructor ‘BodySystemCUDA<T>::BodySystemCUDA(int, unsigned int, unsigned int, bool, bool)’: bodysystemcuda_impl.h:88: error: class ‘BodySystemCUDA<T>’ does not have any field named ‘BodySystem’ bodysystemcuda_impl.h: In destructor ‘virtual BodySystemCUDA<T>::~BodySystemCUDA()’: bodysystemcuda_impl.h:110: error: ‘m_numBodies’ was not declared in this scope bodysystemcuda_impl.h: In member function ‘virtual void BodySystemCUDA<T>::_initialize(int)’: bodysystemcuda_impl.h:116: error: ‘m_bInitialized’ was not declared in this scope bodysystemcuda_impl.h:118: error: ‘m_numBodies’ was not declared in this scope bodysystemcuda_impl.h: In member function ‘virtual void BodySystemCUDA<T>::_finalize()’: bodysystemcuda_impl.h:180: error: ‘m_bInitialized’ was not declared in this scope bodysystemcuda_impl.h: In member function ‘virtual void BodySystemCUDA<T>::update(float)’: bodysystemcuda_impl.h:227: error: ‘m_bInitialized’ was not declared in this scope bodysystemcuda_impl.h:233: error: ‘m_numBodies’ was not declared in this scope bodysystemcuda_impl.h:239: error: ‘m_numBodies’ was not declared in this scope bodysystemcuda_impl.h: At global scope: bodysystemcuda_impl.h:246: error: ‘T* BodySystemCUDA<T>::getArray’ is not a static member of ‘class BodySystemCUDA<T>’ bodysystemcuda_impl.h:246: error: template definition of non-template ‘T* BodySystemCUDA<T>::getArray’ bodysystemcuda_impl.h:246: error: ‘BodyArray’ was not declared in this scope bodysystemcuda_impl.h:247: error: expected ;’ before ‘{’ token
bodysystemcuda_impl.h:278: error: variable or field ‘setArray’ declared void
bodysystemcuda_impl.h:278: error: ‘BodyArray’ was not declared in this scope
bodysystemcuda_impl.h:278: error: expected primary-expression before ‘const’
In file included from nbody.cpp:38:
bodysystemcpu.h:34: error: ‘getArray’ declared as a ‘virtual’ field
bodysystemcpu.h:34: error: expected ‘;’ before ‘(’ token
bodysystemcpu.h:35: error: ‘BodyArray’ has not been declared
In file included from bodysystemcpu.h:60,
from nbody.cpp:38:
bodysystemcpu_impl.h: In constructor ‘BodySystemCPU::BodySystemCPU(int)’:
bodysystemcpu_impl.h:28: error: class ‘BodySystemCPU’ does not have any field named ‘BodySystem’
bodysystemcpu_impl.h: In destructor ‘virtual BodySystemCPU::~BodySystemCPU()’:
bodysystemcpu_impl.h:45: error: ‘m_numBodies’ was not declared in this scope
bodysystemcpu_impl.h: In member function ‘virtual void BodySystemCPU::_initialize(int)’:
bodysystemcpu_impl.h:51: error: ‘m_bInitialized’ was not declared in this scope
bodysystemcpu_impl.h:53: error: ‘m_numBodies’ was not declared in this scope
bodysystemcpu_impl.h: In member function ‘virtual void BodySystemCPU::_finalize()’:
bodysystemcpu_impl.h:73: error: ‘m_bInitialized’ was not declared in this scope
bodysystemcpu_impl.h: In member function ‘virtual void BodySystemCPU::update(float)’:
bodysystemcpu_impl.h:85: error: ‘m_bInitialized’ was not declared in this scope
bodysystemcpu_impl.h: At global scope:
bodysystemcpu_impl.h:93: error: ‘T* BodySystemCPU::getArray’ is not a static member of ‘class BodySystemCPU’
bodysystemcpu_impl.h:93: error: template definition of non-template ‘T* BodySystemCPU::getArray’
bodysystemcpu_impl.h:93: error: ‘BodyArray’ was not declared in this scope
bodysystemcpu_impl.h:94: error: expected ;' before ‘{’ token bodysystemcpu_impl.h:113: error: variable or field ‘setArray’ declared void bodysystemcpu_impl.h:113: error: ‘BodyArray’ was not declared in this scope bodysystemcpu_impl.h:113: error: expected primary-expression before ‘const’ bodysystemcpu_impl.h: In member function ‘void BodySystemCPU<T>::_computeNBodyGravitation()’: bodysystemcpu_impl.h:164: error: ‘m_numBodies’ was not declared in this scope bodysystemcpu_impl.h: In member function ‘void BodySystemCPU<T>::_integrateNBodySystem(float)’: bodysystemcpu_impl.h:186: error: ‘m_numBodies’ was not declared in this scope nbody.cpp: In member function ‘void NBodyDemo<T>::_runBenchmark(int)’: nbody.cpp:334: error: there are no arguments to ‘computePerfStats’ that depend on a template parameter, so a declaration of ‘computePerfStats’ must be available nbody.cpp:334: error: (if you use ‘-fpermissive’, G++ will accept your code, but allowing the use of an undeclared name is deprecated) nbody.cpp: At global scope: nbody.cpp:347: error: too few template-parameter-lists nbody.cpp:348: error: too few template-parameter-lists nbody.cpp: In function ‘void initGL()’: nbody.cpp:379: warning: deprecated conversion from string constant to ‘char*’ nbody.cpp: In member function ‘void NBodyDemo<T>::_init(int, int, int, bool, bool) [with T = double]’: nbody.cpp:136: instantiated from ‘static void NBodyDemo<T>::init(int, int, int, bool, bool) [with T = double]’ nbody.cpp:852: instantiated from here nbody.cpp:236: error: cannot allocate an object of abstract type ‘BodySystemCUDA<double>’ bodysystemcuda.h:24: note: because the following virtual functions are pure within ‘BodySystemCUDA<double>’: bodysystem.h:46: note: T* BodySystem<T>::getArray(BodySystem<T>::BodyArray) [with T = double] bodysystem.h:47: note: void BodySystem<T>::setArray(BodySystem<T>::BodyArray, const T*) [with T = double] nbody.cpp: In member function ‘void NBodyDemo<T>::_compareResults(int) [with T = double]’: nbody.cpp:151: instantiated from ‘static void NBodyDemo<T>::compareResults(int) [with T = double]’ nbody.cpp:863: instantiated from here nbody.cpp:291: error: cannot allocate an object of abstract type ‘BodySystemCPU<double>’ bodysystemcpu.h:24: note: because the following virtual functions are pure within ‘BodySystemCPU<double>’: bodysystem.h:46: note: T* BodySystem<T>::getArray(BodySystem<T>::BodyArray) [with T = double] bodysystem.h:47: note: void BodySystem<T>::setArray(BodySystem<T>::BodyArray, const T*) [with T = double] nbody.cpp: In member function ‘void NBodyDemo<T>::_init(int, int, int, bool, bool) [with T = float]’: nbody.cpp:136: instantiated from ‘static void NBodyDemo<T>::init(int, int, int, bool, bool) [with T = float]’ nbody.cpp:883: instantiated from here nbody.cpp:236: error: cannot allocate an object of abstract type ‘BodySystemCUDA<float>’ bodysystemcuda.h:24: note: because the following virtual functions are pure within ‘BodySystemCUDA<float>’: bodysystem.h:46: note: T* BodySystem<T>::getArray(BodySystem<T>::BodyArray) [with T = float] bodysystem.h:47: note: void BodySystem<T>::setArray(BodySystem<T>::BodyArray, const T*) [with T = float] nbody.cpp: In member function ‘void NBodyDemo<T>::_compareResults(int) [with T = float]’: nbody.cpp:151: instantiated from ‘static void NBodyDemo<T>::compareResults(int) [with T = float]’ nbody.cpp:894: instantiated from here nbody.cpp:291: error: cannot allocate an object of abstract type ‘BodySystemCPU<float>’ bodysystemcpu.h:24: note: because the following virtual functions are pure within ‘BodySystemCPU<float>’: bodysystem.h:46: note: T* BodySystem<T>::getArray(BodySystem<T>::BodyArray) [with T = float] bodysystem.h:47: note: void BodySystem<T>::setArray(BodySystem<T>::BodyArray, const T*) [with T = float] make[1]: *** [obj/x86_64/release/nbody.cpp.o] Error 1 make[1]: Leaving directory /home/luke/NVIDIA_GPU_Computing_SDK/C/src/nbody’
make: *** [src/nbody/Makefile.ph_build] Error 2

Hi Luke,

Did you manage to get this fixed? I have exactly the same problem.

Thanks

David

Any people reading this post down the line… Luke didn’t get it working.

I think this problem was caused by NVidia’s website having too many different packages and places to download them. Their website is also buggy, which means you can end up with the wrong version of a file :-(.

In the end I got CUDA compiled and also got the separate OpenCL stuff working.

As NVidia’s site is a bit rubbish, here’s what you should do to get things running on Karmic Koala:

  1. Only use this page to download files:

http://developer.nvidia.com/object/opencl-download.html

  1. Do not install the NVidia drivers for Ubuntu from their repositories.

  2. Do not revert to GCC 4.2 or 4.1 as others might tell you to - it is not necessary.

  3. Download the drivers from the webpage above. Control/Alt & F1 into the terminal. “sudo stop gdm” to stop X. Then run the drivers.

  4. “sudo start gdm” to resume X.

  5. Download and install the SDK from the page above. Note that this seems to have both CUDA support and OpenCL support, so God knows why nvidia still have CUDA-only downloads.

  6. To build the examples, you’ll need to change a couple of source files.

/usr/local/cuda/include/common_functions.h

Comment out the externs for memset and memcpy.

/usr/local/cuda/include/math_functions.h

Comment out the externs for signbit/signbitl/signbitd/signbitf.

Then change to the SDK’s C directory and “make”.

Hope this helps someone, half the OpenCL examples still crash for me but the CUDA ones work fine.

David

Disclaimer: I’ve set up CUDA dev/testing environments several times on various OS-es, including Ubuntu 9.10. I belive that the above comment is slightly misleading so I’ll try to make a couple of comments/corrections.

True, there are minor bugs, like when you choose ubuntu 9.04 then at the toolkit the 8.10 shows up (“CUDA Toolkit: CUDA Toolkit 2.3 for Linux (Ubuntu 8.10)”) but the links point to the right location.

That’s one way, but there you have only the driver v190.29 while the latest stable driver is v190.53. Why wouldn’t use the latter when it just works?

As far as I know NVIDIA (unfotunately) does not have official repositories! Probably you are talking about on of the Launchpad PPAs that do package the drivers.

You do not need to use neither gcc 4.2 nor 4.1, it does perfectly work with gcc 4.3, but not with 4.4 that comes with Karmic - at least not out of the box.

Sure - but again, why not the newer driver?

Sure.

Yes, it’s a bit confusing but if you think twice it is actually not that bad: CUDA 2.3 came out in July 09. NVIDIA released OpenCL in September so that became CUDA 2.3a as it is based on the 2.3 release (thoughI would have liked 2.3.1 better) and of course the SDk does include both C and OpenCL samples. It would have been quite unreasonable to leave out the CUDA samples, isn’t it?

I think it’s much safer and simpler to just switch to gcc 4.3 and wait until 4.4 gets officially supported. If you really think it’s worth messing around with the CUDA library headers - and of course if you know what you’re doing - go ahead and do it.

Cheers,

Sz

For operating system Ubuntu v9.10 64 bit running on intel i7 CPU and NVIDIA GTX275,

my research indicates the following are the correct versions to run latest production stable software for NVIDIA GPU programming work.

If I am mistaken please correct me:

  • NVIDIA 190.53 driver. (195.21 and 196.21 are both beta. Or 190.89 – not sure please help)

  • NVIDIA Cuda 2.3 SDK. (Or 2.3a with OpenCL – not sure please help)

  • GCC 4.3 (4.4 is not compatible, but 4.4 is standard on Ubuntu v9.10)

Thank you