From 6579f40a58c8884c863868f890560c8b09e085a4 Mon Sep 17 00:00:00 2001 From: Lukas Rothenberger Date: Tue, 23 Jul 2024 15:44:20 +0200 Subject: [PATCH] cleanup: remove deprecated tools --- DEPRECATED_discopop_profiler/__init__.py | 85 ---- DEPRECATED_discopop_profiler/__main__.py | 91 ---- DEPRECATED_discopop_profiler/utils.py | 52 -- DEPRECATED_discopop_wizard/__init__.py | 0 DEPRECATED_discopop_wizard/__main__.py | 60 --- DEPRECATED_discopop_wizard/assets/__init__.py | 0 .../assets/icons/__init__.py | 0 .../assets/icons/discoPoP_128x128.png | Bin 18077 -> 0 bytes .../assets/profiling_container/Dockerfile | 46 -- .../classes/Arguments.py | 14 - .../classes/CodePreview.py | 109 ---- DEPRECATED_discopop_wizard/classes/Console.py | 65 --- .../classes/ExecutionConfiguration.py | 468 ------------------ DEPRECATED_discopop_wizard/classes/Pragma.py | 27 - .../classes/ProfilingContainer.py | 149 ------ .../classes/Settings.py | 155 ------ .../classes/Suggestion.py | 216 -------- .../classes/TKVarStorage.py | 47 -- .../classes/__init__.py | 0 .../headless/__init__.py | 0 .../headless/headless_execution.py | 65 --- .../screens/__init__.py | 0 .../screens/execution.py | 105 ---- DEPRECATED_discopop_wizard/screens/main.py | 143 ------ .../screens/optimizer/__init__.py | 0 .../screens/optimizer/binding.py | 145 ------ .../screens/settings.py | 180 ------- .../screens/suggestions/__init__.py | 0 .../screens/suggestions/overview.py | 140 ------ DEPRECATED_discopop_wizard/screens/utils.py | 60 --- .../screens/widgets/__init__.py | 0 DEPRECATED_discopop_wizard/utils.py | 65 --- DEPRECATED_discopop_wizard/wizard.py | 187 ------- .../gui/presentation/ChoiceDetails.py | 2 +- .../gui}/widgets/ScrollableText.py | 0 setup.py | 2 - 36 files changed, 1 insertion(+), 2677 deletions(-) delete mode 100644 DEPRECATED_discopop_profiler/__init__.py delete mode 100644 DEPRECATED_discopop_profiler/__main__.py delete mode 100644 DEPRECATED_discopop_profiler/utils.py delete mode 100644 DEPRECATED_discopop_wizard/__init__.py delete mode 100644 DEPRECATED_discopop_wizard/__main__.py delete mode 100644 DEPRECATED_discopop_wizard/assets/__init__.py delete mode 100644 DEPRECATED_discopop_wizard/assets/icons/__init__.py delete mode 100644 DEPRECATED_discopop_wizard/assets/icons/discoPoP_128x128.png delete mode 100644 DEPRECATED_discopop_wizard/assets/profiling_container/Dockerfile delete mode 100644 DEPRECATED_discopop_wizard/classes/Arguments.py delete mode 100644 DEPRECATED_discopop_wizard/classes/CodePreview.py delete mode 100644 DEPRECATED_discopop_wizard/classes/Console.py delete mode 100644 DEPRECATED_discopop_wizard/classes/ExecutionConfiguration.py delete mode 100644 DEPRECATED_discopop_wizard/classes/Pragma.py delete mode 100644 DEPRECATED_discopop_wizard/classes/ProfilingContainer.py delete mode 100644 DEPRECATED_discopop_wizard/classes/Settings.py delete mode 100644 DEPRECATED_discopop_wizard/classes/Suggestion.py delete mode 100644 DEPRECATED_discopop_wizard/classes/TKVarStorage.py delete mode 100644 DEPRECATED_discopop_wizard/classes/__init__.py delete mode 100644 DEPRECATED_discopop_wizard/headless/__init__.py delete mode 100644 DEPRECATED_discopop_wizard/headless/headless_execution.py delete mode 100644 DEPRECATED_discopop_wizard/screens/__init__.py delete mode 100644 DEPRECATED_discopop_wizard/screens/execution.py delete mode 100644 DEPRECATED_discopop_wizard/screens/main.py delete mode 100644 DEPRECATED_discopop_wizard/screens/optimizer/__init__.py delete mode 100644 DEPRECATED_discopop_wizard/screens/optimizer/binding.py delete mode 100644 DEPRECATED_discopop_wizard/screens/settings.py delete mode 100644 DEPRECATED_discopop_wizard/screens/suggestions/__init__.py delete mode 100644 DEPRECATED_discopop_wizard/screens/suggestions/overview.py delete mode 100644 DEPRECATED_discopop_wizard/screens/utils.py delete mode 100644 DEPRECATED_discopop_wizard/screens/widgets/__init__.py delete mode 100644 DEPRECATED_discopop_wizard/utils.py delete mode 100644 DEPRECATED_discopop_wizard/wizard.py rename {DEPRECATED_discopop_wizard/screens => discopop_library/discopop_optimizer/gui}/widgets/ScrollableText.py (100%) diff --git a/DEPRECATED_discopop_profiler/__init__.py b/DEPRECATED_discopop_profiler/__init__.py deleted file mode 100644 index 9a57e9dde..000000000 --- a/DEPRECATED_discopop_profiler/__init__.py +++ /dev/null @@ -1,85 +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. - -import logging -import os -import re -import subprocess -from contextlib import suppress -from typing import List - -from .utils import recursive_scandir, is_compile, is_link, get_library - - -class DiscopopCpp: - def __init__( - self, - cugeneration: bool, - dpinstrumentation: bool, - dpreduction: bool, - clang_path: str, - ): - self.cugeneration = cugeneration - self.dpinstrumentation = dpinstrumentation - self.dpreduction = dpreduction - self.clang_path = clang_path - - def update_filemapping(self): - cwd = os.getcwd() - with suppress(FileNotFoundError): - # Do not regenerate if FileMapping.txt is still up-to-date. - filemapping_mtime = os.stat("FileMapping.txt").st_mtime - if os.stat(cwd).st_mtime < filemapping_mtime and all( - [not entry.is_dir() or entry.stat().st_mtime < filemapping_mtime for entry in recursive_scandir(cwd)] - ): - return - logging.info("Generating FileMapping.txt.") - with open("FileMapping.txt", "w") as fd: - i = 1 - for entry in sorted(recursive_scandir(cwd), key=lambda e: e.path): - if entry.is_file() and re.match(r"^[^.].+\.(?:c|cc|cpp|h|hpp|ipp)$", entry.name): - print(f"{i}\t{entry.path}", file=fd) - i += 1 - - def wrap_clang_args(self, clang_args: List[str]) -> List[str]: - args = [self.clang_path] - if is_compile(clang_args): - if any([self.cugeneration, self.dpinstrumentation, self.dpreduction]): - self.update_filemapping() - args += ["-g", "-O0", "-fno-discard-value-names"] - if self.cugeneration: - # clang++ -g -O0 -fno-discard-value-names -Xclang -load \ - # -Xclang ${DISCOPOP_INSTALL}/libi/LLVMCUGeneration.so \ - # -mllvm -fm-path -mllvm ./FileMapping.txt -c - args += ["-Xclang", "-load", "-Xclang", get_library("LLVMCUGeneration.so")] - if self.dpinstrumentation: - # clang++ -g -O0 -fno-discard-value-names -Xclang -load \ - # -Xclang ${DISCOPOP_INSTALL}/libi/LLVMDPInstrumentation.so \ - # -mllvm -fm-path -mllvm ./FileMapping.txt -c -o out.o - args += ["-Xclang", "-load", "-Xclang", get_library("LLVMDPInstrumentation.so")] - if self.dpreduction: - # clang++ -g -O0 -fno-discard-value-names -Xclang -load \ - # -Xclang ${DISCOPOP_INSTALL}/libi/LLVMDPReduction.so \ - # -mllvm -fm-path -mllvm ./FileMapping.txt -c -o out.o - args += ["-Xclang", "-load", "-Xclang", get_library("LLVMDPReduction.so")] - args += ["-mllvm", "-fm-path", "-mllvm", "./FileMapping.txt"] - args += clang_args - if is_link(clang_args): - if self.dpinstrumentation or self.dpreduction: - # clang++ out.o -L${DISCOPOP_INSTALL}/rtlib -lDiscoPoP_RT -lpthread - args += [ - f"-L{os.path.dirname(get_library('libDiscoPoP_RT.a'))}", - "-lDiscoPoP_RT", - "-lpthread", - ] - return args - - def invoke(self, clang_args: List[str]) -> subprocess.CompletedProcess: # type: ignore - args = self.wrap_clang_args(clang_args) - logging.info(" ".join(args)) - return subprocess.run(args) diff --git a/DEPRECATED_discopop_profiler/__main__.py b/DEPRECATED_discopop_profiler/__main__.py deleted file mode 100644 index c00ad4690..000000000 --- a/DEPRECATED_discopop_profiler/__main__.py +++ /dev/null @@ -1,91 +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. - -"""Call clang++ with DiscoPoP LLVM passes.""" - -import argparse -import logging -import shutil - -from discopop_library.global_data.version.utils import get_version -from . import DiscopopCpp - -PROG = "discopop_profiler" - -USAGE = f"""{PROG} [--verbose] [--clang CLANG] - {'':{len(PROG)}} (--CUGeneration | --DPInstrumentation | --DPReduction) - {'':{len(PROG)}} -""" - - -def main(args=None): - parser = argparse.ArgumentParser(prog=PROG, description=__doc__, usage=USAGE, add_help=False) - parser.add_argument("-h", "--help", action="help", help="Show this help message and exit.") - parser.add_argument( - "-V", - "--version", - action="version", - version=f"%(prog)s {get_version()}", - help="Show version number and exit.", - ) - parser.add_argument( - "-v", - "--verbose", - action="store_true", - help="Show additional information such as clang++ invocations.", - ) - parser.add_argument("--clang", help="Path to clang++ executable.") - action = parser.add_mutually_exclusive_group() - action.add_argument( - "--CUGeneration", - "--cugeneration", - action="store_true", - help="Obtain the computational unit (CU) graph of the target application.", - ) - action.add_argument( - "--DPInstrumentation", - "--dpinstrumentation", - action="store_true", - help="Instrument the target application to obtain data dependences.", - ) - action.add_argument( - "--DPReduction", - "--dpreduction", - action="store_true", - help="Instrument the target application to obtain the list of reduction operations.", - ) - parameters, clang_args = parser.parse_known_args(args) - - logging.basicConfig( - format="%(message)s", - level=logging.INFO if parameters.verbose else logging.WARNING, - ) - - if not any([parameters.CUGeneration, parameters.DPInstrumentation, parameters.DPReduction]): - logging.warning( - "Warning: Not using any DiscoPoP LLVM pass (specify either --CUGeneration, " - "--DPInstrumentation or --DPReduction).", - ) - clang_path = parameters.clang or shutil.which("clang++-8") or shutil.which("clang++") - if not clang_path: - raise SystemExit("clang++ executable not found in PATH. Specify --clang PATH/TO/CLANG++.") - if not clang_args: - logging.warning("Warning: No arguments to clang++ were given.") - - clang_proc = DiscopopCpp( - cugeneration=parameters.CUGeneration, - dpinstrumentation=parameters.DPInstrumentation, - dpreduction=parameters.DPReduction, - clang_path=clang_path, - ).invoke(clang_args) - if clang_proc.returncode != 0: - raise SystemExit(clang_proc.returncode) - - -if __name__ == "__main__": - main() diff --git a/DEPRECATED_discopop_profiler/utils.py b/DEPRECATED_discopop_profiler/utils.py deleted file mode 100644 index 5ee7fb686..000000000 --- a/DEPRECATED_discopop_profiler/utils.py +++ /dev/null @@ -1,52 +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. - -import os -import re -from typing import List, Iterator - - -def get_library(name: str) -> str: - library_dirs: List[str] - if os.getenv("DISCOPOP_INSTALL"): - library_dirs = [ - os.path.expandvars("${DISCOPOP_INSTALL}"), - os.path.expandvars("${DISCOPOP_INSTALL}/libi"), - os.path.expandvars("${DISCOPOP_INSTALL}/rtlib"), - os.path.expandvars("${DISCOPOP_INSTALL}/lib"), - ] - else: - library_dirs = [ - os.path.expanduser("~/.local/lib"), - "/usr/local/lib", - "/usr/lib", - "/lib", - ] - for library_dir in library_dirs: - if os.path.exists(os.path.join(library_dir, name)): - return os.path.join(library_dir, name) - raise SystemExit( - f"File {name} not found. Searched in: {', '.join(library_dirs)}.\n" - f"Build DiscoPoP and set DISCOPOP_INSTALL environment variable." - ) - - -def is_compile(clang_args: List[str]) -> bool: - return "-c" in clang_args or any([re.match(r"^[^-].+\.(?:c|cc|cpp)$", arg) for arg in clang_args]) - - -def is_link(clang_args: List[str]) -> bool: - return "-c" not in clang_args - - -def recursive_scandir(path: str) -> Iterator[os.DirEntry]: # type: ignore - with os.scandir(path) as dir_iter: - for entry in dir_iter: - yield entry - if entry.is_dir(): - yield from recursive_scandir(entry.path) diff --git a/DEPRECATED_discopop_wizard/__init__.py b/DEPRECATED_discopop_wizard/__init__.py deleted file mode 100644 index e69de29bb..000000000 diff --git a/DEPRECATED_discopop_wizard/__main__.py b/DEPRECATED_discopop_wizard/__main__.py deleted file mode 100644 index 1e614ce47..000000000 --- a/DEPRECATED_discopop_wizard/__main__.py +++ /dev/null @@ -1,60 +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. - -import argparse -import os -from os.path import dirname - -from DEPRECATED_discopop_wizard.classes.Arguments import Arguments -from DEPRECATED_discopop_wizard.headless.headless_execution import ( - execute_all_stored_configurations, - execute_tag_filtered_configurations, -) -from DEPRECATED_discopop_wizard.wizard import main as wizard_main - - -def convert_args(namespace_args: argparse.Namespace) -> Arguments: - """Stores args into an Arguments object.""" - return_arg = Arguments() - return_arg.execute_configurations_with_tag = [ - tag for tag in namespace_args.execute_configurations_with_tag.split(",") if len(tag) > 0 - ] - return_arg.execute_all_configurations = namespace_args.execute_all_configurations == "true" - - return return_arg - - -def main(): - parser = argparse.ArgumentParser(description="DiscoPoP Configuration Wizard") - - parser.add_argument( - "--execute_all_configurations", - help="Execute all stored configurations in a headless manner. [true / false]", - ) - parser.add_argument( - "--execute_configurations_with_tag", - default="", - help="Execute all stored configurations in a headless manner which have any of the given tags assigned. [comma-separated list of tags to be executed]", - ) - - args = convert_args(parser.parse_args()) - - if args.execute_all_configurations: - # start headless mode and execute all stored configurations - source_dir = dirname(os.path.abspath(__file__)) # source_dir: discopop/discopop_wizard - execute_all_stored_configurations(args, source_dir) - elif len(args.execute_configurations_with_tag) > 0: - # start headless mode and execute stored configurations with the suitable tags - source_dir = dirname(os.path.abspath(__file__)) # source_dir: discopop/discopop_wizard - execute_tag_filtered_configurations(args, source_dir) - else: - wizard_main(args) - - -if __name__ == "__main__": - main() diff --git a/DEPRECATED_discopop_wizard/assets/__init__.py b/DEPRECATED_discopop_wizard/assets/__init__.py deleted file mode 100644 index e69de29bb..000000000 diff --git a/DEPRECATED_discopop_wizard/assets/icons/__init__.py b/DEPRECATED_discopop_wizard/assets/icons/__init__.py deleted file mode 100644 index e69de29bb..000000000 diff --git a/DEPRECATED_discopop_wizard/assets/icons/discoPoP_128x128.png b/DEPRECATED_discopop_wizard/assets/icons/discoPoP_128x128.png deleted file mode 100644 index 750685d83867a984dbff99aeb19875aaf44747a5..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 18077 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wdh_oBqt=d3*l> zE|M0g;FmpXhu^Ho=(E~=W#+dSEecf0Xja+?RpW(sLVbdf>WAh45hF4$(o&d`VN>SA zI=E1L%8e{bXi3YVM{>O=Z1|_q0$HY^Yi5a+dWo)@iEyIsZ5fvo!Z=1c8aUg>eh9$|}d$B8nZ zz@}kU{XKEDuaXT95Qk{Nw%d*a=LTQYNzkFMz#N;-yh9c!k5pW>BMID->p*>7rS^H` zqgb*?)0i??*6lIs@&|#c0@)rJ_F}c!AjI7XzIRyQPuyEE^%+rOvPA69kVOH^u7vxcQh#6 zvcNiRoILB%onC==Oz)6;VzVjGWkHJ=lmx$x&%(;f6V<19nN?pVv-C4if8)t>U|Ll^ zu#_GYLZT+7{1N&O>N<#OU=~7ii57l#3GvF!bH{n@ScA5+v)fjNPly(a`JIpRw|F;y z9i%)hex>M>{FfgmF!Nq60?*ioqS~wnbj`*u{GFO4J!SI7nzh zjHx9_lL8ty>ea#pZr80Z#V5Zgg7r!j0)`NN5t5Gm+mVqDq4af2VZ6JQg~GNkUqI7C zwc3GR!JC~8BaX4R)iS+5B)I(;-Vb=z1|us$Nf?2gpi-A=iiwpVRQ~iTABqaR)Y_bI y-Jz{1s+0M32vyBj^o62=zZd=gyl5uAK#{QwluUr_C4kd7khHjhSiOi*$o~U$3Z2&g diff --git a/DEPRECATED_discopop_wizard/assets/profiling_container/Dockerfile b/DEPRECATED_discopop_wizard/assets/profiling_container/Dockerfile deleted file mode 100644 index 06089aac3..000000000 --- a/DEPRECATED_discopop_wizard/assets/profiling_container/Dockerfile +++ /dev/null @@ -1,46 +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 ubuntu:22.04 - -ENV TZ=Europe/Berlin -RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone - -RUN apt-get update -RUN apt-get install -y git cmake gcc libclang-11-dev clang-11 llvm-11 clang-tools-11 python3 python3-pip python3-tk wget file - -# clone DiscoPoP -RUN git clone https://github.com/discopop-project/discopop.git -WORKDIR /discopop - -# install DiscoPoP -RUN mkdir build -WORKDIR /discopop/build -RUN cmake .. -RUN make -WORKDIR /discopop - -# install GO -WORKDIR / -RUN mkdir software -WORKDIR /software -RUN wget https://dl.google.com/go/go1.16.15.linux-amd64.tar.gz -RUN tar -xvf * -RUN rm *.tar.gz -RUN ln -s /software/go/bin/go /usr/bin/go - -# install GLLVM -WORKDIR / -RUN GOPATH=/software/go/bin GO111MODULE=off go get github.com/SRI-CSL/gllvm/cmd/... -WORKDIR /software/go/bin -RUN mv bin/* . -RUN mv src/* ../src - -# install python dependencies and modules -WORKDIR /discopop -RUN pip install . diff --git a/DEPRECATED_discopop_wizard/classes/Arguments.py b/DEPRECATED_discopop_wizard/classes/Arguments.py deleted file mode 100644 index bffc171ee..000000000 --- a/DEPRECATED_discopop_wizard/classes/Arguments.py +++ /dev/null @@ -1,14 +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 typing import List - - -class Arguments(object): - no_gui: bool = False - execute_all_configurations: bool = False - execute_configurations_with_tag: List[str] = [] diff --git a/DEPRECATED_discopop_wizard/classes/CodePreview.py b/DEPRECATED_discopop_wizard/classes/CodePreview.py deleted file mode 100644 index f2bbbd610..000000000 --- a/DEPRECATED_discopop_wizard/classes/CodePreview.py +++ /dev/null @@ -1,109 +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. - -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 - - -class CodePreviewLine(Line): - highlight_color: Optional[str] - - def __init__(self, parent_line_num: int, line_num=None, content=""): - super().__init__(parent_line_num, line_num, content) - self.highlight_color = None - - def display(self, wizard, parent_element: tk.Text, line_idx: int, max_line_num: int): - if not self.content.endswith("\n"): - self.content += "\n" - - # assemble line_num_str if requested - line_num_str = "" - if wizard.settings.code_preview_show_line_numbers == 1: - line_num_str = str(self.line_num) if self.line_num is not None else "" - while len(line_num_str) < len(str(max_line_num)): - line_num_str += " " - line_num_str += " " # padding - - # assemble line for display - line = "" - line += line_num_str - line += self.content - - parent_element.insert(tk.END, line) - - # highlight inserted pragmas - if self.line_num is None: - # todo generate background colors - background_color = "#e5f2b3" if line_idx % 2 == 0 else "#a4ed9a" - if self.owns_region is not None: - # highlight entire line if a new region is created - self.__highlight(parent_element, line_idx, 0, len(line), background_color) - else: - # highlight pragma only - self.__highlight( - parent_element, - line_idx, - len(line) - len(self.content), - len(line), - background_color, - ) - - def __highlight( - self, - parent_element: tk.Text, - line_idx: int, - start_position: int, - end_position: int, - color: str, - ): - """highlights the given section of the line in the given color""" - start_position_str = str(line_idx) + "." + str(start_position) - end_position_str = str(line_idx) + "." + str(end_position) - parent_element.tag_add( - color + ":" + start_position_str + "-" + end_position_str, - start_position_str, - end_position_str, - ) - parent_element.tag_config( - color + ":" + start_position_str + "-" + end_position_str, - background=color, - foreground="black", - ) - - -class CodePreviewContentBuffer(ContentBuffer): - max_line_num: int # used to determine width of padding - file_id: int - next_free_region_id = 0 - lines: List[Line] - - def __init__(self, wizard, file_id: int, source_code_path: Path, tab_width: int = 4): - super().__init__(file_id, source_code_path, tab_width, line_type=CodePreviewLine) - self.wizard = wizard - - def show_in(self, parent_element: tk.Text): - """Displays the contents of the CodePreview object in the supplied parent_element.""" - for line_idx, line in enumerate(self.lines): - # offset line_id to account for start with 1 - offset_line_id = line_idx + 1 - cast(CodePreviewLine, line).display(self.wizard, parent_element, offset_line_id, self.max_line_num) - - def jump_to_first_modification(self, parent_element: tk.Text): - """Jumps to the location of the first modified source code location.""" - first_location = "" - for idx, line in enumerate(self.lines): - if line.line_num is None: - first_location = "" + str(idx) + ".0" - break - if first_location == "": - first_location = "1.0" - parent_element.see(first_location) diff --git a/DEPRECATED_discopop_wizard/classes/Console.py b/DEPRECATED_discopop_wizard/classes/Console.py deleted file mode 100644 index f6fd37a1e..000000000 --- a/DEPRECATED_discopop_wizard/classes/Console.py +++ /dev/null @@ -1,65 +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. -import tkinter as tk -from tkinter import ttk - - -class Console(object): - parent_frame: tk.Frame - progress_bar: ttk.Progressbar - log_screen: tk.Text - - def __init__(self, parent_frame: tk.Frame): - self.parent_frame = tk.Frame(parent_frame, bg="red") - self.parent_frame.grid(row=1, column=1, sticky="nsew") - self.__show_console() - - def print(self, msg: str): - if not msg.endswith("\n"): - msg = msg + "\n" - self.log_screen.config(state=tk.NORMAL) - self.log_screen.insert(tk.END, msg) - self.log_screen.see(tk.END) - self.log_screen.update() - self.log_screen.config(state=tk.DISABLED) - - def clear(self): - raise NotImplementedError("TODO") - - def start_progress(self): - self.progress_bar.start(20) - self.progress_bar.update() - - def stop_progress(self): - self.progress_bar.stop() - self.progress_bar.update() - - def __show_console(self): - for c in self.parent_frame.winfo_children(): - c.destroy() - # configure parent_frame - self.parent_frame.rowconfigure(0, weight=1) - self.parent_frame.columnconfigure(0, weight=1) - # self.parent_frame.rowconfigure(2, weight=1) - - # create content frame and scroll bars - self.log_screen = tk.Text(self.parent_frame, wrap=tk.NONE, height=8) - self.log_screen.grid(row=0, column=0, sticky="nsew") - self.log_screen.config(state=tk.DISABLED) - - # create a Scrollbar and associate it with the content frame - y_scrollbar = ttk.Scrollbar(self.parent_frame, command=self.log_screen.yview) - y_scrollbar.grid(row=0, column=1, sticky="nsew") - self.log_screen["yscrollcommand"] = y_scrollbar.set - x_scrollbar = ttk.Scrollbar(self.parent_frame, orient="horizontal", command=self.log_screen.xview) - x_scrollbar.grid(row=1, column=0, columnspan=2, sticky="nsew") - self.log_screen["xscrollcommand"] = x_scrollbar.set - - # create progress bar - # self.progress_bar = ttk.Progressbar(self.parent_frame, orient=tk.HORIZONTAL, mode="determinate") - # self.progress_bar.grid(row=2, column=0, columnspan=2, sticky="nsew") diff --git a/DEPRECATED_discopop_wizard/classes/ExecutionConfiguration.py b/DEPRECATED_discopop_wizard/classes/ExecutionConfiguration.py deleted file mode 100644 index 2018519fc..000000000 --- a/DEPRECATED_discopop_wizard/classes/ExecutionConfiguration.py +++ /dev/null @@ -1,468 +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. - -import os -import random -import string -import subprocess -import tkinter as tk -from json import JSONDecodeError -from tkinter import filedialog -from typing import TextIO, List, Dict, Tuple, Any - -import jsons # type:ignore - -from DEPRECATED_discopop_wizard.screens.execution import ExecutionView -from DEPRECATED_discopop_wizard.screens.optimizer.binding import create_optimizer_screen -from DEPRECATED_discopop_wizard.screens.suggestions.overview import ( - show_suggestions_overview_screen, - get_suggestion_objects, -) -from DEPRECATED_discopop_wizard.screens.utils import create_tool_tip - - -class ExecutionConfiguration(object): - button: tk.Button - value_dict: Dict[str, Any] - - def __init__(self, wizard): - self.value_dict = { - "label": "", - "description": "", - "executable_name": "", - "executable_arguments": "", - "make_flags": "", - "project_path": "", - "linker_flags": "", - "make_target": "", - "memory_profiling_skip_function_parameters": 0, - "notes": "", - "working_copy_path": "", - "tags": "", - "explorer_flags": "--json=patterns.json --dump-detection-result", - } - self.value_dict["id"] = "".join(random.choices(string.ascii_uppercase + string.digits, k=8)) - self.wizard = wizard - - # self.__extract_values_from_help_string() - - def __extract_values_from_help_string(self): - """Read help strings of: - - DiscoPoP Explorer - - runDiscoPoP script - in order to automatically determine the required and optional arguments""" - targets: List[Tuple[str, str]] = [ # [(name, executable)] - ("rundiscopop", self.wizard.settings.discopop_build_dir + "/scripts/runDiscoPoP"), - ("explorer", "discopop_explorer"), - ] - for target_name, target_executable in targets: - # get help string - tmp = subprocess.run([target_executable, "--help"], stdout=subprocess.PIPE) - help_string = tmp.stdout.decode("utf-8") - for line in help_string.split("\n"): - line = line.replace("\t", " ") - while " " in line: - line = line.replace(" ", " ") - if line.startswith(" "): - line = line[1:] - if not line.startswith("* --"): - continue - line = line[4:] # cut off '* --' - # extract name and type - name_cutoff_index = len(line) - if " " in line: - name_cutoff_index = min(name_cutoff_index, line.index(" ")) - if "=" in line: - name_cutoff_index = min(name_cutoff_index, line.index("=")) - value_name = line[:name_cutoff_index] - if value_name == "help": - continue - line = line[name_cutoff_index:] - # extract type if present - value_type = "bool" - if "<" in line and ">" in line: - left_index = line.index("<") + 1 - right_index = line.index(">") - value_type = line[left_index:right_index] - # add value to dictionaries - self.value_dict[target_name + "_" + value_name] = "" - # self.type_dict[target_name + "_" + value_name] = value_type - - def get_as_button(self, wizard, main_screen_obj, parent_frame: tk.Frame, all_buttons: List[tk.Button]) -> tk.Button: - button = tk.Button(parent_frame, text=self.value_dict["label"]) - button.config( - command=lambda: self.highlight_and_update_notebook_screens(wizard, main_screen_obj, button, all_buttons) - ) - self.button = button - return button - - def init_from_json(self, json_file: TextIO): - json_str = "" - for line in json_file.readlines(): - json_str += line - self.value_dict = {**self.value_dict, **jsons.loads(json_str)} # merge both dictionaries - - def get_values_as_json_string(self): - """returns a representation of the settings which will be stored in a configuration file.""" - return jsons.dumps(self.value_dict) - - def highlight_and_update_notebook_screens( - self, wizard, main_screen_obj, pressed_button: tk.Button, all_buttons: List[tk.Button] - ): - # remove previous highlights - for configuration_button in all_buttons: - configuration_button.configure(state=tk.NORMAL) - - # highlight pressed configuration button - pressed_button.configure(state=tk.DISABLED) - - # update details screen of pressed configuration button - self.show_details_screen(wizard, main_screen_obj) - - # update results screen of pressed configuration button and set results tab state based on result existence - main_screen_obj.notebook.tab(main_screen_obj.results_frame, state=self.__button_state_from_result_existence()) - main_screen_obj.notebook.tab(main_screen_obj.optimizer_frame, state=self.__button_state_from_result_existence()) - - if self.__button_state_from_result_existence() == "normal": - show_suggestions_overview_screen(wizard, main_screen_obj.results_frame, self) - if self.__button_state_from_result_existence() == "normal": - create_optimizer_screen(wizard, main_screen_obj.optimizer_frame, self) - - def show_details_screen(self, wizard, main_screen_obj): - # delete previous frame contents - for c in main_screen_obj.details_frame.winfo_children(): - c.destroy() - - frame = tk.Frame(main_screen_obj.details_frame) - frame.grid(row=1, column=2) - - canvas = tk.Canvas(frame) - canvas.grid(row=1) - - # show labels - tk.Label(canvas, text="Label:", justify=tk.RIGHT, anchor="e", font=wizard.style_font_bold_small).grid( - row=1, column=1, sticky="ew" - ) - tk.Label(canvas, text="Description", justify=tk.RIGHT, anchor="e").grid(row=2, column=1, sticky="ew") - tk.Label( - canvas, - text="Executable name:", - justify=tk.RIGHT, - anchor="e", - font=wizard.style_font_bold_small, - ).grid(row=3, column=1, sticky="ew") - tk.Label(canvas, text="Executable arguments:", justify=tk.RIGHT, anchor="e").grid(row=4, column=1, sticky="ew") - tk.Label(canvas, text="Make flags:", justify=tk.RIGHT, anchor="e").grid(row=5, column=1, sticky="ew") - tk.Label( - canvas, - text="Project path:", - justify=tk.RIGHT, - anchor="e", - font=wizard.style_font_bold_small, - ).grid(row=6, column=1, sticky="ew") - tk.Label(canvas, text="Project linker flags:", justify=tk.RIGHT, anchor="e").grid(row=7, column=1, sticky="ew") - tk.Label(canvas, text="Make target:", justify=tk.RIGHT, anchor="e").grid(row=8, column=1, sticky="ew") - tk.Label( - canvas, - text="Memory Profiling:", - justify=tk.RIGHT, - anchor="e", - font=wizard.style_font_bold_small, - ).grid(row=9, column=1, sticky="ew") - tk.Label(canvas, text="Skip function params:", justify=tk.RIGHT, anchor="e").grid(row=10, column=1, sticky="ew") - tk.Label( - canvas, - text="Additional:", - justify=tk.RIGHT, - anchor="e", - font=wizard.style_font_bold_small, - ).grid(row=11, column=1, sticky="ew") - tk.Label(canvas, text="Tags:", justify=tk.RIGHT, anchor="e").grid(row=12, column=1, sticky="ew") - tk.Label(canvas, text="Notes:", justify=tk.RIGHT, anchor="e").grid(row=13, column=1, sticky="ew") - - # show input fields - label = tk.Entry(canvas) - label.grid(row=1, column=2, sticky="ew") - label.insert(tk.END, self.value_dict["label"]) - create_tool_tip(label, "Name of the configuration. Used to distinguish configurations in the main menu.") - - description = tk.Entry(canvas) - description.grid(row=2, column=2, sticky="ew") - description.insert(tk.END, self.value_dict["description"]) - - executable_name = tk.Entry(canvas) - executable_name.insert(tk.END, self.value_dict["executable_name"]) - executable_name.grid(row=3, column=2, sticky="ew") - create_tool_tip( - executable_name, - "Name of the executable which is created when building the target project. The name will be " - "used to execute the configuration.", - ) - - executable_args = tk.Entry(canvas) - executable_args.grid(row=4, column=2, sticky="ew") - executable_args.insert(tk.END, self.value_dict["executable_arguments"]) - create_tool_tip( - executable_args, - "Specify arguments which shall be forwarded to the call of the created executable for the " "profiling.", - ) - - make_flags = tk.Entry(canvas) - make_flags.grid(row=5, column=2, sticky="ew") - make_flags.insert(tk.END, str(self.value_dict["make_flags"])) - create_tool_tip( - make_flags, - "Specified flags will be forwarded to Make during the build of the target project.", - ) - - project_path = tk.Entry(canvas) - project_path.grid(row=6, column=2, sticky="ew") - project_path.insert(tk.END, self.value_dict["project_path"]) - create_tool_tip(project_path, "Path to the project which shall be analyzed for potential parallelism.") - - def overwrite_with_selection(target: tk.Entry): - prompt_result = tk.filedialog.askdirectory() - if len(prompt_result) != 0: - target.delete(0, tk.END) - target.insert(0, prompt_result) - - project_path_selector = tk.Button(canvas, text="Select", command=lambda: overwrite_with_selection(project_path)) - project_path_selector.grid(row=6, column=3) - - project_linker_flags = tk.Entry(canvas) - project_linker_flags.grid(row=7, column=2, sticky="ew") - project_linker_flags.insert(tk.END, self.value_dict["linker_flags"]) - create_tool_tip( - project_linker_flags, - "Linker flags which need to be passed to the build system in order to create a valid " "executable.", - ) - - make_target = tk.Entry(canvas) - make_target.grid(row=8, column=2, sticky="ew") - make_target.insert(tk.END, self.value_dict["make_target"]) - create_tool_tip(make_target, "Space-separated list of make targets to be created.") - - mpsfp_var = tk.IntVar() - mpsfp_var.set(self.value_dict["memory_profiling_skip_function_parameters"]) - memory_profiling_skip_function_parameters = tk.Checkbutton(canvas, onvalue=1, offvalue=0, variable=mpsfp_var) - memory_profiling_skip_function_parameters.grid(row=10, column=2, sticky="w") - create_tool_tip( - memory_profiling_skip_function_parameters, - "Disables the memory profiling for function arguments.\n\n" - "Depending on the application, this may lead to significant profiling runtime\n" - "improvements, but the correctness of the results can not be guaranteed anymore!\n" - "Use this mode with caution, and be aware of potential issues!", - ) - - tags = tk.Entry(canvas) - tags.grid(row=12, column=2, sticky="ew") - tags.insert(tk.END, self.value_dict["tags"]) - create_tool_tip(tags, "Space-separated list of tags for identification.") - - additional_notes = tk.Text(canvas, height=10) - additional_notes.grid(row=13, column=2, sticky="ew") - additional_notes.insert(tk.END, self.value_dict["notes"]) - create_tool_tip(additional_notes, "Can be used to store notes regarding the configuration.") - - # show buttons - button_canvas = tk.Canvas(frame) - button_canvas.grid(row=2) - # Create "Save" button - save_button = tk.Button( - button_canvas, - text="Save", - command=lambda: self.save_changes( - wizard, - main_screen_obj, - label, - description, - executable_name, - executable_args, - make_flags, - project_path, - project_linker_flags, - make_target, - mpsfp_var, - tags, - additional_notes, - ), - ) - save_button.grid(row=1, column=1) - - # Create "Delete" button - delete_button = tk.Button( - button_canvas, - text="Delete", - command=lambda: self.delete_configuration(wizard, main_screen_obj, frame), - ) - delete_button.grid(row=1, column=2) - - # Create "Open Folder" button - if os.path.exists(os.path.join(project_path.get(), ".discopop")): - target_path = os.path.join(project_path.get(), ".discopop") - else: - target_path = project_path.get() - open_project_folder_button = tk.Button( - button_canvas, - text="Open Folder", - command=lambda: os.system( - "xdg-open " - + str( - os.path.join(project_path.get(), ".discopop") - if os.path.exists(os.path.join(project_path.get(), ".discopop")) - else project_path.get() - ) - ), - ) - open_project_folder_button.grid(row=1, column=3) - - # Create "Execute" button - execute_button = tk.Button( - button_canvas, - text="Execute", - command=lambda: self.execute_configuration( - wizard, - main_screen_obj, - label, - description, - executable_name, - executable_args, - make_flags, - project_path, - project_linker_flags, - make_target, - mpsfp_var, - tags, - additional_notes, - ), - ) - execute_button.grid(row=1, column=4) - - def __button_state_from_result_existence(self) -> str: - # check if suggestions can be loaded. If so, enable the button. - # Else, disable it. - try: - suggestions = get_suggestion_objects(self.wizard, self) - except FileNotFoundError: - return "disabled" - except JSONDecodeError: - return "disabled" - return "normal" - - def save_changes( - self, - wizard, - main_screen_obj, - label, - description, - executable_name, - executable_args, - make_flags, - project_path, - project_linker_flags, - make_target, - memory_profiling_skip_function_parameters, - tags, - additional_notes, - rebuild_configurations_frame=True, - ): - # update execution configuration - self.value_dict["label"] = label.get() - self.value_dict["description"] = description.get() - self.value_dict["executable_name"] = executable_name.get() - self.value_dict["executable_arguments"] = executable_args.get() - self.value_dict["make_flags"] = make_flags.get() - self.value_dict["project_path"] = project_path.get() - self.value_dict["working_copy_path"] = self.value_dict["project_path"] + "/.discopop" - self.value_dict["linker_flags"] = project_linker_flags.get() - self.value_dict["make_target"] = make_target.get() - self.value_dict["memory_profiling_skip_function_parameters"] = memory_profiling_skip_function_parameters.get() - self.value_dict["tags"] = tags.get() - self.value_dict["notes"] = additional_notes.get("1.0", tk.END) - - # construct config path - config_path = os.path.join( - wizard.config_dir, - "execution_configurations", - str(self.value_dict["id"]) + "_" + self.value_dict["label"] + ".json", - ) - # remove old config if present - if os.path.exists(config_path): - os.remove(config_path) - # write config to file - with open(config_path, "w+") as f: - f.write(self.get_values_as_json_string()) - - if rebuild_configurations_frame: # used to prevent de-selecting button on execution - main_screen_obj.build_configurations_frame(wizard) - print("Saved configuration") - self.wizard.console.print("Saved configuration") - - def delete_configuration(self, wizard, main_screen_obj, details_frame: tk.Frame): - # delete configuration file if it exists - config_path = os.path.join( - wizard.config_dir, - "execution_configurations", - str(self.value_dict["id"]) + "_" + self.value_dict["label"] + ".json", - ) - if os.path.exists(config_path): - os.remove(config_path) - - main_screen_obj.build_configurations_frame(wizard) - # remove details view - for c in details_frame.winfo_children(): - c.destroy() - - def execute_configuration( - self, - wizard, - main_screen_obj, - label, - description, - executable_name, - executable_args, - make_flags, - project_path, - project_linker_flags, - make_target, - memory_profiling_skip_function_parameters, - tags, - additional_notes, - ): - # save changes - self.save_changes( - wizard, - main_screen_obj, - label, - description, - executable_name, - executable_args, - make_flags, - project_path, - project_linker_flags, - make_target, - memory_profiling_skip_function_parameters, - tags, - additional_notes, - rebuild_configurations_frame=False, - ) - - # create execution view and update results frame - ExecutionView(self, wizard, main_screen_obj.results_frame) - # set results tab state based on result existence - main_screen_obj.notebook.tab(main_screen_obj.results_frame, state=self.__button_state_from_result_existence()) - main_screen_obj.notebook.tab(main_screen_obj.optimizer_frame, state=self.__button_state_from_result_existence()) - - # show results tab - main_screen_obj.notebook.select(main_screen_obj.results_frame) - # initialize optimizer tab - create_optimizer_screen(wizard, main_screen_obj.optimizer_frame, self) - - def get_tags(self) -> List[str]: - """Returns a list of strings which represents the tags assigned to the configuration.""" - return [tag for tag in self.value_dict["tags"].split(" ") if len(tag) != 0] diff --git a/DEPRECATED_discopop_wizard/classes/Pragma.py b/DEPRECATED_discopop_wizard/classes/Pragma.py deleted file mode 100644 index 9b1503a5a..000000000 --- a/DEPRECATED_discopop_wizard/classes/Pragma.py +++ /dev/null @@ -1,27 +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 enum import IntEnum -from typing import Optional, List, Any - - -class PragmaPosition(IntEnum): - BEFORE_START = 0 - AFTER_START = 1 - BEFORE_END = 2 - AFTER_END = 3 - - -class Pragma(object): - pragma_str: str = "" - file_id: Optional[int] = None - start_line: Optional[int] = None - end_line: Optional[int] = None - pragma_position: PragmaPosition = PragmaPosition.BEFORE_START - parent_cu_id: str = "" - children: List[Any] = [] diff --git a/DEPRECATED_discopop_wizard/classes/ProfilingContainer.py b/DEPRECATED_discopop_wizard/classes/ProfilingContainer.py deleted file mode 100644 index bb9b1ef19..000000000 --- a/DEPRECATED_discopop_wizard/classes/ProfilingContainer.py +++ /dev/null @@ -1,149 +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. - -import glob -import os -import pathlib -import shutil -import subprocess -import tkinter - - -class ProfilingContainer(object): - def __init__(self, wizard): - self.wizard = wizard - self.start() - - def start(self): - docker_context_path = os.path.join( - pathlib.Path(__file__).parent.resolve(), "..", "assets", "profiling_container" - ) - self.__execute_command("docker kill discopop_container") - self.__execute_command("docker rm discopop_container") - exit_code = self.__execute_command("docker build -t discopop_container " + docker_context_path) - assert exit_code == 0 - exit_code = self.__execute_command("docker run --name discopop_container -d -t discopop_container") - assert exit_code == 0 - - def stop(self): - print("Stopping DiscoPoP profiling container...") - self.__execute_command("docker kill discopop_container") - print("Done.") - - def remove_project_folder(self): - self.__execute_command("docker exec -it discopop_container rm -rvf /project") - - def remove_previous_results(self, target_folder): - files = glob.glob(target_folder + "/*") - for f in files: - if os.path.exists(f): - if os.path.isfile(f): - os.remove(f) - else: - shutil.rmtree(f) - - def copy_project_folder_to_container(self, project_path: str): - self.remove_project_folder() - self.__execute_command("docker cp " + project_path + " discopop_container:/project") - - def copy_results_from_container(self, target_path: str, execution_view): - result_files = [ - "FileMapping.txt", - "Data.xml", - "loop_counter_output.txt", - "reduction.txt", - execution_view.execution_configuration.value_dict["executable_name"] + "_dp_dep.txt", - execution_view.execution_configuration.value_dict["executable_name"] + "_dp.ll", - "patterns.txt", - "patterns.json", - ] - for file in result_files: - exit_code = self.__execute_command( - "docker cp discopop_container:/project/.discopop/" + file + " " + target_path - ) - assert exit_code == 0 - - def analyze_project(self, execution_view): - # copy project folder to container. Note: mounting would be nicer but requires restarting the container. - # might be a nicer solution in the long run, especially for larger projects - self.copy_project_folder_to_container(execution_view.execution_configuration.value_dict["project_path"]) - - # settings - command = "/discopop/build/scripts/runDiscoPoP " - command += "--llvm-clang clang-11 " - command += "--llvm-clang++ clang++-11 " - command += "--llvm-ar llvm-ar-11 " - command += "--llvm-link llvm-link-11 " - command += "--llvm-dis llvm-dis-11 " - command += "--llvm-opt opt-11 " - command += "--llvm-llc llc-11 " - command += "--gllvm /software/go/bin " - # execution configuration - command += "--project /project " - command += '--linker-flags "' + execution_view.execution_configuration.value_dict["linker_flags"] + '" ' - command += '--executable-name "' + execution_view.execution_configuration.value_dict["executable_name"] + '" ' - command += ( - '--executable-arguments "' - + execution_view.execution_configuration.value_dict["executable_arguments"] - + '" ' - ) - command += '--make-flags "' + execution_view.execution_configuration.value_dict["make_flags"] + '" ' - command += '--make-target "' + execution_view.execution_configuration.value_dict["make_target"] + '" ' - command += '--explorer-flags "' + execution_view.execution_configuration.value_dict["explorer_flags"] + '" ' - - self.__execute_command("docker exec -it discopop_container " + command) - - # copy results from container into working copy path - if not os.path.exists(execution_view.execution_configuration.value_dict["working_copy_path"]): - os.mkdir(execution_view.execution_configuration.value_dict["working_copy_path"]) - - # remove previous results - self.remove_previous_results(execution_view.execution_configuration.value_dict["working_copy_path"]) - - # copy results from container - self.copy_results_from_container( - execution_view.execution_configuration.value_dict["working_copy_path"], execution_view - ) - - # correct paths in generated FileMapping.txt - self.__correct_file_mapping_paths(execution_view) - - def __correct_file_mapping_paths(self, execution_view): - file_mapping_path = os.path.join( - execution_view.execution_configuration.value_dict["working_copy_path"], - "FileMapping.txt", - ) - with open(file_mapping_path, "r") as file: - contents = file.read() - contents = contents.replace( - "/project/.discopop", execution_view.execution_configuration.value_dict["project_path"] - ) - with open(file_mapping_path, "w") as file: - file.write(contents) - - def __execute_command(self, command: str) -> int: - with subprocess.Popen(command, stdout=subprocess.PIPE, bufsize=1, universal_newlines=True, shell=True) as p: - if p.stdout is None: - print("executing command was not successfull") - else: - for line in p.stdout: - line = line.replace("\n", "") - print(line) - try: - self.wizard.console.print(line) - except tkinter.TclError: - # happens when container is still shutting down but interface already closed. - pass - if p.returncode != 0: - print("An error occurred during the execution!") # Error message - self.wizard.console.print("An error occurred during the execution!") - for line in str(subprocess.CalledProcessError(p.returncode, p.args)).split("\n"): - line = line.replace("\n", "") - print(line) - self.wizard.console.print(line) - return p.returncode diff --git a/DEPRECATED_discopop_wizard/classes/Settings.py b/DEPRECATED_discopop_wizard/classes/Settings.py deleted file mode 100644 index a45e17192..000000000 --- a/DEPRECATED_discopop_wizard/classes/Settings.py +++ /dev/null @@ -1,155 +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. - -import os -import shutil - -import jsons # type:ignore - - -class Settings(object): - # general settings - initialized = False - discopop_build_dir: str = "" - clang: str = "" - clangpp: str = "" - llvm_ar: str = "" - llvm_link: str = "" - llvm_dis: str = "" - llvm_opt: str = "" - llvm_llc: str = "" - go_bin: str = "" - use_docker_container_for_profiling: bool = True - - # code preview settings - code_preview_show_metadata_regions: int = 0 # 1 = True, 0 = False - code_preview_show_metadata_live_device_variables: int = 0 # 1 = True, 0 = False - code_preview_show_line_numbers: int = 1 # 1 = True, 0 = False - code_preview_disable_compile_check: int = 0 # 1 = True, 0 = False - - def __init__(self, discopop_build_dir="", go_bin_dir="", use_docker_container: bool = True) -> None: - self.discopop_build_dir = discopop_build_dir - self.go_bin = go_bin_dir - self.use_docker_container_for_profiling = use_docker_container - # validate settings - settings_valid = os.path.exists(self.discopop_build_dir) and os.path.exists(self.go_bin) - - # get llvm_bin_dir from stored build configuration - llvm_bin_dir = "" - if settings_valid: - command = "cat " + self.discopop_build_dir + '/build_config.txt | grep -oP "(?<=LLVM_BIN_DIR=).*"' - llvm_bin_dir = os.popen(command).read().replace("\n", "") - if not os.path.exists(llvm_bin_dir): - llvm_bin_dir = "" - - # try and find default values using llvm_bin_dir and shutil.which - if os.path.exists(os.path.join(llvm_bin_dir, "clang")): - self.clang = os.path.join(llvm_bin_dir, "clang") - else: - self.clang = shutil.which("clang") or "" - if os.path.exists(os.path.join(llvm_bin_dir, "clang++")): - self.clangpp = os.path.join(llvm_bin_dir, "clang++") - else: - self.clangpp = shutil.which("clang++") or "" - - if os.path.exists(os.path.join(llvm_bin_dir, "llvm-ar")): - self.llvm_ar = os.path.join(llvm_bin_dir, "llvm-ar") - else: - self.llvm_ar = shutil.which("llvm-ar-11") or "" - - if os.path.exists(os.path.join(llvm_bin_dir, "llvm-link")): - self.llvm_link = os.path.join(llvm_bin_dir, "llvm-link") - else: - self.llvm_link = shutil.which("llvm-link-11") or "" - - if os.path.exists(os.path.join(llvm_bin_dir, "llvm-dis")): - self.llvm_dis = os.path.join(llvm_bin_dir, "llvm-dis") - else: - self.llvm_dis = shutil.which("llvm-dis-11") or "" - - if os.path.exists(os.path.join(llvm_bin_dir, "opt")): - self.llvm_opt = os.path.join(llvm_bin_dir, "opt") - else: - self.llvm_opt = shutil.which("opt-11") or "" - - if os.path.exists(os.path.join(llvm_bin_dir, "llc")): - self.llvm_llc = os.path.join(llvm_bin_dir, "llc") - else: - self.llvm_llc = shutil.which("llc-11") or "" - - # validate settings - settings_valid = ( - settings_valid - and len(self.clang) > 0 - and len(self.clangpp) > 0 - and len(self.llvm_ar) > 0 - and len(self.llvm_link) > 0 - and len(self.llvm_dis) > 0 - and len(self.llvm_opt) > 0 - and len(self.llvm_llc) > 0 - ) - - # set initialized, if all values could be determined and are valid, or docker container is used - self.initialized = use_docker_container or settings_valid - - def get_as_json_string(self): - """returns a representation of the settings which will be stored in a configuration file.""" - return jsons.dumps(self) - - def save_to_file(self, config_dir: str): - settings_path = os.path.join(config_dir, "SETTINGS.txt") - # remove old config if present - if os.path.exists(settings_path): - os.remove(settings_path) - # write config to file - with open(settings_path, "w+") as f: - f.write(self.get_as_json_string()) - - -def load_from_config_file(config_dir: str) -> Settings: - json_str = "" - with open(os.path.join(config_dir, "SETTINGS.txt"), "r") as f: - for line in f.readlines(): - json_str += line - value_dict = jsons.loads(json_str) - settings = Settings() - - # general settings - settings.discopop_build_dir = __load_or_get_default(value_dict, "discopop_build_dir") - settings.clang = __load_or_get_default(value_dict, "clang") - settings.clangpp = __load_or_get_default(value_dict, "clangpp") - settings.llvm_ar = __load_or_get_default(value_dict, "llvm_ar") - settings.llvm_link = __load_or_get_default(value_dict, "llvm_link") - settings.llvm_dis = __load_or_get_default(value_dict, "llvm_dis") - settings.llvm_opt = __load_or_get_default(value_dict, "llvm_opt") - settings.llvm_llc = __load_or_get_default(value_dict, "llvm_llc") - settings.go_bin = __load_or_get_default(value_dict, "go_bin") - settings.use_docker_container_for_profiling = __load_or_get_default( - value_dict, "use_docker_container_for_profiling" - ) - # code preview settings - settings.code_preview_show_metadata_regions = __load_or_get_default( - value_dict, "code_preview_show_metadata_regions" - ) - settings.code_preview_show_line_numbers = __load_or_get_default(value_dict, "code_preview_show_line_numbers") - settings.code_preview_show_metadata_live_device_variables = __load_or_get_default( - value_dict, "code_preview_show_metadata_live_device_variables" - ) - settings.code_preview_disable_compile_check = __load_or_get_default( - value_dict, "code_preview_disable_compile_check" - ) - - settings.initialized = True - return settings - - -def __load_or_get_default(value_dict, key_name): - if key_name in value_dict: - return value_dict[key_name] - # get default value - return getattr(Settings(), key_name) diff --git a/DEPRECATED_discopop_wizard/classes/Suggestion.py b/DEPRECATED_discopop_wizard/classes/Suggestion.py deleted file mode 100644 index 06920694e..000000000 --- a/DEPRECATED_discopop_wizard/classes/Suggestion.py +++ /dev/null @@ -1,216 +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. - -import os -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_library.CodeGenerator.classes.UnpackedSuggestion import UnpackedSuggestion -from DEPRECATED_discopop_wizard.classes.CodePreview import CodePreviewContentBuffer - - -class PragmaType(IntEnum): - PRAGMA = 1 - REGION = 2 - - -class Suggestion(UnpackedSuggestion): - def __init__(self, wizard, type_str: str, values: Dict[str, Any]): - super().__init__(type_str, values) - self.wizard = wizard - - def show_code_section(self, parent_frame: tk.Frame, execution_configuration): - # close elements of parent_frame - for c in parent_frame.winfo_children(): - c.destroy() - - # configure parent_frame - parent_frame.rowconfigure(0, weight=1) - parent_frame.columnconfigure(0, weight=1) - - # create content frame and scroll bars - source_code = tk.Text(parent_frame, wrap=tk.NONE) - source_code.grid(row=0, column=0, sticky="nsew") - - # create a Scrollbar and associate it with the content frame - y_scrollbar = ttk.Scrollbar(parent_frame, command=source_code.yview) - y_scrollbar.grid(row=0, column=1, sticky="nsew") - source_code["yscrollcommand"] = y_scrollbar.set - - x_scrollbar = ttk.Scrollbar(parent_frame, orient="horizontal", command=source_code.xview) - x_scrollbar.grid(row=1, column=0, columnspan=2, sticky="nsew") - source_code["xscrollcommand"] = x_scrollbar.set - - # load file mapping from project path - file_mapping: Dict[int, Path] = dict() - with open( - os.path.join(execution_configuration.value_dict["working_copy_path"], "FileMapping.txt"), - "r", - ) as f: - for line in f.readlines(): - line = line.replace("\n", "") - split_line = line.split("\t") - id = int(split_line[0]) - path = split_line[1] - file_mapping[id] = Path(path) - - # create CodePreview object - code_preview = CodePreviewContentBuffer(self.wizard, self.file_id, file_mapping[self.file_id]) - - # get and insert pragmas - pragmas = self.get_pragmas() - for pragma in pragmas: - compile_check_command = ( - "cd " - + execution_configuration.value_dict["working_copy_path"] - + " && make " - + execution_configuration.value_dict["make_flags"] - + " " - + execution_configuration.value_dict["make_target"] - ) - successful = code_preview.add_pragma( - file_mapping, - pragma, - [], - skip_compilation_check=True if self.wizard.settings.code_preview_disable_compile_check == 1 else False, - compile_check_command=compile_check_command, - ) - # if the addition resulted in a non-compilable file, add the pragma as a comment - if not successful: - # print error codes - self.wizard.console.print(code_preview.compile_result_buffer) - code_preview.add_pragma( - file_mapping, - pragma, - [], - add_as_comment=True, - skip_compilation_check=True, - compile_check_command=compile_check_command, - ) - - # show CodePreview - code_preview.show_in(source_code) - - # show targeted code section - code_preview.jump_to_first_modification(source_code) - - # disable source code text widget to disallow editing - source_code.config(state=tk.DISABLED) - - def get_as_button(self, frame: tk.Frame, code_preview_frame: tk.Frame, execution_configuration) -> tk.Button: - return tk.Button( - frame, - text=self.type + " @ " + self.values["start_line"], - command=lambda: self.show_code_section(code_preview_frame, execution_configuration), - ) - - def __insert_pragmas(self, source_code: tk.Text, pragmas: List[Tuple[int, int, str]]): - highlight_start_positions = [] - - idx = 0 - for start_line, end_line, pragma_str in sorted( - pragmas, reverse=True, key=lambda v: int(v[0]) - ): # sort reverse by line num - # add pragma string - source_code.insert(str(start_line) + ".0", " " + pragma_str + "\n") - # highlight inserted pragmas and their target code sections - pos = self.__highlight_code( - source_code, start_line, end_line + 1, idx - ) # +1 to account for added pragma line - highlight_start_positions.append(pos) - idx += 1 - - return sorted(highlight_start_positions, key=lambda value: int(value.split(".")[0])) - - def __highlight_code(self, source_code: tk.Text, start_line: int, end_line: int, index): - """highlights the specified lines in the source code preview and returns the used start position. - index is used to determine the color.""" - end_line_length = 200 - background_color = "#e5f2b3" if index % 2 == 0 else "#a4ed9a" - # highlight code - start_pos = str(start_line) + ".0" - end_pos = str(end_line) + "." + str(end_line_length) - source_code.tag_add("start" + str(index), start_pos, end_pos) - source_code.tag_config("start" + str(index), background=background_color, foreground="black") - return start_pos - - def __get_pragmas(self) -> List[Tuple[int, int, str]]: - """returns a list of source code lines and pragmas to be inserted into the code preview""" - pragmas = [] - if self.type == "do_all" or self.type == "reduction": - pragma = "#pragma omp parallel for " - if len(self.values["first_private"]) > 0: - pragma += "firstprivate(" + ",".join(self.values["first_private"]) + ") " - if len(self.values["private"]) > 0: - pragma += "private(" + ",".join(self.values["private"]) + ") " - if len(self.values["last_private"]) > 0: - pragma += "lastprivate(" + ",".join(self.values["last_private"]) + ") " - if len(self.values["shared"]) > 0: - pragma += "shared(" + ",".join(self.values["shared"]) + ") " - if len(self.values["reduction"]) > 0: - reductions_dict: Dict[Any, Any] = dict() - for entry in self.values["reduction"]: - red_type = entry.split(":")[0] - var = entry.split(":")[1] - if red_type not in reductions_dict: - reductions_dict[red_type] = [] - reductions_dict[red_type].append(var) - for red_type in reductions_dict: - pragma += "reduction(" + red_type + ":" + ",".join(reductions_dict[red_type]) + ") " - pragma_tuple = (self.start_line, self.end_line, pragma) - pragmas.append(pragma_tuple) - return pragmas - elif self.type == "pipeline": - for stage in self.values["stages"]: - pragma = "#pragma omp task " - if len(stage["first_private"]) > 0: - pragma += "firstprivate(" + ",".join(stage["first_private"]) + ") " - if len(stage["private"]) > 0: - pragma += "private(" + ",".join(stage["private"]) + ") " - if len(stage["shared"]) > 0: - pragma += "shared(" + ",".join(stage["shared"]) + ") " - if len(stage["reduction"]) > 0: - reductions_dict = dict() - for entry in stage["reduction"]: - red_type = entry.split(":")[0] - var = entry.split(":")[1] - if red_type not in reductions_dict: - reductions_dict[red_type] = [] - reductions_dict[red_type].append(var) - for red_type in reductions_dict: - pragma += "reduction(" + red_type + ":" + ",".join(reductions_dict[red_type]) + ") " - if len(stage["in_deps"]) > 0: - pragma += "depends(in:" + ",".join(stage["in_deps"]) + ") " - if len(stage["out_deps"]) > 0: - pragma += "depends(out:" + ",".join(stage["out_deps"]) + ") " - if len(stage["in_out_deps"]) > 0: - pragma += "depends(inout:" + ",".join(stage["in_out_deps"]) + ") " - pragma_tuple = ( - int(stage["startsAtLine"].split(":")[1]), - int(stage["endsAtLine"].split(":")[1]), - pragma, - ) - pragmas.append(pragma_tuple) - else: - pragmas.append( - ( - self.start_line, - self.end_line, - "#CURRENTLY UNSUPPORTED PREVIEW FOR TYPE: " + self.type, - ) - ) - return pragmas - - def get_details(self) -> str: - """Returns the details string which should be shown when hovering over the Suggestion button.""" - import pprint - - return pprint.pformat(self.values) diff --git a/DEPRECATED_discopop_wizard/classes/TKVarStorage.py b/DEPRECATED_discopop_wizard/classes/TKVarStorage.py deleted file mode 100644 index e046d2dda..000000000 --- a/DEPRECATED_discopop_wizard/classes/TKVarStorage.py +++ /dev/null @@ -1,47 +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. - -import tkinter as tk - - -class TKVarStorage(object): - # code preview settings - toggle_var_code_preview_show_metadata_regions: tk.IntVar - toggle_var_code_preview_show_metadata_live_device_variables: tk.IntVar - toggle_var_code_preview_show_line_numbers: tk.IntVar - toggle_var_code_preview_disable_compile_check: tk.IntVar - - def __init__(self, wizard): - self.wizard = wizard - self.toggle_var_code_preview_show_metadata_regions = tk.IntVar( - value=self.wizard.settings.code_preview_show_metadata_regions - ) - self.toggle_var_code_preview_show_line_numbers = tk.IntVar( - value=self.wizard.settings.code_preview_show_line_numbers - ) - self.toggle_var_code_preview_show_metadata_live_device_variables = tk.IntVar( - value=self.wizard.settings.code_preview_show_metadata_live_device_variables - ) - self.toggle_var_code_preview_disable_compile_check = tk.IntVar( - value=self.wizard.settings.code_preview_disable_compile_check - ) - - def toggle_code_preview_setting_action(self): - """overwrites the respective value in wizard.settings and triggers saving the new settings.""" - self.wizard.settings.code_preview_show_metadata_regions = ( - self.toggle_var_code_preview_show_metadata_regions.get() - ) - self.wizard.settings.code_preview_show_metadata_live_device_variables = ( - self.toggle_var_code_preview_show_metadata_live_device_variables.get() - ) - self.wizard.settings.code_preview_show_line_numbers = self.toggle_var_code_preview_show_line_numbers.get() - self.wizard.settings.code_preview_disable_compile_check = ( - self.toggle_var_code_preview_disable_compile_check.get() - ) - self.wizard.settings.save_to_file(self.wizard.config_dir) - self.wizard.console.print("Saved settings.") diff --git a/DEPRECATED_discopop_wizard/classes/__init__.py b/DEPRECATED_discopop_wizard/classes/__init__.py deleted file mode 100644 index e69de29bb..000000000 diff --git a/DEPRECATED_discopop_wizard/headless/__init__.py b/DEPRECATED_discopop_wizard/headless/__init__.py deleted file mode 100644 index e69de29bb..000000000 diff --git a/DEPRECATED_discopop_wizard/headless/headless_execution.py b/DEPRECATED_discopop_wizard/headless/headless_execution.py deleted file mode 100644 index 83ea937b2..000000000 --- a/DEPRECATED_discopop_wizard/headless/headless_execution.py +++ /dev/null @@ -1,65 +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. - -import os -from typing import List, Tuple - -from DEPRECATED_discopop_wizard.classes.Arguments import Arguments -from DEPRECATED_discopop_wizard.classes.ExecutionConfiguration import ExecutionConfiguration -from DEPRECATED_discopop_wizard.classes.Settings import load_from_config_file, Settings -from DEPRECATED_discopop_wizard.screens.execution import ExecutionView -from DEPRECATED_discopop_wizard.wizard import DiscoPoPConfigurationWizard - - -def execute_all_stored_configurations(args: Arguments, source_dir: str): - wizard, settings, execution_configs = __load_data(args, source_dir) - # execute all configurations - execution_views: List[ExecutionView] = [] - for config in execution_configs: - execution_views.append(ExecutionView(config, wizard, None, headless_mode=True)) - - -def execute_tag_filtered_configurations(args: Arguments, source_dir: str): - wizard, settings, execution_configs = __load_data(args, source_dir) - # filter configurations by tags - filtered_execution_configs: List[ExecutionConfiguration] = [] - for config in execution_configs: - # get tags from config - # get tags from arguments - # if an overlap exists, the configurations shall be executed - overlapping_tags = [tag for tag in config.get_tags() if tag in args.execute_configurations_with_tag] - if len(overlapping_tags) > 0: - filtered_execution_configs.append(config) - - # execute the filtered configurations - execution_views: List[ExecutionView] = [] - for config in filtered_execution_configs: - execution_views.append(ExecutionView(config, wizard, None, headless_mode=True)) - - -def __load_data( - args: Arguments, source_dir: str -) -> Tuple[DiscoPoPConfigurationWizard, Settings, List[ExecutionConfiguration]]: - """Loads and returns a DiscoPoPConfigurationWizard, Settings, and a list of ExecutionConfigurations.""" - config_dir = os.path.join(source_dir, ".config") - # load settings - settings = load_from_config_file(config_dir) - # create DiscoPoPWizard - wizard = DiscoPoPConfigurationWizard(config_dir, args, headless_mode=True) - - # load execution configurations - execution_configs: List[ExecutionConfiguration] = [] - for filename in os.listdir(os.path.join(config_dir, "execution_configurations")): - if not filename.endswith(".json"): - continue - with open(os.path.join(os.path.join(config_dir, "execution_configurations"), filename), "r") as json_file: - config = ExecutionConfiguration(wizard) - config.init_from_json(json_file) - execution_configs.append(config) - - return wizard, settings, execution_configs diff --git a/DEPRECATED_discopop_wizard/screens/__init__.py b/DEPRECATED_discopop_wizard/screens/__init__.py deleted file mode 100644 index e69de29bb..000000000 diff --git a/DEPRECATED_discopop_wizard/screens/execution.py b/DEPRECATED_discopop_wizard/screens/execution.py deleted file mode 100644 index 011c84f87..000000000 --- a/DEPRECATED_discopop_wizard/screens/execution.py +++ /dev/null @@ -1,105 +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. - -import subprocess -import tkinter as tk -from typing import Optional, cast - -from DEPRECATED_discopop_wizard.classes.ProfilingContainer import ProfilingContainer -from DEPRECATED_discopop_wizard.screens.suggestions.overview import show_suggestions_overview_screen - - -class ExecutionView(object): - def __init__( - self, - execution_configuration, - wizard, - details_frame: Optional[tk.Frame], - headless_mode: bool = False, - ): - self.execution_configuration = execution_configuration - self.wizard = wizard - self.details_frame = details_frame - self.headless_mode = headless_mode - self.__execute() - - def __execute(self): - # prepare environment - if self.wizard.settings.use_docker_container_for_profiling: - # start container if not already present. Required when enabling container usage after start of application. - if self.wizard.profiling_container is None: - self.wizard.profiling_container = ProfilingContainer(self.wizard) - self.wizard.profiling_container.analyze_project(self) - # todo add display of suggestions - if not self.headless_mode: - self.__show_suggestions() - else: - # prepare command - command = self.__assemble_command_string() - # execute command - return_code = self.__execute_command(command) - if return_code == 0: - # show suggestions, stored in project_path/patterns.txt - if not self.headless_mode: - self.__show_suggestions() - - def __assemble_command_string(self) -> str: - # assemble command for regular execution - command = "" - # settings - command = self.wizard.settings.discopop_build_dir + "/scripts/runDiscoPoP " - command += '--llvm-clang "' + self.wizard.settings.clang + '" ' - command += '--llvm-clang++ "' + self.wizard.settings.clangpp + '" ' - command += '--llvm-ar "' + self.wizard.settings.llvm_ar + '" ' - command += '--llvm-link "' + self.wizard.settings.llvm_link + '" ' - command += '--llvm-dis "' + self.wizard.settings.llvm_dis + '" ' - command += '--llvm-opt "' + self.wizard.settings.llvm_opt + '" ' - command += '--llvm-llc "' + self.wizard.settings.llvm_llc + '" ' - command += '--gllvm "' + self.wizard.settings.go_bin + '" ' - # execution configuration - command += '--project "' + self.execution_configuration.value_dict["project_path"] + '" ' - command += '--linker-flags "' + self.execution_configuration.value_dict["linker_flags"] + '" ' - command += '--executable-name "' + self.execution_configuration.value_dict["executable_name"] + '" ' - command += '--executable-arguments "' + self.execution_configuration.value_dict["executable_arguments"] + '" ' - command += '--make-flags "' + self.execution_configuration.value_dict["make_flags"] + '" ' - command += '--make-target "' + self.execution_configuration.value_dict["make_target"] + '" ' - command += ( - "--memory-profiling-skip-function-arguments " - if self.execution_configuration.value_dict["memory_profiling_skip_function_parameters"] == 1 - else "" - ) - command += '--explorer-flags "' + self.execution_configuration.value_dict["explorer_flags"] + '" ' - - return command - - def __execute_command(self, command: str) -> int: - with subprocess.Popen(command, stdout=subprocess.PIPE, bufsize=1, universal_newlines=True, shell=True) as p: - if p.stdout is None: - print("command execution was not successfull") - else: - for line in p.stdout: - line = line.replace("\n", "") - self.__print_to_console(line) - if not self.headless_mode: - self.wizard.console.print(line) - if p.returncode != 0: - self.__print_to_console("An error occurred during the execution!") # Error message - if not self.headless_mode: - self.wizard.console.print("An error occurred during the execution!") - for line in str(subprocess.CalledProcessError(p.returncode, p.args)).split("\n"): - line = line.replace("\n", "") - self.__print_to_console(line) - if not self.headless_mode: - self.wizard.console.print(line) - return p.returncode - - def __print_to_console(self, msg: str): - print(msg) - - def __show_suggestions(self): - show_suggestions_overview_screen(self.wizard, cast(tk.Frame, self.details_frame), self.execution_configuration) diff --git a/DEPRECATED_discopop_wizard/screens/main.py b/DEPRECATED_discopop_wizard/screens/main.py deleted file mode 100644 index 671169ceb..000000000 --- a/DEPRECATED_discopop_wizard/screens/main.py +++ /dev/null @@ -1,143 +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. -import os.path -import tkinter as tk -from tkinter import ttk -from typing import List - -from DEPRECATED_discopop_wizard.classes.ExecutionConfiguration import ExecutionConfiguration -from DEPRECATED_discopop_wizard.screens.settings import show_settings_screen -from DEPRECATED_discopop_wizard.utils import support_scrolling - - -class MainScreen(object): - configuration_frame: tk.Frame - notebook: ttk.Notebook - details_frame: tk.Frame - results_frame: tk.Frame - - toggle_var_code_preview_show_metadata: tk.IntVar - - def __init__(self, wizard, window_frame: tk.Frame): - self.wizard = wizard - self.push_main_screen(wizard, window_frame) - - def push_main_screen(self, wizard, window_frame: tk.Frame): - frame = tk.Frame(window_frame) - frame.grid(row=1, column=1, sticky="nsew") - - # create horizontally split frames (configurations + details frame) - horizontal_paned_window = ttk.PanedWindow(frame, orient="horizontal") - horizontal_paned_window.pack(fill=tk.BOTH, expand=True) - self.configuration_frame = tk.Frame(horizontal_paned_window) - horizontal_paned_window.add(self.configuration_frame) - self.notebook = ttk.Notebook(horizontal_paned_window) - horizontal_paned_window.add(self.notebook, weight=1) - - self.details_frame = tk.Frame(self.notebook) - self.results_frame = tk.Frame(self.notebook) - self.optimizer_frame = tk.Frame(self.notebook) - self.notebook.add(self.details_frame, text="Details") - self.notebook.add(self.results_frame, text="Results") - self.notebook.add(self.optimizer_frame, text="Optimizer (experimental)") - - self.build_configurations_frame(wizard) - - self.__build_menu_bar(wizard) - - def __build_menu_bar(self, wizard): - # build menu bar - optionsmenu = tk.Menu(wizard.menubar) - wizard.menubar.add_cascade(label="Options", menu=optionsmenu) - optionsmenu.add_command(label="Settings", command=lambda: show_settings_screen(wizard)) - # build code preview menu - code_preview_menu = tk.Menu(optionsmenu) - optionsmenu.add_cascade(label="Code Preview", menu=code_preview_menu) - code_preview_menu.add_checkbutton( - label="Show Metadata Regions", - variable=wizard.tk_var_storage.toggle_var_code_preview_show_metadata_regions, - onvalue=1, - offvalue=0, - command=lambda: wizard.tk_var_storage.toggle_code_preview_setting_action(), - ) - code_preview_menu.add_checkbutton( - label="Show Line Numbers", - variable=wizard.tk_var_storage.toggle_var_code_preview_show_line_numbers, - onvalue=1, - offvalue=0, - command=lambda: wizard.tk_var_storage.toggle_code_preview_setting_action(), - ) - code_preview_menu.add_checkbutton( - label="Show Live Variables", - variable=wizard.tk_var_storage.toggle_var_code_preview_show_metadata_live_device_variables, - onvalue=1, - offvalue=0, - command=lambda: wizard.tk_var_storage.toggle_code_preview_setting_action(), - ) - code_preview_menu.add_checkbutton( - label="Disable compile validation of inserted pragmas", - variable=wizard.tk_var_storage.toggle_var_code_preview_disable_compile_check, - onvalue=1, - offvalue=0, - command=lambda: wizard.tk_var_storage.toggle_code_preview_setting_action(), - ) - - def build_configurations_frame(self, wizard): - # clear previous contents if existent - for c in self.configuration_frame.winfo_children(): - c.destroy() - # build configuration frame - self.__display_execution_configurations(wizard) - - def __create_new_execution_configuration(self, wizard): - execution_config = ExecutionConfiguration(wizard) - execution_config.show_details_screen(wizard, self) - - def __display_execution_configurations(self, wizard): - # based on https://blog.teclado.com/tkinter-scrollable-frames/ - # load configuration options - configs: List[ExecutionConfiguration] = self.load_execution_configurations(wizard.config_dir) - frame = tk.Frame(self.configuration_frame) - frame.pack(fill=tk.BOTH, expand=True) - tk.Label(frame, text="Configurations", font=wizard.style_font_bold, pady=10).pack() - # add New.. Button - tk.Button(frame, text="New..", command=lambda: self.__create_new_execution_configuration(wizard)).pack() - - tmp_frame = tk.Frame(frame) - tmp_frame.pack(fill=tk.BOTH, expand=True) - - # create scrollable list of suggestions - canvas = tk.Canvas(tmp_frame) - scrollbar = tk.Scrollbar(tmp_frame, orient="vertical", command=canvas.yview) - scrollable_frame = tk.Frame(canvas) - scrollable_frame.bind("", lambda e: canvas.configure(scrollregion=canvas.bbox("all"))) - canvas.create_window((0, 0), window=scrollable_frame, anchor="nw") - canvas.configure(yscrollcommand=scrollbar.set) - - all_buttons: List[tk.Button] = [] # used to manage highlights when a different configuration is selected - for row, config in enumerate(configs): - button = config.get_as_button(wizard, self, scrollable_frame, all_buttons) - button.pack(fill=tk.BOTH, expand=True) - all_buttons.append(button) - - # support scrolling on all platforms (linux, windows, macOS) - support_scrolling(canvas) - - canvas.pack(side="left", fill="both", expand=True) - scrollbar.pack(side="right", fill="y") - - def load_execution_configurations(self, config_dir: str) -> List[ExecutionConfiguration]: - execution_configs: List[ExecutionConfiguration] = [] - for filename in os.listdir(os.path.join(config_dir, "execution_configurations")): - if not filename.endswith(".json"): - continue - with open(os.path.join(os.path.join(config_dir, "execution_configurations"), filename), "r") as json_file: - config = ExecutionConfiguration(self.wizard) - config.init_from_json(json_file) - execution_configs.append(config) - return execution_configs diff --git a/DEPRECATED_discopop_wizard/screens/optimizer/__init__.py b/DEPRECATED_discopop_wizard/screens/optimizer/__init__.py deleted file mode 100644 index e69de29bb..000000000 diff --git a/DEPRECATED_discopop_wizard/screens/optimizer/binding.py b/DEPRECATED_discopop_wizard/screens/optimizer/binding.py deleted file mode 100644 index f44a13326..000000000 --- a/DEPRECATED_discopop_wizard/screens/optimizer/binding.py +++ /dev/null @@ -1,145 +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. -import tkinter as tk -from tkinter import filedialog -import warnings - -from discopop_library.PathManagement.PathManagement import get_path - - -def create_optimizer_screen(wizard, parent_frame, execution_configuration): - # close elements on optimizer_frame - for c in parent_frame.winfo_children(): - c.destroy() - - canvas = tk.Canvas(parent_frame) - canvas.pack(fill=tk.BOTH) - - arguments = dict() - - def overwrite_with_file_selection(target: tk.Entry): - prompt_result = filedialog.askopenfilename() - if len(prompt_result) != 0: - target.delete(0, tk.END) - target.insert(0, prompt_result) - - ### - tk.Label( - canvas, - text="Compile_command", - justify=tk.RIGHT, - anchor="e", - font=wizard.style_font_bold_small, - ).grid(row=1, column=0, sticky="ew") - compile_command = tk.Entry(canvas, width=100) - compile_command.insert(tk.END, "make") - compile_command.grid(row=1, column=1, sticky="ew") - ### - tk.Label( - canvas, - text="DoAll microbench file", - justify=tk.RIGHT, - anchor="e", - font=wizard.style_font_bold_small, - ).grid(row=2, column=0, sticky="ew") - doall_microbench_file = tk.Entry(canvas, width=100) - doall_microbench_file.insert(tk.END, "None") - doall_microbench_file.grid(row=2, column=1, sticky="ew") - - doall_microbench_file_path_selector = tk.Button( - canvas, text="Select", command=lambda: overwrite_with_file_selection(doall_microbench_file) - ) - doall_microbench_file_path_selector.grid(row=2, column=3) - ### - tk.Label( - canvas, - text="Reduction microbench file", - justify=tk.RIGHT, - anchor="e", - font=wizard.style_font_bold_small, - ).grid(row=3, column=0, sticky="ew") - reduction_microbench_file = tk.Entry(canvas, width=100) - reduction_microbench_file.insert(tk.END, "None") - reduction_microbench_file.grid(row=3, column=1, sticky="ew") - - reduction_microbench_file_path_selector = tk.Button( - canvas, - text="Select", - command=lambda: overwrite_with_file_selection(reduction_microbench_file), - ) - reduction_microbench_file_path_selector.grid(row=3, column=3) - ### - tk.Label( - canvas, - text="Exhaustive search", - justify=tk.RIGHT, - anchor="e", - font=wizard.style_font_bold_small, - ).grid(row=4, column=0, sticky="ew") - exhaustive_search = tk.IntVar(canvas) - exhaustive_search.set(0) - cb = tk.Checkbutton(canvas, onvalue=1, offvalue=0, variable=exhaustive_search) - cb.grid(row=4, column=1) - - start_button = tk.Button( - canvas, - text="Start Optimizer for " + execution_configuration.value_dict["label"], - command=lambda: __start_optimizer( - execution_configuration, - compile_command, - doall_microbench_file, - reduction_microbench_file, - exhaustive_search, - parent_frame, - ), - ) - start_button.grid(row=5, column=0) - - -def __start_optimizer( - execution_configuration, - compile_command, - doall_microbench_file, - reduction_microbench_file, - exhaustive_search, - parent_frame, -): - arguments = { - "--project": execution_configuration.value_dict["project_path"], - "--detection-result-dump": get_path( - execution_configuration.value_dict["working_copy_path"], "detection_result_dump.json" - ), - "--execute-created-models": False, - "--clean-created-code": False, - "--code-export-path": get_path( - execution_configuration.value_dict["project_path"], ".discopop_optimizer/code_exports" - ), - "--dp-output-path": execution_configuration.value_dict["working_copy_path"], - "--file-mapping": get_path(execution_configuration.value_dict["working_copy_path"], "FileMapping.txt"), - "--executable-arguments": execution_configuration.value_dict["executable_arguments"], - "--executable-name": execution_configuration.value_dict["executable_name"], - "--linker-flags": execution_configuration.value_dict["linker_flags"], - "--make-target": execution_configuration.value_dict["make_target"], - "--make-flags": execution_configuration.value_dict["make_flags"], - "--execution-repetitions": 1, - "--execute-single-model": False, - "--compile-command": compile_command.get(), - "--execution-append-measurements": False, - "--exhaustive-search": True if exhaustive_search.get() == 1 else False, - "--headless-mode": False, - "--doall-microbench-file": doall_microbench_file.get(), - "--reduction-microbench-file": reduction_microbench_file.get(), - "--dp-optimizer-path": get_path(execution_configuration.value_dict["project_path"], ".discopop_optimizer"), - } - - # close elements on optimizer_frame - for c in parent_frame.winfo_children(): - c.destroy() - - # start_optimizer(arguments, parent_frame=parent_frame) - warnings.warn("TODO: BINDING TO OPTIMIZER CURRENTLY NOT IMPLEMENTED!") diff --git a/DEPRECATED_discopop_wizard/screens/settings.py b/DEPRECATED_discopop_wizard/screens/settings.py deleted file mode 100644 index bd209bf59..000000000 --- a/DEPRECATED_discopop_wizard/screens/settings.py +++ /dev/null @@ -1,180 +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. - -import tkinter as tk -from tkinter import filedialog -from tkinter import ttk - -from DEPRECATED_discopop_wizard.screens.utils import create_tool_tip - - -def show_settings_screen(wizard): - # clear content frame - for c in wizard.window_frame.winfo_children(): - c.destroy() - - # build settings frame - frame = tk.Frame(wizard.window_frame) - frame.grid(row=1, column=1) - - # show labels - tk.Label(frame, text="Directories:", justify=tk.RIGHT, font=wizard.style_font_bold).grid( - row=1, column=1, sticky="ew" - ) - tk.Label(frame, text="DiscoPoP build:", justify=tk.RIGHT, anchor="e").grid(row=3, column=1, sticky="ew") - tk.Label(frame, text="go/bin directory:", justify=tk.RIGHT, anchor="e").grid(row=4, column=1, sticky="ew") - - ttk.Separator(frame, orient="horizontal").grid(row=5, column=1, sticky="ew", pady=10) - tk.Label(frame, text="Executables:", justify=tk.RIGHT, font=wizard.style_font_bold).grid(row=6, column=1) - tk.Label(frame, text="clang:", justify=tk.RIGHT, anchor="e").grid(row=7, column=1, sticky="ew") - tk.Label(frame, text="clang++:", justify=tk.RIGHT, anchor="e").grid(row=8, column=1, sticky="ew") - tk.Label(frame, text="llvm-ar:", justify=tk.RIGHT, anchor="e").grid(row=9, column=1, sticky="ew") - tk.Label(frame, text="llvm-link:", justify=tk.RIGHT, anchor="e").grid(row=10, column=1, sticky="ew") - tk.Label(frame, text="llvm-dis:", justify=tk.RIGHT, anchor="e").grid(row=11, column=1, sticky="ew") - tk.Label(frame, text="llvm-opt:", justify=tk.RIGHT, anchor="e").grid(row=12, column=1, sticky="ew") - tk.Label(frame, text="llvm-llc:", justify=tk.RIGHT, anchor="e").grid(row=13, column=1, sticky="ew") - - ttk.Separator(frame, orient="horizontal").grid(row=14, column=1, sticky="ew", pady=10) - tk.Label(frame, text="Options:", justify=tk.RIGHT, font=wizard.style_font_bold).grid(row=15, column=1) - tk.Label(frame, text="Use Docker Container for profiling:", justify=tk.RIGHT, anchor="e").grid( - row=16, column=1, sticky="ew" - ) - - def __get_field_state(): - return tk.DISABLED if wizard.settings.use_docker_container_for_profiling else tk.NORMAL - - # show input fields - discopop_build = tk.Entry(frame) - discopop_build.grid(row=3, column=2, sticky="ew") - discopop_build.insert(tk.END, wizard.settings.discopop_build_dir) - discopop_build.config(state=__get_field_state()) - create_tool_tip(discopop_build, "Path to DiscoPoP build directory.") - - go_bin_path = tk.Entry(frame) - go_bin_path.grid(row=4, column=2, sticky="ew") - go_bin_path.insert(tk.END, wizard.settings.go_bin) - go_bin_path.config(state=__get_field_state()) - create_tool_tip(go_bin_path, "Path to the bin folder inside the installation folder of Go.") - - clang = tk.Entry(frame, width=50) - clang.grid(row=7, column=2, sticky="ew") - clang.insert(tk.END, wizard.settings.clang) - clang.config(state=__get_field_state()) - create_tool_tip(clang, "Path to the clang executable.") - - clangpp = tk.Entry(frame) - clangpp.grid(row=8, column=2, sticky="ew") - clangpp.insert(tk.END, wizard.settings.clangpp) - clangpp.config(state=__get_field_state()) - create_tool_tip(clangpp, "Path to the clang++ executable.") - - llvm_ar = tk.Entry(frame) - llvm_ar.grid(row=9, column=2, sticky="ew") - llvm_ar.insert(tk.END, wizard.settings.llvm_ar) - llvm_ar.config(state=__get_field_state()) - create_tool_tip(llvm_ar, "Path to the llvm-ar executable.") - - llvm_link = tk.Entry(frame) - llvm_link.grid(row=10, column=2, sticky="ew") - llvm_link.insert(tk.END, wizard.settings.llvm_link) - llvm_link.config(state=__get_field_state()) - create_tool_tip(llvm_link, "Path to the llvm_link executable.") - - llvm_dis = tk.Entry(frame) - llvm_dis.grid(row=11, column=2, sticky="ew") - llvm_dis.insert(tk.END, wizard.settings.llvm_dis) - llvm_dis.config(state=__get_field_state()) - create_tool_tip(llvm_dis, "Path to the llvm_dis executable.") - - llvm_opt = tk.Entry(frame) - llvm_opt.grid(row=12, column=2, sticky="ew") - llvm_opt.insert(tk.END, wizard.settings.llvm_opt) - llvm_opt.config(state=__get_field_state()) - create_tool_tip(llvm_opt, "Path to the llvm_opt executable.") - - llvm_llc = tk.Entry(frame) - llvm_llc.grid(row=13, column=2, sticky="ew") - llvm_llc.insert(tk.END, wizard.settings.llvm_llc) - llvm_llc.config(state=__get_field_state()) - create_tool_tip(llvm_llc, "Path to the llvm_llc executable.") - - use_docker_container_var = tk.IntVar(value=1 if wizard.settings.use_docker_container_for_profiling else 0) - use_docker_container = tk.Checkbutton(frame, variable=use_docker_container_var) - create_tool_tip( - use_docker_container, - "When un-checking, please save and re-open" " the settings to enable input fields!", - ) - - use_docker_container.grid(row=16, column=2) - - # show path selector buttons - tk.Button(frame, text="Select", command=lambda: __overwrite_with_selection(discopop_build)).grid(row=3, column=3) - tk.Button(frame, text="Select", command=lambda: __overwrite_with_selection(go_bin_path)).grid(row=4, column=3) - tk.Button(frame, text="Select", command=lambda: __overwrite_with_selection(clang)).grid(row=7, column=3) - tk.Button(frame, text="Select", command=lambda: __overwrite_with_selection(clangpp)).grid(row=8, column=3) - tk.Button(frame, text="Select", command=lambda: __overwrite_with_selection(llvm_ar)).grid(row=9, column=3) - tk.Button(frame, text="Select", command=lambda: __overwrite_with_selection(llvm_link)).grid(row=10, column=3) - tk.Button(frame, text="Select", command=lambda: __overwrite_with_selection(llvm_dis)).grid(row=11, column=3) - tk.Button(frame, text="Select", command=lambda: __overwrite_with_selection(llvm_opt)).grid(row=12, column=3) - tk.Button(frame, text="Select", command=lambda: __overwrite_with_selection(llvm_llc)).grid(row=13, column=3) - - # show save button - tk.Button( - frame, - text="Save", - command=lambda: save_settings( - wizard, - discopop_build, - go_bin_path, - clang, - clangpp, - llvm_ar, - llvm_link, - llvm_dis, - llvm_opt, - llvm_llc, - use_docker_container_var, - ), - ).grid(row=17, column=2, pady=10) - - -def __overwrite_with_selection(target: tk.Entry): - prompt_result = tk.filedialog.askdirectory() - if len(prompt_result) != 0: - target.delete(0, tk.END) - target.insert(0, prompt_result) - - -def save_settings( - wizard, - discopop_build: tk.Entry, - go_bin_path: tk.Entry, - clang: tk.Entry, - clangpp: tk.Entry, - llvm_ar: tk.Entry, - llvm_link: tk.Entry, - llvm_dis: tk.Entry, - llvm_opt: tk.Entry, - llvm_llc: tk.Entry, - use_docker_container_var, -): - wizard.settings.discopop_build_dir = discopop_build.get() - wizard.settings.go_bin = go_bin_path.get() - wizard.settings.clang = clang.get() - wizard.settings.clangpp = clangpp.get() - wizard.settings.llvm_ar = llvm_ar.get() - wizard.settings.llvm_link = llvm_link.get() - wizard.settings.llvm_dis = llvm_dis.get() - wizard.settings.llvm_opt = llvm_opt.get() - wizard.settings.llvm_llc = llvm_llc.get() - wizard.settings.use_docker_container_for_profiling = True if use_docker_container_var.get() == 1 else False - - wizard.settings.save_to_file(config_dir=wizard.config_dir) - - # return to main screen - wizard.show_main_screen() diff --git a/DEPRECATED_discopop_wizard/screens/suggestions/__init__.py b/DEPRECATED_discopop_wizard/screens/suggestions/__init__.py deleted file mode 100644 index e69de29bb..000000000 diff --git a/DEPRECATED_discopop_wizard/screens/suggestions/overview.py b/DEPRECATED_discopop_wizard/screens/suggestions/overview.py deleted file mode 100644 index 640352cc0..000000000 --- a/DEPRECATED_discopop_wizard/screens/suggestions/overview.py +++ /dev/null @@ -1,140 +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. -import json -import os -import tkinter as tk -from tkinter import ttk -from typing import List - -from DEPRECATED_discopop_wizard.classes.Suggestion import Suggestion -from DEPRECATED_discopop_wizard.screens.utils import create_tool_tip -from DEPRECATED_discopop_wizard.screens.widgets.ScrollableText import ScrollableTextWidget -from DEPRECATED_discopop_wizard.utils import support_scrolling - - -def show_suggestions_overview_screen(wizard, details_frame: tk.Frame, execution_configuration_obj): - # close elements on details_frame - for c in details_frame.winfo_children(): - c.destroy() - # load suggestions from execution - suggestions = get_suggestion_objects(wizard, execution_configuration_obj) - - # create horizontally split frames (scrollable list of suggestions + code preview) - horizontal_paned_window = ttk.PanedWindow(details_frame, orient="horizontal") - horizontal_paned_window.pack(fill=tk.BOTH, expand=True) - scrollable_list_frame = tk.Frame(horizontal_paned_window) - horizontal_paned_window.add(scrollable_list_frame, weight=1) - code_preview_frame = tk.Frame(horizontal_paned_window) - horizontal_paned_window.add(code_preview_frame, weight=5) - - tmp_frame = tk.Frame(scrollable_list_frame) - tmp_frame.pack(fill=tk.BOTH, expand=True) - - # define notebook widget to show generated CUs and dependencies - separator = ttk.Separator(scrollable_list_frame, orient="horizontal") - separator.pack(fill=tk.X) - result_browser_frame = tk.Frame(scrollable_list_frame) - result_browser_frame.pack(fill=tk.BOTH, expand=True) - result_notebook = ttk.Notebook(result_browser_frame) - result_notebook.pack(fill=tk.BOTH, expand=True) - # add CU preview - cu_display_widget = ScrollableTextWidget(result_notebook) - with open(execution_configuration_obj.value_dict["working_copy_path"] + "/Data.xml", "r") as f: - cu_display_widget.set_text(f.read()) - result_notebook.add(cu_display_widget.frame, text="CU's") - # add dynamic dependency preview - dynamic_dep_display_widget = ScrollableTextWidget(result_notebook) - with open( - execution_configuration_obj.value_dict["working_copy_path"] - + "/" - + execution_configuration_obj.value_dict["executable_name"] - + "_dp_dep.txt", - "r", - ) as f: - dynamic_dep_display_widget.set_text(f.read()) - result_notebook.add(dynamic_dep_display_widget.frame, text="Dynamic DEP's") - # add static dependency preview - static_dep_display_widget = ScrollableTextWidget(result_notebook) - if os.path.exists(execution_configuration_obj.value_dict["working_copy_path"] + "/static_dependencies.txt"): - with open( - execution_configuration_obj.value_dict["working_copy_path"] + "/static_dependencies.txt", - "r", - ) as f: - static_dep_display_widget.set_text(f.read()) - else: - static_dep_display_widget.set_text( - execution_configuration_obj.value_dict["working_copy_path"] + "/static_dependencies.txt" + " NOT FOUND." - ) - result_notebook.add(static_dep_display_widget.frame, text="Static DEP's") - # add instrumented LLVM IR preview - instrumented_llvm_ir_display_widget = ScrollableTextWidget(result_notebook) - if os.path.exists( - execution_configuration_obj.value_dict["working_copy_path"] - + "/" - + execution_configuration_obj.value_dict["executable_name"] - + "_dp.ll" - ): - with open( - execution_configuration_obj.value_dict["working_copy_path"] - + "/" - + execution_configuration_obj.value_dict["executable_name"] - + "_dp.ll", - "r", - ) as f: - instrumented_llvm_ir_display_widget.set_text(f.read()) - else: - instrumented_llvm_ir_display_widget.set_text( - execution_configuration_obj.value_dict["working_copy_path"] - + "/" - + execution_configuration_obj.value_dict["executable_name"] - + "_dp.ll" - + " NOT FOUND." - ) - result_notebook.add(instrumented_llvm_ir_display_widget.frame, text="LLVM IR") - # add patterns.json preview - patterns_json_display_widget = ScrollableTextWidget(result_notebook) - with open(execution_configuration_obj.value_dict["working_copy_path"] + "/" + "patterns.json", "r") as f: - patterns_json_display_widget.set_text(f.read()) - result_notebook.add(patterns_json_display_widget.frame, text="patterns.json") - - # create scrollable list of suggestions - canvas = tk.Canvas(tmp_frame) - scrollbar = tk.Scrollbar(tmp_frame, orient="vertical", command=canvas.yview) - scrollable_frame = tk.Frame(canvas) - scrollable_frame.bind("", lambda e: canvas.configure(scrollregion=canvas.bbox("all"))) - canvas.create_window((0, 0), window=scrollable_frame, anchor="nw") - canvas.configure(yscrollcommand=scrollbar.set) - for row, suggestion in enumerate(suggestions): - # create button to load code preview - button = suggestion.get_as_button(scrollable_frame, code_preview_frame, execution_configuration_obj) - button.pack(fill=tk.BOTH, expand=True) - - # register hover message (suggestion details) - create_tool_tip(button, text=suggestion.get_details()) - - # add support for mouse wheel scrolling - support_scrolling(canvas) - - # add label - tk.Label(tmp_frame, text="Suggestions", font=wizard.style_font_bold).pack(side="top", pady=10) - - canvas.pack(side="left", fill="both", expand=True) - scrollbar.pack(side="right", fill="y") - - -def get_suggestion_objects(wizard, execution_configuration_obj) -> List[Suggestion]: - suggestions_path = os.path.join(execution_configuration_obj.value_dict["working_copy_path"], "patterns.json") - - suggestions_list: List[Suggestion] = [] - with open(suggestions_path, "r") as f: - suggestions_dict = json.load(f) - for suggestion_type in suggestions_dict: - for suggestion_values in suggestions_dict[suggestion_type]: - suggestions_list.append(Suggestion(wizard, suggestion_type, suggestion_values)) - - return suggestions_list diff --git a/DEPRECATED_discopop_wizard/screens/utils.py b/DEPRECATED_discopop_wizard/screens/utils.py deleted file mode 100644 index 55e655535..000000000 --- a/DEPRECATED_discopop_wizard/screens/utils.py +++ /dev/null @@ -1,60 +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. -import tkinter as tk - - -class ToolTip(object): - # based on https://stackoverflow.com/questions/20399243/display-message-when-hovering-over-something-with-mouse-cursor-in-python - - def __init__(self, widget): - self.widget = widget - self.tip_window = None - self.id = None - self.x = self.y = 0 - self.text = "" - - def showtip(self, text): - """Display text in tooltip window""" - self.text = text - if self.tip_window or not self.text: - return - x, y, cx, cy = self.widget.bbox("insert") - x = x + self.widget.winfo_rootx() + 57 - y = y + cy + self.widget.winfo_rooty() + 27 - self.tip_window = tw = tk.Toplevel(self.widget) - tw.wm_overrideredirect(True) - tw.wm_geometry("+%d+%d" % (x, y)) - label = tk.Label( - tw, - text=self.text, - justify=tk.LEFT, - background="#ffffe0", - relief=tk.SOLID, - borderwidth=1, - font=("tahoma", 8, "normal"), - ) - label.pack(ipadx=1) - - def hidetip(self): - tw = self.tip_window - self.tip_window = None - if tw: - tw.destroy() - - -def create_tool_tip(widget, text): - tool_tip = ToolTip(widget) - - def enter(event): - tool_tip.showtip(text) - - def leave(event): - tool_tip.hidetip() - - widget.bind("", enter) - widget.bind("", leave) diff --git a/DEPRECATED_discopop_wizard/screens/widgets/__init__.py b/DEPRECATED_discopop_wizard/screens/widgets/__init__.py deleted file mode 100644 index e69de29bb..000000000 diff --git a/DEPRECATED_discopop_wizard/utils.py b/DEPRECATED_discopop_wizard/utils.py deleted file mode 100644 index 3087a882d..000000000 --- a/DEPRECATED_discopop_wizard/utils.py +++ /dev/null @@ -1,65 +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. - - -import functools -from enum import Enum -from sys import platform - - -class Platform(Enum): - UNKNOWN = 0 - LINUX = 1 - WINDOWS = 2 - OSX = 3 - - -def get_platform(): - platforms = { - "linux1": Platform.LINUX, - "linux2": Platform.LINUX, - "darwin": Platform.OSX, - "win32": Platform.WINDOWS, - } - if platform not in platforms: - return Platform.UNKNOWN - - return platforms[platform] - - -def support_scrolling(canvas): - # add support for mouse wheel scrolling (on linux systems) - def _on_mousewheel(event, scroll): - canvas.yview_scroll(int(scroll), "units") - - def _bind_to_mousewheel(event): - pf = get_platform() - if pf == Platform.LINUX: - canvas.bind_all("", functools.partial(_on_mousewheel, scroll=-1)) - canvas.bind_all("", functools.partial(_on_mousewheel, scroll=1)) - elif pf == Platform.WINDOWS: - canvas.bind_all("", functools.partial(_on_mousewheel, scroll=(-1 * (event.delta / 120)))) - elif pf == Platform.OSX: - canvas.bind_all("", functools.partial(_on_mousewheel, scroll=-1 * event.delta)) - else: - canvas.bind_all("", functools.partial(_on_mousewheel, scroll=-1)) - canvas.bind_all("", functools.partial(_on_mousewheel, scroll=1)) - - def _unbind_from_mousewheel(event): - pf = get_platform() - if pf == Platform.LINUX: - canvas.unbind_all("") - canvas.unbind_all("") - elif pf == Platform.WINDOWS or pf == Platform.OSX: - canvas.unbind_all("") - else: - canvas.unbind_all("") - canvas.unbind_all("") - - canvas.bind("", _bind_to_mousewheel) - canvas.bind("", _unbind_from_mousewheel) diff --git a/DEPRECATED_discopop_wizard/wizard.py b/DEPRECATED_discopop_wizard/wizard.py deleted file mode 100644 index 7dbfe9908..000000000 --- a/DEPRECATED_discopop_wizard/wizard.py +++ /dev/null @@ -1,187 +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. - -import os -import pathlib -import signal -import tkinter as tk -import warnings -from enum import IntEnum -from os.path import dirname -from tkinter import messagebox, filedialog -from tkinter import ttk -from typing import Optional - -from DEPRECATED_discopop_wizard.classes.Arguments import Arguments -from DEPRECATED_discopop_wizard.classes.Console import Console -from DEPRECATED_discopop_wizard.classes.ProfilingContainer import ProfilingContainer -from DEPRECATED_discopop_wizard.classes.Settings import Settings, load_from_config_file -from DEPRECATED_discopop_wizard.classes.TKVarStorage import TKVarStorage -from DEPRECATED_discopop_wizard.screens.main import MainScreen - -# todo add command line option to list available run configurations -# todo add command line option to execute run configuration (by name) -from DEPRECATED_discopop_wizard.screens.settings import show_settings_screen -from DEPRECATED_discopop_wizard.utils import get_platform, Platform - - -def main(arguments: Arguments): - print("starting DiscoPoP Wizard...\n") - source_dir = dirname(os.path.abspath(__file__)) # source_dir: discopop/discopop_wizard - config_dir = os.path.join(source_dir, ".config") - - # check if config exists, if not, initialize config folder and files - if not os.path.exists(config_dir): - os.mkdir(config_dir) - if not os.path.exists(os.path.join(config_dir, "execution_configurations")): - os.mkdir(os.path.join(config_dir, "execution_configurations")) - - # check if SETTINGS file exists. if not, create it. - if not os.path.exists(os.path.join(config_dir, "SETTINGS.txt")): - with open(os.path.join(config_dir, "SETTINGS.txt"), "w+"): - pass - - wizard = DiscoPoPConfigurationWizard(config_dir, arguments) - print() - - -class ConsoleStyles(IntEnum): - NORMAL = 1 - WARNING = 2 - ERROR = 3 - - -class DiscoPoPConfigurationWizard(object): - arguments: Arguments - settings: Settings - window: tk.Tk - window_frame: tk.Frame - config_dir: str - menubar: tk.Menu - profiling_container: Optional[ProfilingContainer] = None - tk_var_storage: TKVarStorage - - ## font styles - style_font_bold: str = "Helvetica 12 bold" - style_font_bold_small: str = "Helvetica 10 bold" - - def __init__(self, config_dir: str, arguments: Arguments, headless_mode: bool = False): - self.arguments = arguments - self.config_dir = config_dir - # check if settings exist - if os.stat(os.path.join(config_dir, "SETTINGS.txt")).st_size == 0: - # no settings exist - prompt_result = messagebox.askyesno( - "DiscoPoP Wizard", - "Do you want to make use of a docker container for the profiling?", - ) - if not prompt_result: - # ask user for path to discopop_build and go/bin directory - discopop_build_dir = filedialog.askdirectory(title="Select DiscoPoP build folder") - go_bin_dir = filedialog.askdirectory(title="Select go/bin folder (Go installation)") - else: - discopop_build_dir = "" - go_bin_dir = "" - self.settings = Settings( - use_docker_container=prompt_result, - discopop_build_dir=discopop_build_dir, - go_bin_dir=go_bin_dir, - ) - else: - # load settings - self.settings = load_from_config_file(config_dir) - if not headless_mode: - self.initialize_screen(config_dir) - - def initialize_screen(self, config_dir: str): - self.window = tk.Tk() - self.window.title("DiscoPoP Wizard") - - # enable closing by pressing CTRL+C in the command line or the interface - def handler(event): - self.window.destroy() - print("caught ^C") - - def check(): - self.window.after(500, check) - - signal.signal(signal.SIGINT, lambda x, y: print("terminal ^C") or handler(None)) - self.window.after(500, check) - # self.window.bind_all('', handler) # uncomment to close with CTRL+C from interface - - # load window icon - try: - photo = tk.PhotoImage( - file=os.path.join( - str(pathlib.Path(__file__).parent.resolve()), - "assets", - "icons", - "discoPoP_128x128.png", - ) - ) - self.window.iconphoto(False, photo) - except tk.TclError: - warnings.warn("Loading the window icon was not successful.") - - # set window to full screen - if get_platform() in (Platform.OSX, Platform.WINDOWS): - self.window.state("zoomed") - else: - self.window.attributes("-zoomed", True) - self.window.columnconfigure(1, weight=1) - self.window.rowconfigure(1, weight=1) - paned_window = ttk.PanedWindow(self.window, orient=tk.VERTICAL) - paned_window.pack(fill=tk.BOTH, expand=True) - - # create content frame - self.window_frame = tk.Frame(paned_window) - paned_window.add(self.window_frame, weight=5) - self.window_frame.columnconfigure(1, weight=1) - self.window_frame.rowconfigure(1, weight=1) - - # create menu bar - self.menubar = tk.Menu(self.window) - self.window.config(menu=self.menubar) - - # create console frame - self.console_frame = tk.Frame(paned_window) - paned_window.add(self.console_frame, weight=0) - self.console_frame.columnconfigure(1, weight=1) - self.console_frame.rowconfigure(1, weight=1) - self.console = Console(self.console_frame) - - # create TKVarStorage - self.tk_var_storage = TKVarStorage(self) - - MainScreen(self, self.window_frame) - - # show settings screen if first start - if not self.settings.initialized: - show_settings_screen(self) - else: - # save settings - self.settings.save_to_file(self.config_dir) - - self.window.mainloop() - - # close DiscoPoP profiling profiling_container before exiting the application - if self.profiling_container is not None: - self.profiling_container.stop() - - def close_frame_contents(self): - # close current frame contents - for c in self.window_frame.winfo_children(): - c.destroy() - # create empty menu bar - self.menubar.destroy() - self.menubar = tk.Menu(self.window) - self.window.config(menu=self.menubar) - - def show_main_screen(self): - self.close_frame_contents() - MainScreen(self, self.window_frame) diff --git a/discopop_library/discopop_optimizer/gui/presentation/ChoiceDetails.py b/discopop_library/discopop_optimizer/gui/presentation/ChoiceDetails.py index d17e80ec1..540db72f2 100644 --- a/discopop_library/discopop_optimizer/gui/presentation/ChoiceDetails.py +++ b/discopop_library/discopop_optimizer/gui/presentation/ChoiceDetails.py @@ -13,7 +13,7 @@ from discopop_library.discopop_optimizer.CostModels.CostModel import CostModel from discopop_library.discopop_optimizer.gui.widgets.ScrollableFrame import ScrollableFrameWidget from discopop_library.discopop_optimizer.utilities.simple_utilities import data_at -from DEPRECATED_discopop_wizard.screens.widgets.ScrollableText import ScrollableTextWidget +from discopop_library.discopop_optimizer.gui.widgets.ScrollableText import ScrollableTextWidget def display_choices_for_model(graph: nx.DiGraph, model: CostModel, window_title: Optional[str] = None) -> None: diff --git a/DEPRECATED_discopop_wizard/screens/widgets/ScrollableText.py b/discopop_library/discopop_optimizer/gui/widgets/ScrollableText.py similarity index 100% rename from DEPRECATED_discopop_wizard/screens/widgets/ScrollableText.py rename to discopop_library/discopop_optimizer/gui/widgets/ScrollableText.py diff --git a/setup.py b/setup.py index 413ceba19..f08890c6d 100644 --- a/setup.py +++ b/setup.py @@ -58,8 +58,6 @@ entry_points={ "console_scripts": [ "discopop_explorer=discopop_explorer.__main__:main", - "DEPRECATED_discopop_profiler=DEPRECATED_discopop_profiler.__main__:main", - "DEPRECATED_discopop_wizard=DEPRECATED_discopop_wizard.__main__:main", "discopop_optimizer=discopop_library.discopop_optimizer.__main__:main", "discopop_patch_generator=discopop_library.PatchGenerator.__main__:main", "discopop_patch_applicator=discopop_library.PatchApplicator.__main__:main",