Repository navigation
Expand file tree
/
Copy pathMakefile.rule
More file actions
139 lines (112 loc) · 3.13 KB
/
Copy pathMakefile.rule
File metadata and controls
139 lines (112 loc) · 3.13 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
# Detect operating system
OS = WINDOWS
UNAME_S = $(shell uname -s)
ifeq ($(UNAME_S),Linux)
OS = LINUX
endif
ifeq ($(UNAME_S),Darwin)
OS = MAC
endif
# Set default compiler
ifeq ($(OS), MAC)
CC="/usr/local/bin/gcc-8"
CXX="/usr/local/bin/g++-8"
#CC=clang
#CXX=clang++
else
CC=gcc
CXX=g++
endif
# Installation directory
TOP = $(shell pwd)
# BLASFEO path
BLASFEO_PATH = $(TOP)/external/blasfeo
#BLASFEO_PATH = $(TOP)/../blasfeo
#BLASFEO_PATH = /opt/blasfeo
# flag to directly use BLASFEO install dir instead of compiling it within treeQP
# !!! USE WITH CAUTION !!!
# BLASFEO_VERSION & BLASFEO_TARGET options below are not used if flag is enabled
# treeQP should be deep_cleaned and recompiled if installed BLASFEO changes
SKIP_BLASFEO_COMPILATION = OFF
# BLASFEO version
BLASFEO_VERSION = HIGH_PERFORMANCE
#BLASFEO_VERSION = REFERENCE
# BLASFEO target
BLASFEO_TARGET = X64_INTEL_HASWELL
#BLASFEO_TARGET = X64_INTEL_SANDY_BRIDGE
#BLASFEO_TARGET = X64_INTEL_CORE
#BLASFEO_TARGET = GENERIC
#BLASFEO_TARGET = X64_AMD_BULLDOZER
# HPMPC target
HPMPC_TARGET = X64_AVX
# HPIPM target
HPIPM_TARGET = AVX
# HPIPM path
HPIPM_PATH = $(TOP)/external/hpipm
################################ OPTIONS #######################################
# Parallelize computations with openmp (ON/OFF)
# NOTE: slow on mac
# NOTE: to define maximum number of threads type e.g. "export OMP_NUM_THREADS=4" in terminal
OPENMP = OFF
# Enable to save intermediate iterations results to txt for debugging (ON/OFF)
# TODO: revive or remove completely
SAVE_DETAILED_RESULTS = OFF
# Add debugging symbols (ON/OFF)
DEBUG = OFF
# Choose profiling level (0-3)
# 0: no profiling
# 1: save only (min) total time
# 2: save also (min) time per iteration (and LS iterations)
# 3: save also (min) time per operation per iteration
PROFILING_LEVEL = 0
# Define number of runs in examples (to take min. execution time)
NREP = 20
# Define print level (0-3)
# 0: supress all printing
# 1: print profiling information at the end
# 2: print also some iteration stats
# 3: print also debugging info (nothing for scenarios atm)
# TODO: check that all levels work and see which ones are necessary, use more consistently in examples
PRINT_LEVEL = 1
################################################################################
# Set compiler flags
CFLAGS=
CFLAGS+= -fPIC
ifeq ($(OPENMP), ON)
CFLAGS+=-DPARALLEL
CFLAGS+=-fopenmp
endif
ifeq ($(SAVE_DETAILED_RESULTS), ON)
CFLAGS+=-DSAVE_DATA
endif
ifeq ($(DEBUG), ON)
CFLAGS += -g -O0
# TODO: disable timings if debugging is enabled
CFLAGS +=-DDEBUGGING_ENABLED
else
CFLAGS += -O2
endif
ifeq ($(PROFILING_LEVEL), 3)
CFLAGS+=-DPROFILE=3
else ifeq ($(PROFILING_LEVEL), 2)
CFLAGS+=-DPROFILE=2
else ifeq ($(PROFILING_LEVEL), 1)
CFLAGS+=-DPROFILE=1
else
CFLAGS+=-DPROFILE=0
endif
CFLAGS+=-DNREP=$(NREP)
CFLAGS+=-DPRINT_LEVEL=$(PRINT_LEVEL)
# Include dirs
CFLAGS += -I$(TOP)
CFLAGS += -I$(TOP)/external
CFLAGS += -I$(TOP)/external/qpoases/include
CFLAGS += -I$(BLASFEO_PATH)/include
CFLAGS += -I$(HPIPM_PATH)/include
# Distinguish between CXX and purely C flags
CXXFLAGS:=$(CFLAGS) -std=c++11
CFLAGS+= -std=c99
# Lib dirs
LDFLAGS =
LDFLAGS += -L$(BLASFEO_PATH)/lib
LDFLAGS += -L$(TOP)/lib