undefined references

Hi, i was develping my project in device emulation but now i want to run it in my cuda device.

when i make the project, while linking all the object files i get:

paralelLayer.o: In function `$$SymbolTable’:

(.nv11Segment+0x7660): undefined reference to `$gpu_registers’

paralelLayer.o: In function `$$SymbolTable’:

(.nv11Segment+0xabdc): undefined reference to `blockDim’

paralelLayer.o: In function `$$SymbolTable’:

(.nv11Segment+0xabe8): undefined reference to `gridDim’

paralelLayer.o: In function `$$SymbolTable’:

(.nv11Segment+0xabf4): undefined reference to `blockIdx’

paralelLayer.o: In function `$$SymbolTable’:

(.nv11Segment+0xac00): undefined reference to `threadIdx’

my makefile:

CX = gcc

CXX = g++ -ggdb

all: preann

preann: xmm32.o paralelLayer.o commonFunctions.o vector.o xmmVector.o layer.o cudaLayer.o xmmLayer.o neuralNet.o cudaNeuralNet.o xmmNeuralNet.o chronometer.o main.o

	$(CXX) -o preann xmm32.o paralelLayer.o commonFunctions.o vector.o xmmVector.o layer.o cudaLayer.o xmmLayer.o neuralNet.o cudaNeuralNet.o xmmNeuralNet.o chronometer.o main.o -L/usr/local/cuda/lib -lcudart

main.o : main.cpp cudaNeuralNet.o xmmNeuralNet.o chronometer.o

	$(CXX) -c main.cpp 

cudaNeuralNet.o : cudaNeuralNet.cpp cudaNeuralNet.h neuralNet.o cudaLayer.o

	$(CXX) -c cudaNeuralNet.cpp

xmmNeuralNet.o : xmmNeuralNet.cpp xmmNeuralNet.h neuralNet.o xmmLayer.o

	$(CXX) -c xmmNeuralNet.cpp

neuralNet.o : neuralNet.cpp neuralNet.h layer.o

	$(CXX) -c neuralNet.cpp

xmmLayer.o : xmmLayer.cpp xmmLayer.h layer.o xmm32.o xmmVector.o

	$(CXX) -c xmmLayer.cpp

cudaLayer.o : cudaLayer.cpp cudaLayer.h layer.o paralelLayer.o

	$(CXX) -c cudaLayer.cpp

layer.o : layer.h layer.cpp vector.o

	$(CXX) -c layer.cpp

xmmVector.o : xmmVector.h xmmVector.cpp vector.o xmmDefinitions.h

	$(CXX) -c xmmVector.cpp

vector.o : vector.h vector.cpp commonFunctions.o

	$(CXX) -c vector.cpp

commonFunctions.o : commonFunctions.c generalDefinitions.h

	$(CXX) -c commonFunctions.c

	

chronometer.o : chronometer.cpp chronometer.h

	$(CXX) -c chronometer.cpp

paralelLayer.o : paralelLayer.cu cudaDefinitions.h generalDefinitions.h

	nvcc -g -G -c -arch sm_11 paralelLayer.cu

xmm32.o : xmm32.asm

	nasm -f elf xmm32.asm

clean: 

	rm preann xmm32.o paralelLayer.o commonFunctions.o vector.o xmmVector.o layer.o cudaLayer.o xmmLayer.o neuralNet.o cudaNeuralNet.o xmmNeuralNet.o chronometer.o main.o

Part of the code is here.

Any help would be great.

I don’t see any nvcc in that Makefile. You have to compile CUDA containing source files with nvcc (and they have to have the correct file extension .cu for the nvcc front end to know what to do with them),

The relevant lines may be these:

nvcc -g -G -c -arch sm_11 paralelLayer.cu

CXX = g++ -ggdb

$(CXX) -o preann xmm32.o paralelLayer.o commonFunctions.o vector.o xmmVector.o layer.o cudaLayer.o xmmLayer.o neuralNet.o cudaNeuralNet.o xmmNeuralNet.o chronometer.o main.o -L/usr/local/cuda/lib -lcudart

Sorry, I missed that hiding at the bottom of the makefile. That error you are getting is typical of trying to compile and link CUDA code directly with the host compiler. Are you sure those object files have been compiled with nvcc? Can you clean the build and try from the beginning?

Yes, I did “make clean” and then “make” and I get the same errors.

I’m confused because it did compile with the emulation-mode.

I found the answer to my questions here