diff --git a/sapfor/experts/Sapfor_2017/_src/CFGraph/CFGraph.cpp b/sapfor/experts/Sapfor_2017/_src/CFGraph/CFGraph.cpp index 3040d80..33151bb 100644 --- a/sapfor/experts/Sapfor_2017/_src/CFGraph/CFGraph.cpp +++ b/sapfor/experts/Sapfor_2017/_src/CFGraph/CFGraph.cpp @@ -741,12 +741,12 @@ static void buildReachingDefs(const map>& CFG, const vector> callLvlsForRD = groupByCallDependencies(callDeps, scc); //TODO: take into account ssc structure - __spf_print(DEB_PRINT, "count of functions %d, count of lvls %d\n", (int)CFG.size(), (int)callLvlsForRD.size()); + __spf_print(DEB_PRINT, " count of functions %d, count of lvls %d\n", (int)CFG.size(), (int)callLvlsForRD.size()); for (auto& byLvl : callLvlsForRD) { for (auto& byFunc : byLvl) { - __spf_print(DEB_PRINT, " RD time for '%s' function", byFunc->funcName.c_str()); + __spf_print(DEB_PRINT, " RD time for '%s' function", byFunc->funcName.c_str()); auto t = high_resolution_clock::now(); auto itCFG = CFG.find(byFunc); diff --git a/sapfor/experts/Sapfor_2017/_src/CFGraph/private_variables_analysis.cpp b/sapfor/experts/Sapfor_2017/_src/CFGraph/private_variables_analysis.cpp index e10ad27..72f5fc9 100644 --- a/sapfor/experts/Sapfor_2017/_src/CFGraph/private_variables_analysis.cpp +++ b/sapfor/experts/Sapfor_2017/_src/CFGraph/private_variables_analysis.cpp @@ -46,7 +46,7 @@ void printLoopInfo(const LoopGraph* loop) if(!loop_stmt) printInternalError(convertFileName(__FILE__).c_str(), __LINE__); - __spf_print(PRINT_PRIVATES, "loop at file '%s' at line %d\n", loop->fileName.c_str(), loop->lineNum); + __spf_print(PRINT_PRIVATES, " loop in file '%s' at line %d\n", loop->fileName.c_str(), loop->lineNum); __spf_print(PRINT_PRIVATES, " privates:"); for(const auto& ident : priv) __spf_print(PRINT_PRIVATES, " %s", ident.c_str()); @@ -67,7 +67,7 @@ void printLoopInfo(const LoopGraph* loop) if (extra_old.size() != 0) { - __spf_print(PRINT_WARNINGS, "[WARNING] extra private variables:"); + __spf_print(PRINT_WARNINGS, " [WARNING] extra private variables:"); for (const auto& ident : extra_old) __spf_print(PRINT_WARNINGS, " %s", ident.c_str()); __spf_print(PRINT_WARNINGS, "\n"); diff --git a/sapfor/experts/Sapfor_2017/_src/DvmhRegions/DvmhRegionInserter.cpp b/sapfor/experts/Sapfor_2017/_src/DvmhRegions/DvmhRegionInserter.cpp index bf38814..5adc9a5 100644 --- a/sapfor/experts/Sapfor_2017/_src/DvmhRegions/DvmhRegionInserter.cpp +++ b/sapfor/experts/Sapfor_2017/_src/DvmhRegions/DvmhRegionInserter.cpp @@ -626,7 +626,7 @@ void DvmhRegionInserter::insertActualDirectives(const vector* r if (SgFile::switchToFile(file->filename()) == -1) printInternalError(convertFileName(__FILE__).c_str(), __LINE__); - __spf_print(1, "Insert actuals for file %s\n", file->filename()); + __spf_print(1, " Insert actuals for file %s\n", file->filename()); for (auto& func : funcsForFile) { @@ -663,7 +663,7 @@ void DvmhRegionInserter::insertActualDirectives(const vector* r if (regs) { - __spf_print(1, "Insert actuals for arrays copying before and after parallelization areas\n"); + __spf_print(1, " Insert actuals for arrays copying before and after parallelization areas\n"); for (auto& area : *regs) { auto lines = area->GetLines(file->filename()); @@ -719,10 +719,10 @@ vector DvmhRegionInserter::getArrayList(Statement* start, Stateme void DvmhRegionInserter::insertDirectives(const vector *regs) { - __spf_print(1, "Find edges for regions\n"); + __spf_print(1, " Find edges for regions\n"); findEdgesForRegions(loopGraph); - __spf_print(1, "Merging regions\n"); + __spf_print(1, " Merging regions\n"); auto merger = RegionsMerger(regions, rw_analyzer); regions = merger.mergeRegions(); @@ -735,7 +735,7 @@ void DvmhRegionInserter::insertDirectives(const vector *regs) } } - __spf_print(1, "Insert regions\n"); + __spf_print(1, " Insert regions\n"); insertRegionDirectives(); } @@ -1201,6 +1201,33 @@ static SgExpression* getPrivateArraysInPar(const FuncInfo* funcInfo, const std:: return NULL; } +static SgStatement* getInsertionPlace(SgStatement* func) +{ + SgStatement* place = func->lexNext(); + SgStatement* insertAfter = NULL; + for (auto st = place; st != func->lastNodeOfStmt(); st = st->lexNext()) + { + if (isSPF_stat(st) || isDVM_stat(st)) + continue; + + if (st->variant() == CONTAINS_STMT) + break; + + if (isSgExecutableStatement(st)) + break; + + if (st->variant() == IMPL_DECL) + insertAfter = st; + else if (st->variant() == USE_STMT) + insertAfter = st; + } + + if (insertAfter) + return insertAfter->lexNext(); + else + return place; +} + static void insertRoutine(SgStatement* func, const FuncInfo* funcInfo, const std::set& inLoops, const map>& arrayLinksByFuncCalls) { @@ -1224,9 +1251,9 @@ static void insertRoutine(SgStatement* func, const FuncInfo* funcInfo, const std if (!routine) { - st = func->lexNext(); + st = getInsertionPlace(func); routine = new SgStatement(ACC_ROUTINE_DIR); - st->insertStmtBefore(*routine, *st->controlParent()); + st->insertStmtBefore(*routine, *func); } SgExpression* list = getPrivateArraysInPar(funcInfo, inLoops, arrayLinksByFuncCalls, routine->expr(0)); @@ -1487,10 +1514,14 @@ void DvmhRegionInserter::addUsedWriteArrays(set& arrays) } } -static void insertDeclare(const set& usedArraysInRegions, - const set& usedWriteArraysInRegions, - const map> arrayLinksByFuncCalls) +static set + insertDeclare(const set& usedArraysInRegions, + const set& usedWriteArraysInRegions, + const map> arrayLinksByFuncCalls, + SgStatement* main) { + set commonArrays; + vector usedAll; std::set_union(usedArraysInRegions.begin(), usedArraysInRegions.end(), usedWriteArraysInRegions.begin(), usedWriteArraysInRegions.end(), @@ -1506,22 +1537,45 @@ static void insertDeclare(const set& usedArraysInRegions, for (auto& realArray : realRef) { - if (std::count(usedAll.begin(), usedAll.end(), realArray) == 0 && added.count(realArray) == 0) + if (added.count(realArray) != 0 || !realArray->IsNotDistribute()) + continue; + + SgStatement* declStat = NULL; + + if (realArray->GetLocation().first != DIST::l_COMMON) { - added.insert(realArray); - //TODO: for common - if (realArray->GetLocation().first != DIST::l_COMMON) + if (std::count(usedAll.begin(), usedAll.end(), realArray) == 0) { auto declInfo = *realArray->GetDeclInfo().begin(); - SgStatement* declStat = SgStatement::getStatementByFileAndLine(declInfo.first, declInfo.second); + declStat = SgStatement::getStatementByFileAndLine(declInfo.first, declInfo.second); checkNull(declStat, convertFileName(__FILE__).c_str(), __LINE__); - - declStat = getFuncStat(declStat); - checkNull(declStat, convertFileName(__FILE__).c_str(), __LINE__); - - toDeclareByFunc[declStat].insert(realArray->GetDeclSymbol()); } } + else + { + commonArrays.insert(realArray); + auto decls = realArray->GetDeclInfo(); + for (auto& decl : decls) + { + declStat = SgStatement::getStatementByFileAndLine(decl.first, decl.second); + checkNull(declStat, convertFileName(__FILE__).c_str(), __LINE__); + + if (declStat != main) + { + declStat = NULL; + continue; + } + } + } + + if (declStat) + { + added.insert(realArray); + declStat = getFuncStat(declStat); + checkNull(declStat, convertFileName(__FILE__).c_str(), __LINE__); + + toDeclareByFunc[declStat].insert(realArray->GetDeclSymbol()); + } } } @@ -1544,16 +1598,22 @@ static void insertDeclare(const set& usedArraysInRegions, } } - func->insertStmtAfter(*new SgStatement(ACC_DECLARE_DIR, NULL, NULL, makeExprList(list)), *func); + auto place = getInsertionPlace(func); + place->insertStmtBefore(*new SgStatement(ACC_DECLARE_DIR, NULL, NULL, makeExprList(list)), *func); } + + return commonArrays; } -void insertDvmhRegions(SgProject& project, int files, const vector& parallelRegions, - map>& allFuncInfo, - map> loopGraph, - ReadWriteAnalyzer& rw_analyzer, - const map> arrayLinksByFuncCalls) +int insertDvmhRegions(SgProject& project, int files, const vector& parallelRegions, + map>& allFuncInfo, + map> loopGraph, + ReadWriteAnalyzer& rw_analyzer, + map>& SPF_messages, + const map> arrayLinksByFuncCalls) { + int internalExit = 0; + vector inserters; const bool regionCondition = ((parallelRegions.size() == 0 && parallelRegions[0]->GetName() == "DEFAULT") || sharedMemoryParallelization == 1); @@ -1563,7 +1623,7 @@ void insertDvmhRegions(SgProject& project, int files, const vector= 0; --i) { SgFile* file = &(project.file(i)); - __spf_print(1, "Start region inserter for file %s\n", file->filename()); + __spf_print(1, " ==> Start region inserter for file %s\n", file->filename()); map mapOfFuncs; createMapOfFunc(allFuncInfo, mapOfFuncs); @@ -1613,7 +1673,11 @@ void insertDvmhRegions(SgProject& project, int files, const vectorcreateInterfaceBlockForParallelFunctions(false); } - insertDeclare(usedArraysInRegions, usedWriteArraysInRegions, arrayLinksByFuncCalls); + SgStatement* main = findMainUnit(&project, SPF_messages); + checkNull(main, convertFileName(__FILE__).c_str(), __LINE__); + + set commonArrays = insertDeclare(usedArraysInRegions, usedWriteArraysInRegions, arrayLinksByFuncCalls, main); + internalExit = checkCommonInMainUnit(project, SPF_messages, commonArrays, false); for (auto& regionInserter : inserters) { @@ -1625,4 +1689,6 @@ void insertDvmhRegions(SgProject& project, int files, const vectorinsertActualDirectives(¶llelRegions); delete regionInserter; } + + return internalExit; } \ No newline at end of file diff --git a/sapfor/experts/Sapfor_2017/_src/DvmhRegions/DvmhRegionInserter.h b/sapfor/experts/Sapfor_2017/_src/DvmhRegions/DvmhRegionInserter.h index 2e48afb..eba428d 100644 --- a/sapfor/experts/Sapfor_2017/_src/DvmhRegions/DvmhRegionInserter.h +++ b/sapfor/experts/Sapfor_2017/_src/DvmhRegions/DvmhRegionInserter.h @@ -112,8 +112,9 @@ public: } }; -void insertDvmhRegions(SgProject& project, int files, const std::vector& parallelRegions, - std::map>& allFuncInfo, - std::map> loopGraph, - ReadWriteAnalyzer& rw_analyzer, - const std::map> arrayLinksByFuncCalls); +int insertDvmhRegions(SgProject& project, int files, const std::vector& parallelRegions, + std::map>& allFuncInfo, + std::map> loopGraph, + ReadWriteAnalyzer& rw_analyzer, + std::map>& SPF_messages, + const std::map> arrayLinksByFuncCalls); diff --git a/sapfor/experts/Sapfor_2017/_src/Sapfor.cpp b/sapfor/experts/Sapfor_2017/_src/Sapfor.cpp index 3057042..e16c05c 100644 --- a/sapfor/experts/Sapfor_2017/_src/Sapfor.cpp +++ b/sapfor/experts/Sapfor_2017/_src/Sapfor.cpp @@ -1444,40 +1444,11 @@ static bool runAnalysis(SgProject &project, const int curr_regime, const bool ne ALGORITHMS_DONE[CREATE_ALIGNS][z] = 1; } - SgStatement* mainUnit = findMainUnit(&project, SPF_messages); - checkNull(mainUnit, convertFileName(__FILE__).c_str(), __LINE__); - - map> commonBlocks; - getCommonBlocksRef(commonBlocks, mainUnit, mainUnit->lastNodeOfStmt()); - - // check array declaration + set toCheck; for (auto& arrayP : dataDirectives.GenAlignsRules(NULL)) - { - auto array = arrayP.alignArray; - if (array->IsLoopArray() || array->IsTemplate()) - continue; - if (array->GetLocation().first == DIST::l_COMMON) - { - auto nameOfCommon = array->GetLocation().second; - if (commonBlocks.find(nameOfCommon) == commonBlocks.end()) - { - auto declPlaces = array->GetDeclInfo(); - for (auto& place : declPlaces) - { - vector& currMessages = getObjectForFileFromMap(place.first.c_str(), SPF_messages); - __spf_print(1, " ERROR: distributed array '%s' in common block '%s' must have declaration in main unit\n", array->GetShortName().c_str(), nameOfCommon.c_str()); + toCheck.insert(arrayP.alignArray); - wstring messageE, messageR; - __spf_printToLongBuf(messageE, L"distributed array '%s' in common block '%s' must have declaration in main unit", - to_wstring(array->GetShortName()).c_str(), to_wstring(nameOfCommon).c_str()); - __spf_printToLongBuf(messageR, R75, - to_wstring(array->GetShortName()).c_str(), to_wstring(nameOfCommon).c_str()); - currMessages.push_back(Messages(ERROR, place.second, messageR, messageE, 1042)); - } - internalExit = 1; - } - } - } + internalExit = checkCommonInMainUnit(project, SPF_messages, toCheck, true); __spf_print(1, "*** FOR PARALLEL REGION '%s':\n", parallelRegions[z]->GetName().c_str()); result = dataDirectives.GenAlignsRules(); @@ -1498,7 +1469,7 @@ static bool runAnalysis(SgProject &project, const int curr_regime, const bool ne int allLineSum = 0; for (auto &elem : lineInfo) allLineSum += elem.second; - __spf_print(1, "All lines in project %d\n", allLineSum); + __spf_print(1, " All lines in project %d\n", allLineSum); } else if (curr_regime == FILL_PAR_REGIONS_LINES) { @@ -1875,7 +1846,7 @@ static bool runAnalysis(SgProject &project, const int curr_regime, const bool ne else if (curr_regime == INLINE_PROCEDURES) callInliner(allFuncInfo, inDataProc, inDataChains, inDataChainsStart, SPF_messages, commonBlocks); else if (curr_regime == INSERT_REGIONS) - insertDvmhRegions(project, n, parallelRegions, allFuncInfo, loopGraph, rw_analyzer, arrayLinksByFuncCalls); + internalExit = insertDvmhRegions(project, n, parallelRegions, allFuncInfo, loopGraph, rw_analyzer, SPF_messages, arrayLinksByFuncCalls); else if (curr_regime == RENAME_SYMBOLS) runRenameSymbols(&project, commonBlocks); else if (curr_regime == FIND_PARAMETERS) @@ -2623,6 +2594,9 @@ int main(int argc, char **argv) } } + if (curr_regime == INSERT_PARALLEL_DIRS_NODIST) + ignoreArrayDistributeState = true; + if (runAsClient) { printf("[SAPFOR]: Started as client with server port %d\n", serverPort); diff --git a/sapfor/experts/Sapfor_2017/_src/Sapfor.h b/sapfor/experts/Sapfor_2017/_src/Sapfor.h index 867a82f..61da779 100644 --- a/sapfor/experts/Sapfor_2017/_src/Sapfor.h +++ b/sapfor/experts/Sapfor_2017/_src/Sapfor.h @@ -208,7 +208,7 @@ enum options { KEEP_GCOV, ANALYSIS_OPTIONS, DEBUG_PRINT_ON, - MPI_PROGRAM, + SHARED_MEMORY, IGNORE_IO_SAPFOR, KEEP_SPF_DIRECTIVES_AMONG_TRANSFORMATIONS, PARSE_FOR_INLINE, diff --git a/sapfor/experts/Sapfor_2017/_src/Transformations/loop_transform.cpp b/sapfor/experts/Sapfor_2017/_src/Transformations/loop_transform.cpp index d8adf97..b720652 100644 --- a/sapfor/experts/Sapfor_2017/_src/Transformations/loop_transform.cpp +++ b/sapfor/experts/Sapfor_2017/_src/Transformations/loop_transform.cpp @@ -604,7 +604,7 @@ bool createNestedLoops(LoopGraph *current, const map &depInfo if (outerTightened) firstChild->perfectLoop = countPerfectLoopNest(firstChild->loop); - __spf_print(1, "createNestedLoops for loop at %d. Tighten success: %d\n", current->lineNum, outerTightened); + __spf_print(1, " createNestedLoops for loop at %d. Tighten success: %d\n", current->lineNum, outerTightened); wchar_t buf[256]; std::wstring messageE, messageR; @@ -619,14 +619,14 @@ bool createNestedLoops(LoopGraph *current, const map &depInfo wasTightened = outerTightened; for (int i = 0; i < current->children.size(); ++i) { - __spf_print(1, "createNestedLoops for loop at %d. Transform child %d\n", current->lineNum, i); + __spf_print(1, " createNestedLoops for loop at %d. Transform child %d\n", current->lineNum, i); bool result = createNestedLoops(current->children[i], depInfoForLoopGraphV, mapFuncInfo, messages); wasTightened = wasTightened || result; } //update perfect loop current->recalculatePerfect(); - __spf_print(1, "createNestedLoops for loop at %d. End\n", current->lineNum); + __spf_print(1, " createNestedLoops for loop at %d. End\n", current->lineNum); return wasTightened; } \ No newline at end of file diff --git a/sapfor/experts/Sapfor_2017/_src/Utils/SgUtils.cpp b/sapfor/experts/Sapfor_2017/_src/Utils/SgUtils.cpp index 5f1c00b..39f5c7d 100644 --- a/sapfor/experts/Sapfor_2017/_src/Utils/SgUtils.cpp +++ b/sapfor/experts/Sapfor_2017/_src/Utils/SgUtils.cpp @@ -1219,6 +1219,62 @@ void getCommonBlocksRef(map> &commonBlocks, SgStat } } +int checkCommonInMainUnit(SgProject& project, map>& SPF_messages, + const set& arrays, bool forDistrbuted) +{ + int internalExit = 0; + + SgStatement* mainUnit = findMainUnit(&project, SPF_messages); + checkNull(mainUnit, convertFileName(__FILE__).c_str(), __LINE__); + + map> commonBlocks; + getCommonBlocksRef(commonBlocks, mainUnit, mainUnit->lastNodeOfStmt()); + + // check array declaration + for (auto& array : arrays) + { + if (array->IsLoopArray() || array->IsTemplate()) + continue; + if (array->GetLocation().first == DIST::l_COMMON) + { + auto nameOfCommon = array->GetLocation().second; + if (commonBlocks.find(nameOfCommon) == commonBlocks.end()) + { + auto declPlaces = array->GetDeclInfo(); + for (auto& place : declPlaces) + { + vector& currMessages = getObjectForFileFromMap(place.first.c_str(), SPF_messages); + if (forDistrbuted) + { + __spf_print(1, " ERROR: distributed array '%s' in common block '%s' must have declaration in main unit\n", array->GetShortName().c_str(), nameOfCommon.c_str()); + + wstring messageE, messageR; + __spf_printToLongBuf(messageE, L"distributed array '%s' in common block '%s' must have declaration in main unit", + to_wstring(array->GetShortName()).c_str(), to_wstring(nameOfCommon).c_str()); + __spf_printToLongBuf(messageR, R75, + to_wstring(array->GetShortName()).c_str(), to_wstring(nameOfCommon).c_str()); + currMessages.push_back(Messages(ERROR, place.second, messageR, messageE, 1042)); + } + else + { + __spf_print(1, " ERROR: array '%s' in common block '%s' must have declaration in main unit for DECLARE insertion\n", array->GetShortName().c_str(), nameOfCommon.c_str()); + + wstring messageE, messageR; + __spf_printToLongBuf(messageE, L"array '%s' in common block '%s' must have declaration in main unit for DECLARE insertion", + to_wstring(array->GetShortName()).c_str(), to_wstring(nameOfCommon).c_str()); + __spf_printToLongBuf(messageR, R205, + to_wstring(array->GetShortName()).c_str(), to_wstring(nameOfCommon).c_str()); + currMessages.push_back(Messages(ERROR, place.second, messageR, messageE, 1062)); + } + } + internalExit = 1; + } + } + } + + return internalExit; +} + static SgExpression* isInCommon(const vector &commonBlocks, const char *arrayName, int &commonPos) { commonPos = 0; diff --git a/sapfor/experts/Sapfor_2017/_src/Utils/SgUtils.h b/sapfor/experts/Sapfor_2017/_src/Utils/SgUtils.h index 6ad3937..ff889c0 100644 --- a/sapfor/experts/Sapfor_2017/_src/Utils/SgUtils.h +++ b/sapfor/experts/Sapfor_2017/_src/Utils/SgUtils.h @@ -31,6 +31,7 @@ bool isDVM_stat(SgStatement *st); bool isSPF_stat(SgStatement *st); bool isEqExpressions(SgExpression *left, SgExpression *right, std::map &collection); void getCommonBlocksRef(std::map> &commonBlocks, SgStatement *start, SgStatement *end, const std::string *nameToSkip = NULL); +int checkCommonInMainUnit(SgProject& project, std::map>& SPF_messages, const std::set& arrays, bool forDistrbuted); std::tuple getFromUniqTable(SgSymbol *symb); std::tuple getUniqName(const std::map> &commonBlocks, SgStatement *decl, SgSymbol *symb); diff --git a/sapfor/experts/Sapfor_2017/_src/Utils/errors.h b/sapfor/experts/Sapfor_2017/_src/Utils/errors.h index 565d4b6..82e198b 100644 --- a/sapfor/experts/Sapfor_2017/_src/Utils/errors.h +++ b/sapfor/experts/Sapfor_2017/_src/Utils/errors.h @@ -75,6 +75,7 @@ enum typeMessage { WARR, ERROR, NOTE }; // 59 "Reduction by element of array '%s' is not implemented yet" // 60 "Format misplaced" // 61 "Array has declaration area conflict" +// 62 "need to move common declaration to main for DECLATE" // // 20xx TRANSFORM GROUP // 01 "can not convert array assign to loop" @@ -276,7 +277,7 @@ static void printStackTrace() { }; } \ } while (0) -// Свободный - R205 +// Свободный - R206 // Гайд по русификации сообщений: При добавлении нового сообщения, меняется последний сводобный идентификатор. // В этом файле остаются только спецификаторы, для которых будет заполнен текст. Полный текст пишется в файле // russian_errors_text.txt. Спецификаторы там тоже сохраняются, по ним в визуализаторе будет восстановлен @@ -473,6 +474,8 @@ static const wchar_t *R182 = L"R176:%s"; static const wchar_t *R183 = L"R183:"; //1061 static const wchar_t *R184 = L"R184:%s"; +//1062 +static const wchar_t* R205 = L"R205:%s#%s"; //2001 static const wchar_t *R94 = L"R94:"; diff --git a/sapfor/experts/Sapfor_2017/_src/Utils/russian_errors_text.txt b/sapfor/experts/Sapfor_2017/_src/Utils/russian_errors_text.txt index 0d254e3..cf2c8f3 100644 --- a/sapfor/experts/Sapfor_2017/_src/Utils/russian_errors_text.txt +++ b/sapfor/experts/Sapfor_2017/_src/Utils/russian_errors_text.txt @@ -184,6 +184,8 @@ R182 = "Редукционная операция по элементу масс R183 = "Расположение операторов FORMAT не поддерживается, попробуйте применить проход Коррекция стиля кода". //1061 R184 = "Область объявления массива '%s' конфликтует с предыдущей областью. Возможно, это вызвано использованием include-файлов. Попробуйте применить проход 'Подстановка заголовочных файлов'". +//1042 +R205 = "Массив '%s' состоящий в common блоке '%s' должен иметь описание в главной программной единице для объявления в директиве DECLARE" //2001 R94 = "Невозможно автоматически преобразовать данное присваивание к циклу" diff --git a/sapfor/experts/Sapfor_2017/_src/Utils/version.h b/sapfor/experts/Sapfor_2017/_src/Utils/version.h index 2a5461c..a501899 100644 --- a/sapfor/experts/Sapfor_2017/_src/Utils/version.h +++ b/sapfor/experts/Sapfor_2017/_src/Utils/version.h @@ -1,3 +1,3 @@ #pragma once -#define VERSION_SPF "2380" +#define VERSION_SPF "2381" diff --git a/sapfor/experts/Sapfor_2017/_src/VisualizerCalls/get_information.cpp b/sapfor/experts/Sapfor_2017/_src/VisualizerCalls/get_information.cpp index 7caba1e..8019846 100644 --- a/sapfor/experts/Sapfor_2017/_src/VisualizerCalls/get_information.cpp +++ b/sapfor/experts/Sapfor_2017/_src/VisualizerCalls/get_information.cpp @@ -96,6 +96,7 @@ static char* ConvertShortToChar(const short* source, int& strL) return dist; } +extern bool ignoreArrayDistributeState; static void setOptions(const short* options, bool isBuildParallel = false, const set* turnOffOptions = NULL) { if (!optionNames[STATIC_SHADOW_ANALYSIS]) @@ -113,7 +114,7 @@ static void setOptions(const short* options, bool isBuildParallel = false, const optionNames[KEEP_GCOV] = "KEEP_GCOV"; optionNames[ANALYSIS_OPTIONS] = "ANALYSIS_OPTIONS"; optionNames[DEBUG_PRINT_ON] = "DEBUG_PRINT_ON"; - optionNames[MPI_PROGRAM] = "MPI_PROGRAM"; + optionNames[SHARED_MEMORY] = "SHARED_MEMORY"; optionNames[IGNORE_IO_SAPFOR] = "IGNORE_IO_SAPFOR"; optionNames[KEEP_SPF_DIRECTIVES_AMONG_TRANSFORMATIONS] = "KEEP_SPF_DIRECTIVES_AMONG_TRANSFORMATIONS"; optionNames[PARSE_FOR_INLINE] = "PARSE_FOR_INLINE"; @@ -137,12 +138,12 @@ static void setOptions(const short* options, bool isBuildParallel = false, const if (splited.size() == z) break; - __spf_print(1, "read value '%s' to '%s' option\n", splited[z].c_str(), optionNames[z]); + __spf_print(1, " read value '%s' to '%s' option\n", splited[z].c_str(), optionNames[z]); if (z != ANALYSIS_OPTIONS) { if (sscanf(splited[z].c_str(), "%d", &intOptions[z]) != 1) { - __spf_print(1, "!wrong value!\n"); + __spf_print(1, " !wrong value!\n"); printInternalError(convertFileName(__FILE__).c_str(), __LINE__); } } @@ -166,7 +167,7 @@ static void setOptions(const short* options, bool isBuildParallel = false, const removeNestedIntervals = (intOptions[KEEP_LOOPS_CLOSE_NESTING] == 1); showDebug = (intOptions[DEBUG_PRINT_ON] == 1); - sharedMemoryParallelization = (sharedMemoryParallelization != 1) ? intOptions[MPI_PROGRAM] : sharedMemoryParallelization; + sharedMemoryParallelization = (sharedMemoryParallelization != 1) ? intOptions[SHARED_MEMORY] : sharedMemoryParallelization; parallizeFreeLoops = (sharedMemoryParallelization == 1) ? 0 : intOptions[PARALLIZE_FREE_LOOPS]; ignoreIO = (sharedMemoryParallelization == 1) ? 1 : intOptions[IGNORE_IO_SAPFOR]; keepDvmDirectives = (sharedMemoryParallelization == 1) ? 0 : intOptions[KEEP_DVM_DIRECTIVES]; @@ -175,6 +176,11 @@ static void setOptions(const short* options, bool isBuildParallel = false, const string optAnalisys = splited.size() > ANALYSIS_OPTIONS ? splited[ANALYSIS_OPTIONS] : ""; + if (sharedMemoryParallelization == 1) + ignoreArrayDistributeState = true; + else + ignoreArrayDistributeState = false; + if (!turnOffOptions) return; @@ -820,7 +826,10 @@ int SPF_GetArrayDistribution(void*& context, int winHandler, short *options, sho else if (regime == 1) { if (sharedMemoryParallelization) + { + ignoreArrayDistributeState = true; runPassesForVisualizer(projName, { LOOP_ANALYZER_NODIST }); + } else runPassesForVisualizer(projName, { LOOP_ANALYZER_DATA_DIST_S1 }); } @@ -1875,7 +1884,6 @@ int SPF_ExpressionSubstitution(void*& context, int winHandler, short* options, s return simpleTransformPass(SUBST_EXPR_RD_AND_UNPARSE, options, projName, folderName, output, outputSize, outputMessage, outputMessageSize); } -extern bool ignoreArrayDistributeState; int SPF_InsertDvmhRegions(void*& context, int winHandler, short* options, short* projName, short* folderName, short*& output, int*& outputSize, short*& outputMessage, int*& outputMessageSize) {