forked from GooFit/GooFit
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
93 lines (72 loc) · 2.63 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
#------------------------------------------------------------------------------
CXX=nvcc
LD=g++
OutPutOpt = -o
CXXFLAGS = -O3
DEFINEFLAGS=-DDUMMY=dummy
CUDALIBDIR=lib64
UNAME=$(shell uname)
ifeq ($(UNAME), Darwin)
CUDALIBDIR=lib
CXXFLAGS+=-m64
endif
ifneq ($(CUDAPRINT),)
DEFINEFLAGS += -DCUDAPRINT=yes
endif
ifneq ($(PRINTCALLS),)
DEFINEFLAGS += -DPRINTCALLS=yes
endif
ifneq ($(PROFILE),)
DEFINEFLAGS += -DPROFILING=yes
endif
ifeq ($(TARGET_OMP),)
CXXFLAGS += -arch=sm_20
else
DEFINEFLAGS += -fno-inline -fopenmp -DTHRUST_DEVICE_SYSTEM=THRUST_DEVICE_BACKEND_OMP
LIBS += -lgomp
endif
ifeq ($(CUDALOCATION), )
CUDALOCATION = /usr/local/cuda/
endif
CUDAHEADERS = $(CUDALOCATION)/include/
PWD = $(shell /bin/pwd)
SRCDIR = $(PWD)/PDFs
INCLUDES += -I$(SRCDIR) -I$(PWD) -I$(CUDAHEADERS) -I$(PWD)/rootstuff
LIBS += -L$(CUDALOCATION)/$(CUDALIBDIR) -lcudart -L$(PWD)/rootstuff -lRootUtils
# GooPdf must be first in CUDAglob, as it defines global variables.
FUNCTORLIST = $(SRCDIR)/GooPdf.cu
FUNCTORLIST += $(filter-out $(SRCDIR)/GooPdf.cu, $(wildcard $(SRCDIR)/*Pdf.cu))
FUNCTORLIST += $(wildcard $(SRCDIR)/*Aux.cu)
HEADERLIST = $(patsubst %.cu,%.hh,$(SRCFILES))
WRKFUNCTORLIST = $(patsubst $(SRCDIR)/%.cu,wrkdir/%.cu,$(FUNCTORLIST))
#NB, the above are used in the SRCDIR Makefile.
THRUSTO = wrkdir/Variable.o wrkdir/FitManager.o wrkdir/GooPdfCUDA.o wrkdir/Faddeeva.o wrkdir/FitControl.o wrkdir/PdfBase.o wrkdir/DataSet.o wrkdir/BinnedDataSet.o wrkdir/UnbinnedDataSet.o wrkdir/FunctorWriter.o
ROOTRIPDIR = $(PWD)/rootstuff
ROOTRIPOBJS = $(ROOTRIPDIR)/TMinuit.o $(ROOTRIPDIR)/TRandom.o $(ROOTRIPDIR)/TRandom3.o
ROOTUTILLIB = $(ROOTRIPDIR)/libRootUtils.so
.SUFFIXES:
.PHONY: goofit clean
goofit: $(THRUSTO) $(ROOTUTILLIB)
@echo "Built GooFit objects"
# One rule for GooFit objects.
wrkdir/%.o: %.cc %.hh
@mkdir -p wrkdir
$(CXX) $(INCLUDES) $(CXXFLAGS) $(DEFINEFLAGS) -c -o $@ $<
# A different rule for user-level objects. Notice ROOT_INCLUDES.
%.o: %.cu
$(CXX) $(INCLUDES) $(ROOT_INCLUDES) $(DEFINEFLAGS) $(CXXFLAGS) -c -o $@ $<
# Still a third rule for the ROOT objects - these have their own Makefile.
$(ROOTRIPDIR)/%.o: $(ROOTRIPDIR)/%.cc
rm -f $@
@echo "Postponing $@ for separate Makefile"
$(ROOTUTILLIB): $(ROOTRIPOBJS)
@cd rootstuff; $(MAKE)
include $(SRCDIR)/Makefile
FitManager.o: FitManager.cc FitManager.hh wrkdir/ThrustFitManagerCUDA.o Variable.o
$(CXX) $(DEFINEFLAGS) $(CXXFLAGS) $(INCLUDES) -c -o $@ $<
wrkdir/GooPdfCUDA.o: wrkdir/CUDAglob.cu PdfBase.cu
$(CXX) $(CXXFLAGS) $(INCLUDES) -I. $(DEFINEFLAGS) -c $< -o $@
@echo "$@ done"
clean:
@rm -f *.o wrkdir/*
cd rootstuff; $(MAKE) clean