diff --git a/CHANGES b/CHANGES index 4945e6b..9cad821 100644 --- a/CHANGES +++ b/CHANGES @@ -1,3 +1,5 @@ +* 2017.08.13 * added --shared_solution_cid= (-Ocid-uid1-uid2) to reuse shared solutions in program pipelines + * 2017.07.30 * added prepare_table_with_results program (generate HTML and Tex with optimization results - useful for interactive optimization reports) diff --git a/demo/run-program-pipeline-susan/run-specific-solution.bat b/demo/run-program-pipeline-susan/run-specific-solution.bat new file mode 100644 index 0000000..0713583 --- /dev/null +++ b/demo/run-program-pipeline-susan/run-specific-solution.bat @@ -0,0 +1,5 @@ +rem Grigori Fursin prepared these low-level scripts for RPi3 autotuning and crowd-tuning + +ck benchmark program:cbench-automotive-susan --target_os=mingw-64 ^ + --cmd_key=corners --quiet --repeat=100 --dataset_uoa=image-pgm-0001 ^ + --shared_solution_cid=27bc42ee449e880e:4863a4eb1b1f3f36-8289e0cf24346aa7-e816666622cdc04a diff --git a/demo/run-program-pipeline-susan/run-specific-solution.sh b/demo/run-program-pipeline-susan/run-specific-solution.sh new file mode 100644 index 0000000..688b963 --- /dev/null +++ b/demo/run-program-pipeline-susan/run-specific-solution.sh @@ -0,0 +1,5 @@ +# Grigori Fursin prepared these low-level scripts for RPi3 autotuning and crowd-tuning + +ck benchmark program:cbench-automotive-susan \ + --cmd_key=corners --quiet --repeat=100 --dataset_uoa=image-pgm-0001 \ + --shared_solution_cid=27bc42ee449e880e:4863a4eb1b1f3f36-8289e0cf24346aa7-e816666622cdc04a diff --git a/demo/run-program-pipeline-susan/run-specific-solution2.bat b/demo/run-program-pipeline-susan/run-specific-solution2.bat new file mode 100644 index 0000000..088ced1 --- /dev/null +++ b/demo/run-program-pipeline-susan/run-specific-solution2.bat @@ -0,0 +1,5 @@ +rem Grigori Fursin prepared these low-level scripts for RPi3 autotuning and crowd-tuning + +ck benchmark program:cbench-automotive-susan --target_os=mingw-64 ^ + --cmd_key=corners --quiet --repeat=100 --dataset_uoa=image-pgm-0001 ^ + -O27bc42ee449e880e:4863a4eb1b1f3f36-8289e0cf24346aa7-e816666622cdc04a diff --git a/demo/run-program-pipeline-susan/run-specific-solution2.sh b/demo/run-program-pipeline-susan/run-specific-solution2.sh new file mode 100644 index 0000000..d785dc5 --- /dev/null +++ b/demo/run-program-pipeline-susan/run-specific-solution2.sh @@ -0,0 +1,5 @@ +rem Grigori Fursin prepared these low-level scripts for RPi3 autotuning and crowd-tuning + +ck benchmark program:cbench-automotive-susan \ + --cmd_key=corners --quiet --repeat=100 --dataset_uoa=image-pgm-0001 \ + -O27bc42ee449e880e:4863a4eb1b1f3f36-8289e0cf24346aa7-e816666622cdc04a diff --git a/module/program/module.py b/module/program/module.py index 85ea566..60c8a0b 100644 --- a/module/program/module.py +++ b/module/program/module.py @@ -3263,6 +3263,14 @@ def pipeline(i): (skip_best_base_flag) - if 'yes', do not use best base flag (useful for exploration of other levels -O2,-O1,etc) (env_speed) - use environment flag for best optimization (CK_OPT_SPEED) + (shared_solution_cid) - CID-UID1-UID2 of the shared optimization solution at cKnowledge.org/repo + You can find it by clicking on a "Copy CID to clipboard" button of a given solution. + See example at http://cknowledge.org/repo/web.php?wcid=8289e0cf24346aa7:79bca2b76876b5c6 + 27bc42ee449e880e:79bca2b76876b5c6-8289e0cf24346aa7-f49649288ab0accd + + (Ocid-uid1-uid2) Substituting compiler -Ox levels with shared solutions in above format + (-O27bc42ee449e880e:79bca2b76876b5c6-8289e0cf24346aa7-f49649288ab0accd) + (select_best_base_flag_for_first_iteration) - if 'yes' and autotuning_iteration=0 @@ -4482,6 +4490,82 @@ def pipeline(i): # env=ck.get_from_dicts(i,'env',{},choices) + ############################################################################################################### + # PIPELINE SECTION: Check remote solution + for k in i: + if k.startswith('O'): + i['shared_solution_cid']=k[1:] + del(i[k]) + break + scid=ck.get_from_dicts(i, 'shared_solution_cid', '', choices) + + if scid!='': + if o=='con': + ck.out(sep) + ck.out('Attempting to load shared solution ('+scid+') ...') + ck.out('') + + xsuid1='' + xsuid2='' + j=scid.find('-') + if j>0: + xscid=scid[j+1:].split('-') + xsuid1=xscid[0] + if len(xscid)>1: + xsuid2=xscid[1] + + scid=scid[:j] + + rx=ck.parse_cid({'cid':scid}) + if rx['return']>0: return rx + + xsruoa=rx.get('repo_uoa','') + xsmuoa=rx.get('module_uoa','') + xsduoa=rx.get('data_uoa','') + + if xsruoa=='': xsruoa=ck.cfg['default_exchange_repo_uoa'] + + ii={'action':'get', + 'module_uoa':xsmuoa, + 'repo_uoa':xsruoa, + 'scenario_module_uoa':xsuid1, + 'solution_uid':xsuid2, + 'data_uoa':xsduoa} + rz=ck.access(ii) + if rz['return']>0: return rz + + sols=rz['solutions'] + + if len(sols)==0: + return {'return':1, 'error':'no shared solutions found'} + + if len(sols)>1: + return {'return':1, 'error':'ambiguity - more than 1 shared solution found'} + + xsp=sols[0].get('points',[]) + + if len(xsp)==0: + return {'return':1, 'error':'no optimization points found in a shared solution'} + + if len(xsp)>1: + return {'return':1, 'error':'ambiguity - more than 1 optimization point found in a shared solution'} + + xpruned_choices=xsp[0].get('pruned_choices',{}) + xpruned_choices_order=xsp[0].get('pruned_choices_order',[]) + + # Rebuild choices! + for k in xpruned_choices_order: + if k in xpruned_choices: + if k not in choices_order: + choices_order.append(k) + v=xpruned_choices[k] + + rx=ck.set_by_flat_key({'dict':choices, 'key':k, 'value':v}) + if rx['return']>0: return rx + + ck.out('') + ck.out('Successfully pre-loaded solution choices and orders to program pipeline!') + ############################################################################################################### # Pipeline ready for compile/run i['ready']='yes' @@ -4489,7 +4573,6 @@ def pipeline(i): return finalize_pipeline(i) ############################################################################################################### - # Restore compiler flag selection with order for optimization reordering (!) # Simplified - needs to be improved for more complex cases (dict of dict) compiler_flags=ck.get_from_dicts(i, 'compiler_flags', {}, choices)