Makefile
4.02 KB
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
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
SRC = src
VPATH = $(SRC):bench:fz/examples
ARCH = $(shell uname -s)
ifeq ($(ARCH), SunOS)
CC = cc
CFLAGS = -g -m64 -xc99
else
CC = gcc
CFLAGS = -ggdb3 -O3 # -std=c99 -Wall
endif
CPPFLAGS = -I$(SRC) $(ALL_DEFINES)
# -DFILTER_DOMAINS perform an initial filtering on the domains
# -DCOMPACT_DOMAINS use a bitmapped representation of domains
# -DINLINE_DOMAINS bitmapped domains accessed directly
# -DUSE_VALUE maintain a field with the value of the variable
# -DUSE_STORE keep all domains in a compact store
# -DPACK_PROBLEM use a compact (quasi-relocatable) problem definition
# -DREVISION_IS_VAR revisions only contain the variable to revise against
# -DORDER_REVISIONS order the revisions list(s)
# -DCOUNT_REVISIONS count and report number of revisions performed
# -DDEBUG_REVISION debug the insertion of revisions in their list(s)
# -DDEBUG_SEARCH applies to all exhaustive searches
# -DDEBUG_VALUE debug operations on values (domains)
# -DDISTRIBUTED_SOLVER use one of the parallel/distributed algorithms
# -DSPLITGO simultaneous DFSs on disjoint parts of the domain
# without backtracking
# -DSPLITGO_MPI distributed split&go
# -DBIG distributed split&go with neighbourhoods (UNAVAILABLE)
EXTRA_DEFINES =
DEFINES = -DFAST # -DNDEBUG
DEFAULTS = -DREVISION_IS_VAR -DGROWABLE_POOL -DINDEX_IN_POOL -DSTORE_IN_POOL \
-DNEW_ENTRANCE -DRANDOM_VICTIM -DDOMAIN_BOUNDS
REQUIRED = -DDISTRIBUTED_SOLVER -DSPLITGO -DCOMPACT_DOMAINS -DCONSTRAINT_CLASS \
-DUSE_STORE -DPACK_PROBLEM
ALL_DEFINES = $(REQUIRED) $(DEFAULTS) $(DEFINES) $(EXTRA_DEFINES)
# imbed version and svn's revision into the code
ifeq ($(VERSION),)
ifneq ($(wildcard $(SRC)/VERSION), )
VERSION = $(shell cat $(SRC)/VERSION)
else
$(error could not determine code version (VERSION not set))
endif
endif
override CPPFLAGS += -DVERSION="\"paccs $(VERSION)\""
FDC_FILES = util.c variables.c problem.c revisions.c options.c bound.c \
packed.c store.c misc.c $(FDC_OBJS)
FDC_OBJS = constraints.o list.o values.o
.INTERMEDIATE: constraints.o values.o
ifeq ($(filter -DUSE_MATCHING, $(ALL_DEFINES)), -DUSE_MATCHING)
FDC_FILES += matching.c
endif
DFDC_FILES = dsearch-sg.c splitting.c variables2.c
AGENTS_C = agents-splitgo.c
ifeq ($(findstring -DBIG, $(DEFINES) $(EXTRA_DEFINES)), -DBIG)
MPI_AGENTS_C = agents-splitgo-mpi-big.c
else
MPI_AGENTS_C = agents-splitgo-mpi.c
endif
FDC_SRCS = \
$(subst bench/,,$(wildcard bench/*.c)) \
$(subst fz/examples/,,$(wildcard fz/examples/*.c))
FDC_NAMES = $(subst .c,,$(FDC_SRCS))
FDC_BINS = $(FDC_NAMES) x
DFDC_BINS = $(FDC_BINS:=-mpi)
none:
@echo "choose one from: $(FDC_NAMES) ..."
$(FDC_BINS) : $(FDC_FILES) $(DFDC_FILES) $(AGENTS_C)
$(FDC_BINS) : override DEFAULTS += -DSTEAL_WORK=1
$(FDC_BINS) : override AGENTS_C = agents-splitgo.c
$(FDC_BINS) : override CFLAGS += -pthread
%-mpi: override AGENTS_C = agents-splitgo-mpi.c
%-mpi: override DEFINES += -DSPLITGO_MPI
%-mpi: override DEFAULTS += -DSTEAL_WORK=2
%-mpi: override CC = mpicc
%-mpi: LDLIBS = -lrt
%-mpi: %.c $(FDC_FILES) $(DFDC_FILES) $(MPI_AGENTS_C)
$(LINK.c) $^ $(LOADLIBES) $(LDLIBS) -o $@
ifeq ($(DEBUG), 1)
CFLAGS := -g $(CFLAGS)
CPPFLAGS := -DDEBUG_VALUE -DDEBUG_REVISION -DDEBUG_SEARCH $(CPPFLAGS)
endif
constraints.o: fdc_int.h constraints.h
constraints.o: $(SRC)/constraints/*.c
list.o: $(SRC)/list.c $(SRC)/list.h
values.o: values.h values-bitmap.c values-intervals.c fdc_int.h
costas costas-mpi : override DEFAULTS += -DCONSTRAINT_TEMPS
qap qap-mpi : override DEFAULTS += \
-DDOMAIN_BITS=256 -DCONSTRAINT_TEMPS -DQAP_MODEL_B
magic-square magic-square-mpi : override DEFAULTS += -DCONSTRAINT_TEMPS
graphs graphs-mpi : override DEFAULTS += -DUSE_MATCHING -DCONSTRAINT_TEMPS
graphs graphs-mpi : matching.c
partition partition-mpi : override DEFAULTS += -DCONSTRAINT_TEMPS
golomb golomb-mpi : override DEFAULTS += -DDOMAIN_BOUNDS
langford langford-mpi : override DEFAULTS += \
-UDOMAIN_BOUNDS -DINLINE_DOMAINS -DCONSTRAINT_TEMPS -DDISABLE_ENTAILED
clean:
rm -f $(FDC_OBJS) $(FDC_BINS) $(DFDC_BINS)
fresh:
rm -f constraints.o values.o