Makefile.mak 2.05 KB
Newer Older
Pillai, Himanshu's avatar
Pillai, Himanshu committed
1
2
3
4
5
6
KOKKOS_DEVICES = "Serial"
EXE_NAME1 = "test_CanopyHydrology_kern1_multiple"
EXE_NAME1 = "test_CanopyHydrology_module"
OBJECT  = ../../../src/
KERNEL_LANG	  = cc_serial
SRCDIR	      =	$(OBJECT)$(KERNEL_LANG)
7
8
include $(OBJECT)config/Makefile.config

Pillai, Himanshu's avatar
Pillai, Himanshu committed
9
10
11
12
13
SRC1 = CanopyHydrology_kern1_multiple.cpp
SRC2 = CanopyHydrology_module.cpp

default: build1 build2
	echo "Start Build"
14
15
16
17


ifneq (,$(findstring Cuda,$(KOKKOS_DEVICES)))
CXX = ${KOKKOS_PATH}/bin/nvcc_wrapper
Pillai, Himanshu's avatar
Pillai, Himanshu committed
18
19
20
#EXE = ${EXE_NAME}.cuda
KOKKOS_ARCH = "BSW,Pascal60"
KOKKOS_CUDA_OPTIONS = "enable_lambda"
21
22
else
CXX = g++
Pillai, Himanshu's avatar
Pillai, Himanshu committed
23
24
#EXE = ${EXE_NAME}.host
KOKKOS_ARCH = "BSW"
25
26
27
28
endif

CXXFLAGS = -g -O0
LINK = ${CXX}
Pillai, Himanshu's avatar
Pillai, Himanshu committed
29
LINKFLAGS = -lnetcdf
30
31
32
33
EXTRA_PATH = -I/usr/local/include

DEPFLAGS = -M

Pillai, Himanshu's avatar
Pillai, Himanshu committed
34
35
36
OBJ1 =  $(SRC1:.cpp=.o)
OBJ2 =  $(SRC2:.cpp=.o)
LIB = -I$(NETCDF_ROOT)/include  -I$(SRCDIR)
37
38
39
40
41
42
43

include $(KOKKOS_PATH)/Makefile.kokkos

.PHONY: links library test

default: all

Pillai, Himanshu's avatar
Pillai, Himanshu committed
44
all: links library $(EXE_NAME1) $(EXE_NAME2)
45

Pillai, Himanshu's avatar
Pillai, Himanshu committed
46
47
build1: $(SRC1)
	python ../../compare_to_gold.py $(EXE_NAME1)
48

Pillai, Himanshu's avatar
Pillai, Himanshu committed
49
50
CanopyHydrology_kern1_multiple: test_CanopyHydrology_kern1_multiple
	./test_CanopyHydrology_kern1_multiple.host > test_CanopyHydrology_kern1_multiple.stdout
51

Pillai, Himanshu's avatar
Pillai, Himanshu committed
52
53
build2: $(SRC2)
	python ../../compare_to_gold.py $(EXE_NAME2)
54

Pillai, Himanshu's avatar
Pillai, Himanshu committed
55
56
CanopyHydrology_module: test_CanopyHydrology_module
	./test_CanopyHydrology_module.host > test_CanopyHydrology_module.stdout
57
58


Pillai, Himanshu's avatar
Pillai, Himanshu committed
59
60
sandbox: test_sandbox_domain_template_magic
	./test_sandbox_domain_template_magic
61

Pillai, Himanshu's avatar
Pillai, Himanshu committed
62
63
64
65
$(EXE_NAME1): $(OBJ1) $(KOKKOS_LINK_DEPENDS)
	$(LINK) $(KOKKOS_LDFLAGS) $(CC_LD_FLAGS) $(OBJ1) $(KOKKOS_LIBS) $(LIB) -o $(EXE_NAME1) $(LINKFLAGS) $(EXTRA_PATH)
$(EXE_NAME2): $(OBJ2) $(KOKKOS_LINK_DEPENDS)
	$(LINK) $(KOKKOS_LDFLAGS) $(CC_LD_FLAGS) $(OBJ2) $(KOKKOS_LIBS) $(LIB) -o $(EXE_NAME2) $(LINKFLAGS) $(EXTRA_PATH)
66

Pillai, Himanshu's avatar
Pillai, Himanshu committed
67
68
clean: kokkos-clean
	rm -f *.o *.cuda *.host test_*
69
70
71

links:
	@echo "making in links"
Pillai, Himanshu's avatar
Pillai, Himanshu committed
72
	$(MAKE) -C ../../links links
73
74

library:
Pillai, Himanshu's avatar
Pillai, Himanshu committed
75
76
77
78
79
80
81
82
83
	$(MAKE) -C $(OBJECT) cc_serial

# Compilation rules

%.o:%.cpp $(KOKKOS_CPP_DEPENDS)
	$(CXX) $(KOKKOS_CPPFLAGS) $(KOKKOS_CXXFLAGS) $(CXXFLAGS) -I$(SRCDIR) $(EXTRA_PATH) $(EXTRA_INC) -c $<

test: $(EXE_NAME1)
	./$(EXE_NAME1)