Skip to content

Commit

Permalink
Release 3.3.0
Browse files Browse the repository at this point in the history
- Update HTML and TXT reports. Include table for optimization run.
- Add ratio field in eb_full_result_t.
- Add ratio field in python bindings.
  • Loading branch information
psyrykh committed May 14, 2024
1 parent ac4688d commit fa1df92
Show file tree
Hide file tree
Showing 8 changed files with 266 additions and 97 deletions.
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
3.1.0
3.3.0
2 changes: 1 addition & 1 deletion bin/src/app.c
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ void app_print_run_results(const eb_result_t result) {
printf("%-14s - %-6.*f", EB_RUN_TYPE_NAMES[run_type],
AUTO_PRECISION(result.full_result[EB_OPTIMIZATION_DISABLED].detailed[run_type].score));
if (run_type != EB_RUN_TYPE_SINGLE_CORE) {
printf(" (ratio x%.1f)", result.full_result[EB_OPTIMIZATION_DISABLED].detailed[run_type].ratio);
printf(" (MP ratio x%.1f)", result.full_result[EB_OPTIMIZATION_DISABLED].detailed[run_type].ratio);
}
printf("\n");
}
Expand Down
36 changes: 24 additions & 12 deletions bindings/python/evolution_benchmark.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -20,18 +20,16 @@
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.


'''This is the python module for interfacing with lfk-mp-benchmark.
'''This is the python module for interfacing with evolution-benchmark.
Usage::
import lfkbenchmark
benchmark = lfkbenchmark.lfk_benchmark()
import evolution_benchmark
benchmark = evolution_benchmark.Benchmark()
benchmark.console_run_benchmark()
Repository: https://github.com/waverian/py-lfk-mp-benchmark
For details of the C module look at https://github.com/waverian/lfk-mp-benchmark
Repository: https://github.com/waverian/evolution-benchmark
'''

cython: language_level=3
Expand Down Expand Up @@ -115,12 +113,16 @@ cdef extern from "waverian/evolution_benchmark/types.h":

ctypedef struct eb_full_result_t:
double score
double optimized_ratio

eb_run_result_t detailed[5]

ctypedef struct eb_result_t:
eb_system_info_t system_info

char timestamp[32]
char comment[128]

eb_full_result_t full_result[2]

cdef extern from "waverian/evolution_benchmark.h":
Expand Down Expand Up @@ -185,7 +187,7 @@ cdef class Result():


cdef class Benchmark:
'''Wrapper around the lfkbenchmark module.
'''Wrapper around the evolution-benchmark module.
'''

cdef eb_handler_t handler
Expand All @@ -207,7 +209,7 @@ cdef class Benchmark:
return 0
return ret
#default callback
Logger.debug(f'LFKBenchmark: {progress}, {message}')
Logger.debug(f'EvolutionBenchmark: {progress}, {message}')
return 0

def __init__(self, *args, **kwargs):
Expand Down Expand Up @@ -241,7 +243,7 @@ cdef class Benchmark:
if workstation:
eb_set_execution_mode(self.handler, EB_EXECUTION_MODE_FULL_AUTO)

Logger.debug('LFKBenchmark: Setting up benchmark.')
Logger.debug('EvolutionBenchmark: Setting up benchmark.')

self.external_callback = callback

Expand All @@ -250,12 +252,12 @@ cdef class Benchmark:

eb_get_system_info(self.handler, &c_system_info)

Logger.debug('LFKBenchmark: Runing benchmark.')
Logger.debug('EvolutionBenchmark: Running benchmark.')
with nogil:
eb_run_benchmark(self.handler, &c_result)


Logger.debug('LFKBenchmark: Returning results.')
Logger.debug('EvolutionBenchmark: Returning results.')
result = Result()
result.init(c_result)
return result
Expand All @@ -273,4 +275,14 @@ cdef class Benchmark:
def get_parameters(self):
cdef eb_system_info_t system_info
eb_get_system_info(self.handler, &system_info)
return system_info

system_info_result = dict(system_info)
def fix_string(param):
for key, value in param.items():
if isinstance(value, dict):
fix_string(value)
elif isinstance(value, bytes):
param[key] = value.decode('utf-8')
fix_string(system_info_result)

