diff --git a/sapfor/experts/Sapfor_2017/CMakeLists.txt b/sapfor/experts/Sapfor_2017/CMakeLists.txt index f62151f..d6c259b 100644 --- a/sapfor/experts/Sapfor_2017/CMakeLists.txt +++ b/sapfor/experts/Sapfor_2017/CMakeLists.txt @@ -285,7 +285,9 @@ set(EXPR_TRANSFORM _src/ExpressionTransform/control_flow_graph_part.cpp set(GR_CALL _src/GraphCall/graph_calls.cpp _src/GraphCall/graph_calls.h _src/GraphCall/graph_calls_base.cpp - _src/GraphCall/graph_calls_func.h) + _src/GraphCall/graph_calls_func.h + _src/GraphCall/select_array_conf.cpp + _src/GraphCall/select_array_conf.h) set(GR_LOOP _src/GraphLoop/graph_loops_base.cpp _src/GraphLoop/graph_loops.cpp diff --git a/sapfor/experts/Sapfor_2017/_src/GraphCall/select_array_conf.cpp b/sapfor/experts/Sapfor_2017/_src/GraphCall/select_array_conf.cpp new file mode 100644 index 0000000..6fddf28 Binary files /dev/null and b/sapfor/experts/Sapfor_2017/_src/GraphCall/select_array_conf.cpp differ diff --git a/sapfor/experts/Sapfor_2017/_src/GraphCall/select_array_conf.h b/sapfor/experts/Sapfor_2017/_src/GraphCall/select_array_conf.h new file mode 100644 index 0000000..4148698 Binary files /dev/null and b/sapfor/experts/Sapfor_2017/_src/GraphCall/select_array_conf.h differ diff --git a/sapfor/experts/Sapfor_2017/_src/Sapfor.cpp b/sapfor/experts/Sapfor_2017/_src/Sapfor.cpp index e5c58fd..4ec86e8 100644 --- a/sapfor/experts/Sapfor_2017/_src/Sapfor.cpp +++ b/sapfor/experts/Sapfor_2017/_src/Sapfor.cpp @@ -37,6 +37,7 @@ #include "LoopAnalyzer/loop_analyzer_nodist.h" #include "GraphCall/graph_calls_func.h" +#include "GraphCall/select_array_conf.h" #include "GraphLoop/graph_loops_func.h" #include "DynamicAnalysis/gCov_parser_func.h" #include "DynamicAnalysis/createParallelRegions.h" @@ -2174,6 +2175,11 @@ static bool runAnalysis(SgProject &project, const int curr_regime, const bool ne runPrivateVariableAnalysis(loopGraph, fullIR, commonBlocks, SPF_messages); else if (curr_regime == FIX_COMMON_BLOCKS) fixCommonBlocks(allFuncInfo, commonBlocks, &project); + else if (curr_regime == SELECT_ARRAY_DIM_CONF) { + map> localMessages; + + SelectArrayConfForParallelization(&project, allFuncInfo, loopGraph, createdDirectives, localMessages, arrayLinksByFuncCalls, parallelRegions); + } const float elapsed = duration_cast(high_resolution_clock::now() - timeForPass).count() / 1000.; const float elapsedGlobal = duration_cast(high_resolution_clock::now() - globalTime).count() / 1000.; @@ -2385,6 +2391,8 @@ void runPass(const int curr_regime, const char *proj_name, const char *folderNam case INSERT_PARALLEL_DIRS_NODIST: { + mpiProgram = 1; + string additionalName = (consoleMode && folderName == NULL) ? "__shared" : ""; runAnalysis(*project, INSERT_PARALLEL_DIRS_NODIST, false); @@ -2392,6 +2400,8 @@ void runPass(const int curr_regime, const char *proj_name, const char *folderNam runPass(REVERT_SUBST_EXPR_RD, proj_name, folderName); runPass(CONVERT_LOOP_TO_ASSIGN, proj_name, folderName); + + runPass(SELECT_ARRAY_DIM_CONF, proj_name, folderName); runAnalysis(*project, INSERT_PARALLEL_DIRS, false, consoleMode ? additionalName.c_str() : NULL, folderName); diff --git a/sapfor/experts/Sapfor_2017/_src/Sapfor.h b/sapfor/experts/Sapfor_2017/_src/Sapfor.h index 739bce9..4375adc 100644 --- a/sapfor/experts/Sapfor_2017/_src/Sapfor.h +++ b/sapfor/experts/Sapfor_2017/_src/Sapfor.h @@ -67,6 +67,7 @@ enum passes { CHECK_ARGS_DECL, FIND_FUNC_TO_INCLUDE, + SELECT_ARRAY_DIM_CONF, ONLY_ARRAY_GRAPH, PRIVATE_ANALYSIS_SPF, @@ -225,6 +226,7 @@ static void setPassValues() passNames[VERIFY_COMMON] = "VERIFY_COMMON"; passNames[VERIFY_OPERATORS] = "VERIFY_OPERATORS"; passNames[FIND_FUNC_TO_INCLUDE] = "FIND_FUNC_TO_INCLUDE"; + passNames[SELECT_ARRAY_DIM_CONF] = "SELECT_ARRAY_DIM_CONF"; passNames[CREATE_DISTR_DIRS] = "CREATE_DISTR_DIRS"; passNames[CREATE_PARALLEL_DIRS] = "CREATE_PARALLEL_DIRS"; passNames[INSERT_PARALLEL_DIRS] = "INSERT_PARALLEL_DIRS"; diff --git a/sapfor/experts/Sapfor_2017/_src/Utils/PassManager.h b/sapfor/experts/Sapfor_2017/_src/Utils/PassManager.h index 06fb0b6..de2cc9d 100644 --- a/sapfor/experts/Sapfor_2017/_src/Utils/PassManager.h +++ b/sapfor/experts/Sapfor_2017/_src/Utils/PassManager.h @@ -173,7 +173,9 @@ void InitPassesDependencies(map> &passDepsIn, set Pass(GET_ALL_ARRAY_DECL) <= Pass(CALL_GRAPH_IR); - Pass(LOOP_GRAPH) <= Pass(PRIVATE_CALL_GRAPH_STAGE3) <= Pass(PRIVATE_ANALYSIS_IR) <= list({ LOOP_ANALYZER_DATA_DIST_S0, LOOP_ANALYZER_DATA_DIST_S1, ONLY_ARRAY_GRAPH, LOOP_ANALYZER_ALIGNS, LOOP_ANALYZER_NODIST }); + Pass(LOOP_GRAPH) <= Pass(PRIVATE_CALL_GRAPH_STAGE3) <= list(FIND_FUNC_TO_INCLUDE, PRIVATE_ANALYSIS_IR) << list({ LOOP_ANALYZER_DATA_DIST_S0, LOOP_ANALYZER_DATA_DIST_S1, ONLY_ARRAY_GRAPH, LOOP_ANALYZER_ALIGNS }); + + Pass(PRIVATE_ANALYSIS_IR) <= Pass(LOOP_ANALYZER_NODIST); Pass(CORRECT_VAR_DECL) <= list({ VERIFY_DVM_DIRS, PREPROC_SPF, VERIFY_ENDDO, VERIFY_INCLUDE, PREPROC_ALLOCATES, CHECK_FUNC_TO_INCLUDE, FILL_PAR_REGIONS_LINES, CONVERT_ASSIGN_TO_LOOP, VERIFY_COMMON, VERIFY_EQUIVALENCE, PRINT_PAR_REGIONS_ERRORS, VERIFY_OPERATORS, VERIFY_FORMAT }) <= Pass(CODE_CHECKER_PASSES); @@ -203,7 +205,7 @@ void InitPassesDependencies(map> &passDepsIn, set list({ CORRECT_VAR_DECL, PREPROC_SPF }) << list({ LOOP_GRAPH, CALL_GRAPH, CALL_GRAPH2 }); - list({ PREPROC_SPF, CALL_GRAPH2 }) <= Pass(FILL_PAR_REGIONS_LINES) <= list({ EXPAND_EXTRACT_PAR_REGION, CHECK_FUNC_TO_INCLUDE, FIND_FUNC_TO_INCLUDE, CHECK_ARGS_DECL }); + list({ PREPROC_SPF, CALL_GRAPH2 }) <= Pass(FILL_PAR_REGIONS_LINES) <= list({ EXPAND_EXTRACT_PAR_REGION, CHECK_FUNC_TO_INCLUDE, FIND_FUNC_TO_INCLUDE, CHECK_ARGS_DECL, SELECT_ARRAY_DIM_CONF}); list({ PREPROC_SPF, CALL_GRAPH2, FILL_PAR_REGIONS_LINES }) <= Pass(FILL_PAR_REGIONS) <= Pass(RESOLVE_PAR_REGIONS); @@ -237,7 +239,7 @@ void InitPassesDependencies(map> &passDepsIn, set list({ GCOV_PARSER, CREATE_INTER_TREE, CALL_GRAPH, CALL_GRAPH2 }) <= Pass(CREATE_PARALLEL_REGIONS); - list({ PRIVATE_CALL_GRAPH_STAGE1, PRIVATE_CALL_GRAPH_STAGE2, MACRO_EXPANSION, CONVERT_ASSIGN_TO_LOOP, DEF_USE_STAGE1, DEF_USE_STAGE2, LOOP_GRAPH, CALL_GRAPH, PRIVATE_ANALYSIS_IR }) <= Pass(INSERT_REGIONS); + list({ PRIVATE_CALL_GRAPH_STAGE1, PRIVATE_CALL_GRAPH_STAGE2, MACRO_EXPANSION, CONVERT_ASSIGN_TO_LOOP, DEF_USE_STAGE1, DEF_USE_STAGE2, LOOP_GRAPH, CALL_GRAPH, PRIVATE_ANALYSIS_IR, FIND_FUNC_TO_INCLUDE }) <= Pass(INSERT_REGIONS); list({ LOOP_ANALYZER_DATA_DIST_S1, REVERT_SUBST_EXPR, REVERT_SUBST_EXPR_RD }) << list({ LOOPS_SPLITTER, LOOPS_COMBINER, UNROLL_LOOPS, INSERT_REGIONS }); @@ -251,7 +253,7 @@ void InitPassesDependencies(map> &passDepsIn, set list({ BUILD_IR, CALL_GRAPH }) <= Pass(LIVE_ANALYSIS_IR); - list({ BUILD_IR, LOOP_GRAPH, LIVE_ANALYSIS_IR, FIND_FUNC_TO_INCLUDE }) <= Pass(PRIVATE_ANALYSIS_IR); + list({ BUILD_IR, LOOP_GRAPH, LIVE_ANALYSIS_IR }) <= Pass(PRIVATE_ANALYSIS_IR); Pass(CALL_GRAPH2) <= Pass(FIX_COMMON_BLOCKS);