Skip to content
Snippets Groups Projects
Select Git revision
  • 20a74b6749e1af0e24c8416185cfff856dcb24cf
  • main default protected
  • parcoach
  • fix-rma-lockunlock
  • paper_repro
  • fortran
  • usertypes
  • must-toolcoverage
  • toolcoverage
  • tools
  • must-json
  • merged
  • tools-parallel
  • coll
  • rma
  • dtypes
  • p2p
  • infrastructure-patch-3
  • infrastructure-patch2
  • devel-TJ
  • infrasructure-patch-1
21 results

Variables.py

Blame
  • Variables.py 2.59 KiB
    #! /usr/bin/python3
    
    # The 'Magic' Comments denoting where the Error is in a testcase
    ERROR_MARKER_COMMENT_BEGIN = "/*MBBERROR_BEGIN*/"
    ERROR_MARKER_COMMENT_END = "/*MBBERROR_END*/"
    ERROR_MARKER_COMMENT_BEGIN_FORT = "! MBBERROR_BEGIN\n"
    ERROR_MARKER_COMMENT_END_FORT = "\n! MBBERROR_END"
    
    # The List of  Features considered
    featurelist = ["P2P", "COLL", "RMA", "TOOL", "other"]
    
    # Language to use
    generator_language = "c"
    
    arg_c_to_fort = {
        "MPI_INT": "MPI_INTEGER",
        "MPI_DOUBLE": "MPI_DOUBLE_PRECISION",
        "MPI_C_BOOL": "MPI_LOGICAL",
        "sizeof(int)": "integer_size",
        "sizeof(signed int)": "integer_size",
        "sizeof(_Bool)": "logical_size",
        "sizeof(double)": "double_size",
        "true": ".TRUE.",
        "false": ".FALSE.",
    }
    
    def adjust_var_language(var) -> str:
        import re
        actual_value = str(var)
        if generator_language == "fort":
            # NULL() and MPI_REQUEST_NULL (as a literal, not variable) are both caught by the compiler
            # Tests are invalid, and would not compile
            if actual_value == "NULL" or actual_value == "MPI_REQUEST_NULL": actual_value = "! FORTRAN_INCOMPATIBLE"
            # Using a C datatype with no (implemented) fortran equivalent, also invalid
            from Infrastructure.TemplateFactory import predefined_types
            if actual_value in predefined_types and actual_value not in arg_c_to_fort: actual_value = "! FORTRAN_INCOMPATIBLE"
            # Normal replacements
            for c_arg in arg_c_to_fort.keys():
                if c_arg in str(actual_value):
                    actual_value = actual_value.replace(c_arg, arg_c_to_fort[c_arg])
                    break
            # Need to remove addrof
            actual_value = actual_value.replace("&", "")
            # Need to remove derefs, but preserve multiplication!
            actual_value = re.sub(r"^\*", r"", actual_value)
            # Need to replace % with MODULO
            actual_value = re.sub(r"([A-z0-9]+)\s*\%\s*([A-z0-9]+)", r"modulo(\1, \2)", actual_value)
            # Replace array access [*] with (*)
            actual_value = re.sub(r"([A-z0-9]+)\s*\[(.+)\]", r"\1(\2)", actual_value)
        return actual_value
    
    BASIC_TEST_LEVEL = 1
    SUFFICIENT_REAL_WORLD_TEST_LEVEL = 2
    SUFFICIENT_TEST_LEVEL = 3
    FULL_REAL_WORLD_TEST_LEVEL = 4
    FULL_TEST_LEVEL = 5
    
    REAL_WORLD_FILTERING_LEVELS = [SUFFICIENT_REAL_WORLD_TEST_LEVEL, FULL_REAL_WORLD_TEST_LEVEL]
    
    # list of all error possible classes
    ERROR_CLASSES = [
        "Correct",  # no error
    
        "LocalConcurrency",
        "GlobalConcurrency",
    
        "CallOrdering",
        "MissingCall",
    
        "EpochLifeCycle",
        "RequestLifeCycle",
    
        "LocalParameterMissmatch",
        "GlobalParameterMissmatch",
    
        "InvalidParam",
    
    ]