return system_info_result
2 changes: 2 additions & 0 deletions lib/inc/waverian/evolution_benchmark/types.h
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,8 @@ typedef struct {

typedef struct {
double score;
double optimized_ratio;

eb_run_result_t detailed[EB_RUN_TYPE_SIZE];
} eb_full_result_t;

Expand Down
5 changes: 5 additions & 0 deletions lib/src/evolution_benchmark.c
Original file line number Diff line number Diff line change
Expand Up @@ -376,6 +376,11 @@ static void benchmark_fill_results(eb_handler_t handler, eb_result_t *result) {
}
}
}

// Calculate optimization ratio, skip disabled optimization
for (optimization = EB_OPTIMIZATION_DISABLED; optimization < EB_OPTIMIZATION_SIZE; optimization++) {
result->full_result[optimization].optimized_ratio = result->full_result[optimization].score / result->full_result[EB_OPTIMIZATION_DISABLED].score;
}
}

EB_ERROR_CODE_E
Expand Down
152 changes: 114 additions & 38 deletions lib/src/printers/html_generated.c
Original file line number Diff line number Diff line change
@@ -1,24 +1,27 @@

fprintf(
file_handler,
"\n<html xmlns=\"http://www.w3.org/1999/html\">\n<head>\n <title>Evolution Benchmark</title>\n "
"<style>\n body {\n font-family: system-ui, -apple-system, \"Segoe UI\", Roboto, \"Helvetica "
"Neue\", Arial, \"Noto Sans\", \"Liberation Sans\", sans-serif, \"Apple Color Emoji\", \"Segoe UI Emoji\", \"Segoe "
"UI Symbol\", \"Noto Color Emoji\"\n }\n\n .container {\n margin-left: auto;\n "
"margin-right: auto;\n min-width: 30em;\n max-width: 50em;\n text-align: "
"center;\n }\n\n .thin_font {\n font-weight: 300;\n margin: auto;\n "
"}\n\n .white_on_blue {\n background-color: #1e90ff;\n color: #f0f8ff;\n }\n\n "
" td {\n border: 1px solid #1e90ff;\n }\n\n h1 {\n font-size: 5em;\n "
" }\n\n h2 {\n font-size: 3em;\n }\n\n h3 {\n font-size: 1.8em;\n "
" }\n\n h4 {\n font-size: 1.2em;\n }\n\n .row_spacer {\n border: "
"none;\n height: 1.5em;\n }\n\n table {\n border-collapse: collapse;\n "
" border-width: 0;\n width: 100%%;\n text-align: left;\n }\n\n p {\n "
" text-align: left;\n }\n\n .logo {\n text-align: left;\n padding: 10px;\n "
" }\n\n .no_border {\n border: none;\n }\n\n .sub_result_div {\n "
"text-align: center;\n padding-bottom: 10px;\n }\n </style>\n</head>\n<body>\n<div "
"class=\"container\">\n <div class=\"logo white_on_blue\">\n <h3 class=\"thin_font\">Waverian "
"lib</h3>\n </div>\n <table class=\"table_info\">\n <thead></thead>\n "
"<tbody>\n <tr>\n <td>Version</td>\n <td colspan=\"4\">");
"\n<html xmlns=\"http://www.w3.org/1999/html\">\n<head>\n <title>Waverian Evolution benchmark "
"results</title>\n <style>\n body {\n font-family: system-ui, -apple-system, \"Segoe UI\", "
"Roboto, \"Helvetica Neue\", Arial, \"Noto Sans\", \"Liberation Sans\", sans-serif, \"Apple Color Emoji\", \"Segoe "
"UI Emoji\", \"Segoe UI Symbol\", \"Noto Color Emoji\"\n }\n\n .container {\n "
"margin-left: auto;\n margin-right: auto;\n min-width: 30em;\n max-width: 50em;\n "
" text-align: center;\n }\n\n .thin_font {\n font-weight: 300;\n "
"margin: auto;\n }\n\n .white_on_blue {\n background-color: #1e90ff;\n color: "
"#f0f8ff;\n }\n\n .white_on_grey {\n background-color: #909090;\n "
" color: #f0f8ff;\n }\n\n table.blue_border td{\n border: 1px "
"solid #1e90ff;\n }\n\n table.grey_border td{\n border: 1px solid #909090;\n "
"}\n\n h1 {\n font-size: 5em;\n }\n\n h2 {\n font-size: 3em;\n "
"}\n\n h3 {\n font-size: 1.8em;\n }\n\n h4 {\n font-size: 1.2em;\n "
" }\n\n .row_spacer {\n border: none;\n height: 1.5em;\n }\n\n table "
"{\n border-collapse: collapse;\n border-width: 0;\n width: 100%%;\n "
"text-align: left;\n }\n\n p {\n text-align: left;\n }\n\n .logo {\n "
" text-align: left;\n padding: 10px;\n }\n\n .no_border {\n border: none;\n "
" }\n\n .sub_result_div {\n text-align: center;\n padding-bottom: 10px;\n "
" }\n </style>\n</head>\n<body>\n<div class=\"container\">\n <div class=\"logo white_on_blue\">\n "
" <h3 class=\"thin_font\">Waverian Evolution benchmark</h3>\n </div>\n <table "
"class=\"blue_border\">\n <thead></thead>\n <tbody>\n <tr>\n "
" <td>Version</td>\n <td colspan=\"4\">");
fprintf(file_handler, "%s", result.system_info.version_info);
fprintf(
file_handler,
Expand All @@ -28,10 +31,9 @@ fprintf(file_handler,
"</td>\n </tr>\n <tr>\n <td>Compiler</td>\n <td "
"colspan=\"4\">");
fprintf(file_handler, "%s", result.system_info.compiler_info);
fprintf(
file_handler,
"</td>\n </tr>\n <tr>\n <td>Logical cores</td>\n <td "
"colspan=\"4\">");
fprintf(file_handler,
"</td>\n </tr>\n <tr>\n <td>Logical cores</td>\n "
" <td colspan=\"4\">");
fprintf(file_handler, "%i", result.core_count);
fprintf(file_handler,
"</td>\n </tr>\n <tr>\n <td>CPU name</td>\n <td "
Expand Down Expand Up @@ -70,10 +72,10 @@ if (result.full_result[EB_OPTIMIZATION_DISABLED].detailed[EB_RUN_TYPE_MULTI_CORE
}
fprintf(file_handler, "</h2>\n <h4 class=\"thin_font\">");
if (result.full_result[EB_OPTIMIZATION_DISABLED].detailed[EB_RUN_TYPE_MULTI_CORE].valid) {
fprintf(file_handler, "\n MP ratio x");
fprintf(file_handler, "%.1f", result.full_result[EB_OPTIMIZATION_DISABLED].detailed[EB_RUN_TYPE_MULTI_CORE].ratio);
fprintf(file_handler, " x ratio");
} else {
fprintf(file_handler, " -");
fprintf(file_handler, "-");
}
fprintf(
file_handler,
Expand All @@ -89,10 +91,10 @@ if (result.full_result[EB_OPTIMIZATION_DISABLED].detailed[EB_RUN_TYPE_QUAD_CORE]
}
fprintf(file_handler, "</h2>\n <h4 class=\"thin_font\">");
if (result.full_result[EB_OPTIMIZATION_DISABLED].detailed[EB_RUN_TYPE_QUAD_CORE].valid) {
fprintf(file_handler, "\n MP ratio x");
fprintf(file_handler, "%.1f", result.full_result[EB_OPTIMIZATION_DISABLED].detailed[EB_RUN_TYPE_QUAD_CORE].ratio);
fprintf(file_handler, " x ratio");
} else {
fprintf(file_handler, " -");
fprintf(file_handler, "-");
}
fprintf(file_handler,
"</h4>\n <h3 class=\"thin_font\">Quadcore</h3>\n "
Expand All @@ -107,15 +109,15 @@ if (result.full_result[EB_OPTIMIZATION_DISABLED].detailed[EB_RUN_TYPE_WORKSTATIO
}
fprintf(file_handler, "</h2>\n <h4 class=\"thin_font\">");
if (result.full_result[EB_OPTIMIZATION_DISABLED].detailed[EB_RUN_TYPE_WORKSTATION].valid) {
fprintf(file_handler, "\n MP ratio x");
fprintf(file_handler, "%.1f", result.full_result[EB_OPTIMIZATION_DISABLED].detailed[EB_RUN_TYPE_WORKSTATION].ratio);
fprintf(file_handler, " x ratio");
} else {
fprintf(file_handler, " -");
fprintf(file_handler, "-");
}
fprintf(file_handler,
"</h4>\n <h3 class=\"thin_font\">Workstation</h3>\n "
" </div>\n </td>\n </tr>\n "
" </table>\n </div>\n <div>\n <table>\n <tr "
" </table>\n </div>\n <div>\n <table class=\"blue_border\">\n <tr "
"class=\"row_spacer\"></tr>\n <tr class=\"white_on_blue\">\n "
"<td></td>\n <td><b>Non optimized</b></td>");
for (j = 0; j < EB_RUN_TYPE_SIZE; j++) {
Expand Down Expand Up @@ -200,21 +202,95 @@ for (i = 0; i < EB_KERNEL_COUNT; i++) {
}
fprintf(file_handler, "\n </tr>");
}
fprintf(file_handler, "\n </table>\n <p>\n Optimized score - ");
fprintf(file_handler,
"\n </table>\n\n <br>\n <div>\n <h2 class=\"thin_font\">");
if (result.full_result[EB_OPTIMIZATION_ENABLED].score) {
fprintf(file_handler, "%.*f", AUTO_PRECISION(result.full_result[EB_OPTIMIZATION_ENABLED].score));
} else {
fprintf(file_handler, "N/A");
}
fprintf(file_handler, "\n (");
if (result.full_result[EB_OPTIMIZATION_ENABLED].score && result.full_result[EB_OPTIMIZATION_DISABLED].score) {
fprintf(file_handler, "%.1f",
result.full_result[EB_OPTIMIZATION_ENABLED].score / result.full_result[EB_OPTIMIZATION_DISABLED].score);
fprintf(file_handler, " x optimized ratio)");
fprintf(file_handler, "\n </h2>\n <h4 class=\"thin_font\">");
if (result.full_result[EB_OPTIMIZATION_ENABLED].optimized_ratio) {
fprintf(file_handler, "\n Optimized ratio x");
fprintf(file_handler, "%.1f", result.full_result[EB_OPTIMIZATION_ENABLED].optimized_ratio);
}
fprintf(file_handler,
"\n </h4>\n <h3 class=\"thin_font\">Optimized score</h3>\n "
"</div>\n <br>\n <div>\n <table>\n "
"<tr>\n <td class=\"no_border\">\n "
" <div class=\"sub_result_div white_on_grey\">\n <h2 "
"class=\"thin_font\">");
if (result.full_result[EB_OPTIMIZATION_ENABLED].detailed[EB_RUN_TYPE_SINGLE_CORE].valid) {
fprintf(file_handler, "%.*f",
AUTO_PRECISION(result.full_result[EB_OPTIMIZATION_ENABLED].detailed[EB_RUN_TYPE_SINGLE_CORE].score));
} else {
fprintf(file_handler, "N/A");
}
fprintf(
file_handler,
"</h2>\n <h4 class=\"thin_font\">-</h4>\n "
" <h3 class=\"thin_font\">Singlecore</h3>\n "
" </div>\n </td>\n <td "
"class=\"no_border\">\n <div class=\"sub_result_div "
"white_on_grey\">\n <h2 class=\"thin_font\">");
if (result.full_result[EB_OPTIMIZATION_ENABLED].detailed[EB_RUN_TYPE_MULTI_CORE].valid) {
fprintf(file_handler, "%.*f",
AUTO_PRECISION(result.full_result[EB_OPTIMIZATION_ENABLED].detailed[EB_RUN_TYPE_MULTI_CORE].score));
} else {
fprintf(file_handler, "N/A");
}
fprintf(file_handler, "</h2>\n <h4 class=\"thin_font\">");
if (result.full_result[EB_OPTIMIZATION_ENABLED].detailed[EB_RUN_TYPE_MULTI_CORE].valid) {
fprintf(file_handler, "\n MP ratio x");
fprintf(file_handler, "%.1f", result.full_result[EB_OPTIMIZATION_ENABLED].detailed[EB_RUN_TYPE_MULTI_CORE].ratio);
} else {
fprintf(file_handler, "-");
}
fprintf(
file_handler,
"</h4>\n <h3 class=\"thin_font\">Multicore</h3>\n "
" </div>\n </td>\n "
" </tr>\n <tr>\n <td class=\"no_border\">\n "
" <div class=\"sub_result_div white_on_grey\">\n "
" <h2 class=\"thin_font\">");
if (result.full_result[EB_OPTIMIZATION_ENABLED].detailed[EB_RUN_TYPE_QUAD_CORE].valid) {
fprintf(file_handler, "%.*f",
AUTO_PRECISION(result.full_result[EB_OPTIMIZATION_ENABLED].detailed[EB_RUN_TYPE_QUAD_CORE].score));
} else {
fprintf(file_handler, "N/A");
}
fprintf(file_handler, "</h2>\n <h4 class=\"thin_font\">");
if (result.full_result[EB_OPTIMIZATION_ENABLED].detailed[EB_RUN_TYPE_QUAD_CORE].valid) {
fprintf(file_handler, "\n MP ratio x");
fprintf(file_handler, "%.1f", result.full_result[EB_OPTIMIZATION_ENABLED].detailed[EB_RUN_TYPE_QUAD_CORE].ratio);
} else {
fprintf(file_handler, "-");
}
fprintf(
file_handler,
"</h4>\n <h3 class=\"thin_font\">Quadcore</h3>\n "
" </div>\n </td>\n "
" <td class=\"no_border\">\n <div class=\"sub_result_div "
"white_on_grey\">\n <h2 class=\"thin_font\">");
if (result.full_result[EB_OPTIMIZATION_ENABLED].detailed[EB_RUN_TYPE_WORKSTATION].valid) {
fprintf(file_handler, "%.*f",
AUTO_PRECISION(result.full_result[EB_OPTIMIZATION_ENABLED].detailed[EB_RUN_TYPE_WORKSTATION].score));
} else {
fprintf(file_handler, "N/A");
}
fprintf(file_handler, "</h2>\n <h4 class=\"thin_font\">");
if (result.full_result[EB_OPTIMIZATION_ENABLED].detailed[EB_RUN_TYPE_WORKSTATION].valid) {
fprintf(file_handler, "\n MP ratio x");
fprintf(file_handler, "%.1f", result.full_result[EB_OPTIMIZATION_ENABLED].detailed[EB_RUN_TYPE_WORKSTATION].ratio);
} else {
fprintf(file_handler, "-");
}
fprintf(file_handler,
"\n </p>\n <table>\n <tr class=\"white_on_blue\">\n "
" <td></td>\n <td><b>Optimized</b></td>");
"</h4>\n <h3 "
"class=\"thin_font\">Workstation</h3>\n </div>\n "
" </td>\n </tr>\n </table>\n "
"</div>\n <table class=\"grey_border\">\n <tr class=\"white_on_grey\">\n "
" <td></td>\n <td><b>Optimized</b></td>");
for (j = 0; j < EB_RUN_TYPE_SIZE; j++) {
if (result.full_result[EB_OPTIMIZATION_ENABLED].detailed[j].valid) {
fprintf(file_handler, "\n <td>");
Expand Down Expand Up @@ -273,7 +349,7 @@ for (j = 0; j < EB_RUN_TYPE_SIZE; j++) {
}
}
fprintf(file_handler,
"\n </tr>\n\n <tr class=\"white_on_blue\">\n "
"\n </tr>\n\n <tr class=\"white_on_grey\">\n "
" <td>#</td>\n <td>Kernel name</td>");
for (j = 0; j < EB_RUN_TYPE_SIZE; j++) {
if (result.full_result[EB_OPTIMIZATION_DISABLED].detailed[j].valid) {
Expand Down

0 comments on commit fa1df92

Please sign in to comment.