Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
added program template demonstrating how to validate numerical output…
… with threshold!
- Loading branch information
Showing
13 changed files
with
261 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
890074521935414f |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
icc-15.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
{ | ||
"all_compiler_flags_desc": { | ||
"##base_opt": { | ||
"choice": [ | ||
"-O3", | ||
"-fast", | ||
"-O0", | ||
"-O1", | ||
"-O2", | ||
"-Os" | ||
], | ||
"default": "", | ||
"desc": "base compiler flag", | ||
"sort": 10000, | ||
"tags": [ | ||
"base", | ||
"basic", | ||
"optimization" | ||
], | ||
"type": "text" | ||
}, | ||
"##global_loop_unrolling": { | ||
"can_omit": "yes", | ||
"default": "", | ||
"desc": "compiler flag: -Qunroll", | ||
"explore_prefix": "-Qunroll", | ||
"explore_start": 1, | ||
"explore_step": 1, | ||
"explore_stop": 32, | ||
"sort": 10100, | ||
"tags": [ | ||
"basic", | ||
"optimization" | ||
], | ||
"type": "integer" | ||
}, | ||
"##openmp": { | ||
"can_omit": "yes", | ||
"choice": [ | ||
"-openmp", | ||
"" | ||
], | ||
"default": "", | ||
"desc": "compiler flag: openmp", | ||
"sort": 10001, | ||
"tags": [ | ||
"basic", | ||
"openmp", | ||
"optimization" | ||
], | ||
"type": "text" | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
{ | ||
"backup_data_uid": "890074521935414f", | ||
"backup_module_uid": "36ebc331048475bb", | ||
"backup_module_uoa": "compiler", | ||
"cm_outdated": { | ||
"cm_access_control": { | ||
"comments_groups": "admin", | ||
"read_groups": "all", | ||
"write_groups": "owner" | ||
}, | ||
"powered_by": { | ||
"name": "Collective Mind Engine", | ||
"version": "1.0.1977.beta" | ||
} | ||
}, | ||
"control": { | ||
"author_uoa": "74c2480dcec9e85d", | ||
"engine": "CM", | ||
"iso_datetime": "2017-10-11T16:56:43.931214", | ||
"version": [ | ||
"1", | ||
"9", | ||
"2", | ||
"1" | ||
] | ||
}, | ||
"data_name": "icc-15.0", | ||
"description": "" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
{ | ||
"tags": [ | ||
"compiler", | ||
"icc", | ||
"v15", | ||
"v15.0", | ||
"auto" | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
08ef407b9ce82e10 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
template-hello-world-c-output-validation |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
{} |
21 changes: 21 additions & 0 deletions
21
program/template-hello-world-c-output-validation/.cm/info.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
{ | ||
"backup_data_uid": "08ef407b9ce82e10", | ||
"backup_module_uid": "b0ac08fe1d3c2615", | ||
"backup_module_uoa": "program", | ||
"control": { | ||
"author": "Grigori Fursin", | ||
"author_email": "Grigori.Fursin@cTuning.org", | ||
"author_webpage": "http://fursin.net", | ||
"copyright": "See CK COPYRIGHT.txt for copyright details", | ||
"engine": "CK", | ||
"iso_datetime": "2018-05-25T14:56:27.497199", | ||
"license": "See CK LICENSE.txt for licensing details", | ||
"version": [ | ||
"1", | ||
"9", | ||
"4", | ||
"1" | ||
] | ||
}, | ||
"data_name": "C program \"Hello world\" with output validation" | ||
} |
58 changes: 58 additions & 0 deletions
58
program/template-hello-world-c-output-validation/.cm/meta.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
{ | ||
"backup_data_uid": "08ef407b9ce82e10", | ||
"build_compiler_vars": {}, | ||
"compile_deps": { | ||
"compiler": { | ||
"local": "yes", | ||
"name": "C compiler", | ||
"tags": "compiler,lang-c" | ||
} | ||
}, | ||
"compiler_env": "CK_CC", | ||
"data_name": "template-hello-world-c-output-validation", | ||
"extra_ld_vars": "$<<CK_EXTRA_LIB_M>>$", | ||
"main_language": "c", | ||
"print_files_after_run": [ | ||
"stderr.log", | ||
"stdout.log" | ||
], | ||
"process_in_tmp": "yes", | ||
"program": "yes", | ||
"run_cmds": { | ||
"default": { | ||
"ignore_return_code": "no", | ||
"run_time": { | ||
"output_invariant_of_repeat": "yes", | ||
"post_process_via_ck": { | ||
"script_name": "process" | ||
}, | ||
"run_cmd_main": "$#BIN_FILE#$ \"$#src_path#$\"", | ||
"run_cmd_out1": "stdout.log", | ||
"run_cmd_out2": "stderr.log", | ||
"run_correctness_output_files": [ | ||
"tmp-ck-output.json" | ||
], | ||
"run_output_files": [ | ||
"tmp-ck-output.json", | ||
"stdout.log", | ||
"stderr.log" | ||
] | ||
} | ||
} | ||
}, | ||
"run_vars": { | ||
"CK_ABS_DIFF_THRESHOLD": 0.1, | ||
"CK_VAR1": 123, | ||
"CK_VAR2": 666 | ||
}, | ||
"source_files": [ | ||
"hello-world.c" | ||
], | ||
"tags": [ | ||
"template", | ||
"program", | ||
"lang-c" | ||
], | ||
"target_file": "a", | ||
"template": "yes" | ||
} |
36 changes: 36 additions & 0 deletions
36
program/template-hello-world-c-output-validation/hello-world.c
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
/* | ||
CK program template | ||
See CK LICENSE.txt for licensing details | ||
See CK COPYRIGHT.txt for copyright details | ||
Developer: Grigori Fursin, 2018, Grigori.Fursin@cTuning.org, http://fursin.net | ||
*/ | ||
|
||
#include <stdio.h> | ||
#include <stdlib.h> | ||
|
||
int main(int argc, char* argv[]) | ||
{ | ||
char* env; | ||
FILE* f; | ||
|
||
printf("Hello world!\n\n"); | ||
|
||
env=getenv("CK_VAR1"); | ||
if (env!=NULL) { | ||
printf("CK_VAR1=%s\n",env); | ||
|
||
f=fopen("tmp-ck-output.json","w"); | ||
fprintf(f, "[%s]\n",env); | ||
fclose(f); | ||
} | ||
|
||
env=getenv("CK_VAR2"); | ||
if (env!=NULL) { | ||
printf("CK_VAR2=%s\n",env); | ||
} | ||
|
||
return 0; | ||
} |
43 changes: 43 additions & 0 deletions
43
program/template-hello-world-c-output-validation/process.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
# | ||
# Postprocessing CK template demo | ||
# | ||
# See CK LICENSE.txt for licensing details | ||
# See CK COPYRIGHT.txt for copyright details | ||
# | ||
# Developer: Grigori Fursin, 2018, Grigori.Fursin@cTuning.org, http://fursin.net | ||
# | ||
|
||
import json | ||
import os | ||
import re | ||
import sys | ||
|
||
def ck_postprocess(i): | ||
|
||
ck=i['ck_kernel'] | ||
rt=i['run_time'] | ||
deps=i['deps'] | ||
|
||
d={} | ||
|
||
env=i.get('env',{}) | ||
|
||
return {'return':0} | ||
|
||
# Check output with a reference one (can check numerical stability) | ||
|
||
def ck_check_output(i): | ||
ck=i['ck_kernel'] | ||
|
||
env=i.get('env',{}) | ||
|
||
r=ck.access({'action':'check_numerical', | ||
'module_uoa':'program.output', | ||
'file1':i['file1'], | ||
'file2':i['file2'], | ||
'abs_threshold':env.get('CK_ABS_DIFF_THRESHOLD','')}) | ||
return r | ||
|
||
# Do not add anything here! | ||
|
||
# Do not add anything here! |