Skip to content

About

Use Polybench to Test the Result of Optimization

Resources

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

-----------------------
* Available benchmarks:
-----------------------

See utilities/benchmark_list for paths to each files.
See doc/polybench.pdf for detailed description of the algorithms.



------------------------------
* Sample compilation commands:
------------------------------

   To compile a benchmark without any monitoring:
-------------------------------------------------
直接运行算子
$> gcc -I utilities -I linear-algebra/kernels/atax utilities/polybench.c linear-algebra/kernels/atax/atax.c -o atax_base


   To compile a benchmark with execution time reporting:
--------------------------------------------------------
运行算子后反馈时间
$> gcc -O3 -I utilities -I linear-algebra/kernels/atax utilities/polybench.c linear-algebra/kernels/atax/atax.c -DPOLYBENCH_TIME -o atax_time


   To generate the reference output of a benchmark:
---------------------------------------------------
运行算子后反馈输出
$> gcc -O0 -I utilities -I linear-algebra/kernels/atax utilities/polybench.c linear-algebra/kernels/atax/atax.c -DPOLYBENCH_DUMP_ARRAYS -o atax_ref
$> ./atax_ref 2>atax_ref.out



-------------------------
* Some available options:
-------------------------

They are all passed as macro definitions during compilation time (e.g,
-Dname_of_the_option).

   Typical options:
-------------------
反馈时间
- POLYBENCH_TIME: output execution time (gettimeofday) [default: off]
指定数据集大小
- MINI_DATASET, SMALL_DATASET, MEDIUM_DATASET, LARGE_DATASET,
  EXTRALARGE_DATASET: set the dataset size to be used
  [default: STANDARD_DATASET]
指定数据输出
- POLYBENCH_DUMP_ARRAYS: dump all live-out arrays on stderr [default: off]
指定用栈进行空间分配
- POLYBENCH_STACK_ARRAYS: use stack allocation instead of malloc [default: off]

可以产生更好性能表现的选项
   Options that may lead to better performance:
-----------------------------------------------
使用 restrict 关键字,以允许编译器假定不存在(指针)别名
- POLYBENCH_USE_RESTRICT: Use restrict keyword to allow compilers to
  assume absence of aliasing. [default: off]
使用标量循环边界(即编译时常量),而非参数化循环边界。[默认: 关闭]
- POLYBENCH_USE_SCALAR_LB: Use scalar loop bounds instead of parametric ones.
  [default: off]
为所有数组的每一个维度填充(Pad)指定数量的元素。[默认: 0]
- POLYBENCH_PADDING_FACTOR: Pad all dimensions of all arrays by this
  value [default: 0]
在堆上分配的多个Polybench数组之间,增加一个偏移量(其值是指定因子的倍数)。[默认: 0]
- POLYBENCH_INTER_ARRAY_PADDING_FACTOR: Offset the starting address of
  polybench arrays allocated on the heap (default) by a multiple of
  this value [default: 0]
为函数使用标准的C99原型(Prototype)。[默认: 关闭]
- POLYBENCH_USE_C99_PROTO: Use standard C99 prototype for the functions.
  [default: off]

计时/性能分析选项
   Timing/profiling options:
----------------------------
开启PAPI计时(详见下文)。
- POLYBENCH_PAPI: turn on papi timing (see below).
用于冲刷(flush)的缓存大小,单位为KB [默认: 33MB]。
- POLYBENCH_CACHE_SIZE_KB: cache size to flush, in kB [default: 33MB]
在调用计时器前,不要冲刷缓存 [默认: 冲刷缓存]。
- POLYBENCH_NO_FLUSH_CACHE: don't flush the cache before calling the
  timer [default: flush the cache]
使用时间戳计数器(Time Stamp Counter)来监控内核的执行时间 [默认: 关闭]。
- POLYBENCH_CYCLE_ACCURATE_TIMER: Use Time Stamp Counter to monitor
  the execution time of the kernel [default: off]
 为内核执行使用FIFO实时调度器。该程序必须以root身份运行,仅限Linux系统,且需链接 -lc 库 [默认: 关闭]。
- POLYBENCH_LINUX_FIFO_SCHEDULER: use FIFO real-time scheduler for the
  kernel execution, the program must be run as root, under linux only,
  and compiled with -lc [default: off]



---------------
* PAPI support:
---------------

   To compile a benchmark with PAPI support:
--------------------------------------------

$> gcc -O3 -I utilities -I linear-algebra/kernels/atax utilities/polybench.c linear-algebra/kernels/atax/atax.c -DPOLYBENCH_PAPI -lpapi -o atax_papi


   To specify which counter(s) to monitor:
------------------------------------------

Edit utilities/papi_counters.list, and add 1 line per event to
monitor. Each line (including the last one) must finish with a ',' and
both native and standard events are supported.

The whole kernel is run one time per counter (no multiplexing) and
there is no sampling being used for the counter value.

如何指定要监控的一个或多个计数器:
编辑 utilities/papi_counters.list 文件,每行添加一个您希望监控的事件。每一行(包括最后一行)都必须以逗号(,)结尾。支持原生事件(native events)和标准事件(standard events)。

整个内核(kernel)会为每一个计数器完整地运行一次(不使用多路复用技术),并且计数器的值是直接读取的,不使用采样技术。

------------------------------
* Accurate performance timing:
------------------------------
自动进行时间测量的脚本(还有偏差校准),要求必须先使用-DPOLYBENCH_TIME标识编译
With kernels that have an execution time in the orders of a few tens
of milliseconds, it is critical to validate any performance number by
repeating several times the experiment. A companion script is
available to perform reasonable performance measurement of a PolyBench.

$> gcc -O3 -I utilities -I linear-algebra/kernels/atax utilities/polybench.c linear-algebra/kernels/atax/atax.c -DPOLYBENCH_TIME -o atax_time
$> ./utilities/time_benchmark.sh ./atax_time

This script will run five times the benchmark (that must be a
PolyBench compiled with -DPOLYBENCH_TIME), eliminate the two extremal
times, and check that the deviation of the three remaining does not
exceed a given threshold, set to 5%.

It is also possible to use POLYBENCH_CYCLE_ACCURATE_TIMER to use the
Time Stamp Counter instead of gettimeofday() to monitor the number of
elapsed cycles.



----------------------------------------
* Generating macro-free benchmark suite:
----------------------------------------
生成没有宏定义的基准套件
批量地将整个Polybench测试套件的所有源文件,转换成独立的、已展开所有宏的 .preproc.c 文件。
(from the root of the archive:)
$> PARGS="-I utilities -DPOLYBENCH_TIME";
$> for i in `cat utilities/benchmark_list`; do perl utilities/create_cpped_version.pl $i "$PARGS"; done

This create for each benchmark file 'xxx.c' a new file
'xxx.preproc.c'. The PARGS variable in the above example can be set to
the desired configuration, for instance to create a full C99 version
(parametric arrays):

$> PARGS="-I utilities -DPOLYBENCH_USE_C99_PROTO";
$> for i in `cat utilities/benchmark_list`; do perl utilities/create_cpped_version.pl $i "$PARGS"; done



------------------
* Utility scripts:
------------------
create_cpped_version.pl: Used in the above for generating macro free version.

makefile-gen.pl: generates make files in each directory. Options are globally
                 configurable through config.mk at polybench root.
  header-gen.pl: refers to 'polybench.spec' file and generates header in
                 each directory. Allows default problem sizes and datatype to
                 be configured without going into each header file.

    run-all.pl: compiles and runs each kernel.
      clean.pl: runs make clean in each directory and then removes Makefile.

About

Use Polybench to Test the Result of Optimization

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages