device emulation mode and execution mode cannot be mixed Please help

Hello All,

I am having CUDA error mixed device execution, when running my code in emulation mode ( -deviceemu) and I can’t figure out what is wrong, I am using following makefie.







NVCFLAGS= -deviceemu -c -O3 -I$(CUDA_INC_PATH) -I$(INCLUDE_PATH) --host-compilation=c++ --ptxas-options=-v -arch=sm_13

LDFLAGS=-L$(CUDA_LIB_PATH) -lcublasemu -lcudart

all: sim

cpu_context.o: …/include/cpu_context.h

$(NVCC) $(NVCFLAGS) -o cpu_context.o 

core.o: …/include/cpu_context.h …/include/processor.h …/include/decode.h …/include/execute.h …/include/simulator.h …/include/tools.h

$(NVCC) $(NVCFLAGS) -o core.o

core_main.o: …/include/cpu_context.h …/include/tools.h …/include/processor.h …/include/simulator.h

$(NVCC) $(NVCFLAGS) -o core_main.o

sim: core_main.o core.o cpu_context.o

$(NVCC) $(LDFLAGS) ../common/tools.o cpu_context.o core.o core_main.o   -o sim


\rm -f *.o

\rm -f sim

\rm -f *~

\rm -f *.linkinfo[/codebox]

According to programming guide, All code for an application, including any libraries used, must be compiled consistently either for device emulation or for device execution. Linking code compiled for device emulation with code compiled for device execution causes the following runtime error to be returned upon initialization: cudaErrorMixedDeviceExecution.

I have used cublasemu instead of -lcublasemu, still this doesn’t work. Can’t figure out what is it that not compiled with device emulation. my ldd to the executable is as follows: =>  (0x00007fff98bff000) => /usr/local/cuda/lib64/ (0x00007f75a5308000) => /usr/local/cuda/lib64/ (0x00007f75a50c8000) => /usr/lib/ (0x00007f75a4dbb000) => /lib/ (0x00007f75a4b36000) => /lib/ (0x00007f75a491e000) => /lib/ (0x00007f75a45ac000) => /lib/ (0x00007f75a4390000) => /lib/ (0x00007f75a418c000) => /lib/ (0x00007f75a3f84000)

/lib64/ (0x00007f75a5a93000)

Please help. Thanks in advance.