shared memory parallelization: do not include private arrays in TIE list

This commit is contained in:
2024-07-17 20:01:50 +03:00
parent 8931aced85
commit 7b46798785

View File

@@ -243,7 +243,8 @@ static vector<SgExpression*>
const map<DIST::Array*, set<DIST::Array*>>& arrayLinksByFuncCalls, const map<DIST::Array*, set<DIST::Array*>>& arrayLinksByFuncCalls,
const map<string, set<SgSymbol*>>& byUseInFunc, const map<string, set<SgSymbol*>>& byUseInFunc,
File* file, const pair<int, int>& lineRange, File* file, const pair<int, int>& lineRange,
const set<DIST::Array*>& onlyFor) const set<DIST::Array*>& onlyFor,
const set<string>& privates)
{ {
vector<SgExpression*> tieList; vector<SgExpression*> tieList;
vector<pair<DIST::Array*, DIST::Array*>> realRefsUsed; vector<pair<DIST::Array*, DIST::Array*>> realRefsUsed;
@@ -269,6 +270,9 @@ static vector<SgExpression*>
for (auto& pairs : realRefsUsed) for (auto& pairs : realRefsUsed)
{ {
if (privates.find(pairs.second->GetShortName()) != privates.end())
continue;
auto type = pairs.second->GetDeclSymbol(currLoop->fileName, lineRange, getAllFilesInProject())->GetOriginal()->type(); auto type = pairs.second->GetDeclSymbol(currLoop->fileName, lineRange, getAllFilesInProject())->GetOriginal()->type();
SgSymbol* arrayS = getFromModule(byUseInFunc, findSymbolOrCreate(file, pairs.second->GetShortName(), type)); SgSymbol* arrayS = getFromModule(byUseInFunc, findSymbolOrCreate(file, pairs.second->GetShortName(), type));
SgArrayRefExp* array = new SgArrayRefExp(*arrayS); SgArrayRefExp* array = new SgArrayRefExp(*arrayS);
@@ -706,9 +710,9 @@ ParallelDirective::genDirective(File* file, const vector<pair<DIST::Array*, cons
} }
vector<SgExpression*> tieList; vector<SgExpression*> tieList;
if (sharedMemoryParallelization) if (sharedMemoryParallelization)
tieList = compliteTieList(currLoop, loopsTie, arrayLinksByFuncCalls, byUseInFunc, file, lineRange, onlyFor); tieList = compliteTieList(currLoop, loopsTie, arrayLinksByFuncCalls, byUseInFunc, file, lineRange, onlyFor, uniqNamesOfPrivates);
else if (onlyFor.size()) // not MPI regime else if (onlyFor.size()) // not MPI regime
tieList = compliteTieList(currLoop, loopsTie, arrayLinksByFuncCalls, byUseInFunc, file, lineRange, onlyFor); tieList = compliteTieList(currLoop, loopsTie, arrayLinksByFuncCalls, byUseInFunc, file, lineRange, onlyFor, uniqNamesOfPrivates);
if (tieList.size()) if (tieList.size())
{ {