# GNU Lesser General Public License for more details. # You should have received a copy of the GNU Lesser General Public License # along with Hybrid Fortran. If not, see <http://www.gnu.org/licenses/>. from xml.dom.minidom import Document from tools.metadata import addCallers, addCallees, createOrGetFirstNodeWithName, getDomainDependantTemplatesAndEntries, getArguments from tools.commons import enum, prettyprint, UsageError import sys import logging SymbolType = enum( "UNDEFINED", "ARGUMENT_WITH_DOMAIN_DEPENDANT_SPEC", "ARGUMENT", "MODULE_DATA_USED_IN_CALLEE_GRAPH", "MODULE_DATA", "MODULE_DATA_USED_IN_CALLEE_GRAPH_WITH_DOMAIN_DEPENDANT_SPEC", "MODULE_DATA_WITH_DOMAIN_DEPENDANT_SPEC", "DOMAIN_DEPENDANT" ) def emitSymbolAnalysisWarnings(analysisWarningsByCalleeName): for calleeName in analysisWarningsByCalleeName: warnings = analysisWarningsByCalleeName[calleeName] callers = [warning[0] for warning in warnings] logging.warning("Cannot fully analyze symbol dependencies since argument list from callers %s has different length (e.g. %i) than routine argument list (%i) for routine %s.\n" %( callers, warnings[0][1], warnings[0][2], calleeName ))
# Hybrid Fortran is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Lesser General Public License for more details. # You should have received a copy of the GNU Lesser General Public License # along with Hybrid Fortran. If not, see <http://www.gnu.org/licenses/>. import re, logging from tools.commons import BracketAnalyzer, UsageError, findRightMostOccurrenceNotInsideQuotes, \ splitIntoComponentsAndRemainder, getComponentNameAndBracketContent, enum from tools.patterns import regexPatterns TypeParameter = enum( "ValueByteLength", "Dimension" ) def getAccessorsAndRemainder(accessorString): symbolAccessString_match = regexPatterns.symbolAccessPattern.match(accessorString) if not symbolAccessString_match: return [], accessorString currBracketAnalyzer = BracketAnalyzer() return currBracketAnalyzer.getListOfArgumentsInOpenedBracketsAndRemainder(symbolAccessString_match.group(1)) def updateTypeParameterProperties(symbolToCheckAsTypeParameter, symbolsToUpdate): matchedSymbols, typeParameterType = symbolIsTypeParameterFor(symbolToCheckAsTypeParameter, symbolsToUpdate) if len(matchedSymbols) > 0: symbolToCheckAsTypeParameter.isTypeParameter = True if typeParameterType == TypeParameter.Dimension: symbolToCheckAsTypeParameter.isDimensionParameter = True
# You should have received a copy of the GNU Lesser General Public License # along with Hybrid Fortran. If not, see <http://www.gnu.org/licenses/>. import copy, re from tools.commons import enum, UsageError, OrderedDict from tools.metadata import getArguments, getIterators from tools.patterns import regexPatterns from machinery.commons import conversionOptions, \ getSymbolAccessStringAndRemainder, \ implement, \ replaceEarlyExits from symbol import DeclarationType, FrameworkArray, frameworkArrayName, limitLength, uniqueIdentifier RegionType = enum( "MODULE_DECLARATION", "KERNEL_CALLER_DECLARATION", "OTHER" ) def implementSymbolAccessStringAndRemainder( line, suffix, symbol, iterators=[], parallelRegionTemplate=None, callee=None, useDeviceVersionIfAvailable=True ): isPointerAssignment = regexPatterns.pointerAssignmentPattern.match(line) != None try: symbolAccessString, remainder = getSymbolAccessStringAndRemainder(
cgDoc._templateCache = {} if regionTemplatesByID: return regionTemplatesByID regionTemplatesByID = {} templateNodes = cgDoc.getElementsByTagName(templateTypeName) for templateNode in templateNodes: idStr = templateNode.getAttribute('id') if not idStr or idStr == '': raise Exception("Template definition without id attribute.") regionTemplatesByID[idStr] = templateNode cgDoc._templateCache[templateTypeName] = regionTemplatesByID return regionTemplatesByID RoutineNodeInitStage = enum("NO_DIRECTIVES", "DIRECTIVES_WITH_PARALLELREGION_POSITION", "DIRECTIVES_WITHOUT_PARALLELREGION_POSITION", "UNDEFINED" ) def getRoutineNodeInitStage(routineNode): hasActiveParallelRegions = False hasDomainDependantDirectives = False parallelRegionsParents = routineNode.getElementsByTagName('activeParallelRegions') if parallelRegionsParents and len(parallelRegionsParents) > 0 \ and len(parallelRegionsParents[0].getElementsByTagName("templateRelation")) > 0: hasActiveParallelRegions = True domainDependantRelationsParents = routineNode.getElementsByTagName("domainDependants") if domainDependantRelationsParents and len(domainDependantRelationsParents) > 0 \ and len(domainDependantRelationsParents[0].getElementsByTagName("templateRelation")) > 0: hasDomainDependantDirectives = True