diff --git a/discopop_explorer/PETGraphX.py b/discopop_explorer/PETGraphX.py index c6d77ade1..91421c61f 100644 --- a/discopop_explorer/PETGraphX.py +++ b/discopop_explorer/PETGraphX.py @@ -9,20 +9,18 @@ from __future__ import annotations import copy -import sys -from time import sleep -from typing import Dict, List, Sequence, Tuple, Set, Optional, Type, TypeVar, cast, Union, overload, Any -from enum import IntEnum, Enum import itertools +from enum import IntEnum, Enum +from typing import Dict, List, Sequence, Tuple, Set, Optional, Type, TypeVar, cast, Union, overload, Any import jsonpickle # type:ignore import matplotlib.pyplot as plt # type:ignore import networkx as nx # type:ignore +from alive_progress import alive_bar # type: ignore from lxml.objectify import ObjectifiedElement # type:ignore from .parser import LoopData, readlineToCUIdMap, writelineToCUIdMap, DependenceItem from .variable import Variable -from alive_progress import alive_bar # type: ignore # unused diff --git a/discopop_explorer/discopop_explorer.py b/discopop_explorer/discopop_explorer.py index 343011cdd..8156c71b3 100644 --- a/discopop_explorer/discopop_explorer.py +++ b/discopop_explorer/discopop_explorer.py @@ -7,27 +7,26 @@ # directory for details. import cProfile -from dataclasses import dataclass -from pathlib import Path -from pluginbase import PluginBase # type:ignore -from typing import List, Optional - import json import os -import pstats2 # type:ignore import sys import time +from dataclasses import dataclass +from pathlib import Path +from typing import List, Optional -from .json_serializer import PatternInfoSerializer -from .parser import parse_inputs -from .pattern_detection import PatternDetectorX -from .PETGraphX import PETGraphX +import pstats2 # type:ignore +from pluginbase import PluginBase # type:ignore +from discopop_library.PathManagement.PathManagement import get_path from discopop_library.discopop_optimizer.Microbench.ExtrapInterpolatedMicrobench import ( ExtrapInterpolatedMicrobench, ) -from discopop_library.PathManagement.PathManagement import get_path from discopop_library.result_classes.DetectionResult import DetectionResult +from .PETGraphX import PETGraphX +from .json_serializer import PatternInfoSerializer +from .parser import parse_inputs +from .pattern_detection import PatternDetectorX @dataclass diff --git a/discopop_explorer/generate_Data_CUInst.py b/discopop_explorer/generate_Data_CUInst.py index 5f7268615..e64ac4633 100644 --- a/discopop_explorer/generate_Data_CUInst.py +++ b/discopop_explorer/generate_Data_CUInst.py @@ -20,7 +20,6 @@ EdgeType, ) from .parser import parse_inputs -from discopop_library.PathManagement.PathManagement import get_path def __collect_children_ids(pet: PETGraphX, parent_id: NodeID, children_ids: List[NodeID]): diff --git a/discopop_explorer/json_serializer.py b/discopop_explorer/json_serializer.py index c9740b092..c0aee07dc 100644 --- a/discopop_explorer/json_serializer.py +++ b/discopop_explorer/json_serializer.py @@ -9,12 +9,12 @@ from json import JSONEncoder from typing import Dict, Any -from .PETGraphX import Node from discopop_library.result_classes.DetectionResult import DetectionResult +from .PETGraphX import Node from .pattern_detectors.PatternInfo import PatternInfo from .pattern_detectors.pipeline_detector import PipelineStage -from .variable import Variable from .pattern_detectors.task_parallelism.classes import TPIType +from .variable import Variable def filter_members(d: Dict[Any, Any]) -> Dict[Any, Any]: diff --git a/discopop_explorer/parser.py b/discopop_explorer/parser.py index 1f48e9210..802229a8f 100644 --- a/discopop_explorer/parser.py +++ b/discopop_explorer/parser.py @@ -6,13 +6,13 @@ # the 3-Clause BSD License. See the LICENSE file in the package base # directory for details. -from dataclasses import dataclass -import re import os -from typing import Any, List, Tuple +import re import warnings from collections import defaultdict +from dataclasses import dataclass from os.path import abspath, dirname +from typing import Any, List, Tuple from lxml import objectify # type:ignore diff --git a/discopop_explorer/pattern_detection.py b/discopop_explorer/pattern_detection.py index 78aedd683..78dc5adf7 100644 --- a/discopop_explorer/pattern_detection.py +++ b/discopop_explorer/pattern_detection.py @@ -5,10 +5,13 @@ # This software may be modified and distributed under the terms of # the 3-Clause BSD License. See the LICENSE file in the package base # directory for details. -import os import sys -from typing import Dict, Union +from alive_progress import alive_bar # type: ignore + +from discopop_explorer.pattern_detectors.task_parallelism.task_parallelism_detector import ( + build_preprocessed_graph_and_run_detection as detect_tp, +) from discopop_library.discopop_optimizer.OptimizationGraph import OptimizationGraph from discopop_library.discopop_optimizer.Variables.Experiment import Experiment from discopop_library.discopop_optimizer.classes.system.System import System @@ -20,13 +23,9 @@ from .PETGraphX import DummyNode, LoopNode, PETGraphX, EdgeType from .pattern_detectors.do_all_detector import run_detection as detect_do_all from .pattern_detectors.geometric_decomposition_detector import run_detection as detect_gd -from .pattern_detectors.simple_gpu_patterns.gpu_pattern_detector import run_detection as detect_gpu from .pattern_detectors.pipeline_detector import run_detection as detect_pipeline from .pattern_detectors.reduction_detector import run_detection as detect_reduction -from discopop_explorer.pattern_detectors.task_parallelism.task_parallelism_detector import ( - build_preprocessed_graph_and_run_detection as detect_tp, -) -from alive_progress import alive_bar # type: ignore +from .pattern_detectors.simple_gpu_patterns.gpu_pattern_detector import run_detection as detect_gpu class PatternDetectorX(object): diff --git a/discopop_explorer/pattern_detectors/PatternInfo.py b/discopop_explorer/pattern_detectors/PatternInfo.py index 989a41339..126c7537a 100644 --- a/discopop_explorer/pattern_detectors/PatternInfo.py +++ b/discopop_explorer/pattern_detectors/PatternInfo.py @@ -8,8 +8,8 @@ import json from typing import Optional -from ..utils import calculate_workload, calculate_per_iteration_workload_of_loop from ..PETGraphX import LoopNode, Node, NodeID, LineID, PETGraphX +from ..utils import calculate_workload, calculate_per_iteration_workload_of_loop class PatternInfo(object): diff --git a/discopop_explorer/pattern_detectors/combined_gpu_patterns/CombinedGPURegions.py b/discopop_explorer/pattern_detectors/combined_gpu_patterns/CombinedGPURegions.py index c8dd0e3f0..879b13b92 100644 --- a/discopop_explorer/pattern_detectors/combined_gpu_patterns/CombinedGPURegions.py +++ b/discopop_explorer/pattern_detectors/combined_gpu_patterns/CombinedGPURegions.py @@ -5,11 +5,14 @@ # This software may be modified and distributed under the terms of # the 3-Clause BSD License. See the LICENSE file in the package base # directory for details. -import os.path -from typing import List, Tuple, Dict, Set, Type, Optional +import sys +from typing import List, Tuple, Dict, Set from discopop_explorer.PETGraphX import EdgeType, CUNode, PETGraphX, NodeID, MemoryRegion from discopop_explorer.pattern_detectors.PatternInfo import PatternInfo +from discopop_explorer.pattern_detectors.combined_gpu_patterns.classes.Aliases import ( + VarName, +) from discopop_explorer.pattern_detectors.combined_gpu_patterns.classes.Dependency import Dependency from discopop_explorer.pattern_detectors.combined_gpu_patterns.classes.Enums import ( ExitPointPositioning, @@ -18,10 +21,6 @@ EntryPointType, UpdateType, ) -from discopop_explorer.pattern_detectors.combined_gpu_patterns.classes.Aliases import ( - VarName, -) -from discopop_explorer.pattern_detectors.combined_gpu_patterns.classes.Update import Update from discopop_explorer.pattern_detectors.combined_gpu_patterns.prepare_metadata import ( get_dependencies_as_metadata, ) @@ -35,21 +34,21 @@ add_memory_regions_to_device_liveness, propagate_memory_regions, convert_liveness, - extend_data_lifespan, calculate_host_liveness, ) from discopop_explorer.pattern_detectors.combined_gpu_patterns.step_3 import ( initialize_writes, - propagate_writes, cleanup_writes, group_writes_by_cu, ) from discopop_explorer.pattern_detectors.combined_gpu_patterns.step_4 import ( - identify_updates, create_circle_free_function_graphs, add_accesses_from_called_functions, identify_updates_in_unrolled_function_graphs, ) +from discopop_explorer.pattern_detectors.combined_gpu_patterns.step_5 import ( + propagate_variable_name_associations, +) from discopop_explorer.pattern_detectors.combined_gpu_patterns.step_6 import ( convert_updates_to_entry_and_exit_points, identify_end_of_life_points, @@ -58,17 +57,8 @@ remove_duplicates, join_elements, ) -from discopop_explorer.pattern_detectors.combined_gpu_patterns.utilities import ( - prepare_liveness_metadata, -) -from discopop_explorer.pattern_detectors.combined_gpu_patterns.step_5 import ( - propagate_variable_name_associations, -) - from discopop_explorer.pattern_detectors.simple_gpu_patterns.GPURegions import GPURegionInfo -import sys - class CombinedGPURegion(PatternInfo): contained_regions: List[GPURegionInfo] diff --git a/discopop_explorer/pattern_detectors/combined_gpu_patterns/classes/EntryPoint.py b/discopop_explorer/pattern_detectors/combined_gpu_patterns/classes/EntryPoint.py index 207718d8d..76724ca3d 100644 --- a/discopop_explorer/pattern_detectors/combined_gpu_patterns/classes/EntryPoint.py +++ b/discopop_explorer/pattern_detectors/combined_gpu_patterns/classes/EntryPoint.py @@ -6,7 +6,6 @@ # the 3-Clause BSD License. See the LICENSE file in the package base # directory for details. import os.path -import sys from typing import Set, Tuple, List from discopop_explorer.PETGraphX import PETGraphX, NodeID, MemoryRegion diff --git a/discopop_explorer/pattern_detectors/combined_gpu_patterns/prepare_metadata.py b/discopop_explorer/pattern_detectors/combined_gpu_patterns/prepare_metadata.py index 6b95d9b95..fc957b89a 100644 --- a/discopop_explorer/pattern_detectors/combined_gpu_patterns/prepare_metadata.py +++ b/discopop_explorer/pattern_detectors/combined_gpu_patterns/prepare_metadata.py @@ -6,16 +6,11 @@ # the 3-Clause BSD License. See the LICENSE file in the package base # directory for details. -import sys from typing import Set, List, Tuple from discopop_explorer.PETGraphX import PETGraphX, NodeID from discopop_explorer.pattern_detectors.combined_gpu_patterns.classes.Aliases import VarName from discopop_explorer.pattern_detectors.combined_gpu_patterns.classes.Dependency import Dependency -from discopop_explorer.pattern_detectors.combined_gpu_patterns.classes.Enums import ( - EntryPointPositioning, - ExitPointPositioning, -) def get_dependencies_as_metadata( diff --git a/discopop_explorer/pattern_detectors/combined_gpu_patterns/step_3.py b/discopop_explorer/pattern_detectors/combined_gpu_patterns/step_3.py index 73c68cd42..fd7f11dd9 100644 --- a/discopop_explorer/pattern_detectors/combined_gpu_patterns/step_3.py +++ b/discopop_explorer/pattern_detectors/combined_gpu_patterns/step_3.py @@ -6,8 +6,7 @@ # the 3-Clause BSD License. See the LICENSE file in the package base # directory for details. -import sys -from typing import Dict, List, Tuple, Set, Optional, cast +from typing import Dict, List, Tuple, Set, Optional from discopop_explorer.PETGraphX import PETGraphX, EdgeType, NodeID, CUNode, MemoryRegion diff --git a/discopop_explorer/pattern_detectors/combined_gpu_patterns/step_4.py b/discopop_explorer/pattern_detectors/combined_gpu_patterns/step_4.py index 10ecc68b9..8f22e28c8 100644 --- a/discopop_explorer/pattern_detectors/combined_gpu_patterns/step_4.py +++ b/discopop_explorer/pattern_detectors/combined_gpu_patterns/step_4.py @@ -7,7 +7,8 @@ # directory for details. import copy -from typing import Dict, Set, Tuple, Optional, List, cast, Any +import sys +from typing import Dict, Set, Tuple, Optional, List, cast import networkx as nx # type: ignore from networkx import NetworkXNoCycle, MultiDiGraph @@ -22,8 +23,6 @@ Dependency, FunctionNode, ) -import sys - from discopop_explorer.pattern_detectors.combined_gpu_patterns.classes.Enums import UpdateType from discopop_explorer.pattern_detectors.combined_gpu_patterns.classes.Update import Update diff --git a/discopop_explorer/pattern_detectors/combined_gpu_patterns/step_5.py b/discopop_explorer/pattern_detectors/combined_gpu_patterns/step_5.py index bd59a3a58..7f531b2de 100644 --- a/discopop_explorer/pattern_detectors/combined_gpu_patterns/step_5.py +++ b/discopop_explorer/pattern_detectors/combined_gpu_patterns/step_5.py @@ -6,7 +6,7 @@ # the 3-Clause BSD License. See the LICENSE file in the package base # directory for details. -from typing import Dict, Set, cast +from typing import Dict, Set from discopop_explorer.PETGraphX import PETGraphX, NodeID, MemoryRegion from discopop_explorer.pattern_detectors.combined_gpu_patterns.classes.Aliases import ( diff --git a/discopop_explorer/pattern_detectors/combined_gpu_patterns/step_6.py b/discopop_explorer/pattern_detectors/combined_gpu_patterns/step_6.py index 13bda16d0..5bd80370c 100644 --- a/discopop_explorer/pattern_detectors/combined_gpu_patterns/step_6.py +++ b/discopop_explorer/pattern_detectors/combined_gpu_patterns/step_6.py @@ -7,7 +7,6 @@ # directory for details. import copy import sys -import typing from typing import Set, Tuple, Dict, List, cast, Optional, Union from networkx import MultiDiGraph # type: ignore @@ -24,14 +23,11 @@ from discopop_explorer.pattern_detectors.combined_gpu_patterns.classes.Aliases import ( VarName, ) -from discopop_explorer.pattern_detectors.combined_gpu_patterns.classes.Dependency import Dependency from discopop_explorer.pattern_detectors.combined_gpu_patterns.classes.EntryPoint import EntryPoint from discopop_explorer.pattern_detectors.combined_gpu_patterns.classes.Enums import ( UpdateType, EntryPointType, ExitPointType, - EntryPointPositioning, - ExitPointPositioning, ) from discopop_explorer.pattern_detectors.combined_gpu_patterns.classes.ExitPoint import ExitPoint from discopop_explorer.pattern_detectors.combined_gpu_patterns.classes.Update import Update diff --git a/discopop_explorer/pattern_detectors/combined_gpu_patterns/utilities.py b/discopop_explorer/pattern_detectors/combined_gpu_patterns/utilities.py index 5e441c551..b5b739013 100644 --- a/discopop_explorer/pattern_detectors/combined_gpu_patterns/utilities.py +++ b/discopop_explorer/pattern_detectors/combined_gpu_patterns/utilities.py @@ -9,7 +9,6 @@ from typing import List, Set, Dict, Tuple, Optional from discopop_explorer.PETGraphX import ( - CUNode, PETGraphX, EdgeType, NodeID, diff --git a/discopop_explorer/pattern_detectors/do_all_detector.py b/discopop_explorer/pattern_detectors/do_all_detector.py index 061afa114..ca66fa152 100644 --- a/discopop_explorer/pattern_detectors/do_all_detector.py +++ b/discopop_explorer/pattern_detectors/do_all_detector.py @@ -5,8 +5,11 @@ # This software may be modified and distributed under the terms of # the 3-Clause BSD License. See the LICENSE file in the package base # directory for details. +from multiprocessing import Pool from typing import List, Dict, Set, Tuple, cast + from alive_progress import alive_bar # type: ignore + from .PatternInfo import PatternInfo from ..PETGraphX import ( CUNode, @@ -19,9 +22,8 @@ MemoryRegion, DepType, ) -from ..variable import Variable from ..utils import classify_loop_variables -from multiprocessing import Pool +from ..variable import Variable class DoAllInfo(PatternInfo): diff --git a/discopop_explorer/pattern_detectors/geometric_decomposition_detector.py b/discopop_explorer/pattern_detectors/geometric_decomposition_detector.py index 55ec86899..809524420 100644 --- a/discopop_explorer/pattern_detectors/geometric_decomposition_detector.py +++ b/discopop_explorer/pattern_detectors/geometric_decomposition_detector.py @@ -10,11 +10,12 @@ import math from typing import Dict, List, Tuple, Optional +from alive_progress import alive_bar # type: ignore + from .PatternInfo import PatternInfo -from ..PETGraphX import FunctionNode, LoopNode, NodeID, PETGraphX, NodeType, Node, EdgeType -from ..utils import classify_task_vars, get_child_loops, contains +from ..PETGraphX import FunctionNode, LoopNode, NodeID, PETGraphX, Node, EdgeType +from ..utils import classify_task_vars, get_child_loops from ..variable import Variable -from alive_progress import alive_bar # type: ignore __loop_iterations: Dict[NodeID, int] = {} diff --git a/discopop_explorer/pattern_detectors/pipeline_detector.py b/discopop_explorer/pattern_detectors/pipeline_detector.py index 1b5e8cfdd..7f0937d08 100644 --- a/discopop_explorer/pattern_detectors/pipeline_detector.py +++ b/discopop_explorer/pattern_detectors/pipeline_detector.py @@ -8,7 +8,9 @@ from typing import List, Tuple, Dict, Set + from alive_progress import alive_bar # type: ignore + from .PatternInfo import PatternInfo from ..PETGraphX import ( CUNode, @@ -16,13 +18,12 @@ LoopNode, NodeID, PETGraphX, - NodeType, Node, EdgeType, DepType, Dependency, ) -from ..utils import correlation_coefficient, classify_task_vars, contains +from ..utils import correlation_coefficient, classify_task_vars __pipeline_threshold = 0.9 diff --git a/discopop_explorer/pattern_detectors/reduction_detector.py b/discopop_explorer/pattern_detectors/reduction_detector.py index f28eaaa39..2f07e77cd 100644 --- a/discopop_explorer/pattern_detectors/reduction_detector.py +++ b/discopop_explorer/pattern_detectors/reduction_detector.py @@ -7,7 +7,9 @@ # directory for details. +from multiprocessing import Pool from typing import List, cast + from alive_progress import alive_bar # type: ignore from .PatternInfo import PatternInfo @@ -21,9 +23,8 @@ DepType, EdgeType, ) +from ..utils import is_reduction_var, classify_loop_variables from ..variable import Variable -from ..utils import is_reduction_var, classify_loop_variables, contains -from multiprocessing import Pool class ReductionInfo(PatternInfo): diff --git a/discopop_explorer/pattern_detectors/simple_gpu_patterns/GPULoop.py b/discopop_explorer/pattern_detectors/simple_gpu_patterns/GPULoop.py index cfb24f06c..65c98270e 100644 --- a/discopop_explorer/pattern_detectors/simple_gpu_patterns/GPULoop.py +++ b/discopop_explorer/pattern_detectors/simple_gpu_patterns/GPULoop.py @@ -6,17 +6,12 @@ # the 3-Clause BSD License. See the LICENSE file in the package base # directory for details. import os -import sys from enum import IntEnum - from typing import List, Set, Optional, Union, Any, Dict, Tuple, cast -from discopop_library.MemoryRegions.utils import get_sizes_of_memory_regions -from .GPUMemory import getCalledFunctions, map_node, map_type_t, assignMapType from discopop_explorer.PETGraphX import ( PETGraphX, CUNode, - NodeType, parse_id, DepType, NodeID, @@ -26,30 +21,28 @@ Node, LoopNode, ) +from discopop_explorer.pattern_detectors.PatternInfo import PatternInfo +from discopop_explorer.utils import ( + __get_dep_of_type as get_dep_of_type, +) from discopop_explorer.utils import ( is_scalar_val, is_loop_index2, classify_loop_variables, get_initialized_memory_regions_in, ) -from discopop_explorer.utils import ( - __get_variables as get_vars, - __get_dep_of_type as get_dep_of_type, -) from discopop_explorer.utils import ( is_written_in_subtree, is_func_arg, is_readonly, is_global, - is_read_in_subtree, is_read_in_right_subtree, is_first_written, is_read_in_subtree, ) -from discopop_explorer.pattern_detectors.PatternInfo import PatternInfo from discopop_explorer.variable import Variable -from discopop_explorer.pattern_detectors.do_all_detector import DoAllInfo - +from discopop_library.MemoryRegions.utils import get_sizes_of_memory_regions +from .GPUMemory import getCalledFunctions, map_node """ def remove_duplicates(my_list: List) -> List: diff --git a/discopop_explorer/pattern_detectors/simple_gpu_patterns/GPUMemory.py b/discopop_explorer/pattern_detectors/simple_gpu_patterns/GPUMemory.py index 4ac084d88..96f232302 100644 --- a/discopop_explorer/pattern_detectors/simple_gpu_patterns/GPUMemory.py +++ b/discopop_explorer/pattern_detectors/simple_gpu_patterns/GPUMemory.py @@ -8,11 +8,10 @@ from enum import Enum from typing import List, Set, cast, Tuple -from discopop_explorer.variable import Variable + from discopop_explorer.PETGraphX import ( PETGraphX, CUNode, - NodeType, DepType, NodeID, Node, @@ -22,6 +21,7 @@ Dependency, ) from discopop_explorer.utils import is_func_arg, is_global, __get_dep_of_type as get_dep_of_type +from discopop_explorer.variable import Variable def map_node(pet: PETGraphX, nodeID: NodeID) -> Node: diff --git a/discopop_explorer/pattern_detectors/simple_gpu_patterns/GPURegions.py b/discopop_explorer/pattern_detectors/simple_gpu_patterns/GPURegions.py index fd00a67f5..ef5131cd0 100644 --- a/discopop_explorer/pattern_detectors/simple_gpu_patterns/GPURegions.py +++ b/discopop_explorer/pattern_detectors/simple_gpu_patterns/GPURegions.py @@ -7,6 +7,9 @@ # directory for details. from typing import List, Set, Optional, cast, Dict, Tuple + +from alive_progress import alive_bar # type: ignore + from discopop_explorer.PETGraphX import ( PETGraphX, CUNode, @@ -17,12 +20,10 @@ LoopNode, Node, ) +from discopop_explorer.variable import Variable from .GPULoop import GPULoopPattern from .GPUMemory import map_node -from discopop_explorer.utils import is_loop_index2 -from discopop_explorer.variable import Variable from ..PatternInfo import PatternInfo -from alive_progress import alive_bar # type: ignore class GPURegionInfo(PatternInfo): diff --git a/discopop_explorer/pattern_detectors/simple_gpu_patterns/gpu_pattern_detector.py b/discopop_explorer/pattern_detectors/simple_gpu_patterns/gpu_pattern_detector.py index c9b9a52c6..702944bc3 100644 --- a/discopop_explorer/pattern_detectors/simple_gpu_patterns/gpu_pattern_detector.py +++ b/discopop_explorer/pattern_detectors/simple_gpu_patterns/gpu_pattern_detector.py @@ -8,18 +8,16 @@ from typing import List, cast -from discopop_explorer.PETGraphX import NodeType, PETGraphX, LoopNode +from alive_progress import alive_bar # type: ignore + +from discopop_explorer.PETGraphX import PETGraphX, LoopNode from discopop_explorer.pattern_detectors.PatternInfo import PatternInfo -from discopop_explorer.pattern_detectors.combined_gpu_patterns.CombinedGPURegions import ( - find_combined_gpu_regions, -) from discopop_explorer.pattern_detectors.simple_gpu_patterns.GPULoop import GPULoopPattern from discopop_explorer.pattern_detectors.simple_gpu_patterns.GPURegions import ( GPURegions, GPURegionInfo, ) from discopop_explorer.variable import Variable -from alive_progress import alive_bar # type: ignore def run_detection(pet: PETGraphX, res, project_folder_path: str) -> List[PatternInfo]: diff --git a/discopop_explorer/pattern_detectors/task_parallelism/alias_detection.py b/discopop_explorer/pattern_detectors/task_parallelism/alias_detection.py index 59ad2afe5..203a8348f 100644 --- a/discopop_explorer/pattern_detectors/task_parallelism/alias_detection.py +++ b/discopop_explorer/pattern_detectors/task_parallelism/alias_detection.py @@ -11,6 +11,7 @@ import re import subprocess from typing import Dict, List, Optional, Match, cast, Any + from lxml import objectify # type: ignore diff --git a/discopop_explorer/pattern_detectors/task_parallelism/classes.py b/discopop_explorer/pattern_detectors/task_parallelism/classes.py index 34687febd..44a6fffb8 100644 --- a/discopop_explorer/pattern_detectors/task_parallelism/classes.py +++ b/discopop_explorer/pattern_detectors/task_parallelism/classes.py @@ -12,6 +12,7 @@ from discopop_explorer.PETGraphX import Node, MWType, PETGraphX from discopop_explorer.pattern_detectors.PatternInfo import PatternInfo + # We decided to omit the information that computes the workload and the relevant codes. For large programs (e.g., ffmpeg), the generated Data.xml file becomes very large. However, we keep the code here because we would like to integrate a hotspot detection algorithm (TODO: Bertin) with the parallelism discovery. Then, we need to retrieve the information to decide which code sections (loops or functions) are worth parallelizing. # from discopop_explorer.utils import total_instructions_count, calculate_workload diff --git a/discopop_explorer/pattern_detectors/task_parallelism/preprocessor.py b/discopop_explorer/pattern_detectors/task_parallelism/preprocessor.py index 36aa00d27..f9682382e 100644 --- a/discopop_explorer/pattern_detectors/task_parallelism/preprocessor.py +++ b/discopop_explorer/pattern_detectors/task_parallelism/preprocessor.py @@ -12,8 +12,7 @@ from lxml import objectify, etree # type: ignore -from discopop_explorer.PETGraphX import LoopNode, NodeType, PETGraphX - +from discopop_explorer.PETGraphX import LoopNode, PETGraphX from discopop_explorer.pattern_detectors.task_parallelism.tp_utils import line_contained_in_region diff --git a/discopop_explorer/pattern_detectors/task_parallelism/suggesters/auxiliary.py b/discopop_explorer/pattern_detectors/task_parallelism/suggesters/auxiliary.py index 90dc07d9f..7125fdfe7 100644 --- a/discopop_explorer/pattern_detectors/task_parallelism/suggesters/auxiliary.py +++ b/discopop_explorer/pattern_detectors/task_parallelism/suggesters/auxiliary.py @@ -14,7 +14,6 @@ from discopop_explorer.pattern_detectors.task_parallelism.classes import ( TaskParallelismInfo, ParallelRegionInfo, - Task, OmittableCuInfo, TPIType, ) diff --git a/discopop_explorer/pattern_detectors/task_parallelism/suggesters/data_sharing_clauses.py b/discopop_explorer/pattern_detectors/task_parallelism/suggesters/data_sharing_clauses.py index 654dcf8fc..78495d0e3 100644 --- a/discopop_explorer/pattern_detectors/task_parallelism/suggesters/data_sharing_clauses.py +++ b/discopop_explorer/pattern_detectors/task_parallelism/suggesters/data_sharing_clauses.py @@ -6,9 +6,9 @@ # the 3-Clause BSD License. See the LICENSE file in the package base # directory for details. -from typing import List, cast +from typing import List -from discopop_explorer.PETGraphX import EdgeType, FunctionNode, NodeType, PETGraphX +from discopop_explorer.PETGraphX import EdgeType, FunctionNode, PETGraphX from discopop_explorer.pattern_detectors.PatternInfo import PatternInfo from discopop_explorer.pattern_detectors.task_parallelism.classes import ( TaskParallelismInfo, diff --git a/discopop_explorer/pattern_detectors/task_parallelism/suggesters/dependency_clauses.py b/discopop_explorer/pattern_detectors/task_parallelism/suggesters/dependency_clauses.py index 1e9102159..46cf44bac 100644 --- a/discopop_explorer/pattern_detectors/task_parallelism/suggesters/dependency_clauses.py +++ b/discopop_explorer/pattern_detectors/task_parallelism/suggesters/dependency_clauses.py @@ -7,23 +7,23 @@ # directory for details. import os -from typing import List, Dict, Tuple, Optional, Union, cast, Any +from typing import List, Dict, Tuple, Optional, cast, Any from discopop_explorer.PETGraphX import ( CUNode, - DummyNode, EdgeType, FunctionNode, - NodeType, Node, PETGraphX, NodeID, LineID, ) from discopop_explorer.pattern_detectors.PatternInfo import PatternInfo +from discopop_explorer.pattern_detectors.task_parallelism.alias_detection import ( + get_alias_information as get_alias_detection_result, +) from discopop_explorer.pattern_detectors.task_parallelism.classes import ( TaskParallelismInfo, - OmittableCuInfo, TPIType, ) from discopop_explorer.pattern_detectors.task_parallelism.tp_utils import ( @@ -33,9 +33,6 @@ demangle, get_called_functions_recursively, ) -from discopop_explorer.pattern_detectors.task_parallelism.alias_detection import ( - get_alias_information as get_alias_detection_result, -) def detect_dependency_clauses_alias_based( diff --git a/discopop_explorer/pattern_detectors/task_parallelism/suggesters/tasks.py b/discopop_explorer/pattern_detectors/task_parallelism/suggesters/tasks.py index c0a9830dd..64888b1e2 100644 --- a/discopop_explorer/pattern_detectors/task_parallelism/suggesters/tasks.py +++ b/discopop_explorer/pattern_detectors/task_parallelism/suggesters/tasks.py @@ -13,7 +13,6 @@ FunctionNode, LoopNode, MWType, - NodeType, EdgeType, Node, PETGraphX, diff --git a/discopop_explorer/pattern_detectors/task_parallelism/task_parallelism_detector.py b/discopop_explorer/pattern_detectors/task_parallelism/task_parallelism_detector.py index c51422287..2bf13f596 100644 --- a/discopop_explorer/pattern_detectors/task_parallelism/task_parallelism_detector.py +++ b/discopop_explorer/pattern_detectors/task_parallelism/task_parallelism_detector.py @@ -9,7 +9,7 @@ from typing import List, Optional, cast -from discopop_explorer.PETGraphX import DummyNode, PETGraphX, NodeType, MWType +from discopop_explorer.PETGraphX import DummyNode, PETGraphX, MWType from discopop_explorer.parser import parse_inputs from discopop_explorer.pattern_detectors.PatternInfo import PatternInfo from discopop_explorer.pattern_detectors.do_all_detector import run_detection as detect_do_all @@ -33,6 +33,12 @@ cu_xml_preprocessing, check_loop_scopes, ) +from discopop_explorer.pattern_detectors.task_parallelism.suggesters.auxiliary import ( + suggest_parallel_regions, + set_task_contained_lines, + detect_taskloop_reduction, + combine_omittable_cus, +) from discopop_explorer.pattern_detectors.task_parallelism.suggesters.barriers import ( detect_barrier_suggestions, suggest_barriers_for_uncovered_tasks_before_return, @@ -49,12 +55,6 @@ detect_task_suggestions, correct_task_suggestions_in_loop_body, ) -from discopop_explorer.pattern_detectors.task_parallelism.suggesters.auxiliary import ( - suggest_parallel_regions, - set_task_contained_lines, - detect_taskloop_reduction, - combine_omittable_cus, -) from discopop_explorer.pattern_detectors.task_parallelism.tp_utils import ( create_task_tree, __forks, diff --git a/discopop_explorer/pattern_detectors/task_parallelism/tp_utils.py b/discopop_explorer/pattern_detectors/task_parallelism/tp_utils.py index 59700eb26..8f30a96e8 100644 --- a/discopop_explorer/pattern_detectors/task_parallelism/tp_utils.py +++ b/discopop_explorer/pattern_detectors/task_parallelism/tp_utils.py @@ -7,9 +7,10 @@ # directory for details. import subprocess -from typing import Union, cast, IO, Dict, List, Tuple, Optional, Any +from typing import Union, cast, Dict, List, Tuple, Optional, Any from lxml import objectify # type: ignore + from discopop_explorer.PETGraphX import ( DummyNode, FunctionNode, diff --git a/discopop_explorer/plugins/pipeline.py b/discopop_explorer/plugins/pipeline.py index 31c12d246..6b3549e02 100644 --- a/discopop_explorer/plugins/pipeline.py +++ b/discopop_explorer/plugins/pipeline.py @@ -9,7 +9,7 @@ from copy import deepcopy from typing import List -from ..PETGraphX import LineID, LoopNode, PETGraphX, NodeType, Node, EdgeType +from ..PETGraphX import LineID, LoopNode, PETGraphX, Node, EdgeType from ..utils import correlation_coefficient total = 0 diff --git a/discopop_explorer/utils.py b/discopop_explorer/utils.py index 68ccfefc0..0b8bfada3 100644 --- a/discopop_explorer/utils.py +++ b/discopop_explorer/utils.py @@ -5,8 +5,6 @@ # This software may be modified and distributed under the terms of # the 3-Clause BSD License. See the LICENSE file in the package base # directory for details. -import sys -import time import itertools from typing import List, Sequence, Set, Dict, Tuple, cast diff --git a/discopop_explorer/variable.py b/discopop_explorer/variable.py index ce43e5f8e..e93ebf390 100644 --- a/discopop_explorer/variable.py +++ b/discopop_explorer/variable.py @@ -5,7 +5,6 @@ # This software may be modified and distributed under the terms of # the 3-Clause BSD License. See the LICENSE file in the package base # directory for details. -import json from typing import Optional diff --git a/discopop_library/CodeGenerator/__main__.py b/discopop_library/CodeGenerator/__main__.py index c8307fe09..826cf8d52 100644 --- a/discopop_library/CodeGenerator/__main__.py +++ b/discopop_library/CodeGenerator/__main__.py @@ -31,8 +31,8 @@ from discopop_library.CodeGenerator.CodeGenerator import ( from_json_strings as generate_code_from_json_strings, ) -from discopop_library.PathManagement.PathManagement import load_file_mapping, get_path from discopop_library.JSONHandler.JSONHandler import read_patterns_from_json_to_json +from discopop_library.PathManagement.PathManagement import load_file_mapping, get_path docopt_schema = Schema( { diff --git a/discopop_library/CodeGenerator/classes/ContentBuffer.py b/discopop_library/CodeGenerator/classes/ContentBuffer.py index e748f6d4f..a49831fa7 100644 --- a/discopop_library/CodeGenerator/classes/ContentBuffer.py +++ b/discopop_library/CodeGenerator/classes/ContentBuffer.py @@ -11,9 +11,8 @@ import re import shlex import subprocess -import sys from pathlib import Path -from typing import List, Dict, Sequence, Any, Optional +from typing import List, Dict, Any, Optional from discopop_library.CodeGenerator.classes.Enums import PragmaPosition from discopop_library.CodeGenerator.classes.Line import Line diff --git a/discopop_library/discopop_optimizer/CostModels/CostModel.py b/discopop_library/discopop_optimizer/CostModels/CostModel.py index 8689fa832..95206a76f 100644 --- a/discopop_library/discopop_optimizer/CostModels/CostModel.py +++ b/discopop_library/discopop_optimizer/CostModels/CostModel.py @@ -7,8 +7,6 @@ # directory for details. import random import sys -import warnings -from functools import cmp_to_key from typing import List, Dict, Tuple, Optional import numpy as np diff --git a/discopop_library/discopop_optimizer/CostModels/DataTransfer/DataTransferCosts.py b/discopop_library/discopop_optimizer/CostModels/DataTransfer/DataTransferCosts.py index d0049cdc8..e0693859a 100644 --- a/discopop_library/discopop_optimizer/CostModels/DataTransfer/DataTransferCosts.py +++ b/discopop_library/discopop_optimizer/CostModels/DataTransfer/DataTransferCosts.py @@ -5,7 +5,7 @@ # This software may be modified and distributed under the terms of # the 3-Clause BSD License. See the LICENSE file in the package base # directory for details. -from typing import Dict, List, Tuple, Set +from typing import Dict, List, Tuple import networkx as nx # type: ignore from sympy import Integer # type: ignore @@ -16,7 +16,6 @@ from discopop_library.discopop_optimizer.classes.context.ContextObjectUtils import ( get_transfer_costs, ) -from discopop_library.discopop_optimizer.classes.context.Update import Update from discopop_library.discopop_optimizer.classes.nodes.FunctionRoot import FunctionRoot diff --git a/discopop_library/discopop_optimizer/CostModels/utilities.py b/discopop_library/discopop_optimizer/CostModels/utilities.py index ff87a72ef..dd9bb9bf2 100644 --- a/discopop_library/discopop_optimizer/CostModels/utilities.py +++ b/discopop_library/discopop_optimizer/CostModels/utilities.py @@ -16,8 +16,6 @@ from discopop_library.discopop_optimizer.CostModels.CostModel import CostModel from discopop_library.discopop_optimizer.Variables.Experiment import Experiment from discopop_library.discopop_optimizer.classes.nodes.FunctionRoot import FunctionRoot -from discopop_library.discopop_optimizer.classes.nodes.GenericNode import GenericNode -from discopop_library.discopop_optimizer.classes.nodes.Loop import Loop from discopop_library.discopop_optimizer.classes.system.devices.GPU import GPU from discopop_library.discopop_optimizer.utilities.MOGUtilities import ( get_successors, diff --git a/discopop_library/discopop_optimizer/DataTransfers/DataTransfers.py b/discopop_library/discopop_optimizer/DataTransfers/DataTransfers.py index c4541826d..93ed6ccc1 100644 --- a/discopop_library/discopop_optimizer/DataTransfers/DataTransfers.py +++ b/discopop_library/discopop_optimizer/DataTransfers/DataTransfers.py @@ -5,16 +5,14 @@ # This software may be modified and distributed under the terms of # the 3-Clause BSD License. See the LICENSE file in the package base # directory for details. -from typing import Dict, List, Tuple, Set, cast +from typing import Dict, List, Tuple, cast import networkx as nx # type: ignore from discopop_library.discopop_optimizer.CostModels.CostModel import CostModel from discopop_library.discopop_optimizer.classes.context.ContextObject import ContextObject -from discopop_library.discopop_optimizer.classes.context.Update import Update from discopop_library.discopop_optimizer.classes.nodes.ContextNode import ContextNode from discopop_library.discopop_optimizer.classes.nodes.FunctionRoot import FunctionRoot -from discopop_library.discopop_optimizer.classes.types.Aliases import DeviceID from discopop_library.discopop_optimizer.utilities.MOGUtilities import ( get_successors, data_at, diff --git a/discopop_library/discopop_optimizer/Microbench/DelaunayInterpolatedMicrobench.py b/discopop_library/discopop_optimizer/Microbench/DelaunayInterpolatedMicrobench.py index 61305d1b9..ecea207d8 100644 --- a/discopop_library/discopop_optimizer/Microbench/DelaunayInterpolatedMicrobench.py +++ b/discopop_library/discopop_optimizer/Microbench/DelaunayInterpolatedMicrobench.py @@ -5,18 +5,18 @@ # This software may be modified and distributed under the terms of # the 3-Clause BSD License. See the LICENSE file in the package base # directory for details. -from .PureDataMicrobench import PureDataMicrobench +from typing import Dict, List, Tuple, Union + +import numpy as np +from scipy.interpolate import LinearNDInterpolator # type: ignore + from .Microbench import ( Microbench, MicrobenchType, MicrobenchDimension, MicrobenchCoordinate, ) - -from typing import Dict, List, Tuple, Union - -import numpy as np -from scipy.interpolate import LinearNDInterpolator # type: ignore +from .PureDataMicrobench import PureDataMicrobench # This class uses Delaunay Interpolation to create a microbench model from measurements. No extrapolation is possible diff --git a/discopop_library/discopop_optimizer/Microbench/ExtrapInterpolatedMicrobench.py b/discopop_library/discopop_optimizer/Microbench/ExtrapInterpolatedMicrobench.py index daccfc47e..960549456 100644 --- a/discopop_library/discopop_optimizer/Microbench/ExtrapInterpolatedMicrobench.py +++ b/discopop_library/discopop_optimizer/Microbench/ExtrapInterpolatedMicrobench.py @@ -5,15 +5,9 @@ # This software may be modified and distributed under the terms of # the 3-Clause BSD License. See the LICENSE file in the package base # directory for details. -from .Microbench import ( - Microbench, - MicrobenchType, - MicrobenchDimension, - MicrobenchCoordinate, -) - from typing import Dict, Tuple, Union +import sympy from extrap.entities.callpath import Callpath # type: ignore from extrap.entities.metric import Metric # type: ignore from extrap.entities.model import Model # type: ignore @@ -22,7 +16,13 @@ from extrap.modelers.model_generator import ModelGenerator # type: ignore from extrap.modelers.multi_parameter.multi_parameter_modeler import MultiParameterModeler # type: ignore from sympy.parsing.sympy_parser import parse_expr # type: ignore -import sympy + +from .Microbench import ( + Microbench, + MicrobenchType, + MicrobenchDimension, + MicrobenchCoordinate, +) # This class uses extrap to extrapolate microbench measurements. diff --git a/discopop_library/discopop_optimizer/Microbench/Microbench.py b/discopop_library/discopop_optimizer/Microbench/Microbench.py index 430d17290..b2f2567d0 100644 --- a/discopop_library/discopop_optimizer/Microbench/Microbench.py +++ b/discopop_library/discopop_optimizer/Microbench/Microbench.py @@ -6,14 +6,15 @@ # the 3-Clause BSD License. See the LICENSE file in the package base # directory for details. from __future__ import annotations + +import logging from abc import ABC, abstractmethod from enum import Enum -import logging from pathlib import Path -from typing import Dict, List, NamedTuple, Optional, Tuple, Union, cast, Any +from typing import Dict, List, NamedTuple, Optional, Tuple, Union -import numpy as np import matplotlib # type: ignore +import numpy as np matplotlib.use("Agg") from matplotlib import cm # type: ignore diff --git a/discopop_library/discopop_optimizer/Microbench/MicrobenchParser.py b/discopop_library/discopop_optimizer/Microbench/MicrobenchParser.py index 579c05a39..3c11c7ccd 100644 --- a/discopop_library/discopop_optimizer/Microbench/MicrobenchParser.py +++ b/discopop_library/discopop_optimizer/Microbench/MicrobenchParser.py @@ -5,9 +5,8 @@ # This software may be modified and distributed under the terms of # the 3-Clause BSD License. See the LICENSE file in the package base # directory for details. -from dataclasses import dataclass import json -import os +from dataclasses import dataclass from typing import Dict, List, Tuple from .Microbench import ( @@ -16,7 +15,6 @@ MicrobenchDimension, ) - # threads/workload/iterations ParsedCoordinate = Tuple[int, int, int] diff --git a/discopop_library/discopop_optimizer/Microbench/MixedMicrobench.py b/discopop_library/discopop_optimizer/Microbench/MixedMicrobench.py index fbb0c9f7a..bf64b6113 100644 --- a/discopop_library/discopop_optimizer/Microbench/MixedMicrobench.py +++ b/discopop_library/discopop_optimizer/Microbench/MixedMicrobench.py @@ -6,6 +6,7 @@ # the 3-Clause BSD License. See the LICENSE file in the package base # directory for details. from typing import Dict, List, Tuple, Union + from .Microbench import Microbench from .Microbench import MicrobenchCoordinate, MicrobenchDimension, MicrobenchType diff --git a/discopop_library/discopop_optimizer/Microbench/PureDataMicrobench.py b/discopop_library/discopop_optimizer/Microbench/PureDataMicrobench.py index 0a6a1f48d..bf0cb1f86 100644 --- a/discopop_library/discopop_optimizer/Microbench/PureDataMicrobench.py +++ b/discopop_library/discopop_optimizer/Microbench/PureDataMicrobench.py @@ -6,9 +6,10 @@ # the 3-Clause BSD License. See the LICENSE file in the package base # directory for details. from __future__ import annotations + +import json from dataclasses import dataclass from typing import Dict, List, Tuple, TypeVar, Union, overload -import json import numpy as np diff --git a/discopop_library/discopop_optimizer/OptimizationGraph.py b/discopop_library/discopop_optimizer/OptimizationGraph.py index 6ca214667..9455a5d6e 100644 --- a/discopop_library/discopop_optimizer/OptimizationGraph.py +++ b/discopop_library/discopop_optimizer/OptimizationGraph.py @@ -5,12 +5,12 @@ # This software may be modified and distributed under the terms of # the 3-Clause BSD License. See the LICENSE file in the package base # directory for details. +import tkinter as tk from typing import Dict, cast, List, Tuple, Optional, Any import jsonpickle # type: ignore import networkx as nx # type: ignore import sympy # type: ignore -import tkinter as tk from spb import plot3d, MB # type: ignore from sympy import Integer, Expr, Symbol, lambdify, plot, Float, init_printing, simplify, diff # type: ignore diff --git a/discopop_library/discopop_optimizer/PETParser/DataAccesses/FromCUs.py b/discopop_library/discopop_optimizer/PETParser/DataAccesses/FromCUs.py index c714649ae..ce8122fa8 100644 --- a/discopop_library/discopop_optimizer/PETParser/DataAccesses/FromCUs.py +++ b/discopop_library/discopop_optimizer/PETParser/DataAccesses/FromCUs.py @@ -5,7 +5,7 @@ # This software may be modified and distributed under the terms of # the 3-Clause BSD License. See the LICENSE file in the package base # directory for details. -from typing import Tuple, List, Set, cast, Dict, Optional +from typing import Tuple, Set, cast from discopop_explorer.PETGraphX import NodeID, PETGraphX, MemoryRegion, CUNode, EdgeType, DepType from discopop_library.discopop_optimizer.classes.types.DataAccessType import ( diff --git a/discopop_library/discopop_optimizer/PETParser/PETParser.py b/discopop_library/discopop_optimizer/PETParser/PETParser.py index df6ac4357..9daefce33 100644 --- a/discopop_library/discopop_optimizer/PETParser/PETParser.py +++ b/discopop_library/discopop_optimizer/PETParser/PETParser.py @@ -41,7 +41,6 @@ add_temporary_edge, redirect_edge, convert_temporary_edges, - show, get_all_function_nodes, get_read_and_written_data_from_subgraph, ) diff --git a/discopop_library/discopop_optimizer/Variables/Experiment.py b/discopop_library/discopop_optimizer/Variables/Experiment.py index b906ae84d..229f1e5e2 100644 --- a/discopop_library/discopop_optimizer/Variables/Experiment.py +++ b/discopop_library/discopop_optimizer/Variables/Experiment.py @@ -13,14 +13,14 @@ from sympy import Integer, Symbol, Expr, Float # type: ignore from discopop_explorer.PETGraphX import MemoryRegion -from discopop_library.result_classes.DetectionResult import DetectionResult -from discopop_library.PathManagement.PathManagement import load_file_mapping from discopop_library.MemoryRegions.utils import get_sizes_of_memory_regions +from discopop_library.PathManagement.PathManagement import load_file_mapping from discopop_library.discopop_optimizer.CostModels.CostModel import CostModel from discopop_library.discopop_optimizer.classes.context.ContextObject import ContextObject from discopop_library.discopop_optimizer.classes.enums.Distributions import FreeSymbolDistribution from discopop_library.discopop_optimizer.classes.nodes.FunctionRoot import FunctionRoot from discopop_library.discopop_optimizer.classes.system.System import System +from discopop_library.result_classes.DetectionResult import DetectionResult class Experiment(object): diff --git a/discopop_library/discopop_optimizer/Variables/ExperimentUtils.py b/discopop_library/discopop_optimizer/Variables/ExperimentUtils.py index 83c0b628b..08d3a58da 100644 --- a/discopop_library/discopop_optimizer/Variables/ExperimentUtils.py +++ b/discopop_library/discopop_optimizer/Variables/ExperimentUtils.py @@ -7,8 +7,9 @@ # directory for details. import os import pickle -from tkinter import Tk, Button -from typing import List, Optional, cast, Set +import tkinter as tk +from tkinter import Button +from typing import List, Optional, cast import jsonpickle # type: ignore import jsons # type: ignore @@ -22,7 +23,6 @@ ) from discopop_library.discopop_optimizer.gui.widgets.ScrollableFrame import ScrollableFrameWidget from discopop_library.discopop_optimizer.utilities.MOGUtilities import data_at -import tkinter as tk def show_function_models( diff --git a/discopop_library/discopop_optimizer/__main__.py b/discopop_library/discopop_optimizer/__main__.py index 90197c560..0c2c59061 100644 --- a/discopop_library/discopop_optimizer/__main__.py +++ b/discopop_library/discopop_optimizer/__main__.py @@ -64,7 +64,6 @@ import pstats2 # type:ignore from docopt import docopt # type:ignore from schema import Schema, Use, SchemaError # type:ignore -from sympy import Symbol, Integer from discopop_library.result_classes.DetectionResult import DetectionResult from discopop_library.discopop_optimizer.Microbench.ExtrapInterpolatedMicrobench import ( diff --git a/discopop_library/discopop_optimizer/bindings/CodeGenerator.py b/discopop_library/discopop_optimizer/bindings/CodeGenerator.py index 4d6f6b184..77e8c6772 100644 --- a/discopop_library/discopop_optimizer/bindings/CodeGenerator.py +++ b/discopop_library/discopop_optimizer/bindings/CodeGenerator.py @@ -19,7 +19,6 @@ from discopop_explorer.PETGraphX import NodeID, PETGraphX from discopop_explorer.pattern_detectors.PatternInfo import PatternInfo from discopop_explorer.pattern_detectors.device_updates import DeviceUpdateInfo -from discopop_explorer.variable import Variable from discopop_library.CodeGenerator.CodeGenerator import ( from_pattern_info as code_gen_from_pattern_info, ) diff --git a/discopop_library/discopop_optimizer/bindings/CodeStorageObject.py b/discopop_library/discopop_optimizer/bindings/CodeStorageObject.py index 99acc2184..adf0c34d6 100644 --- a/discopop_library/discopop_optimizer/bindings/CodeStorageObject.py +++ b/discopop_library/discopop_optimizer/bindings/CodeStorageObject.py @@ -8,7 +8,6 @@ from typing import Dict from discopop_library.discopop_optimizer.CostModels.CostModel import CostModel -from discopop_library.discopop_optimizer.classes.context.ContextObject import ContextObject from discopop_library.discopop_optimizer.classes.nodes.FunctionRoot import FunctionRoot diff --git a/discopop_library/discopop_optimizer/classes/context/ContextObject.py b/discopop_library/discopop_optimizer/classes/context/ContextObject.py index 914a56b50..c40714286 100644 --- a/discopop_library/discopop_optimizer/classes/context/ContextObject.py +++ b/discopop_library/discopop_optimizer/classes/context/ContextObject.py @@ -5,7 +5,7 @@ # This software may be modified and distributed under the terms of # the 3-Clause BSD License. See the LICENSE file in the package base # directory for details. -from typing import Dict, Set, cast, List, Optional +from typing import Dict, Set, List, Optional from sympy import Expr, Integer, Symbol # type: ignore diff --git a/discopop_library/discopop_optimizer/classes/edges/SuccessorEdge.py b/discopop_library/discopop_optimizer/classes/edges/SuccessorEdge.py index 7c98a18e6..fdfb09b9d 100644 --- a/discopop_library/discopop_optimizer/classes/edges/SuccessorEdge.py +++ b/discopop_library/discopop_optimizer/classes/edges/SuccessorEdge.py @@ -7,7 +7,6 @@ # directory for details. from sympy import Symbol # type: ignore -from discopop_library.discopop_optimizer.CostModels.CostModel import CostModel from discopop_library.discopop_optimizer.classes.edges.GenericEdge import GenericEdge diff --git a/discopop_library/discopop_optimizer/classes/nodes/ContextNode.py b/discopop_library/discopop_optimizer/classes/nodes/ContextNode.py index f7615fdf9..4f8679e4f 100644 --- a/discopop_library/discopop_optimizer/classes/nodes/ContextNode.py +++ b/discopop_library/discopop_optimizer/classes/nodes/ContextNode.py @@ -6,11 +6,11 @@ # the 3-Clause BSD License. See the LICENSE file in the package base # directory for details. import networkx as nx # type: ignore +from sympy import Integer from discopop_library.discopop_optimizer.CostModels.CostModel import CostModel from discopop_library.discopop_optimizer.classes.context.ContextObject import ContextObject from discopop_library.discopop_optimizer.classes.nodes.Workload import Workload -from sympy import Integer class ContextNode(Workload): diff --git a/discopop_library/discopop_optimizer/classes/nodes/Loop.py b/discopop_library/discopop_optimizer/classes/nodes/Loop.py index 69f451a1c..593e1ecf7 100644 --- a/discopop_library/discopop_optimizer/classes/nodes/Loop.py +++ b/discopop_library/discopop_optimizer/classes/nodes/Loop.py @@ -5,8 +5,7 @@ # This software may be modified and distributed under the terms of # the 3-Clause BSD License. See the LICENSE file in the package base # directory for details. -import sys -from typing import Optional, cast, Set +from typing import Optional from sympy import Symbol, Integer, Expr, Float # type: ignore diff --git a/discopop_library/discopop_optimizer/classes/nodes/Workload.py b/discopop_library/discopop_optimizer/classes/nodes/Workload.py index d74655e69..6635000c7 100644 --- a/discopop_library/discopop_optimizer/classes/nodes/Workload.py +++ b/discopop_library/discopop_optimizer/classes/nodes/Workload.py @@ -5,7 +5,7 @@ # This software may be modified and distributed under the terms of # the 3-Clause BSD License. See the LICENSE file in the package base # directory for details. -from typing import Optional, Set, List, cast, Union +from typing import Optional, Set, List, cast from sympy import Integer, Expr # type: ignore diff --git a/discopop_library/discopop_optimizer/classes/system/System.py b/discopop_library/discopop_optimizer/classes/system/System.py index 25d015dda..e49cd3804 100644 --- a/discopop_library/discopop_optimizer/classes/system/System.py +++ b/discopop_library/discopop_optimizer/classes/system/System.py @@ -8,7 +8,7 @@ import warnings from typing import Dict, List, Tuple, Optional -from sympy import Symbol, Expr, Integer, simplify +from sympy import Symbol, Expr, Integer from discopop_library.discopop_optimizer.classes.system.Network import Network from discopop_library.discopop_optimizer.classes.system.devices.CPU import CPU diff --git a/discopop_library/discopop_optimizer/classes/system/devices/Device.py b/discopop_library/discopop_optimizer/classes/system/devices/Device.py index 6bc81482f..a7bc23607 100644 --- a/discopop_library/discopop_optimizer/classes/system/devices/Device.py +++ b/discopop_library/discopop_optimizer/classes/system/devices/Device.py @@ -8,9 +8,9 @@ from typing import Tuple, List, Optional, cast from sympy import Expr, Symbol +from sympy import Integer from discopop_explorer.pattern_detectors.PatternInfo import PatternInfo -from sympy import Integer class Device(object): diff --git a/discopop_library/discopop_optimizer/classes/system/devices/GPU.py b/discopop_library/discopop_optimizer/classes/system/devices/GPU.py index 5a8918d10..8d66604cf 100644 --- a/discopop_library/discopop_optimizer/classes/system/devices/GPU.py +++ b/discopop_library/discopop_optimizer/classes/system/devices/GPU.py @@ -7,8 +7,8 @@ # directory for details. from typing import Tuple -from discopop_library.discopop_optimizer.classes.system.devices.Device import Device from discopop_explorer.pattern_detectors.PatternInfo import PatternInfo +from discopop_library.discopop_optimizer.classes.system.devices.Device import Device class GPU(Device): diff --git a/discopop_library/discopop_optimizer/classes/types/DataAccessType.py b/discopop_library/discopop_optimizer/classes/types/DataAccessType.py index 42951930d..7e7c367a8 100644 --- a/discopop_library/discopop_optimizer/classes/types/DataAccessType.py +++ b/discopop_library/discopop_optimizer/classes/types/DataAccessType.py @@ -5,7 +5,7 @@ # This software may be modified and distributed under the terms of # the 3-Clause BSD License. See the LICENSE file in the package base # directory for details. -from typing import Tuple, Optional +from typing import Optional from discopop_explorer.PETGraphX import MemoryRegion diff --git a/discopop_library/discopop_optimizer/gui/plotting/CostModels.py b/discopop_library/discopop_optimizer/gui/plotting/CostModels.py index 124baf4bf..084fdaf6a 100644 --- a/discopop_library/discopop_optimizer/gui/plotting/CostModels.py +++ b/discopop_library/discopop_optimizer/gui/plotting/CostModels.py @@ -8,17 +8,16 @@ import copy from typing import List, Dict, Tuple, Optional, cast +import matplotlib # type: ignore import numpy as np +import sympy from matplotlib import pyplot as plt # type: ignore -import matplotlib from spb import plot3d, MB, plot # type: ignore +from sympy import Integer from sympy import Symbol, Expr -import sympy from discopop_library.discopop_optimizer.CostModels.CostModel import CostModel from discopop_library.discopop_optimizer.Variables.Experiment import Experiment -from discopop_library.discopop_optimizer.utilities.MOGUtilities import data_at, show -from sympy import Integer def plot_CostModels( diff --git a/discopop_library/discopop_optimizer/gui/presentation/ChoiceDetails.py b/discopop_library/discopop_optimizer/gui/presentation/ChoiceDetails.py index f1193d8aa..03781dc8f 100644 --- a/discopop_library/discopop_optimizer/gui/presentation/ChoiceDetails.py +++ b/discopop_library/discopop_optimizer/gui/presentation/ChoiceDetails.py @@ -5,14 +5,12 @@ # This software may be modified and distributed under the terms of # the 3-Clause BSD License. See the LICENSE file in the package base # directory for details. +from tkinter import * from typing import Optional import networkx as nx # type: ignore from discopop_library.discopop_optimizer.CostModels.CostModel import CostModel - -from tkinter import * - from discopop_library.discopop_optimizer.gui.widgets.ScrollableFrame import ScrollableFrameWidget from discopop_library.discopop_optimizer.utilities.MOGUtilities import data_at from discopop_wizard.screens.widgets.ScrollableText import ScrollableTextWidget diff --git a/discopop_library/discopop_optimizer/gui/presentation/OptionTable.py b/discopop_library/discopop_optimizer/gui/presentation/OptionTable.py index 45c5de99b..c0c94584b 100644 --- a/discopop_library/discopop_optimizer/gui/presentation/OptionTable.py +++ b/discopop_library/discopop_optimizer/gui/presentation/OptionTable.py @@ -7,10 +7,10 @@ # directory for details. import tkinter from tkinter import * -from typing import List, Tuple, Dict, Union, Optional, cast +from typing import List, Tuple, Dict, Optional, cast import networkx as nx # type: ignore -from sympy import Symbol, Expr +from sympy import Symbol from discopop_explorer.PETGraphX import PETGraphX from discopop_library.discopop_optimizer.CostModels.CostModel import CostModel diff --git a/discopop_library/discopop_optimizer/gui/queries/ValueTableQuery.py b/discopop_library/discopop_optimizer/gui/queries/ValueTableQuery.py index 5a57032a3..34f7af283 100644 --- a/discopop_library/discopop_optimizer/gui/queries/ValueTableQuery.py +++ b/discopop_library/discopop_optimizer/gui/queries/ValueTableQuery.py @@ -5,13 +5,11 @@ # This software may be modified and distributed under the terms of # the 3-Clause BSD License. See the LICENSE file in the package base # directory for details. -import sys +import tkinter as tk +from tkinter import * from typing import List, Tuple, Optional, Dict, cast, Union from sympy import Symbol, Expr -from tkinter import * -from tkinter import ttk -import tkinter as tk from discopop_library.discopop_optimizer.classes.enums.Distributions import FreeSymbolDistribution from discopop_library.discopop_optimizer.gui.widgets.ScrollableFrame import ScrollableFrameWidget diff --git a/discopop_library/discopop_optimizer/scheduling/workload_delta.py b/discopop_library/discopop_optimizer/scheduling/workload_delta.py index 395116022..ad1cbd298 100644 --- a/discopop_library/discopop_optimizer/scheduling/workload_delta.py +++ b/discopop_library/discopop_optimizer/scheduling/workload_delta.py @@ -5,7 +5,6 @@ # This software may be modified and distributed under the terms of # the 3-Clause BSD License. See the LICENSE file in the package base # directory for details. -import sys from typing import List, Tuple, cast, Any, Union, Optional import networkx as nx # type: ignore @@ -23,7 +22,6 @@ get_children, get_successors, ) -from discopop_library.discopop_optimizer.utilities.visualization.plotting import show # define aliases for type checking purposes diff --git a/discopop_library/discopop_optimizer/suggestions/importers/do_all.py b/discopop_library/discopop_optimizer/suggestions/importers/do_all.py index 46c9ffedd..4c6272294 100644 --- a/discopop_library/discopop_optimizer/suggestions/importers/do_all.py +++ b/discopop_library/discopop_optimizer/suggestions/importers/do_all.py @@ -13,7 +13,6 @@ from discopop_library.discopop_optimizer.CostModels.CostModel import CostModel from discopop_library.discopop_optimizer.Microbench.utils import ( - convert_microbench_to_discopop_workload, convert_discopop_to_microbench_workload, ) from discopop_library.discopop_optimizer.Variables.Experiment import Experiment diff --git a/discopop_library/discopop_optimizer/suggestions/importers/reduction.py b/discopop_library/discopop_optimizer/suggestions/importers/reduction.py index f40faee44..96e00174e 100644 --- a/discopop_library/discopop_optimizer/suggestions/importers/reduction.py +++ b/discopop_library/discopop_optimizer/suggestions/importers/reduction.py @@ -13,7 +13,6 @@ from discopop_library.discopop_optimizer.CostModels.CostModel import CostModel from discopop_library.discopop_optimizer.Microbench.utils import ( - convert_microbench_to_discopop_workload, convert_discopop_to_microbench_workload, ) from discopop_library.discopop_optimizer.Variables.Experiment import Experiment diff --git a/discopop_library/discopop_optimizer/utilities/MOGUtilities.py b/discopop_library/discopop_optimizer/utilities/MOGUtilities.py index fa28acd56..48588cf20 100644 --- a/discopop_library/discopop_optimizer/utilities/MOGUtilities.py +++ b/discopop_library/discopop_optimizer/utilities/MOGUtilities.py @@ -5,13 +5,11 @@ # This software may be modified and distributed under the terms of # the 3-Clause BSD License. See the LICENSE file in the package base # directory for details. -import random -from typing import List, cast, Set, Optional, Tuple +from typing import List, cast, Set, Tuple +import matplotlib # type: ignore import matplotlib.pyplot as plt # type:ignore -import matplotlib import networkx as nx # type: ignore -import sympy from discopop_explorer.PETGraphX import MemoryRegion, NodeID from discopop_library.discopop_optimizer.classes.edges.ChildEdge import ChildEdge diff --git a/discopop_library/discopop_optimizer/utilities/optimization/GlobalOptimization/RandomSamples.py b/discopop_library/discopop_optimizer/utilities/optimization/GlobalOptimization/RandomSamples.py index 6b8f3570d..c202c9901 100644 --- a/discopop_library/discopop_optimizer/utilities/optimization/GlobalOptimization/RandomSamples.py +++ b/discopop_library/discopop_optimizer/utilities/optimization/GlobalOptimization/RandomSamples.py @@ -6,13 +6,11 @@ # the 3-Clause BSD License. See the LICENSE file in the package base # directory for details. import copy -import random -from random import shuffle from typing import List, Dict, Tuple import networkx as nx # type: ignore from spb import plot3d, MB, plot # type: ignore -from sympy import Symbol, Expr +from sympy import Symbol from discopop_library.discopop_optimizer.CostModels.CostModel import CostModel from discopop_library.discopop_optimizer.CostModels.utilities import get_random_path @@ -21,8 +19,6 @@ from discopop_library.discopop_optimizer.classes.context.ContextObject import ContextObject from discopop_library.discopop_optimizer.classes.enums.Distributions import FreeSymbolDistribution from discopop_library.discopop_optimizer.classes.nodes.FunctionRoot import FunctionRoot -from discopop_library.discopop_optimizer.gui.plotting.CostModels import plot_CostModels -from discopop_library.discopop_optimizer.utilities.MOGUtilities import show def find_quasi_optimal_using_random_samples( diff --git a/discopop_library/discopop_optimizer/utilities/optimization/LocalOptimization/TopDown.py b/discopop_library/discopop_optimizer/utilities/optimization/LocalOptimization/TopDown.py index d91f3e8cb..3aa095f2d 100644 --- a/discopop_library/discopop_optimizer/utilities/optimization/LocalOptimization/TopDown.py +++ b/discopop_library/discopop_optimizer/utilities/optimization/LocalOptimization/TopDown.py @@ -26,7 +26,6 @@ get_successors, get_children, data_at, - show, ) diff --git a/discopop_library/discopop_optimizer/utilities/visualization/plotting.py b/discopop_library/discopop_optimizer/utilities/visualization/plotting.py index 931ddec0b..01d5294bf 100644 --- a/discopop_library/discopop_optimizer/utilities/visualization/plotting.py +++ b/discopop_library/discopop_optimizer/utilities/visualization/plotting.py @@ -5,6 +5,9 @@ # This software may be modified and distributed under the terms of # the 3-Clause BSD License. See the LICENSE file in the package base # directory for details. +import matplotlib.pyplot as plt # type: ignore +import networkx as nx # type: ignore + from discopop_library.discopop_optimizer.classes.edges.ChildEdge import ChildEdge from discopop_library.discopop_optimizer.classes.edges.OptionEdge import OptionEdge from discopop_library.discopop_optimizer.classes.edges.RequirementEdge import RequirementEdge @@ -16,9 +19,6 @@ from discopop_library.discopop_optimizer.classes.nodes.Workload import Workload from discopop_library.discopop_optimizer.utilities.MOGUtilities import data_at -import matplotlib.pyplot as plt # type: ignore -import networkx as nx # type: ignore - def show(graph): """Plots the graph diff --git a/discopop_library/result_classes/DetectionResult.py b/discopop_library/result_classes/DetectionResult.py index 3db720003..8feed82de 100644 --- a/discopop_library/result_classes/DetectionResult.py +++ b/discopop_library/result_classes/DetectionResult.py @@ -8,6 +8,7 @@ from typing import List import jsonpickle # type: ignore + from discopop_explorer.PETGraphX import PETGraphX from discopop_explorer.pattern_detectors.PatternInfo import PatternInfo from discopop_explorer.pattern_detectors.do_all_detector import DoAllInfo diff --git a/discopop_profiler/__main__.py b/discopop_profiler/__main__.py index c50636bf6..c00ad4690 100644 --- a/discopop_profiler/__main__.py +++ b/discopop_profiler/__main__.py @@ -12,8 +12,8 @@ import logging import shutil -from . import DiscopopCpp from discopop_library.global_data.version.utils import get_version +from . import DiscopopCpp PROG = "discopop_profiler" diff --git a/discopop_wizard/classes/CodePreview.py b/discopop_wizard/classes/CodePreview.py index 033bdfdde..f2bbbd610 100644 --- a/discopop_wizard/classes/CodePreview.py +++ b/discopop_wizard/classes/CodePreview.py @@ -6,15 +6,12 @@ # the 3-Clause BSD License. See the LICENSE file in the package base # directory for details. -import copy -import sys -from pathlib import Path -from typing import Tuple, Optional, List, Dict, Sequence, cast import tkinter as tk +from pathlib import Path +from typing import Optional, List, cast from discopop_library.CodeGenerator.classes.ContentBuffer import ContentBuffer from discopop_library.CodeGenerator.classes.Line import Line -from discopop_wizard.classes.Pragma import Pragma, PragmaPosition class CodePreviewLine(Line): diff --git a/discopop_wizard/classes/Settings.py b/discopop_wizard/classes/Settings.py index 64985afc7..a45e17192 100644 --- a/discopop_wizard/classes/Settings.py +++ b/discopop_wizard/classes/Settings.py @@ -10,7 +10,6 @@ import shutil import jsons # type:ignore -import tkinter as tk class Settings(object): diff --git a/discopop_wizard/classes/Suggestion.py b/discopop_wizard/classes/Suggestion.py index 984ad1b65..3998cdb01 100644 --- a/discopop_wizard/classes/Suggestion.py +++ b/discopop_wizard/classes/Suggestion.py @@ -7,25 +7,14 @@ # directory for details. import os -import sys - import tkinter as tk from enum import IntEnum from pathlib import Path from tkinter import ttk from typing import Any, Dict, List, Tuple -from discopop_explorer.pattern_detectors.combined_gpu_patterns.classes.Enums import ( - ExitPointPositioning, - EntryPointPositioning, - ExitPointType, - EntryPointType, - UpdateType, -) -from discopop_explorer.pattern_detectors.simple_gpu_patterns.GPULoop import OmpConstructPositioning from discopop_library.CodeGenerator.classes.UnpackedSuggestion import UnpackedSuggestion from discopop_wizard.classes.CodePreview import CodePreviewContentBuffer -from discopop_wizard.classes.Pragma import Pragma, PragmaPosition class PragmaType(IntEnum): diff --git a/discopop_wizard/screens/main.py b/discopop_wizard/screens/main.py index 049ddf14c..3449f1a74 100644 --- a/discopop_wizard/screens/main.py +++ b/discopop_wizard/screens/main.py @@ -12,7 +12,6 @@ from discopop_wizard.classes.ExecutionConfiguration import ExecutionConfiguration from discopop_wizard.screens.settings import show_settings_screen - from discopop_wizard.utils import support_scrolling diff --git a/discopop_wizard/screens/settings.py b/discopop_wizard/screens/settings.py index a23b310ce..9aa382cf2 100644 --- a/discopop_wizard/screens/settings.py +++ b/discopop_wizard/screens/settings.py @@ -6,7 +6,6 @@ # the 3-Clause BSD License. See the LICENSE file in the package base # directory for details. -import os import tkinter as tk from tkinter import filedialog from tkinter import ttk diff --git a/discopop_wizard/screens/suggestions/overview.py b/discopop_wizard/screens/suggestions/overview.py index ea674e744..eaa29e5c9 100644 --- a/discopop_wizard/screens/suggestions/overview.py +++ b/discopop_wizard/screens/suggestions/overview.py @@ -5,7 +5,6 @@ # This software may be modified and distributed under the terms of # the 3-Clause BSD License. See the LICENSE file in the package base # directory for details. -import functools import json import os import tkinter as tk @@ -15,7 +14,6 @@ from discopop_wizard.classes.Suggestion import Suggestion from discopop_wizard.screens.utils import create_tool_tip from discopop_wizard.screens.widgets.ScrollableText import ScrollableTextWidget - from discopop_wizard.utils import support_scrolling diff --git a/discopop_wizard/utils.py b/discopop_wizard/utils.py index 3f2226731..3087a882d 100644 --- a/discopop_wizard/utils.py +++ b/discopop_wizard/utils.py @@ -8,8 +8,8 @@ import functools -from sys import platform from enum import Enum +from sys import platform class Platform(Enum): diff --git a/discopop_wizard/wizard.py b/discopop_wizard/wizard.py index e09d7deea..3c129dde8 100644 --- a/discopop_wizard/wizard.py +++ b/discopop_wizard/wizard.py @@ -11,10 +11,10 @@ import signal import tkinter as tk import warnings -from tkinter import messagebox, filedialog -from tkinter import ttk from enum import IntEnum from os.path import dirname +from tkinter import messagebox, filedialog +from tkinter import ttk from typing import Optional from discopop_wizard.classes.Arguments import Arguments @@ -26,8 +26,7 @@ # todo add command line option to list available run configurations # todo add command line option to execute run configuration (by name) -from discopop_wizard.screens.settings import show_settings_screen, save_settings - +from discopop_wizard.screens.settings import show_settings_screen from discopop_wizard.utils import get_platform, Platform diff --git a/docs/img/DPWorkflow.svg b/docs/img/DPWorkflow.svg index 1a01f3cd1..758f9166a 100644 --- a/docs/img/DPWorkflow.svg +++ b/docs/img/DPWorkflow.svg @@ -1,6 +1,7 @@ - + diff --git a/docs/img/init1.svg b/docs/img/init1.svg index 2c9471c0c..5a4b20a1b 100644 --- a/docs/img/init1.svg +++ b/docs/img/init1.svg @@ -1,16 +1,15 @@ image/svg+xml image/svg+xml