-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor(explorer): move stuff out of __init__.py
- Loading branch information
goerlibe
committed
Sep 12, 2023
1 parent
6f170c0
commit b965279
Showing
2 changed files
with
59 additions
and
69 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,67 +0,0 @@ | ||
# This file is part of the DiscoPoP software (http://www.discopop.tu-darmstadt.de) | ||
# | ||
# Copyright (c) 2020, Technische Universitaet Darmstadt, Germany | ||
# | ||
# 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 pathlib import Path | ||
from typing import List, Optional | ||
|
||
from pluginbase import PluginBase # type:ignore | ||
|
||
from .PETGraphX import PETGraphX, NodeType | ||
from .parser import parse_inputs | ||
from .pattern_detection import PatternDetectorX | ||
from discopop_library.result_classes.DetectionResult import DetectionResult | ||
|
||
|
||
def run( | ||
project_path: str, | ||
cu_xml: str, | ||
dep_file: str, | ||
loop_counter_file: str, # TODO we should be able to read all info from the _dep.txt file (?) | ||
reduction_file: str, | ||
plugins: List[str], | ||
file_mapping: Optional[str] = None, | ||
cu_inst_result_file: Optional[str] = None, | ||
llvm_cxxfilt_path: Optional[str] = None, | ||
discopop_build_path: Optional[str] = None, | ||
enable_task_pattern: bool = False, | ||
) -> DetectionResult: | ||
pet = PETGraphX.from_parsed_input(*parse_inputs(cu_xml, dep_file, reduction_file, file_mapping)) | ||
print("PET CREATION FINISHED.") | ||
# pet.show() | ||
# TODO add visualization | ||
|
||
plugin_base = PluginBase(package="plugins") | ||
|
||
plugin_source = plugin_base.make_plugin_source(searchpath=[Path(__file__).parent / "plugins"]) | ||
|
||
for plugin_name in plugins: | ||
p = plugin_source.load_plugin(plugin_name) | ||
print("executing plugin before: " + plugin_name) | ||
pet = p.run_before(pet) | ||
|
||
pattern_detector = PatternDetectorX(pet) | ||
|
||
res: DetectionResult = pattern_detector.detect_patterns( | ||
project_path, | ||
cu_xml, | ||
dep_file, | ||
loop_counter_file, | ||
reduction_file, | ||
file_mapping, | ||
cu_inst_result_file, | ||
llvm_cxxfilt_path, | ||
discopop_build_path, | ||
enable_task_pattern, | ||
) | ||
|
||
for plugin_name in plugins: | ||
p = plugin_source.load_plugin(plugin_name) | ||
# print("executing plugin after: " + plugin_name) | ||
pet = p.run_after(pet) | ||
|
||
return res | ||
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters