bones-compiler 1.3.1 → 1.6.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 +62 -0
- data/README.rdoc +14 -3
- data/Rakefile +13 -12
- data/VERSION +1 -1
- data/examples/applications/ffos.c +24 -8
- data/examples/benchmarks/PolyBench/2mm.c +0 -0
- data/examples/benchmarks/PolyBench/3mm.c +0 -0
- data/examples/benchmarks/PolyBench/adi.c +0 -0
- data/examples/benchmarks/PolyBench/atax.c +0 -0
- data/examples/benchmarks/PolyBench/bicg.c +0 -0
- data/examples/benchmarks/PolyBench/cholesky.c +0 -0
- data/examples/benchmarks/PolyBench/common.h +0 -0
- data/examples/benchmarks/PolyBench/correlation.c +0 -0
- data/examples/benchmarks/PolyBench/covariance.c +0 -0
- data/examples/benchmarks/PolyBench/doitgen.c +0 -0
- data/examples/benchmarks/PolyBench/durbin.c +0 -0
- data/examples/benchmarks/PolyBench/dynprog.c +0 -0
- data/examples/benchmarks/PolyBench/fdtd-2d-apml.c +0 -0
- data/examples/benchmarks/PolyBench/fdtd-2d.c +0 -0
- data/examples/benchmarks/PolyBench/floyd-warshall.c +0 -0
- data/examples/benchmarks/PolyBench/gemm.c +0 -0
- data/examples/benchmarks/PolyBench/gemver.c +0 -0
- data/examples/benchmarks/PolyBench/gesummv.c +0 -0
- data/examples/benchmarks/PolyBench/gramschmidt.c +0 -0
- data/examples/benchmarks/PolyBench/jacobi-1d-imper.c +4 -2
- data/examples/benchmarks/PolyBench/jacobi-2d-imper.c +1 -1
- data/examples/benchmarks/PolyBench/lu.c +0 -0
- data/examples/benchmarks/PolyBench/ludcmp.c +0 -0
- data/examples/benchmarks/PolyBench/mvt.c +0 -0
- data/examples/benchmarks/PolyBench/reg_detect.c +0 -0
- data/examples/benchmarks/PolyBench/seidel-2d.c +0 -0
- data/examples/benchmarks/PolyBench/symm.c +0 -0
- data/examples/benchmarks/PolyBench/syr2k.c +0 -0
- data/examples/benchmarks/PolyBench/syrk.c +0 -0
- data/examples/benchmarks/PolyBench/trisolv.c +0 -0
- data/examples/benchmarks/PolyBench/trmm.c +0 -0
- data/examples/benchmarks/Rodinia/bfs.c +143 -0
- data/examples/benchmarks/Rodinia/common.h +78 -0
- data/examples/benchmarks/Rodinia/hotspot.c +106 -126
- data/examples/benchmarks/Rodinia/kmeans.c +157 -164
- data/examples/benchmarks/Rodinia/nw.c +151 -0
- data/examples/benchmarks/Rodinia/pathfinder.c +88 -0
- data/examples/benchmarks/Rodinia/srad.c +50 -59
- data/examples/benchmarks/other/common.h +0 -0
- data/examples/benchmarks/other/dct.c +0 -0
- data/examples/benchmarks/other/mm.c +0 -0
- data/examples/benchmarks/other/saxpy.c +0 -0
- data/examples/chunk/example01.c +6 -4
- data/examples/chunk/example02.c +6 -4
- data/examples/chunk/example03.c +6 -4
- data/examples/chunk/example04.c +8 -5
- data/examples/chunk/example05.c +6 -4
- data/examples/chunk/example06.c +3 -1
- data/examples/chunk/example07.c +5 -2
- data/examples/dependences/example01.c +3 -1
- data/examples/dependences/example02.c +3 -1
- data/examples/dependences/example03.c +3 -1
- data/examples/dependences/example04.c +3 -1
- data/examples/dependences/example05.c +3 -1
- data/examples/element/example01.c +6 -4
- data/examples/element/example02.c +6 -4
- data/examples/element/example03.c +10 -8
- data/examples/element/example04.c +6 -4
- data/examples/element/example05.c +8 -5
- data/examples/element/example06.c +6 -4
- data/examples/element/example07.c +6 -4
- data/examples/element/example08.c +6 -4
- data/examples/element/example09.c +6 -4
- data/examples/element/example10.c +4 -2
- data/examples/element/example11.c +4 -2
- data/examples/element/example12.c +4 -2
- data/examples/element/example13.c +3 -1
- data/examples/fusion/example01.c +3 -12
- data/examples/fusion/example02.c +3 -16
- data/examples/fusion/example03.c +3 -1
- data/examples/fusion/example04.c +5 -3
- data/examples/fusion/example05.c +3 -1
- data/examples/neighbourhood/example01.c +6 -4
- data/examples/neighbourhood/example02.c +6 -4
- data/examples/neighbourhood/example03.c +6 -4
- data/examples/neighbourhood/example04.c +5 -3
- data/examples/neighbourhood/example05.c +3 -1
- data/examples/shared/example01.c +6 -4
- data/examples/shared/example02.c +6 -4
- data/examples/shared/example03.c +6 -4
- data/examples/shared/example04.c +6 -4
- data/examples/shared/example05.c +6 -4
- data/lib/adarwin/engine.rb +16 -5
- data/lib/adarwin/memorycopies.rb +21 -9
- data/lib/adarwin/nest.rb +18 -1
- data/lib/adarwin/preprocessor.rb +5 -2
- data/lib/adarwin/reference.rb +71 -6
- data/lib/bones/algorithm.rb +20 -5
- data/lib/bones/copy.rb +3 -2
- data/lib/bones/engine.rb +12 -9
- data/lib/bones/preprocessor.rb +170 -120
- data/lib/bones/variablelist.rb +1 -1
- data/lib/cast.rb +11 -0
- data/lib/castaddon.rb +23 -6
- data/lib/castaddon/node_adarwin.rb +17 -0
- data/lib/castaddon/node_common.rb +6 -0
- data/lib/castaddon/transformations.rb +13 -9
- data/skeletons/CPU-C/common/epilogue.c +0 -0
- data/skeletons/CPU-C/common/globals.c +0 -0
- data/skeletons/CPU-C/common/globals_kernel.c +0 -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_global.c +0 -0
- data/skeletons/CPU-C/common/mem_prologue.c +0 -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 +0 -0
- data/skeletons/CPU-C/common/timer_2_stop.c +0 -0
- data/skeletons/CPU-C/common/timer_globals.c +5 -0
- data/skeletons/CPU-C/kernel/default.host.c +0 -0
- data/skeletons/CPU-C/kernel/default.kernel.c +0 -0
- data/skeletons/CPU-C/skeletons.txt +0 -0
- data/skeletons/CPU-OPENCL-AMD/common/epilogue.c +0 -0
- data/skeletons/CPU-OPENCL-AMD/common/globals.c +0 -0
- data/skeletons/CPU-OPENCL-AMD/common/globals_kernel.c +0 -0
- data/skeletons/CPU-OPENCL-AMD/common/header.c +0 -0
- data/skeletons/CPU-OPENCL-AMD/common/mem_copy_D2H.c +0 -0
- data/skeletons/CPU-OPENCL-AMD/common/mem_copy_H2D.c +0 -0
- data/skeletons/CPU-OPENCL-AMD/common/mem_epilogue.c +0 -0
- data/skeletons/CPU-OPENCL-AMD/common/mem_prologue.c +0 -0
- data/skeletons/CPU-OPENCL-AMD/common/prologue.c +0 -0
- data/skeletons/CPU-OPENCL-AMD/common/timer_1_start.c +0 -0
- data/skeletons/CPU-OPENCL-AMD/common/timer_1_stop.c +0 -0
- data/skeletons/CPU-OPENCL-AMD/common/timer_2_start.c +0 -0
- data/skeletons/CPU-OPENCL-AMD/common/timer_2_stop.c +0 -0
- data/skeletons/CPU-OPENCL-AMD/kernel/D-element-to-1-shared.host.c +0 -0
- data/skeletons/CPU-OPENCL-AMD/kernel/D-element-to-1-shared.kernel.cl +0 -0
- data/skeletons/CPU-OPENCL-AMD/kernel/default.host.c +0 -0
- data/skeletons/CPU-OPENCL-AMD/kernel/default.kernel.cl +0 -0
- data/skeletons/CPU-OPENCL-AMD/skeletons.txt +0 -0
- data/skeletons/CPU-OPENCL-INTEL/common/epilogue.c +0 -0
- data/skeletons/CPU-OPENCL-INTEL/common/globals.c +0 -0
- data/skeletons/CPU-OPENCL-INTEL/common/globals_kernel.c +0 -0
- data/skeletons/CPU-OPENCL-INTEL/common/header.c +0 -0
- data/skeletons/CPU-OPENCL-INTEL/common/mem_copy_D2H.c +0 -0
- data/skeletons/CPU-OPENCL-INTEL/common/mem_copy_H2D.c +0 -0
- data/skeletons/CPU-OPENCL-INTEL/common/mem_epilogue.c +0 -0
- data/skeletons/CPU-OPENCL-INTEL/common/mem_global.c +0 -0
- data/skeletons/CPU-OPENCL-INTEL/common/mem_prologue.c +0 -0
- data/skeletons/CPU-OPENCL-INTEL/common/prologue.c +0 -0
- data/skeletons/CPU-OPENCL-INTEL/common/timer_1_start.c +0 -0
- data/skeletons/CPU-OPENCL-INTEL/common/timer_1_stop.c +0 -0
- data/skeletons/CPU-OPENCL-INTEL/common/timer_2_start.c +0 -0
- data/skeletons/CPU-OPENCL-INTEL/common/timer_2_stop.c +0 -0
- data/skeletons/CPU-OPENCL-INTEL/common/timer_globals.c +5 -0
- data/skeletons/CPU-OPENCL-INTEL/kernel/D-element-to-1-shared.host.c +0 -0
- data/skeletons/CPU-OPENCL-INTEL/kernel/D-element-to-1-shared.kernel.cl +0 -0
- data/skeletons/CPU-OPENCL-INTEL/kernel/default.host.c +0 -0
- data/skeletons/CPU-OPENCL-INTEL/kernel/default.kernel.cl +0 -0
- data/skeletons/CPU-OPENCL-INTEL/skeletons.txt +0 -0
- data/skeletons/CPU-OPENMP/common/epilogue.c +0 -0
- data/skeletons/CPU-OPENMP/common/globals.c +0 -0
- data/skeletons/CPU-OPENMP/common/globals_kernel.c +0 -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_global.c +0 -0
- data/skeletons/CPU-OPENMP/common/mem_prologue.c +0 -0
- data/skeletons/CPU-OPENMP/common/prologue.c +0 -0
- data/skeletons/CPU-OPENMP/common/timer_1_start.c +0 -0
- data/skeletons/CPU-OPENMP/common/timer_1_stop.c +0 -0
- data/skeletons/CPU-OPENMP/common/timer_2_start.c +0 -0
- data/skeletons/CPU-OPENMP/common/timer_2_stop.c +0 -0
- data/skeletons/CPU-OPENMP/common/timer_globals.c +2 -0
- data/skeletons/CPU-OPENMP/kernel/D-element-to-1-shared.host.c +0 -0
- data/skeletons/CPU-OPENMP/kernel/D-element-to-1-shared.kernel.c +3 -3
- data/skeletons/CPU-OPENMP/kernel/default.host.c +0 -0
- data/skeletons/CPU-OPENMP/kernel/default.kernel.c +0 -0
- data/skeletons/CPU-OPENMP/skeletons.txt +0 -0
- data/skeletons/GPU-CUDA/common/epilogue.c +0 -0
- data/skeletons/GPU-CUDA/common/globals.c +0 -0
- data/skeletons/GPU-CUDA/common/globals_kernel.c +0 -0
- data/skeletons/GPU-CUDA/common/header.c +0 -0
- data/skeletons/GPU-CUDA/common/mem_async_alloc.c +0 -0
- data/skeletons/GPU-CUDA/common/mem_async_copyin.c +0 -0
- data/skeletons/GPU-CUDA/common/mem_async_copyout.c +0 -0
- data/skeletons/GPU-CUDA/common/mem_async_free.c +0 -0
- data/skeletons/GPU-CUDA/common/mem_copy_D2H.c +0 -0
- data/skeletons/GPU-CUDA/common/mem_copy_H2D.c +0 -0
- data/skeletons/GPU-CUDA/common/mem_epilogue.c +0 -0
- data/skeletons/GPU-CUDA/common/mem_global.c +0 -0
- data/skeletons/GPU-CUDA/common/mem_prologue.c +0 -0
- data/skeletons/GPU-CUDA/common/prologue.c +0 -0
- data/skeletons/GPU-CUDA/common/scheduler.c +2 -2
- data/skeletons/GPU-CUDA/common/timer_1_start.c +0 -0
- data/skeletons/GPU-CUDA/common/timer_1_stop.c +0 -0
- data/skeletons/GPU-CUDA/common/timer_2_start.c +0 -0
- data/skeletons/GPU-CUDA/common/timer_2_stop.c +0 -0
- data/skeletons/GPU-CUDA/common/timer_globals.c +0 -0
- data/skeletons/GPU-CUDA/kernel/2xN-N-chunk-1-N-to-D-element.host.c +0 -0
- data/skeletons/GPU-CUDA/kernel/2xN-N-chunk-1-N-to-D-element.kernel.cu +0 -0
- data/skeletons/GPU-CUDA/kernel/D-element-to-1-shared.host.c +0 -0
- data/skeletons/GPU-CUDA/kernel/D-element-to-1-shared.kernel.cu +0 -0
- data/skeletons/GPU-CUDA/kernel/D-element-to-N-shared.host.c +0 -0
- data/skeletons/GPU-CUDA/kernel/D-element-to-N-shared.kernel.cu +0 -0
- data/skeletons/GPU-CUDA/kernel/N-N-chunk-1-N-to-D-element.host.c +0 -0
- data/skeletons/GPU-CUDA/kernel/N-N-chunk-1-N-to-D-element.kernel.cu +0 -0
- data/skeletons/GPU-CUDA/kernel/N-neighbourhood-N-to-N-element.host.c +0 -0
- data/skeletons/GPU-CUDA/kernel/N-neighbourhood-N-to-N-element.kernel.cu +0 -0
- data/skeletons/GPU-CUDA/kernel/default.host.c +0 -0
- data/skeletons/GPU-CUDA/kernel/default.kernel.cu +0 -0
- data/skeletons/GPU-CUDA/skeletons.txt +4 -2
- data/skeletons/GPU-OPENCL-AMD/common/epilogue.c +0 -0
- data/skeletons/GPU-OPENCL-AMD/common/globals.c +0 -0
- data/skeletons/GPU-OPENCL-AMD/common/globals_kernel.c +0 -0
- data/skeletons/GPU-OPENCL-AMD/common/header.c +0 -0
- data/skeletons/GPU-OPENCL-AMD/common/mem_copy_D2H.c +0 -0
- data/skeletons/GPU-OPENCL-AMD/common/mem_copy_H2D.c +0 -0
- data/skeletons/GPU-OPENCL-AMD/common/mem_epilogue.c +0 -0
- data/skeletons/GPU-OPENCL-AMD/common/mem_prologue.c +0 -0
- data/skeletons/GPU-OPENCL-AMD/common/prologue.c +0 -0
- data/skeletons/GPU-OPENCL-AMD/common/timer_1_start.c +0 -0
- data/skeletons/GPU-OPENCL-AMD/common/timer_1_stop.c +0 -0
- data/skeletons/GPU-OPENCL-AMD/common/timer_2_start.c +0 -0
- data/skeletons/GPU-OPENCL-AMD/common/timer_2_stop.c +0 -0
- data/skeletons/GPU-OPENCL-AMD/kernel/D-element-to-1-shared.host.c +0 -0
- data/skeletons/GPU-OPENCL-AMD/kernel/D-element-to-1-shared.kernel.cl +0 -0
- data/skeletons/GPU-OPENCL-AMD/kernel/default.host.c +0 -0
- data/skeletons/GPU-OPENCL-AMD/kernel/default.kernel.cl +0 -0
- data/skeletons/GPU-OPENCL-AMD/skeletons.txt +0 -0
- data/skeletons/verification/header.c +0 -0
- data/skeletons/verification/timer_start.c +0 -0
- data/skeletons/verification/timer_stop.c +0 -0
- data/skeletons/verification/verify_results.c +0 -0
- data/test/bones/test_algorithm.rb +0 -0
- data/test/bones/test_common.rb +0 -0
- data/test/bones/test_preprocessor.rb +0 -0
- data/test/bones/test_species.rb +0 -0
- data/test/bones/test_variable.rb +0 -0
- data/test/examples/benchmarks/PolyBench/2mm_species.c +1 -1
- data/test/examples/benchmarks/PolyBench/3mm_species.c +0 -0
- data/test/examples/benchmarks/PolyBench/adi_species.c +0 -0
- data/test/examples/benchmarks/PolyBench/atax_species.c +0 -0
- data/test/examples/benchmarks/PolyBench/bicg_species.c +0 -0
- data/test/examples/benchmarks/PolyBench/cholesky_species.c +0 -0
- data/test/examples/benchmarks/PolyBench/correlation_species.c +0 -0
- data/test/examples/benchmarks/PolyBench/covariance_species.c +0 -0
- data/test/examples/benchmarks/PolyBench/doitgen_species.c +0 -0
- data/test/examples/benchmarks/PolyBench/durbin_species.c +0 -0
- data/test/examples/benchmarks/PolyBench/dynprog_species.c +0 -0
- data/test/examples/benchmarks/PolyBench/fdtd-2d-apml_species.c +0 -0
- data/test/examples/benchmarks/PolyBench/fdtd-2d_species.c +0 -0
- data/test/examples/benchmarks/PolyBench/floyd-warshall_species.c +0 -0
- data/test/examples/benchmarks/PolyBench/gemm_species.c +0 -0
- data/test/examples/benchmarks/PolyBench/gemver_species.c +0 -0
- data/test/examples/benchmarks/PolyBench/gesummv_species.c +0 -0
- data/test/examples/benchmarks/PolyBench/gramschmidt_species.c +0 -0
- data/test/examples/benchmarks/PolyBench/jacobi-1d-imper_species.c +0 -0
- data/test/examples/benchmarks/PolyBench/jacobi-2d-imper_species.c +0 -0
- data/test/examples/benchmarks/PolyBench/lu_species.c +0 -0
- data/test/examples/benchmarks/PolyBench/ludcmp_species.c +0 -0
- data/test/examples/benchmarks/PolyBench/mvt_species.c +0 -0
- data/test/examples/benchmarks/PolyBench/reg_detect_species.c +0 -0
- data/test/examples/benchmarks/PolyBench/seidel-2d_species.c +0 -0
- data/test/examples/benchmarks/PolyBench/symm_species.c +0 -0
- data/test/examples/benchmarks/PolyBench/syr2k_species.c +0 -0
- data/test/examples/benchmarks/PolyBench/syrk_species.c +0 -0
- data/test/examples/benchmarks/PolyBench/trisolv_species.c +0 -0
- data/test/examples/benchmarks/PolyBench/trmm_species.c +0 -0
- data/test/examples/chunk/example01_species.c +3 -3
- data/test/examples/chunk/example02_species.c +3 -3
- data/test/examples/chunk/example03_species.c +3 -3
- data/test/examples/chunk/example04_species.c +3 -3
- data/test/examples/chunk/example05_species.c +3 -3
- data/test/examples/chunk/example06_species.c +1 -1
- data/test/examples/chunk/example07_species.c +3 -2
- data/test/examples/dependences/example01_species.c +1 -1
- data/test/examples/dependences/example02_species.c +1 -1
- data/test/examples/dependences/example03_species.c +1 -1
- data/test/examples/dependences/example04_species.c +1 -1
- data/test/examples/dependences/example05_species.c +1 -1
- data/test/examples/element/example01_species.c +3 -3
- data/test/examples/element/example02_species.c +3 -3
- data/test/examples/element/example03_species.c +7 -7
- data/test/examples/element/example04_species.c +3 -3
- data/test/examples/element/example05_species.c +3 -3
- data/test/examples/element/example06_species.c +3 -3
- data/test/examples/element/example07_species.c +3 -3
- data/test/examples/element/example08_species.c +3 -3
- data/test/examples/element/example09_species.c +3 -3
- data/test/examples/element/example10_species.c +1 -1
- data/test/examples/element/example11_species.c +1 -1
- data/test/examples/element/example12_species.c +1 -1
- data/test/examples/element/example13_species.c +1 -1
- data/test/examples/neighbourhood/example01_species.c +3 -3
- data/test/examples/neighbourhood/example02_species.c +3 -3
- data/test/examples/neighbourhood/example03_species.c +3 -3
- data/test/examples/neighbourhood/example04_species.c +3 -3
- data/test/examples/neighbourhood/example05_species.c +1 -1
- data/test/examples/shared/example01_species.c +3 -3
- data/test/examples/shared/example02_species.c +3 -3
- data/test/examples/shared/example03_species.c +3 -3
- data/test/examples/shared/example04_species.c +3 -3
- data/test/examples/shared/example05_species.c +3 -3
- data/test/test_helper.rb +2 -2
- metadata +266 -252
- checksums.yaml +0 -15
- data/examples/benchmarks/Rodinia/cfd.c +0 -180
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
//
|
|
2
|
+
// This file is part of the Bones source-to-source compiler examples. This C-code
|
|
3
|
+
// demonstrates the use of Bones for an example application: 'nw', taken from
|
|
4
|
+
// the Rodinia benchmark suite. For more information on the application or on Bones
|
|
5
|
+
// please use the contact information below.
|
|
6
|
+
//
|
|
7
|
+
// == More information on Hotspot
|
|
8
|
+
// Original code......https://www.cs.virginia.edu/~skadron/wiki/rodinia/
|
|
9
|
+
//
|
|
10
|
+
// == More information on Bones
|
|
11
|
+
// Contact............Cedric Nugteren <c.nugteren@tue.nl>
|
|
12
|
+
// Web address........http://parse.ele.tue.nl/bones/
|
|
13
|
+
//
|
|
14
|
+
// == File information
|
|
15
|
+
// Filename...........applications/nw.c
|
|
16
|
+
// Authors............Cedric Nugteren
|
|
17
|
+
// Last modified on...01-Jun-2014
|
|
18
|
+
//
|
|
19
|
+
|
|
20
|
+
//########################################################################
|
|
21
|
+
//### Includes
|
|
22
|
+
//########################################################################
|
|
23
|
+
|
|
24
|
+
#include <stdio.h>
|
|
25
|
+
#include <stdlib.h>
|
|
26
|
+
#include <math.h>
|
|
27
|
+
|
|
28
|
+
//########################################################################
|
|
29
|
+
//### Defines
|
|
30
|
+
//########################################################################
|
|
31
|
+
|
|
32
|
+
// Config
|
|
33
|
+
#define MAX_ROWS (2048+1)
|
|
34
|
+
#define MAX_COLS (2048+1)
|
|
35
|
+
#define PENALTY 10
|
|
36
|
+
|
|
37
|
+
// Reference
|
|
38
|
+
int blosum62[24][24] = {
|
|
39
|
+
{ 4, -1, -2, -2, 0, -1, -1, 0, -2, -1, -1, -1, -1, -2, -1, 1, 0, -3, -2, 0, -2, -1, 0, -4},
|
|
40
|
+
{-1, 5, 0, -2, -3, 1, 0, -2, 0, -3, -2, 2, -1, -3, -2, -1, -1, -3, -2, -3, -1, 0, -1, -4},
|
|
41
|
+
{-2, 0, 6, 1, -3, 0, 0, 0, 1, -3, -3, 0, -2, -3, -2, 1, 0, -4, -2, -3, 3, 0, -1, -4},
|
|
42
|
+
{-2, -2, 1, 6, -3, 0, 2, -1, -1, -3, -4, -1, -3, -3, -1, 0, -1, -4, -3, -3, 4, 1, -1, -4},
|
|
43
|
+
{ 0, -3, -3, -3, 9, -3, -4, -3, -3, -1, -1, -3, -1, -2, -3, -1, -1, -2, -2, -1, -3, -3, -2, -4},
|
|
44
|
+
{-1, 1, 0, 0, -3, 5, 2, -2, 0, -3, -2, 1, 0, -3, -1, 0, -1, -2, -1, -2, 0, 3, -1, -4},
|
|
45
|
+
{-1, 0, 0, 2, -4, 2, 5, -2, 0, -3, -3, 1, -2, -3, -1, 0, -1, -3, -2, -2, 1, 4, -1, -4},
|
|
46
|
+
{ 0, -2, 0, -1, -3, -2, -2, 6, -2, -4, -4, -2, -3, -3, -2, 0, -2, -2, -3, -3, -1, -2, -1, -4},
|
|
47
|
+
{-2, 0, 1, -1, -3, 0, 0, -2, 8, -3, -3, -1, -2, -1, -2, -1, -2, -2, 2, -3, 0, 0, -1, -4},
|
|
48
|
+
{-1, -3, -3, -3, -1, -3, -3, -4, -3, 4, 2, -3, 1, 0, -3, -2, -1, -3, -1, 3, -3, -3, -1, -4},
|
|
49
|
+
{-1, -2, -3, -4, -1, -2, -3, -4, -3, 2, 4, -2, 2, 0, -3, -2, -1, -2, -1, 1, -4, -3, -1, -4},
|
|
50
|
+
{-1, 2, 0, -1, -3, 1, 1, -2, -1, -3, -2, 5, -1, -3, -1, 0, -1, -3, -2, -2, 0, 1, -1, -4},
|
|
51
|
+
{-1, -1, -2, -3, -1, 0, -2, -3, -2, 1, 2, -1, 5, 0, -2, -1, -1, -1, -1, 1, -3, -1, -1, -4},
|
|
52
|
+
{-2, -3, -3, -3, -2, -3, -3, -3, -1, 0, 0, -3, 0, 6, -4, -2, -2, 1, 3, -1, -3, -3, -1, -4},
|
|
53
|
+
{-1, -2, -2, -1, -3, -1, -1, -2, -2, -3, -3, -1, -2, -4, 7, -1, -1, -4, -3, -2, -2, -1, -2, -4},
|
|
54
|
+
{ 1, -1, 1, 0, -1, 0, 0, 0, -1, -2, -2, 0, -1, -2, -1, 4, 1, -3, -2, -2, 0, 0, 0, -4},
|
|
55
|
+
{ 0, -1, 0, -1, -1, -1, -1, -2, -2, -1, -1, -1, -1, -2, -1, 1, 5, -2, -2, 0, -1, -1, 0, -4},
|
|
56
|
+
{-3, -3, -4, -4, -2, -2, -3, -2, -2, -3, -2, -3, -1, 1, -4, -3, -2, 11, 2, -3, -4, -3, -2, -4},
|
|
57
|
+
{-2, -2, -2, -3, -2, -1, -2, -3, 2, -1, -1, -2, -1, 3, -3, -2, -2, 2, 7, -1, -3, -2, -1, -4},
|
|
58
|
+
{ 0, -3, -3, -3, -1, -2, -2, -3, -3, 3, 1, -2, 1, -1, -2, -2, 0, -3, -1, 4, -3, -2, -1, -4},
|
|
59
|
+
{-2, -1, 3, 4, -3, 0, 1, -1, 0, -3, -4, 0, -3, -3, -2, 0, -1, -4, -3, -3, 4, 1, -1, -4},
|
|
60
|
+
{-1, 0, 0, 1, -3, 3, 4, -2, 0, -3, -3, 1, -1, -3, -1, 0, -1, -3, -2, -2, 1, 4, -1, -4},
|
|
61
|
+
{ 0, -1, -1, -1, -2, -1, -1, -1, -1, -1, -1, -1, -1, -1, -2, 0, 0, -2, -1, -1, -1, -1, -1, -4},
|
|
62
|
+
{-4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, 1}
|
|
63
|
+
};
|
|
64
|
+
|
|
65
|
+
//########################################################################
|
|
66
|
+
//### Start of the main function
|
|
67
|
+
//########################################################################
|
|
68
|
+
|
|
69
|
+
int main(void) {
|
|
70
|
+
printf("[nw] Start Needleman-Wunsch\n");
|
|
71
|
+
|
|
72
|
+
// Arrays
|
|
73
|
+
int similarity[MAX_ROWS][MAX_COLS];
|
|
74
|
+
int items[MAX_ROWS][MAX_COLS];
|
|
75
|
+
|
|
76
|
+
// Initialize random input data
|
|
77
|
+
srand (7);
|
|
78
|
+
for (int i=0; i<MAX_ROWS; i++) {
|
|
79
|
+
for (int j=0; j<MAX_COLS; j++) {
|
|
80
|
+
items[i][j] = 0;
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
for (int i=1; i<MAX_ROWS; i++) {
|
|
84
|
+
items[i][0] = rand()%10 + 1;
|
|
85
|
+
}
|
|
86
|
+
for (int j=1; j<MAX_COLS; j++) {
|
|
87
|
+
items[0][j] = rand()%10 + 1;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
// Initialize reference
|
|
91
|
+
for (int i=0; i<MAX_ROWS; i++) {
|
|
92
|
+
for (int j=0; j<MAX_COLS; j++) {
|
|
93
|
+
similarity[i][j] = blosum62[items[i][0]][items[0][j]];
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
// Update input with penalty
|
|
98
|
+
for (int i=1; i<MAX_ROWS; i++) {
|
|
99
|
+
items[i][0] = -i*PENALTY;
|
|
100
|
+
}
|
|
101
|
+
for (int j=1; j<MAX_COLS; j++) {
|
|
102
|
+
items[0][j] = -j*PENALTY;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
// Start of computation
|
|
106
|
+
#pragma scop
|
|
107
|
+
|
|
108
|
+
// Compute top-left matrix
|
|
109
|
+
for (int i=0; i<MAX_ROWS-2; i++) {
|
|
110
|
+
for (int idx=0; idx <= i; idx++) {
|
|
111
|
+
int a = items[idx+0][i+0-idx] + similarity[idx+1][i+1-idx];
|
|
112
|
+
int b = items[idx+1][i+0-idx] - PENALTY;
|
|
113
|
+
int c = items[idx+0][i+1-idx] - PENALTY;
|
|
114
|
+
int max_val = a;
|
|
115
|
+
if (b > max_val) {
|
|
116
|
+
max_val = b;
|
|
117
|
+
}
|
|
118
|
+
if (c > max_val) {
|
|
119
|
+
max_val = c;
|
|
120
|
+
}
|
|
121
|
+
items[idx+1][i+1-idx] = max_val;
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
// Compute bottom-right matrix
|
|
126
|
+
for (int i=MAX_ROWS-4; i>=0; i--) {
|
|
127
|
+
for (int idx=0; idx <= i; idx++) {
|
|
128
|
+
int a = items[MAX_ROWS-idx-3][idx+MAX_COLS-i-3] + similarity[MAX_ROWS-idx-2][idx+MAX_COLS-i-2];
|
|
129
|
+
int b = items[MAX_ROWS-idx-2][idx+MAX_COLS-i-3] - PENALTY;
|
|
130
|
+
int c = items[MAX_ROWS-idx-3][idx+MAX_COLS-i-2] - PENALTY;
|
|
131
|
+
int max_val = a;
|
|
132
|
+
if (b > max_val) {
|
|
133
|
+
max_val = b;
|
|
134
|
+
}
|
|
135
|
+
if (c > max_val) {
|
|
136
|
+
max_val = c;
|
|
137
|
+
}
|
|
138
|
+
items[MAX_ROWS-idx-2][idx+MAX_COLS-i-2] = max_val;
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
// End of computation
|
|
143
|
+
#pragma endscop
|
|
144
|
+
|
|
145
|
+
// Clean-up and exit
|
|
146
|
+
printf("\n[nw] Completed\n\n"); fflush(stdout);
|
|
147
|
+
fflush(stdout);
|
|
148
|
+
return 0;
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
//########################################################################
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
//
|
|
2
|
+
// This file is part of the Bones source-to-source compiler examples. This C-code
|
|
3
|
+
// demonstrates the use of Bones for an example application: 'pathfinder', taken from
|
|
4
|
+
// the Rodinia benchmark suite. For more information on the application or on Bones
|
|
5
|
+
// please use the contact information below.
|
|
6
|
+
//
|
|
7
|
+
// == More information on Hotspot
|
|
8
|
+
// Original code......https://www.cs.virginia.edu/~skadron/wiki/rodinia/
|
|
9
|
+
//
|
|
10
|
+
// == More information on Bones
|
|
11
|
+
// Contact............Cedric Nugteren <c.nugteren@tue.nl>
|
|
12
|
+
// Web address........http://parse.ele.tue.nl/bones/
|
|
13
|
+
//
|
|
14
|
+
// == File information
|
|
15
|
+
// Filename...........applications/pathfinder.c
|
|
16
|
+
// Authors............Cedric Nugteren
|
|
17
|
+
// Last modified on...05-Jun-2014
|
|
18
|
+
//
|
|
19
|
+
//########################################################################
|
|
20
|
+
|
|
21
|
+
// Includes
|
|
22
|
+
#include "common.h"
|
|
23
|
+
|
|
24
|
+
//########################################################################
|
|
25
|
+
//### Start of the main function
|
|
26
|
+
//########################################################################
|
|
27
|
+
|
|
28
|
+
int main(void) {
|
|
29
|
+
|
|
30
|
+
// Variables
|
|
31
|
+
unsigned long long cycles;
|
|
32
|
+
int min;
|
|
33
|
+
|
|
34
|
+
// Initialize arrays
|
|
35
|
+
int wall[PATHROWS][PATHCOLS];
|
|
36
|
+
int result[PATHCOLS];
|
|
37
|
+
int input[PATHCOLS];
|
|
38
|
+
|
|
39
|
+
// Seed
|
|
40
|
+
int seed = M_SEED;
|
|
41
|
+
srand(seed);
|
|
42
|
+
|
|
43
|
+
// Set initial values
|
|
44
|
+
for (int i=0; i<PATHROWS; i++) {
|
|
45
|
+
for (int j=0; j<PATHCOLS; j++) {
|
|
46
|
+
wall[i][j] = rand() % 10;
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
for (int j=0; j<PATHCOLS; j++) {
|
|
50
|
+
result[j] = wall[0][j];
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
// Iterate over the PATHROWS
|
|
54
|
+
#pragma scop
|
|
55
|
+
for (int t=1; t<PATHROWS; t++) {
|
|
56
|
+
|
|
57
|
+
// Copy result of previous iteration as current input
|
|
58
|
+
for (int n=0; n<PATHCOLS; n++) {
|
|
59
|
+
input[n] = result[n];
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
// Iterate over the columns
|
|
63
|
+
for (int n=0; n<PATHCOLS; n++) {
|
|
64
|
+
min = input[n];
|
|
65
|
+
if (n > 0) {
|
|
66
|
+
int val1 = input[n-1];
|
|
67
|
+
if (val1 < min) {
|
|
68
|
+
min = val1;
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
if (n < PATHCOLS-1) {
|
|
72
|
+
int val2 = input[n+1];
|
|
73
|
+
if (val2 < min) {
|
|
74
|
+
min = val2;
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
result[n] = wall[t][n] + min;
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
#pragma endscop
|
|
81
|
+
|
|
82
|
+
// Clean-up and exit
|
|
83
|
+
printf("\n[pathfinder] Completed\n\n"); fflush(stdout);
|
|
84
|
+
fflush(stdout);
|
|
85
|
+
return 0;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
//########################################################################
|
|
@@ -17,29 +17,12 @@
|
|
|
17
17
|
// Filename...........applications/srad.c
|
|
18
18
|
// Authors............Cedric Nugteren
|
|
19
19
|
// Original authors...Rob Janiczek, Drew Gilliam, Lukasz Szafaryn
|
|
20
|
-
// Last modified on...
|
|
20
|
+
// Last modified on...05-Jun-2014
|
|
21
21
|
//
|
|
22
|
-
|
|
23
|
-
//########################################################################
|
|
24
|
-
//### Includes
|
|
25
|
-
//########################################################################
|
|
26
|
-
|
|
27
|
-
#include <stdio.h>
|
|
28
|
-
#include <stdlib.h>
|
|
29
|
-
#include <math.h>
|
|
30
|
-
|
|
31
|
-
//########################################################################
|
|
32
|
-
//### Defines
|
|
33
22
|
//########################################################################
|
|
34
23
|
|
|
35
|
-
|
|
36
|
-
#
|
|
37
|
-
#define R1 0 // y1 position of the speckle
|
|
38
|
-
#define R2 31 // y2 position of the speckle
|
|
39
|
-
#define C1 0 // x1 position of the speckle
|
|
40
|
-
#define C2 31 // x2 position of the speckle
|
|
41
|
-
#define LAMBDA 0.5 // Lambda value
|
|
42
|
-
#define NITER 2 // Number of iterations
|
|
24
|
+
// Includes
|
|
25
|
+
#include "common.h"
|
|
43
26
|
|
|
44
27
|
//########################################################################
|
|
45
28
|
//### Start of the main function
|
|
@@ -74,19 +57,19 @@ int main(void) {
|
|
|
74
57
|
printf("\n[srad] Initialising memory"); fflush(stdout);
|
|
75
58
|
int size = COLS*ROWS;
|
|
76
59
|
int size_roi = (R2-R1+1)*(C2-C1+1);
|
|
77
|
-
float
|
|
78
|
-
float
|
|
79
|
-
float
|
|
80
|
-
float
|
|
81
|
-
float
|
|
82
|
-
float
|
|
60
|
+
float values[ROWS][COLS];
|
|
61
|
+
float coefficent[ROWS][COLS];
|
|
62
|
+
float dN[ROWS][COLS];
|
|
63
|
+
float dS[ROWS][COLS];
|
|
64
|
+
float dW[ROWS][COLS];
|
|
65
|
+
float dE[ROWS][COLS];
|
|
83
66
|
|
|
84
67
|
// Populate the input matrix
|
|
85
68
|
printf("\n[srad] Populating the input matrix with random values"); fflush(stdout);
|
|
86
69
|
for (i=0; i<ROWS; i++) {
|
|
87
70
|
for (j=0; j<COLS; j++) {
|
|
88
71
|
temp_value = rand()/(float)RAND_MAX;
|
|
89
|
-
values[i
|
|
72
|
+
values[i][j] = (float)exp(temp_value);
|
|
90
73
|
}
|
|
91
74
|
}
|
|
92
75
|
|
|
@@ -99,7 +82,7 @@ int main(void) {
|
|
|
99
82
|
sum2 = 0;
|
|
100
83
|
for (i=R1; i<=R2; i++) {
|
|
101
84
|
for (j=C1; j<=C2; j++) {
|
|
102
|
-
temp_value = values[i
|
|
85
|
+
temp_value = values[i][j];
|
|
103
86
|
sum1 += temp_value;
|
|
104
87
|
sum2 += temp_value*temp_value;
|
|
105
88
|
}
|
|
@@ -108,61 +91,69 @@ int main(void) {
|
|
|
108
91
|
var_roi = (sum2/size_roi) - mean_roi*mean_roi;
|
|
109
92
|
q0s = var_roi / (mean_roi*mean_roi);
|
|
110
93
|
|
|
111
|
-
// Iterate over the full image and compute
|
|
112
94
|
#pragma scop
|
|
95
|
+
// Iterate over the full image and computeΩ
|
|
113
96
|
for (i=0; i<ROWS; i++) {
|
|
114
97
|
for (j=0; j<COLS; j++) {
|
|
115
|
-
|
|
116
|
-
current_value = values[
|
|
98
|
+
|
|
99
|
+
current_value = values[i][j];
|
|
100
|
+
|
|
101
|
+
// Temporary variables
|
|
102
|
+
float valN = 0;
|
|
103
|
+
float valS = 0;
|
|
104
|
+
float valW = 0;
|
|
105
|
+
float valE = 0;
|
|
117
106
|
|
|
118
107
|
// Compute the directional derivates (N,S,W,E)
|
|
119
|
-
if (i
|
|
120
|
-
|
|
121
|
-
if (
|
|
122
|
-
|
|
123
|
-
if (j==0) { dW[index] = 0; }
|
|
124
|
-
else { dW[index] = values[i *COLS + (j-1)] - current_value; }
|
|
125
|
-
if (j==COLS-1) { dE[index] = 0; }
|
|
126
|
-
else { dE[index] = values[i *COLS + (j+1)] - current_value; }
|
|
108
|
+
if (i > 0) { valN = values[i-1][j ] - current_value; }
|
|
109
|
+
if (i < ROWS-1) { valS = values[i+1][j ] - current_value; }
|
|
110
|
+
if (j > 0) { valW = values[i ][j-1] - current_value; }
|
|
111
|
+
if (j < COLS-1) { valE = values[i ][j+1] - current_value; }
|
|
127
112
|
|
|
128
113
|
// Compute the instantaneous coefficient of variation (qs) (equation 35)
|
|
129
|
-
G2 = (
|
|
130
|
-
L = (
|
|
114
|
+
G2 = (valN*valN + valS*valS + valW*valW + valE*valE) / (current_value*current_value);
|
|
115
|
+
L = (valN + valS + valW + valE ) / (current_value );
|
|
131
116
|
temp_a = (0.5*G2)-((1.0/16.0)*(L*L));
|
|
132
117
|
temp_b = 1+(0.25*L);
|
|
133
118
|
qs = temp_a/(temp_b*temp_b);
|
|
134
119
|
|
|
120
|
+
// Write the data
|
|
121
|
+
dN[i][j] = valN;
|
|
122
|
+
dS[i][j] = valS;
|
|
123
|
+
dW[i][j] = valW;
|
|
124
|
+
dE[i][j] = valE;
|
|
125
|
+
|
|
135
126
|
// Set the diffusion coefficent (equation 33)
|
|
136
|
-
|
|
127
|
+
float val = 1.0 / (1.0+( (qs-q0s)/(q0s*(1+q0s)) ));
|
|
137
128
|
|
|
138
129
|
// Saturate the diffusion coefficent
|
|
139
|
-
if (
|
|
140
|
-
|
|
130
|
+
if (val < 0) {
|
|
131
|
+
val = 0;
|
|
141
132
|
}
|
|
142
|
-
else if (
|
|
143
|
-
|
|
133
|
+
else if (val > 1) {
|
|
134
|
+
val = 1;
|
|
144
135
|
}
|
|
136
|
+
coefficent[i][j] = val;
|
|
145
137
|
}
|
|
146
138
|
}
|
|
147
|
-
|
|
139
|
+
|
|
148
140
|
// Iterate over the full image again and compute the final values
|
|
149
141
|
for (i=0; i<ROWS; i++) {
|
|
150
142
|
for (j=0; j<COLS; j++) {
|
|
151
|
-
index = i*COLS+j;
|
|
152
143
|
|
|
153
144
|
// Calculate the diffusion coefficent
|
|
154
|
-
cN = coefficent[i
|
|
145
|
+
cN = coefficent[i ][j ];
|
|
155
146
|
if (i==ROWS-1) { cS = 0; }
|
|
156
|
-
else { cS = coefficent[
|
|
157
|
-
cW = coefficent[i
|
|
147
|
+
else { cS = coefficent[i+1][j ]; }
|
|
148
|
+
cW = coefficent[i ][j ];
|
|
158
149
|
if (j==COLS-1) { cE = 0; }
|
|
159
|
-
else { cE = coefficent[i
|
|
150
|
+
else { cE = coefficent[i ][j+1]; }
|
|
160
151
|
|
|
161
152
|
// Calculate the divergence (equation 58)
|
|
162
|
-
divergence = cN*dN[
|
|
153
|
+
divergence = cN*dN[i][j] + cS*dS[i][j] + cW*dW[i][j] + cE*dE[i][j];
|
|
163
154
|
|
|
164
155
|
// Update the image accordingly (equation 61)
|
|
165
|
-
values[
|
|
156
|
+
values[i][j] = values[i][j] + 0.25*LAMBDA*divergence;
|
|
166
157
|
}
|
|
167
158
|
}
|
|
168
159
|
#pragma endscop
|
|
@@ -172,15 +163,15 @@ int main(void) {
|
|
|
172
163
|
printf("\n[srad] Printing the output matrix:\n\n"); fflush(stdout);
|
|
173
164
|
for (i=0; i<ROWS; i++) {
|
|
174
165
|
for (j=0; j<COLS; j++) {
|
|
175
|
-
|
|
166
|
+
if (i == 5 && j == 5) {
|
|
167
|
+
printf("%.5f ", values[i][j]);
|
|
168
|
+
}
|
|
176
169
|
}
|
|
177
|
-
printf("\n");
|
|
170
|
+
//printf("\n");
|
|
178
171
|
}
|
|
179
172
|
|
|
180
173
|
// Clean-up and exit
|
|
181
|
-
printf("\n[srad] Completed\n\n");
|
|
182
|
-
free(values); free(coefficent);
|
|
183
|
-
free(dN); free(dS); free(dW); free(dE);
|
|
174
|
+
printf("\n[srad] Completed\n\n");
|
|
184
175
|
fflush(stdout);
|
|
185
176
|
return 0;
|
|
186
177
|
}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
data/examples/chunk/example01.c
CHANGED
|
@@ -8,14 +8,14 @@
|
|
|
8
8
|
// Web address........http://parse.ele.tue.nl/bones/
|
|
9
9
|
//
|
|
10
10
|
// == File information
|
|
11
|
-
// Filename...........chunk/
|
|
11
|
+
// Filename...........chunk/example01.c
|
|
12
12
|
// Author.............Cedric Nugteren
|
|
13
|
-
// Last modified on...
|
|
13
|
+
// Last modified on...10-October-2014
|
|
14
14
|
//
|
|
15
15
|
|
|
16
16
|
#include <stdio.h>
|
|
17
17
|
|
|
18
|
-
// This is '
|
|
18
|
+
// This is 'example01', a basic chunk to element example using a 2D tile
|
|
19
19
|
int main(void) {
|
|
20
20
|
int i,j;
|
|
21
21
|
int i2,j2;
|
|
@@ -33,7 +33,8 @@ int main(void) {
|
|
|
33
33
|
}
|
|
34
34
|
|
|
35
35
|
// Perform the computation
|
|
36
|
-
#pragma
|
|
36
|
+
#pragma scop
|
|
37
|
+
#pragma species kernel A[0:559,0:31]|chunk(0:9,0:1) -> B[0:55,0:15]|element
|
|
37
38
|
for(i=0;i<56;i++) {
|
|
38
39
|
for(j=0;j<16;j++) {
|
|
39
40
|
result = 0;
|
|
@@ -46,6 +47,7 @@ int main(void) {
|
|
|
46
47
|
}
|
|
47
48
|
}
|
|
48
49
|
#pragma species endkernel example1
|
|
50
|
+
#pragma endscop
|
|
49
51
|
|
|
50
52
|
// Clean-up and exit the function
|
|
51
53
|
fflush(stdout);
|