forked from triSYCL/triSYCL
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile.bisect
137 lines (110 loc) · 4.5 KB
/
Makefile.bisect
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
## To enable asynchronous kernels
#CXXFLAGS += -DTRISYCL_ASYNC=1
# Compute the absolute directory name from the location of this Makefile
# so that we can compile from anywhere even if we use make -f
# <this_makefile> ... as used by make check:
triSYCL_DIR=$(abspath $(dir $(lastword $(MAKEFILE_LIST)))/..)
# Use all the .cpp C++ files from the subdirectories that have a 1-1
# mapping with the binaries to generate, that means the binary is made
# from only one compilation unit (1 source file)
TARGETS = $(basename $(wildcard */*.cpp))
# There are also .cc C++ files that are used to test binaries made from
# multiple compilation units. There should be specific dependencies added
# later to deal with other compilation units to be linked to the .cc main
# executable. To avoid messing up with LLVM/LIT, the other compilation
# units have .C extensions
TARGETS_CC = $(basename $(wildcard */*.cc))
TARGETS += $(TARGETS_CC)
# Since the .C files generates some .o, think to remove them
FILES_C =$(wildcard */*.C)
CLEANING_TARGETS = $(TARGETS) $(FILES_C:%.C=%.o)
# The implementation uses C++14 and OpenMP
CXXFLAGS = -Wall -std=c++1y -I$(triSYCL_DIR)/include \
-I$(triSYCL_DIR)/tests/common
# To use OpenMP to execute SYCL kernels:
CXXFLAGS += -fopenmp
# To use OpenCL
#CXXFLAGS += -DTRISYCL_OPENCL
#LDLIBS += -lOpenCL
# Specify where OpenCL includes files are with OpenCL_INCPATH
ifdef OpenCL_INCPATH
CXXFLAGS += -I$(OpenCL_INCPATH)
endif
# Specify where Bost.Compute is with BOOST_COMPUTE_INCPATH
ifdef BOOST_COMPUTE_INCPATH
CXXFLAGS += -I$(BOOST_COMPUTE_INCPATH) \
-DBOOST_COMPUTE_DEBUG_KERNEL_COMPILATION \
-DBOOST_COMPUTE_HAVE_THREAD_LOCAL \
-DBOOST_COMPUTE_THREAD_SAFE
endif
# Specify where OpenCL library files are with OpenCL_LIBPATH
ifdef OpenCL_LIBPATH
LDFLAGS += -L$(OpenCL_LIBPATH)
endif
# There are some tests using small array display() method
# To enable debug and tracing:
#CXXFLAGS += -g -DTRISYCL_DEBUG -DBOOST_LOG_DYN_LINK
# -DBOOST_LOG_DYN_LINK -DBOOST_LOG_USE_COMPILER_TLS
CXXFLAGS += -g -DTRISYCL_DEBUG -DTRISYCL_DEBUG_STRUCTORS -DBOOST_LOG_DYN_LINK
LDLIBS+=-lboost_log
#CXXFLAGS += -fsanitize=address -fno-omit-frame-pointer -fsanitize=thread
#CXXFLAGS += -fsanitize=thread -shared
# By default run lit checking in the current directory
CHECKING_DIR ?= .
# Set default compiler instead of default CXX=g++ value
# Assume Clang 3.6 at least
# There are still some limitations in Clang:
# - no OpenMP;
# - the "auto" return type methods that does not work with "-g" option
#CXX = clang++
# But everything works fine with GCC 5
# There some issues with Boost.Log 1.58 & 1.59 with g++-4.9
CXX = g++
#CXX = clang++-3.6
# Some hack to force the compiler from the test infrastructure:
ifdef FORCE_CXX
CXX=$(FORCE_CXX)
endif
all: $(TARGETS)
run: $(TARGETS)
# Execute each element of TARGETS
$(foreach command, $(TARGETS), echo; echo $(command):; ./$(command); )
# Useful before a check...
clean:
$(RM) $(CLEANING_TARGETS)
# Force recompilation of $(TARGETS_CC) binaries through the Makefile since
# LIT does not know the dependencies
check: $(TARGETS_CC)
# Launch testing with lit tool from LLVM in current directory
echo Using $(CXX) compiler:
# lit can be found for example on Debian/Ubuntu in package
# llvm-3.6-tools in /usr/lib/llvm-3.6/build/utils/lit/lit.py
# so try before running the check:
# export TRISYCL_LIT=/usr/lib/llvm-3.6/build/utils/lit/lit.py
# The config file for triSYCL needs at least Python 3.3
test "unset$$TRISYCL_LIT == unset" && echo 'Initialize TRISYCL_LIT variable to the path of "lit" command' ; echo 1
python3 $$TRISYCL_LIT $(LITFLAGS) $(CHECKING_DIR)
check-compilers:
# Launch the check with various compilers
-FORCE_CXX=g++-4.9 $(MAKE) clean check
-FORCE_CXX=clang++-3.6 $(MAKE) clean check
-FORCE_CXX=g++ $(MAKE) clean check
# A special target to be called as from the test as "make execute
# TARGET=%s" with the right Makefile. There is a short-cut in the lit.cfg
# to use "RUN: %{execute}%s | %{filecheck} %s" in test files instead.
# Add a dependency on the binary name, i.e. without the extension
execute: $(basename $(TARGET))
# Execute the compiled binary
$<
# To verify everything is self-contained, run the target in a clone of the
# current branch of the current repository.
#
# Forward any clone-T target into a clone and make T in it
#
# Use for example:
# make clone-check
clone-%:
rm -rf test-clone
git clone --branch `git rev-parse --abbrev-ref HEAD` .. test-clone
cd test-clone/tests; $(MAKE) $*
multiple_compilation_units/parallel_for: multiple_compilation_units/parallel_for_other.o