Makefile 1.06 KB
Newer Older
1 2
include ../../example.mk

3 4 5 6 7
CUDA_CC=
ifeq (, $(shell which nvcc))
        CUDA_CC=mpic++ -x c++ $(INCLUDE_PATH)
        INCLUDE_PATH_NVCC=
else
8
        CUDA_CC=nvcc -ccbin=mpic++
9 10
endif

incardon's avatar
incardon committed
11 12 13 14 15 16 17
ifeq ($(PROFILE),ON)
	CC=scorep --nocompiler  --cuda --mpp=mpi nvcc
	CC_MPI=mpic++
else
	CC=$(CUDA_CC)
	CC_MPI=mpic++
endif
18 19

LDIR =
incardon's avatar
incardon committed
20
OPT=
21

incardon's avatar
incardon committed
22 23 24
OBJ_GPU = main_gpu.o
OBJ_CPU = main_cpu.o
OBJ_CPU_BEST = main_cpu_best.o
25

incardon's avatar
incardon committed
26
all: md_dyn_gpu md_dyn_cpu md_dyn_cpu_best
27

incardon's avatar
incardon committed
28 29 30
md_dyn_gpu_test: OPT += -DTEST_RUN
md_dyn_gpu_test: all

31
%.o: %.cu
32
	$(CC) $(OPT)  -O3 -g -c --std=c++11 -o $@ $< $(INCLUDE_PATH_NVCC)
33

incardon's avatar
incardon committed
34
%.o: %.cpp
incardon's avatar
incardon committed
35
	$(CC_MPI) $(OPT) -O3 -g -c --std=c++11 -o $@ $< $(INCLUDE_PATH)
incardon's avatar
incardon committed
36 37

md_dyn_gpu: $(OBJ_GPU)
38
	$(CC_MPI) -o $@ $^ $(CFLAGS) $(LIBS_PATH) $(LIBS)
39

incardon's avatar
incardon committed
40 41 42 43 44
md_dyn_cpu: $(OBJ_CPU)
	$(CC_MPI) -o $@ $^ $(CFLAGS) $(LIBS_PATH) $(LIBS)

md_dyn_cpu_best: $(OBJ_CPU_BEST)
	$(CC_MPI) -o $@ $^ $(CFLAGS) $(LIBS_PATH) $(LIBS)
45

incardon's avatar
incardon committed
46
run: md_dyn_gpu_test
incardon's avatar
incardon committed
47
	mpirun -np 3 ./md_dyn_gpu && mpirun -np 3 ./md_dyn_cpu && mpirun -np 3 ./md_dyn_cpu_best;
48 49 50 51

.PHONY: clean all run

clean:
incardon's avatar
incardon committed
52
	rm -f *.o *~ core md_dyn_gpu md_dyn_cpu md_dyn_cpu_best
53