user1953683
user1953683

Reputation: 11

Cuda 5.0 linking errors

My project was compiling fine with CUDA 4.2 development environment on Linux machine.

Recently it was upgraded to CUDA 5.0, and now the compilation fails with the following error messages.

In file included from /opt/cuda/bin/crt/link.stub:79:0:
/tmp/tmpxft_000018c8_00000000-1_GPUReax_dlink.reg.c:2:1: error: redefinition of 'const unsigned char def_module_id_str__NV_MODULE_ID []'
/tmp/tmpxft_000018c8_00000000-1_GPUReax_dlink.reg.c:1:1: error: 'const unsigned char def_module_id_str__NV_MODULE_ID [19]' previously defined here
/tmp/tmpxft_000018c8_00000000-1_GPUReax_dlink.reg.c: In function 'void __cudaRegisterLinkedBinary__NV_MODULE_ID(void (*)(void**), void*, void*)':
/tmp/tmpxft_000018c8_00000000-1_GPUReax_dlink.reg.c:2:1: error: redefinition of 'void __cudaRegisterLinkedBinary__NV_MODULE_ID(void (*)(void**), void*, void*)'
/tmp/tmpxft_000018c8_00000000-1_GPUReax_dlink.reg.c:1:1: error: 'void __cudaRegisterLinkedBinary__NV_MODULE_ID(void (*)(void**), void*, void*)' previously defined here

I am using a linux machine

mctesla 93 $ uname -a
Linux mctesla.cs.purdue.edu 3.7.1 #1 SMP Fri Dec 28 12:08:12 EST 2012 x86_64 Intel(R) Xeon(R) CPU E5606 @ 2.13GHz GenuineIntel GNU/Linux
mctesla 94 $ 

Can someone please comment on how to resolve this issue with CUDA 5.0 environment.

Updates-----

Thanks for the very prompt comments.

I spent all day yesterday chasing this problem.. After looking at the compiler output I noticed the following line.... (separated by * below)

nvcc -I. -I/opt/cuda/include -D__USE_GPU__ -arch=sm_20 -Xptxas=-v -L/opt/cuda/lib64 -lm -lz -lcuda -lcudart GMRES.o QEq.o allocate.o analyze.o bond_orders.o box.o forces.o four_body_interactions.o grid.o init_md.o integrate.o list.o lookup.o neighbors.o param.o pdb_tools.o print_utils.o reset_utils.o restart.o single_body_interactions.o system_props.o three_body_interactions.o traj.o two_body_interactions.o vector.o testmd.o cuda_utils.o cuda_copy.o cuda_init.o reduction.o center_mass.o helpers.o validation.o matrix.o matvec.o -o GPUReax

In file included from /opt/cuda/bin/crt/link.stub:79:0:(*) /tmp/tmpxft_0000345f_00000000-1_GPUReax_dlink.reg.c:2:1: error: redefinition of 'const unsigned char def_module_id_str__NV_MODULE_ID []' /tmp/tmpxft_0000345f_00000000-1_GPUReax_dlink.reg.c:1:1: error: 'const unsigned char def_module_id_str__NV_MODULE_ID [19]' previously defined here


Error is coming from the file link.stub file, which is new in the CUDA 5.0 installation. This file was not present in the CUDA 4.2 installation.

If this helps someone pin point the problem.

Thanks for the help.

Sudhir Kylasa


BTW, this is my Makefile

CC    = g++ 
NVCC   = nvcc

LIBS    = -L/opt/cuda/lib64 -lm -lz -lcuda -lcudart

CFLAGS  = -I.  -Wall -O3 -funroll-loops -fstrict-aliasing
NVCCFLAGS  = -I.  -I/opt/cuda/include -D__USE_GPU__ -arch=sm_20 -Xptxas=-v

#-finline-functions  -finline-limit=15 -g#-DTEST -pg -ldl -rdynamic -g
DEFS    = $(CFLAGS)
NVCCDEFS = $(NVCCFLAGS)

FLAG    = $(DEFS) $(INCS) $(LIBS)
NVCCFLAG = $(NVCCDEFS) $(LIBS)

OBJ      = GMRES.o QEq.o allocate.o analyze.o bond_orders.o \
     box.o forces.o four_body_interactions.o \
     grid.o init_md.o integrate.o list.o \
     lookup.o neighbors.o param.o pdb_tools.o \
     print_utils.o reset_utils.o \
     restart.o single_body_interactions.o \
     system_props.o three_body_interactions.o \
     traj.o two_body_interactions.o vector.o \
     testmd.o \
     cuda_utils.o cuda_copy.o cuda_init.o reduction.o \
     center_mass.o helpers.o validation.o matrix.o matvec.o

all:   beta

beta: $(OBJ) Makefile
   $(NVCC) $(NVCCFLAG) $(OBJ) -o GPUReax

