aboutsummaryrefslogtreecommitdiff
path: root/README
blob: 6105f5535c5f9b3b8a733b304e1ddde302dd976a (plain)
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 1.1 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>*

If LLVM lives in a private path:
   -DLLVM_CONFIG_EXECUTABLE=<path to private llvm-config version>
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

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 -DCMAKE_BUILD_TYPE=Debug <path_to>/shamrock
% make
% sudo make install

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/user/shamrock_build
    Start 1: platform
1/8 Test #1: platform .........................   Passed    0.02 sec
    Start 2: device
2/8 Test #2: device ...........................   Passed    0.02 sec
    Start 3: context
3/8 Test #3: context ..........................   Passed    0.02 sec
    Start 4: commandqueue
4/8 Test #4: commandqueue .....................   Passed    1.06 sec
    Start 5: mem
5/8 Test #5: mem ..............................   Passed    0.02 sec
    Start 6: kernel
6/8 Test #6: kernel ...........................   Passed    3.43 sec
    Start 7: program
7/8 Test #7: program ..........................   Passed    5.21 sec
    Start 8: builtins
8/8 Test #8: builtins .........................   Passed    3.45 sec

100% tests passed, 0 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 prototype has been added to include/CL/cpu.h, allowing printf
   to be called from OpenCL kernels.

2. gdb:
   The kernel is called from Coal::CPUKernelWorkGroup::run(), at the
   line:
        p_kernel_func_addr(p_args);

   Placing a breakpoint before this line, one can then put a breakpoint on
   the kernel function itself, disassemble, and stepi through the
   assembly code.