My Program List:
2dcspresdm.rtm.random.iso.c
2dcspresdm.rtm.random.iso.cu
My Makefile:
INC= -I/data/users/tools/mpich/include -I/usr/local/NVIDIA_CUDA_SDK/common/inc -I/usr/local/cuda/include
MPI_LIB = /data/users/tools/mpich/lib -L/usr/local/NVIDIA_CUDA_SDK/lib
MODULE = 2dcspresdm.rtm.random.iso
EXECS= $(BIN)/$(MODULE).e
$(EXECS): $(MODULE).o $(MODULE).co
mpicc $(MODULE).o $(MODULE).co -lm -L$(MPI_LIB) -o $(EXECS)
$(MODULE).o:$(MODULE).c
mpicc -c $(MODULE).c $(INC) -o $(MODULE).o
$(MODULE).co:$(MODULE).cu
nvcc -c $(MODULE).cu $(INC) -o $(MODULE).co
When I type “make” in the terminal, the mpicc compiler says:
nvcc -c 2dcspresdm.rtm.random.iso.cu -I/data/users/tools/mpich/include -I/usr/local/NVIDIA_CUDA_SDK/common/inc -I/usr/local/cuda/include -o 2dcspresdm.rtm.random.iso.co
mpicc 2dcspresdm.rtm.random.iso.o 2dcspresdm.rtm.random.iso.co -lm -L/data/users/tools/mpich/lib -L/usr/local/NVIDIA_CUDA_SDK/lib -o ./data_result/2dcspresdm.rtm.random.iso.e
2dcspresdm.rtm.random.iso.o: In function presdm': 2dcspresdm.rtm.random.iso.c:(.text+0x8d8): undefined reference to
cudaMalloc’
2dcspresdm.rtm.random.iso.c:(.text+0x8ec): undefined reference to `cudaMalloc’
If we use nvcc compiler, it will link the function library automatically. But it doesnot recognize MPI function. When we use mpicc, the “cudaMalloc()” is undefined. Please help me to compile my program or tell me which library I should link. Thanks a lot~~ External Image