bones-compiler 1.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/CHANGELOG +117 -0
- data/LICENSE +9 -0
- data/README.rdoc +126 -0
- data/Rakefile +107 -0
- data/VERSION +1 -0
- data/bin/bones +20 -0
- data/examples/applications/ffos.c +552 -0
- data/examples/benchmarks/2mm.c +70 -0
- data/examples/benchmarks/3mm.c +81 -0
- data/examples/benchmarks/adi.c +81 -0
- data/examples/benchmarks/atax.c +65 -0
- data/examples/benchmarks/bicg.c +67 -0
- data/examples/benchmarks/cholesky.c +64 -0
- data/examples/benchmarks/common.h +168 -0
- data/examples/benchmarks/correlation.c +97 -0
- data/examples/benchmarks/covariance.c +77 -0
- data/examples/benchmarks/doitgen.c +63 -0
- data/examples/benchmarks/durbin.c +76 -0
- data/examples/benchmarks/dynprog.c +67 -0
- data/examples/benchmarks/fdtd-2d-apml.c +114 -0
- data/examples/benchmarks/fdtd-2d.c +74 -0
- data/examples/benchmarks/floyd-warshall.c +50 -0
- data/examples/benchmarks/gemm.c +69 -0
- data/examples/benchmarks/gemver.c +89 -0
- data/examples/benchmarks/gesummv.c +64 -0
- data/examples/benchmarks/gramschmidt.c +84 -0
- data/examples/benchmarks/jacobi-1d-imper.c +55 -0
- data/examples/benchmarks/jacobi-2d-imper.c +61 -0
- data/examples/benchmarks/lu.c +57 -0
- data/examples/benchmarks/ludcmp.c +91 -0
- data/examples/benchmarks/mvt.c +65 -0
- data/examples/benchmarks/overview.txt +38 -0
- data/examples/benchmarks/reg_detect.c +82 -0
- data/examples/benchmarks/saxpy.c +45 -0
- data/examples/benchmarks/seidel-2d.c +51 -0
- data/examples/benchmarks/symm.c +74 -0
- data/examples/benchmarks/syr2k.c +65 -0
- data/examples/benchmarks/syrk.c +62 -0
- data/examples/benchmarks/trisolv.c +57 -0
- data/examples/benchmarks/trmm.c +57 -0
- data/examples/chunk/example1.c +54 -0
- data/examples/chunk/example2.c +44 -0
- data/examples/chunk/example3.c +59 -0
- data/examples/chunk/example4.c +55 -0
- data/examples/chunk/example5.c +52 -0
- data/examples/element/example1.c +46 -0
- data/examples/element/example10.c +50 -0
- data/examples/element/example11.c +47 -0
- data/examples/element/example12.c +56 -0
- data/examples/element/example2.c +46 -0
- data/examples/element/example3.c +58 -0
- data/examples/element/example4.c +49 -0
- data/examples/element/example5.c +56 -0
- data/examples/element/example6.c +46 -0
- data/examples/element/example7.c +54 -0
- data/examples/element/example8.c +45 -0
- data/examples/element/example9.c +48 -0
- data/examples/neighbourhood/example1.c +54 -0
- data/examples/neighbourhood/example2.c +55 -0
- data/examples/neighbourhood/example3.c +82 -0
- data/examples/neighbourhood/example4.c +52 -0
- data/examples/shared/example1.c +45 -0
- data/examples/shared/example2.c +51 -0
- data/examples/shared/example3.c +55 -0
- data/examples/shared/example4.c +52 -0
- data/examples/shared/example5.c +48 -0
- data/lib/bones.rb +266 -0
- data/lib/bones/algorithm.rb +541 -0
- data/lib/bones/engine.rb +386 -0
- data/lib/bones/preprocessor.rb +161 -0
- data/lib/bones/species.rb +196 -0
- data/lib/bones/structure.rb +94 -0
- data/lib/bones/variable.rb +169 -0
- data/lib/bones/variablelist.rb +72 -0
- data/lib/castaddon.rb +27 -0
- data/lib/castaddon/index.rb +40 -0
- data/lib/castaddon/node.rb +753 -0
- data/lib/castaddon/type.rb +37 -0
- data/skeletons/CPU-C/common/epilogue.c +0 -0
- data/skeletons/CPU-C/common/globals.c +17 -0
- data/skeletons/CPU-C/common/globals_kernel.c +1 -0
- data/skeletons/CPU-C/common/header.c +0 -0
- data/skeletons/CPU-C/common/mem_copy_D2H.c +0 -0
- data/skeletons/CPU-C/common/mem_copy_H2D.c +0 -0
- data/skeletons/CPU-C/common/mem_epilogue.c +0 -0
- data/skeletons/CPU-C/common/mem_prologue.c +3 -0
- data/skeletons/CPU-C/common/prologue.c +0 -0
- data/skeletons/CPU-C/common/timer_1_start.c +0 -0
- data/skeletons/CPU-C/common/timer_1_stop.c +0 -0
- data/skeletons/CPU-C/common/timer_2_start.c +20 -0
- data/skeletons/CPU-C/common/timer_2_stop.c +8 -0
- data/skeletons/CPU-C/kernel/default.host.c +3 -0
- data/skeletons/CPU-C/kernel/default.kernel.c +15 -0
- data/skeletons/CPU-C/skeletons.txt +24 -0
- data/skeletons/CPU-OPENCL-AMD/common/epilogue.c +6 -0
- data/skeletons/CPU-OPENCL-AMD/common/globals.c +155 -0
- data/skeletons/CPU-OPENCL-AMD/common/globals_kernel.c +4 -0
- data/skeletons/CPU-OPENCL-AMD/common/header.c +0 -0
- data/skeletons/CPU-OPENCL-AMD/common/mem_copy_D2H.c +8 -0
- data/skeletons/CPU-OPENCL-AMD/common/mem_copy_H2D.c +4 -0
- data/skeletons/CPU-OPENCL-AMD/common/mem_epilogue.c +3 -0
- data/skeletons/CPU-OPENCL-AMD/common/mem_prologue.c +6 -0
- data/skeletons/CPU-OPENCL-AMD/common/prologue.c +24 -0
- data/skeletons/CPU-OPENCL-AMD/common/timer_1_start.c +5 -0
- data/skeletons/CPU-OPENCL-AMD/common/timer_1_stop.c +9 -0
- data/skeletons/CPU-OPENCL-AMD/common/timer_2_start.c +16 -0
- data/skeletons/CPU-OPENCL-AMD/common/timer_2_stop.c +11 -0
- data/skeletons/CPU-OPENCL-AMD/kernel/D-element-to-1-shared.host.c +67 -0
- data/skeletons/CPU-OPENCL-AMD/kernel/D-element-to-1-shared.kernel.cl +72 -0
- data/skeletons/CPU-OPENCL-AMD/kernel/default.host.c +14 -0
- data/skeletons/CPU-OPENCL-AMD/kernel/default.kernel.cl +13 -0
- data/skeletons/CPU-OPENCL-AMD/skeletons.txt +26 -0
- data/skeletons/CPU-OPENCL-INTEL/common/epilogue.c +3 -0
- data/skeletons/CPU-OPENCL-INTEL/common/globals.c +154 -0
- data/skeletons/CPU-OPENCL-INTEL/common/globals_kernel.c +4 -0
- data/skeletons/CPU-OPENCL-INTEL/common/header.c +31 -0
- data/skeletons/CPU-OPENCL-INTEL/common/mem_copy_D2H.c +5 -0
- data/skeletons/CPU-OPENCL-INTEL/common/mem_copy_H2D.c +3 -0
- data/skeletons/CPU-OPENCL-INTEL/common/mem_epilogue.c +3 -0
- data/skeletons/CPU-OPENCL-INTEL/common/mem_prologue.c +4 -0
- data/skeletons/CPU-OPENCL-INTEL/common/prologue.c +24 -0
- data/skeletons/CPU-OPENCL-INTEL/common/timer_1_start.c +5 -0
- data/skeletons/CPU-OPENCL-INTEL/common/timer_1_stop.c +9 -0
- data/skeletons/CPU-OPENCL-INTEL/common/timer_2_start.c +16 -0
- data/skeletons/CPU-OPENCL-INTEL/common/timer_2_stop.c +11 -0
- data/skeletons/CPU-OPENCL-INTEL/kernel/D-element-to-1-shared.host.c +67 -0
- data/skeletons/CPU-OPENCL-INTEL/kernel/D-element-to-1-shared.kernel.cl +72 -0
- data/skeletons/CPU-OPENCL-INTEL/kernel/default.host.c +14 -0
- data/skeletons/CPU-OPENCL-INTEL/kernel/default.kernel.cl +13 -0
- data/skeletons/CPU-OPENCL-INTEL/skeletons.txt +26 -0
- data/skeletons/CPU-OPENMP/common/epilogue.c +0 -0
- data/skeletons/CPU-OPENMP/common/globals.c +37 -0
- data/skeletons/CPU-OPENMP/common/globals_kernel.c +6 -0
- data/skeletons/CPU-OPENMP/common/header.c +0 -0
- data/skeletons/CPU-OPENMP/common/mem_copy_D2H.c +0 -0
- data/skeletons/CPU-OPENMP/common/mem_copy_H2D.c +0 -0
- data/skeletons/CPU-OPENMP/common/mem_epilogue.c +0 -0
- data/skeletons/CPU-OPENMP/common/mem_prologue.c +3 -0
- data/skeletons/CPU-OPENMP/common/prologue.c +0 -0
- data/skeletons/CPU-OPENMP/common/timer_1_start.c +12 -0
- data/skeletons/CPU-OPENMP/common/timer_1_stop.c +0 -0
- data/skeletons/CPU-OPENMP/common/timer_2_start.c +18 -0
- data/skeletons/CPU-OPENMP/common/timer_2_stop.c +8 -0
- data/skeletons/CPU-OPENMP/kernel/D-element-to-1-shared.host.c +27 -0
- data/skeletons/CPU-OPENMP/kernel/D-element-to-1-shared.kernel.c +46 -0
- data/skeletons/CPU-OPENMP/kernel/default.host.c +11 -0
- data/skeletons/CPU-OPENMP/kernel/default.kernel.c +18 -0
- data/skeletons/CPU-OPENMP/skeletons.txt +26 -0
- data/skeletons/GPU-CUDA/common/epilogue.c +0 -0
- data/skeletons/GPU-CUDA/common/globals.c +31 -0
- data/skeletons/GPU-CUDA/common/globals_kernel.c +4 -0
- data/skeletons/GPU-CUDA/common/header.c +0 -0
- data/skeletons/GPU-CUDA/common/mem_copy_D2H.c +3 -0
- data/skeletons/GPU-CUDA/common/mem_copy_H2D.c +3 -0
- data/skeletons/GPU-CUDA/common/mem_epilogue.c +3 -0
- data/skeletons/GPU-CUDA/common/mem_prologue.c +5 -0
- data/skeletons/GPU-CUDA/common/prologue.c +6 -0
- data/skeletons/GPU-CUDA/common/timer_1_start.c +6 -0
- data/skeletons/GPU-CUDA/common/timer_1_stop.c +10 -0
- data/skeletons/GPU-CUDA/common/timer_2_start.c +6 -0
- data/skeletons/GPU-CUDA/common/timer_2_stop.c +10 -0
- data/skeletons/GPU-CUDA/kernel/2xN-N-chunk-1-N-to-D-element.host.c +3 -0
- data/skeletons/GPU-CUDA/kernel/2xN-N-chunk-1-N-to-D-element.kernel.cu +105 -0
- data/skeletons/GPU-CUDA/kernel/D-element-to-1-shared.host.c +3 -0
- data/skeletons/GPU-CUDA/kernel/D-element-to-1-shared.kernel.cu +119 -0
- data/skeletons/GPU-CUDA/kernel/D-element-to-N-shared.host.c +3 -0
- data/skeletons/GPU-CUDA/kernel/D-element-to-N-shared.kernel.cu +166 -0
- data/skeletons/GPU-CUDA/kernel/N-N-chunk-1-N-to-D-element.host.c +3 -0
- data/skeletons/GPU-CUDA/kernel/N-N-chunk-1-N-to-D-element.kernel.cu +69 -0
- data/skeletons/GPU-CUDA/kernel/N-neighbourhood-N-to-N-element.host.c +3 -0
- data/skeletons/GPU-CUDA/kernel/N-neighbourhood-N-to-N-element.kernel.cu +42 -0
- data/skeletons/GPU-CUDA/kernel/default.host.c +3 -0
- data/skeletons/GPU-CUDA/kernel/default.kernel.cu +28 -0
- data/skeletons/GPU-CUDA/skeletons.txt +30 -0
- data/skeletons/GPU-OPENCL-AMD/common/epilogue.c +3 -0
- data/skeletons/GPU-OPENCL-AMD/common/globals.c +155 -0
- data/skeletons/GPU-OPENCL-AMD/common/globals_kernel.c +4 -0
- data/skeletons/GPU-OPENCL-AMD/common/header.c +0 -0
- data/skeletons/GPU-OPENCL-AMD/common/mem_copy_D2H.c +4 -0
- data/skeletons/GPU-OPENCL-AMD/common/mem_copy_H2D.c +4 -0
- data/skeletons/GPU-OPENCL-AMD/common/mem_epilogue.c +3 -0
- data/skeletons/GPU-OPENCL-AMD/common/mem_prologue.c +3 -0
- data/skeletons/GPU-OPENCL-AMD/common/prologue.c +24 -0
- data/skeletons/GPU-OPENCL-AMD/common/timer_1_start.c +5 -0
- data/skeletons/GPU-OPENCL-AMD/common/timer_1_stop.c +9 -0
- data/skeletons/GPU-OPENCL-AMD/common/timer_2_start.c +4 -0
- data/skeletons/GPU-OPENCL-AMD/common/timer_2_stop.c +11 -0
- data/skeletons/GPU-OPENCL-AMD/kernel/D-element-to-1-shared.host.c +67 -0
- data/skeletons/GPU-OPENCL-AMD/kernel/D-element-to-1-shared.kernel.cl +72 -0
- data/skeletons/GPU-OPENCL-AMD/kernel/default.host.c +14 -0
- data/skeletons/GPU-OPENCL-AMD/kernel/default.kernel.cl +13 -0
- data/skeletons/GPU-OPENCL-AMD/skeletons.txt +26 -0
- data/skeletons/verification/header.c +2 -0
- data/skeletons/verification/timer_start.c +4 -0
- data/skeletons/verification/timer_stop.c +6 -0
- data/skeletons/verification/verify_results.c +23 -0
- data/test/bones/test_algorithm.rb +40 -0
- data/test/bones/test_common.rb +54 -0
- data/test/bones/test_preprocessor.rb +46 -0
- data/test/bones/test_species.rb +21 -0
- data/test/bones/test_variable.rb +84 -0
- data/test/test_helper.rb +106 -0
- metadata +303 -0
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
//
|
|
2
|
+
// This file is part of the Bones source-to-source compiler examples. The C-code
|
|
3
|
+
// is largely identical in terms of functionality and variable naming to the code
|
|
4
|
+
// found in PolyBench/C version 3.2. For more information on PolyBench/C or Bones
|
|
5
|
+
// please use the contact information below.
|
|
6
|
+
//
|
|
7
|
+
// == More information on PolyBench/C
|
|
8
|
+
// Contact............Louis-Noel Pouchet <pouchet@cse.ohio-state.edu>
|
|
9
|
+
// Web address........http://polybench.sourceforge.net/
|
|
10
|
+
//
|
|
11
|
+
// == More information on Bones
|
|
12
|
+
// Contact............Cedric Nugteren <c.nugteren@tue.nl>
|
|
13
|
+
// Web address........http://parse.ele.tue.nl/bones/
|
|
14
|
+
//
|
|
15
|
+
// == File information
|
|
16
|
+
// Filename...........benchmark/seidel-2d.c
|
|
17
|
+
// Author.............Cedric Nugteren
|
|
18
|
+
// Last modified on...05-April-2012
|
|
19
|
+
//
|
|
20
|
+
|
|
21
|
+
#include "common.h"
|
|
22
|
+
|
|
23
|
+
// This is 'seidel-2d', a 2D Seidel stencil computation
|
|
24
|
+
int main(void) {
|
|
25
|
+
int i,j,t;
|
|
26
|
+
|
|
27
|
+
// Declare arrays on the stack
|
|
28
|
+
float A[N][N];
|
|
29
|
+
|
|
30
|
+
// Set the input data
|
|
31
|
+
for (i=0; i<N; i++) {
|
|
32
|
+
for (j=0; j<N; j++) {
|
|
33
|
+
A[i][j] = ((float) i*i*(j+2) + 2) / N;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
// Perform the computation
|
|
38
|
+
for (t=0; t<TSTEPS-1; t++) {
|
|
39
|
+
for (i=1; i<=N-2; i++) {
|
|
40
|
+
for (j=1; j<=N-2; j++) {
|
|
41
|
+
A[i][j] = (A[i-1][j-1] + A[i-1][ j ] + A[i-1][j+1]
|
|
42
|
+
+ A[ i ][j-1] + A[ i ][ j ] + A[ i ][j+1]
|
|
43
|
+
+ A[i+1][j-1] + A[i+1][ j ] + A[i+1][j+1])/9.0;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
// Clean-up and exit the function
|
|
49
|
+
fflush(stdout);
|
|
50
|
+
return 0;
|
|
51
|
+
}
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
//
|
|
2
|
+
// This file is part of the Bones source-to-source compiler examples. The C-code
|
|
3
|
+
// is largely identical in terms of functionality and variable naming to the code
|
|
4
|
+
// found in PolyBench/C version 3.2. For more information on PolyBench/C or Bones
|
|
5
|
+
// please use the contact information below.
|
|
6
|
+
//
|
|
7
|
+
// == More information on PolyBench/C
|
|
8
|
+
// Contact............Louis-Noel Pouchet <pouchet@cse.ohio-state.edu>
|
|
9
|
+
// Web address........http://polybench.sourceforge.net/
|
|
10
|
+
//
|
|
11
|
+
// == More information on Bones
|
|
12
|
+
// Contact............Cedric Nugteren <c.nugteren@tue.nl>
|
|
13
|
+
// Web address........http://parse.ele.tue.nl/bones/
|
|
14
|
+
//
|
|
15
|
+
// == File information
|
|
16
|
+
// Filename...........benchmark/symm.c
|
|
17
|
+
// Author.............Cedric Nugteren
|
|
18
|
+
// Last modified on...23-May-2012
|
|
19
|
+
//
|
|
20
|
+
|
|
21
|
+
#include "common.h"
|
|
22
|
+
|
|
23
|
+
// This is 'symm', a symmetric matrix multiplication kernel
|
|
24
|
+
int main(void) {
|
|
25
|
+
int i,j,k;
|
|
26
|
+
float acc[1];
|
|
27
|
+
float bij;
|
|
28
|
+
|
|
29
|
+
// Declare arrays on the stack
|
|
30
|
+
float A[NJ][NJ];
|
|
31
|
+
float B[NI][NJ];
|
|
32
|
+
float C[NI][NJ];
|
|
33
|
+
|
|
34
|
+
// Set the constants
|
|
35
|
+
float alpha = 32412;
|
|
36
|
+
float beta = 2123;
|
|
37
|
+
|
|
38
|
+
// Set the input data
|
|
39
|
+
for (i=0; i<NI; i++) {
|
|
40
|
+
for (j=0; j<NJ; j++) {
|
|
41
|
+
C[i][j] = ((float) i*j) / NI;
|
|
42
|
+
B[i][j] = ((float) i*j) / NI;
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
for (i=0; i<NJ; i++) {
|
|
46
|
+
for (j=0; j<NJ; j++) {
|
|
47
|
+
A[i][j] = ((float) i*j) / NI;
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
// Perform the computation (C := alpha*A*B + beta*C, with A symmetric)
|
|
52
|
+
for (i=0; i<NI; i++) {
|
|
53
|
+
for (j=0; j<NJ; j++) {
|
|
54
|
+
acc[0] = 0;
|
|
55
|
+
bij = B[i][j];
|
|
56
|
+
#pragma species kernel 0:j-2,j:j|element ^ 0:j-2,i:i|element -> 0:j-2,j:j|element
|
|
57
|
+
for (k=0; k<j-1; k++) {
|
|
58
|
+
C[k][j] += alpha*A[k][i] * bij;
|
|
59
|
+
}
|
|
60
|
+
#pragma species endkernel symm-part1
|
|
61
|
+
#pragma species kernel 0:j-2,j:j|element ^ 0:j-2,i:i|element -> 0:0|shared
|
|
62
|
+
for (k=0; k<j-1; k++) {
|
|
63
|
+
acc[0] += B[k][j] * A[k][i];
|
|
64
|
+
}
|
|
65
|
+
#pragma species endkernel symm-part2
|
|
66
|
+
C[i][j] = beta*C[i][j] + alpha*A[i][i]*bij + alpha*acc[0];
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
// Clean-up and exit the function
|
|
71
|
+
fflush(stdout);
|
|
72
|
+
return 0;
|
|
73
|
+
}
|
|
74
|
+
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
//
|
|
2
|
+
// This file is part of the Bones source-to-source compiler examples. The C-code
|
|
3
|
+
// is largely identical in terms of functionality and variable naming to the code
|
|
4
|
+
// found in PolyBench/C version 3.2. For more information on PolyBench/C or Bones
|
|
5
|
+
// please use the contact information below.
|
|
6
|
+
//
|
|
7
|
+
// == More information on PolyBench/C
|
|
8
|
+
// Contact............Louis-Noel Pouchet <pouchet@cse.ohio-state.edu>
|
|
9
|
+
// Web address........http://polybench.sourceforge.net/
|
|
10
|
+
//
|
|
11
|
+
// == More information on Bones
|
|
12
|
+
// Contact............Cedric Nugteren <c.nugteren@tue.nl>
|
|
13
|
+
// Web address........http://parse.ele.tue.nl/bones/
|
|
14
|
+
//
|
|
15
|
+
// == File information
|
|
16
|
+
// Filename...........benchmark/syr2k.c
|
|
17
|
+
// Author.............Cedric Nugteren
|
|
18
|
+
// Last modified on...03-April-2012
|
|
19
|
+
//
|
|
20
|
+
|
|
21
|
+
#include "common.h"
|
|
22
|
+
|
|
23
|
+
// This is 'syr2k', an algorithm for symmetric rank-2k operations
|
|
24
|
+
int main(void) {
|
|
25
|
+
int i,j,k;
|
|
26
|
+
|
|
27
|
+
// Declare arrays on the stack
|
|
28
|
+
float A[NI][NJ];
|
|
29
|
+
float B[NI][NJ];
|
|
30
|
+
float C[NI][NI];
|
|
31
|
+
|
|
32
|
+
// Set the constants
|
|
33
|
+
int alpha = 32412;
|
|
34
|
+
int beta = 2123;
|
|
35
|
+
|
|
36
|
+
// Set the input data
|
|
37
|
+
for (i=0; i<NI; i++) {
|
|
38
|
+
for (j=0; j<NJ; j++) {
|
|
39
|
+
A[i][j] = ((float) i*j) / NI;
|
|
40
|
+
B[i][j] = ((float) i*j) / NI;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
for (i=0; i<NI; i++) {
|
|
44
|
+
for (j=0; j<NI; j++) {
|
|
45
|
+
C[i][j] = ((float) i*j) / NI;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
// Perform the computation (C := alpha*A*B' + alpha*B*A' + beta*C)
|
|
50
|
+
#pragma species kernel 0:NI-1,0:NI-1|element ^ 0:NI-1,0:NJ-1|chunk(0:0,0:NJ-1) ^ 0:NI-1,0:NJ-1|chunk(0:0,0:NJ-1) -> 0:NI-1,0:NI-1|element
|
|
51
|
+
for (i=0; i<NI; i++) {
|
|
52
|
+
for (j=0; j<NI; j++) {
|
|
53
|
+
C[i][j] *= beta;
|
|
54
|
+
for (k=0; k<NJ; k++) {
|
|
55
|
+
C[i][j] += alpha * A[i][k] * B[j][k];
|
|
56
|
+
C[i][j] += alpha * B[i][k] * A[j][k];
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
#pragma species endkernel syr2k
|
|
61
|
+
|
|
62
|
+
// Clean-up and exit the function
|
|
63
|
+
fflush(stdout);
|
|
64
|
+
return 0;
|
|
65
|
+
}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
//
|
|
2
|
+
// This file is part of the Bones source-to-source compiler examples. The C-code
|
|
3
|
+
// is largely identical in terms of functionality and variable naming to the code
|
|
4
|
+
// found in PolyBench/C version 3.2. For more information on PolyBench/C or Bones
|
|
5
|
+
// please use the contact information below.
|
|
6
|
+
//
|
|
7
|
+
// == More information on PolyBench/C
|
|
8
|
+
// Contact............Louis-Noel Pouchet <pouchet@cse.ohio-state.edu>
|
|
9
|
+
// Web address........http://polybench.sourceforge.net/
|
|
10
|
+
//
|
|
11
|
+
// == More information on Bones
|
|
12
|
+
// Contact............Cedric Nugteren <c.nugteren@tue.nl>
|
|
13
|
+
// Web address........http://parse.ele.tue.nl/bones/
|
|
14
|
+
//
|
|
15
|
+
// == File information
|
|
16
|
+
// Filename...........benchmark/syrk.c
|
|
17
|
+
// Author.............Cedric Nugteren
|
|
18
|
+
// Last modified on...08-May-2012
|
|
19
|
+
//
|
|
20
|
+
|
|
21
|
+
#include "common.h"
|
|
22
|
+
|
|
23
|
+
// This is 'syrk', an algorithm for symmetric rank-k operations
|
|
24
|
+
int main(void) {
|
|
25
|
+
int i,j,k;
|
|
26
|
+
|
|
27
|
+
// Declare arrays on the stack
|
|
28
|
+
float A[NI][NJ];
|
|
29
|
+
float C[NI][NI];
|
|
30
|
+
|
|
31
|
+
// Set the constants
|
|
32
|
+
float alpha = 32412;
|
|
33
|
+
float beta = 2123;
|
|
34
|
+
|
|
35
|
+
// Set the input data
|
|
36
|
+
for (i=0; i<NI; i++) {
|
|
37
|
+
for (j=0; j<NJ; j++) {
|
|
38
|
+
A[i][j] = ((float) i*j) / NI;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
for (i=0; i<NI; i++) {
|
|
42
|
+
for (j=0; j<NI; j++) {
|
|
43
|
+
C[i][j] = ((float) i*j) / NI;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
// Perform the computation (C := alpha*A*A' + beta*C)
|
|
48
|
+
#pragma species kernel C[0:NI-1,0:NI-1]|element ^ A[0:NI-1,0:NJ-1]|chunk(0:0,0:NJ-1) ^ A[0:NI-1,0:NJ-1]|chunk(0:0,0:NJ-1) -> C[0:NI-1,0:NI-1]|element
|
|
49
|
+
for (i=0; i<NI; i++) {
|
|
50
|
+
for (j=0; j<NI; j++) {
|
|
51
|
+
C[i][j] *= beta;
|
|
52
|
+
for (k=0; k<NJ; k++) {
|
|
53
|
+
C[i][j] += alpha * A[i][k] * A[j][k];
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
#pragma species endkernel syrk
|
|
58
|
+
|
|
59
|
+
// Clean-up and exit the function
|
|
60
|
+
fflush(stdout);
|
|
61
|
+
return 0;
|
|
62
|
+
}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
//
|
|
2
|
+
// This file is part of the Bones source-to-source compiler examples. The C-code
|
|
3
|
+
// is largely identical in terms of functionality and variable naming to the code
|
|
4
|
+
// found in PolyBench/C version 3.2. For more information on PolyBench/C or Bones
|
|
5
|
+
// please use the contact information below.
|
|
6
|
+
//
|
|
7
|
+
// == More information on PolyBench/C
|
|
8
|
+
// Contact............Louis-Noel Pouchet <pouchet@cse.ohio-state.edu>
|
|
9
|
+
// Web address........http://polybench.sourceforge.net/
|
|
10
|
+
//
|
|
11
|
+
// == More information on Bones
|
|
12
|
+
// Contact............Cedric Nugteren <c.nugteren@tue.nl>
|
|
13
|
+
// Web address........http://parse.ele.tue.nl/bones/
|
|
14
|
+
//
|
|
15
|
+
// == File information
|
|
16
|
+
// Filename...........benchmark/trisolv.c
|
|
17
|
+
// Author.............Cedric Nugteren
|
|
18
|
+
// Last modified on...03-Jul-2012
|
|
19
|
+
//
|
|
20
|
+
|
|
21
|
+
#include "common.h"
|
|
22
|
+
|
|
23
|
+
// This is 'trisolv', a solver for linear systems with triangular matrices
|
|
24
|
+
int main(void) {
|
|
25
|
+
int i,j;
|
|
26
|
+
float A_i_i;
|
|
27
|
+
|
|
28
|
+
// Declare arrays on the stack
|
|
29
|
+
float A[NX][NX];
|
|
30
|
+
float c[NX];
|
|
31
|
+
float x[NX];
|
|
32
|
+
|
|
33
|
+
// Set the input data
|
|
34
|
+
for (i=0; i<NX; i++) {
|
|
35
|
+
c[i] = ((float) i) / NX;
|
|
36
|
+
x[i] = ((float) i) / NX;
|
|
37
|
+
for (j=0; j<NX; j++) {
|
|
38
|
+
A[i][j] = ((float) i*j) / NX;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
// Perform the computation
|
|
43
|
+
for (i=0; i<NX; i++) {
|
|
44
|
+
x[i] = c[i];
|
|
45
|
+
A_i_i = A[i][i];
|
|
46
|
+
//#pragma species kernel i:i,0:i-1|element -> i:i|shared
|
|
47
|
+
for (j=0; j<= i-1; j++) {
|
|
48
|
+
x[i] = x[i] - A[i][j] * x[j];
|
|
49
|
+
x[i] = x[i] / A_i_i;
|
|
50
|
+
}
|
|
51
|
+
//#pragma species endkernel trisolv
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
// Clean-up and exit the function
|
|
55
|
+
fflush(stdout);
|
|
56
|
+
return 0;
|
|
57
|
+
}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
//
|
|
2
|
+
// This file is part of the Bones source-to-source compiler examples. The C-code
|
|
3
|
+
// is largely identical in terms of functionality and variable naming to the code
|
|
4
|
+
// found in PolyBench/C version 3.2. For more information on PolyBench/C or Bones
|
|
5
|
+
// please use the contact information below.
|
|
6
|
+
//
|
|
7
|
+
// == More information on PolyBench/C
|
|
8
|
+
// Contact............Louis-Noel Pouchet <pouchet@cse.ohio-state.edu>
|
|
9
|
+
// Web address........http://polybench.sourceforge.net/
|
|
10
|
+
//
|
|
11
|
+
// == More information on Bones
|
|
12
|
+
// Contact............Cedric Nugteren <c.nugteren@tue.nl>
|
|
13
|
+
// Web address........http://parse.ele.tue.nl/bones/
|
|
14
|
+
//
|
|
15
|
+
// == File information
|
|
16
|
+
// Filename...........benchmark/trmm.c
|
|
17
|
+
// Author.............Cedric Nugteren
|
|
18
|
+
// Last modified on...26-Jun-2012
|
|
19
|
+
//
|
|
20
|
+
|
|
21
|
+
#include "common.h"
|
|
22
|
+
|
|
23
|
+
// This is 'trmm', a triangular matrix multiplication kernel
|
|
24
|
+
int main(void) {
|
|
25
|
+
int i,j,k;
|
|
26
|
+
|
|
27
|
+
// Declare arrays on the stack
|
|
28
|
+
float A[NI][NI];
|
|
29
|
+
float B[NI][NI];
|
|
30
|
+
|
|
31
|
+
// Set the constants
|
|
32
|
+
int alpha = 32412;
|
|
33
|
+
|
|
34
|
+
// Set the input data
|
|
35
|
+
for (i=0; i<NI; i++) {
|
|
36
|
+
for (j=0; j<NI; j++) {
|
|
37
|
+
A[i][j] = ((float) i*j) / NI;
|
|
38
|
+
B[i][j] = ((float) i*j) / NI;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
// Perform the computation (B := alpha*A'*B, with A triangular)
|
|
43
|
+
for (i=1; i<NI; i++) {
|
|
44
|
+
for (j=0; j<NI; j++) {
|
|
45
|
+
#pragma species kernel i:i,0:i-1|element ^ j:j,0:i-1|element -> i:i,j:j|shared
|
|
46
|
+
for (k=0; k<i; k++) {
|
|
47
|
+
B[i][j] += alpha * A[i][k] * B[j][k];
|
|
48
|
+
}
|
|
49
|
+
#pragma species endkernel trmm
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
// Clean-up and exit the function
|
|
54
|
+
fflush(stdout);
|
|
55
|
+
return 0;
|
|
56
|
+
}
|
|
57
|
+
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
//
|
|
2
|
+
// This file is part of the Bones source-to-source compiler examples. This C-code
|
|
3
|
+
// example is meant to illustrate the use of Bones. For more information on Bones
|
|
4
|
+
// use the contact information below.
|
|
5
|
+
//
|
|
6
|
+
// == More information on Bones
|
|
7
|
+
// Contact............Cedric Nugteren <c.nugteren@tue.nl>
|
|
8
|
+
// Web address........http://parse.ele.tue.nl/bones/
|
|
9
|
+
//
|
|
10
|
+
// == File information
|
|
11
|
+
// Filename...........chunk/example1.c
|
|
12
|
+
// Author.............Cedric Nugteren
|
|
13
|
+
// Last modified on...16-April-2012
|
|
14
|
+
//
|
|
15
|
+
|
|
16
|
+
#include <stdio.h>
|
|
17
|
+
|
|
18
|
+
// This is 'example1', a basic chunk to element example using a 2D tile
|
|
19
|
+
int main(void) {
|
|
20
|
+
int i,j;
|
|
21
|
+
int i2,j2;
|
|
22
|
+
int result = 0;
|
|
23
|
+
|
|
24
|
+
// Declare input/output arrays
|
|
25
|
+
int A[560][32];
|
|
26
|
+
int B[56][16];
|
|
27
|
+
|
|
28
|
+
// Set the input data
|
|
29
|
+
for(i=0;i<560;i++) {
|
|
30
|
+
for(j=0;j<32;j++) {
|
|
31
|
+
A[i][j] = i+j;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
// Perform the computation
|
|
36
|
+
#pragma species kernel 0:559,0:31|chunk(0:9,0:1) -> 0:55,0:15|element
|
|
37
|
+
for(i=0;i<56;i++) {
|
|
38
|
+
for(j=0;j<16;j++) {
|
|
39
|
+
result = 0;
|
|
40
|
+
for (i2=0;i2<10;i2++) {
|
|
41
|
+
for (j2=0;j2<2;j2++) {
|
|
42
|
+
result = result + A[i*10+i2][j*2+j2];
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
B[i][j] = result;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
#pragma species endkernel example1
|
|
49
|
+
|
|
50
|
+
// Clean-up and exit the function
|
|
51
|
+
fflush(stdout);
|
|
52
|
+
return 0;
|
|
53
|
+
}
|
|
54
|
+
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
//
|
|
2
|
+
// This file is part of the Bones source-to-source compiler examples. This C-code
|
|
3
|
+
// example is meant to illustrate the use of Bones. For more information on Bones
|
|
4
|
+
// use the contact information below.
|
|
5
|
+
//
|
|
6
|
+
// == More information on Bones
|
|
7
|
+
// Contact............Cedric Nugteren <c.nugteren@tue.nl>
|
|
8
|
+
// Web address........http://parse.ele.tue.nl/bones/
|
|
9
|
+
//
|
|
10
|
+
// == File information
|
|
11
|
+
// Filename...........chunk/example2.c
|
|
12
|
+
// Author.............Cedric Nugteren
|
|
13
|
+
// Last modified on...16-April-2012
|
|
14
|
+
//
|
|
15
|
+
|
|
16
|
+
#include <stdio.h>
|
|
17
|
+
#define SIZE 2048
|
|
18
|
+
#define HALFSIZE (SIZE/2)
|
|
19
|
+
|
|
20
|
+
// This is 'example2', demonstrating a chunk-example without an inner-loop, everything is unrolled manually
|
|
21
|
+
int main(void) {
|
|
22
|
+
int i;
|
|
23
|
+
|
|
24
|
+
// Declare input/output arrays
|
|
25
|
+
float A[SIZE];
|
|
26
|
+
float B[HALFSIZE];
|
|
27
|
+
|
|
28
|
+
// Set the input data
|
|
29
|
+
for(i=0;i<SIZE;i++) {
|
|
30
|
+
A[i] = i%6+i;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
// Perform the computation
|
|
34
|
+
#pragma species kernel 0:SIZE-1|chunk(0:1) -> 0:HALFSIZE-1|element
|
|
35
|
+
for(i=0;i<HALFSIZE;i++) {
|
|
36
|
+
B[i] = A[i*2] + A[i*2+1];
|
|
37
|
+
}
|
|
38
|
+
#pragma species endkernel example2
|
|
39
|
+
|
|
40
|
+
// Clean-up and exit the function
|
|
41
|
+
fflush(stdout);
|
|
42
|
+
return 0;
|
|
43
|
+
}
|
|
44
|
+
|