fixed actuals for shared memory parallelization
This commit is contained in:
@@ -327,10 +327,13 @@ static void analyzeFunctionParameters(SgExpression* paramList, set<string>& exce
|
||||
while (paramList)
|
||||
{
|
||||
SgExpression* ex = paramList->lhs();
|
||||
if (ex->variant() != FUNC_CALL)
|
||||
analyzeFunctionParameter(ex, except, arrays);
|
||||
if (ex->variant() == FUNC_CALL)
|
||||
{
|
||||
if (!isIntrinsicFunctionName(ex->symbol()->identifier()))
|
||||
analyzeFunctionParameters(ex->lhs(), except, arrays);
|
||||
}
|
||||
else
|
||||
analyzeFunctionParameters(ex->lhs(), except, arrays);
|
||||
analyzeFunctionParameter(ex, except, arrays);
|
||||
|
||||
paramList = paramList->rhs();
|
||||
}
|
||||
@@ -341,7 +344,10 @@ static void createExceptList(SgExpression* ex, set<string>& except, ArraySet& ar
|
||||
if (ex)
|
||||
{
|
||||
if (ex->variant() == FUNC_CALL)
|
||||
analyzeFunctionParameters(ex->lhs(), except, arrays);
|
||||
{
|
||||
if (!isIntrinsicFunctionName(ex->symbol()->identifier()))
|
||||
analyzeFunctionParameters(ex->lhs(), except, arrays);
|
||||
}
|
||||
else
|
||||
{
|
||||
createExceptList(ex->lhs(), except, arrays);
|
||||
@@ -419,7 +425,7 @@ ArraySet DvmhRegionInserter::excludeRemotes(const ArraySet& block, SgStatement*
|
||||
void DvmhRegionInserter::insertForProcCall(SgStatement* st, bool& skipGetActualIfProcCall, bool& skipActualIfProcCall)
|
||||
{
|
||||
const char* procName = st->symbol()->identifier();
|
||||
if (isIntrinsicFunctionName(procName) == 0)
|
||||
if (isIntrinsicFunctionName(procName) == 0 || isMpiProgram)
|
||||
{
|
||||
skipGetActualIfProcCall = skipActualIfProcCall = true;
|
||||
|
||||
@@ -591,10 +597,6 @@ void DvmhRegionInserter::insertActualDirectives(const vector<ParallelRegion*>* r
|
||||
printInternalError(convertFileName(__FILE__).c_str(), __LINE__);
|
||||
|
||||
__spf_print(1, "Insert actuals for file %s\n", file->filename());
|
||||
|
||||
/*int funcNum = file->numberOfFunctions();
|
||||
if (funcsForFile.size() != funcNum)
|
||||
printInternalError(convertFileName(__FILE__).c_str(), __LINE__); */
|
||||
|
||||
for (auto& func : funcsForFile)
|
||||
{
|
||||
@@ -774,7 +776,6 @@ void DvmhRegionInserter::insertActualDirective(SgStatement *st, const ArraySet &
|
||||
}
|
||||
else if (variant == ACC_ACTUAL_DIR)
|
||||
{
|
||||
|
||||
auto prev = st->lexPrev();
|
||||
if (prev && prev->variant() == ASSIGN_STAT && !hasFuncCalls(prev->expr(1)) && !hasFuncCalls(prev->expr(0)))
|
||||
{
|
||||
|
||||
@@ -27,6 +27,7 @@ class DvmhRegionInserter
|
||||
const std::vector<LoopGraph*> loopGraph;
|
||||
const std::map<std::string, FuncInfo*> allFunctions;
|
||||
const std::vector<FuncInfo*> funcsForFile;
|
||||
bool isMpiProgram;
|
||||
|
||||
ReadWriteAnalyzer& rw_analyzer;
|
||||
std::set<FuncInfo*> parallel_functions;
|
||||
@@ -63,8 +64,9 @@ public:
|
||||
ReadWriteAnalyzer& rws,
|
||||
const std::map<DIST::Array*, std::set<DIST::Array*>>& arrayLinksByFuncCalls,
|
||||
const std::map<std::string, FuncInfo*>& allFunctions,
|
||||
const std::vector<FuncInfo*>& funcsForFile
|
||||
) : file(curFile), loopGraph(curLoopGraph), rw_analyzer(rws), arrayLinksByFuncCalls(arrayLinksByFuncCalls), allFunctions(allFunctions), funcsForFile(funcsForFile)
|
||||
const std::vector<FuncInfo*>& funcsForFile,
|
||||
bool mpi_program
|
||||
) : file(curFile), loopGraph(curLoopGraph), rw_analyzer(rws), arrayLinksByFuncCalls(arrayLinksByFuncCalls), allFunctions(allFunctions), funcsForFile(funcsForFile), isMpiProgram(mpi_program)
|
||||
{
|
||||
if (loopGraph.size())
|
||||
createMapLoopGraph(loopGraph, loopGraphMap);
|
||||
|
||||
@@ -2110,7 +2110,7 @@ static bool runAnalysis(SgProject &project, const int curr_regime, const bool ne
|
||||
for (auto& loop : loopsForFile)
|
||||
loop->analyzeParallelDirs();
|
||||
|
||||
DvmhRegionInserter* regionInserter = new DvmhRegionInserter(file, loopsForFile, rw_analyzer, arrayLinksByFuncCalls, mapOfFuncs, funcsForFile);
|
||||
DvmhRegionInserter* regionInserter = new DvmhRegionInserter(file, loopsForFile, rw_analyzer, arrayLinksByFuncCalls, mapOfFuncs, funcsForFile, mpiProgram == 1);
|
||||
inserters.push_back(regionInserter);
|
||||
|
||||
//collect info about <parallel> functions
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
#pragma once
|
||||
|
||||
#define VERSION_SPF "2217"
|
||||
#define VERSION_SPF "2218"
|
||||
|
||||
Reference in New Issue
Block a user