param.o: param.c param.h mytypes.h traj.o
   $(CC) $(DEFS) -c param.c

traj.o: traj.c traj.h mytypes.h 
   $(CC) $(DEFS) -c traj.c

restart.o: restart.c restart.h mytypes.h box.h
   $(CC) $(DEFS) -c restart.c

pdb_tools.o: pdb_tools.c pdb_tools.h mytypes.h box.h list.h restart.h param.h
    $(CC) $(DEFS) -c pdb_tools.c

print_utils.o: print_utils.h print_utils.c
    $(CC) $(DEFS) -c print_utils.c

grid.o: grid.h grid.c
   $(CC) $(DEFS) -c grid.c


analyze.o: analyze.h analyze.c
   $(CC) $(DEFS) -c analyze.c

integrate.o: integrate.h integrate.c
   $(CC) $(DEFS) -c integrate.c

vector.o: vector.h vector.cu
   $(NVCC) $(NVCCDEFS) -c vector.cu

system_props.o: system_props.h system_props.cu
   $(NVCC) $(NVCCDEFS) -c system_props.cu

cuda_copy.o: cuda_copy.h cuda_copy.cu
   $(NVCC) $(NVCCDEFS) -c cuda_copy.cu

cuda_utils.o: cuda_utils.h cuda_utils.cu
   $(NVCC) $(NVCCDEFS) -c cuda_utils.cu

cuda_init.o: cuda_init.h cuda_init.cu
   $(NVCC) $(NVCCDEFS) -c cuda_init.cu

reduction.o: reduction.h reduction.cu
   $(NVCC) $(NVCCDEFS) -c reduction.cu

center_mass.o: center_mass.h center_mass.cu
   $(NVCC) $(NVCCDEFS) -c center_mass.cu

box.o: box.h
   $(NVCC) $(NVCCDEFS) -c box.cu

init_md.o: init_md.h init_md.cu
   $(NVCC) $(NVCCDEFS) -c init_md.cu

helpers.o: helpers.h helpers.cu
   $(NVCC) $(NVCCDEFS) -c helpers.cu

GMRES.o: GMRES.h GMRES.cu
   $(NVCC) $(NVCCDEFS) -c GMRES.cu

neighbors.o: neighbors.cu neighbors.h
   $(NVCC) $(NVCCDEFS) -c neighbors.cu

reset_utils.o: reset_utils.h reset_utils.cu mytypes.h list.h vector.h
   $(NVCC) $(NVCCDEFS) -c reset_utils.cu

list.o: list.h
   $(NVCC) $(NVCCDEFS) -c list.cu

forces.o: forces.h forces.cu
   $(NVCC) $(NVCCDEFS) -c forces.cu

allocate.o: allocate.h allocate.cu
   $(NVCC) $(NVCCDEFS) -c allocate.cu

lookup.o: lookup.h lookup.cu
   $(NVCC) $(NVCCDEFS) -c lookup.cu

two_body_interactions.o: two_body_interactions.h two_body_interactions.cu
   $(NVCC) $(NVCCDEFS) -c two_body_interactions.cu

bond_orders.o: bond_orders.h bond_orders.cu
   $(NVCC) $(NVCCDEFS) -c bond_orders.cu

single_body_interactions.o: single_body_interactions.h single_body_interactions.cu
   $(NVCC) $(NVCCDEFS) -c single_body_interactions.cu

three_body_interactions.o: three_body_interactions.h three_body_interactions.cu
   $(NVCC) $(NVCCDEFS) -c three_body_interactions.cu

four_body_interactions.o: four_body_interactions.h four_body_interactions.cu
   $(NVCC) $(NVCCDEFS) -c four_body_interactions.cu

validation.o: validation.h validation.cu
   $(NVCC) $(NVCCDEFS) -c validation.cu

matrix.o: matrix.h matrix.cu
   $(NVCC) $(NVCCDEFS) -c matrix.cu

QEq.o: QEq.h QEq.cu
   $(NVCC) $(NVCCDEFS) -c QEq.cu

matvec.o: matvec.h matvec.cu
   $(NVCC) $(NVCCDEFS) -c matvec.cu

testmd.o: testmd.cu mytypes.h param.o traj.o restart.o pdb_tools.o list.o vector.o
   $(NVCC) $(NVCCDEFS) -c testmd.cu

clean:
   rm -f *.o *~ core 

Upvotes: 1

Views: 1762

Answers (1)

sdiaz
sdiaz

Reputation: 11

I had the same problem when I wanted to compile for sm_35. I solved it by replacing in the NVCCFLAGS variable the section that says:

-arch=sm_20 by -gencode arch=compute_10,code=sm_10 -gencode arch=compute_20,code=sm_20 -gencode arch=compute_30,code=sm_30 -gencode arch=compute_35,code=sm_35

Hope it helps.  

Upvotes: 1

Related Questions