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
|
Shamrock: an OpenCL implementation based on clover
This is a continuation of the clover OpenCL project:
http://people.freedesktop.org/~steckdenis/clover
based on the contributions from Texas Instruments for Keystone II DSP device:
git.ti.com/opencl
and adding contributions from Linaro for ARM CPU-only support.
Prereqs
=======
The following packages need to be installed on your system prior to build:
gcc 4.8 (for building llvm)
cmake
check
libboost-all-dev
libtinfo-dev
mesa-common-dev
python 2.6+, and not greater or equal to v 3.0.
BUILD
=====
LLVM Configuration:
-------------------
This was tested using LLVM 3.5.0 stable release from:
http://llvm.org/releases/download.html
Note: LLVM must be configured and built with certain options to link with shamrock for
ARM.
The following creates a release build for ARM, with LLVM installed
into /opt/llvm:
% CC=gcc CXX=g++ ./configure --prefix=/opt/llvm --enable-jit --enable-targets=arm --enable-optimized --enable-assertions --with-float=hard --with-abi=aapcs-vfp
% make -j4 REQUIRES_RTTI=1
% sudo make -j4 install
See: http://llvm.org/releases/3.5.0/docs/HowToBuildOnARM.html for updates.
Shamrock Build:
---------------
Current Branch: Khronos_conformance
Usage: cmake <project_src_dir> <optional_defines>*
where <optional_defines*> are:
-DPROJECT=shamrock | shannon | hawking
-DLLVM_CONFIG_EXECUTABLE=<path to private llvm-config version>
Note PROJECT=shamrock is default.
The best way to compile is to use an out of src build, eg for a Debug build,
and custom LLVM:
% mkdir shamrock_build
% cd shamrock_build
% cmake -DLLVM_CONFIG_EXECUTABLE=/opt/llvm/bin/llvm-config -DCMAKE_BUILD_TYPE=Debug <path_to>/shamrock
% make
% sudo make install
If your Clang is installed to a different location than LLVM,
then define CLANG_INCLUDE_DIR and CLANG_LIB_DIR on the cmake cmd line:
-DCLANG_INCLUDE_DIR=/opt/clang/include -DCLANG_LIB_DIR=/opt/clang/lib
SANITY TESTS
============
The build commands above will build some simple sanity tests.
% cd shamrock_build
% make test
Latest Results:
---------------
shamrock_build> make test
Running tests...
/usr/bin/ctest --force-new-ctest-process
Test project /home/gpitney/shamrock_build
Start 1: platform
1/8 Test #1: platform ......................... Passed 0.11 sec
Start 2: device
2/8 Test #2: device ........................... Passed 0.01 sec
Start 3: context
3/8 Test #3: context .......................... Passed 0.01 sec
Start 4: commandqueue
4/8 Test #4: commandqueue ..................... Passed 1.03 sec
Start 5: mem
5/8 Test #5: mem .............................. Passed 0.01 sec
Start 6: kernel
6/8 Test #6: kernel ...........................***Failed 0.90 sec
Start 7: program
7/8 Test #7: program .......................... Passed 2.17 sec
Start 8: builtins
8/8 Test #8: builtins ......................... Passed 1.53 sec
88% tests passed, 1 tests failed out of 8
PIGLIT TESTS
============
If running PIGLIT OpenCL tests, to build for the OpenCL piglit binaries only:
% cd piglit
% cmake -DPIGLIT_BUILD_CL_TESTS=ON -DPIGLIT_BUILD_GL_TESTS=OFF \
-DPIGLIT_USE_WAFFLE=OFF -DPIGLIT_USE_GLUT=OFF
% export PIGLIT_CL_VERSION=11
% make
To run OpenCL tests, results in results/all_cl/main
% piglit run tests/all_cl results/all_cl
DEBUGGING OpenCL Kernels:
=========================
1. printf: A builtin function named "debug" maps to the printf symbol in the getBuiltin()
callback function, allowing printf from OpenCL kernels. Alternatively, this mechanism
can be used to define aribraty functions to be called back from kernels.
2. gdb: Using the above getBuiltin() mechanism, a breakpoint can be placed in a callback
function at kernel exit, then stepping back into the kernel via gdb, will allow
debug of the kernel code (assembly level stepping).
|