From 2d3e54b78876563948cde105b57364c4bf43b282 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 28 Oct 2024 18:45:09 +0000 Subject: [PATCH 01/21] chore(deps): bump rexml from 3.3.6 to 3.3.9 in /docs Bumps [rexml](https://github.com/ruby/rexml) from 3.3.6 to 3.3.9. - [Release notes](https://github.com/ruby/rexml/releases) - [Changelog](https://github.com/ruby/rexml/blob/master/NEWS.md) - [Commits](https://github.com/ruby/rexml/compare/v3.3.6...v3.3.9) --- updated-dependencies: - dependency-name: rexml dependency-type: indirect ... Signed-off-by: dependabot[bot] --- docs/Gemfile.lock | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/docs/Gemfile.lock b/docs/Gemfile.lock index 82dd5d729..4f63b5abc 100644 --- a/docs/Gemfile.lock +++ b/docs/Gemfile.lock @@ -56,13 +56,11 @@ GEM rb-fsevent (0.11.2) rb-inotify (0.10.1) ffi (~> 1.0) - rexml (3.3.6) - strscan + rexml (3.3.9) rouge (4.0.0) safe_yaml (1.0.5) sassc (2.4.0) ffi (~> 1.9) - strscan (3.1.0) terminal-table (3.0.2) unicode-display_width (>= 1.1.1, < 3) unicode-display_width (2.3.0) From a14b9fb2a0c20c0f5623d82da640a886e32732fb Mon Sep 17 00:00:00 2001 From: Lukas Rothenberger Date: Tue, 5 Nov 2024 13:04:30 +0100 Subject: [PATCH 02/21] fix: compatibility with Ubuntu 22 LTS --- rtlib/CMakeLists.txt | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/rtlib/CMakeLists.txt b/rtlib/CMakeLists.txt index e8f88b431..c1785f373 100644 --- a/rtlib/CMakeLists.txt +++ b/rtlib/CMakeLists.txt @@ -14,7 +14,7 @@ set(DiscoPoP_SOURCES runtimeFunctions.cpp runtimeFunctionsGlobals.cpp - + memory/MemoryManager.cpp memory/Signature.cpp @@ -24,7 +24,7 @@ set(DiscoPoP_SOURCES calltree/DependencyMetadata.cpp calltree/MetaDataQueueElement.cpp calltree/utils.cpp - + injected_functions/dp_add_bb_deps.cpp injected_functions/dp_alloca.cpp injected_functions/dp_call.cpp @@ -47,7 +47,7 @@ set(DiscoPoP_SOURCES ) set(CMAKE_CXX_FLAGS - "-O2 -std=c++17 -pthread -fno-rtti -fPIE -fPIC -ffreestanding") + "-O2 -std=c++17 -pthread -fno-rtti -fPIE -fPIC") # add_custom_target(DiscoPoP) @@ -119,4 +119,4 @@ install(TARGETS DiscoPoP_RT ARCHIVE DESTINATION lib) # compile simple-alias-detection #exec_program(${CMAKE_CURRENT_SOURCE_DIR}/simple-alias-detection/compile.sh # ARGS ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR} -#) \ No newline at end of file +#) From ee9500e3b09b909416a871ed1a43cc77c957e4e7 Mon Sep 17 00:00:00 2001 From: Lukas Rothenberger Date: Wed, 13 Nov 2024 15:11:16 +0100 Subject: [PATCH 03/21] feat: utilities and restructuring to create .deb packages for releases --- .gitignore | 3 ++ CMakeLists.txt | 58 +++++++++++++++++++---------------- DEBIAN/control.raw | 6 ++++ DEBIAN/postinst | 35 +++++++++++++++++++++ DEBIAN/postrm | 2 ++ DEBIAN/preinst | 0 DEBIAN/prerm | 0 docs/How_to_contribute.md | 2 ++ scripts/CMakeLists.txt | 37 ++++++++++++---------- scripts/dev/create_package.sh | 34 ++++++++++++++++++++ 10 files changed, 134 insertions(+), 43 deletions(-) create mode 100755 DEBIAN/control.raw create mode 100755 DEBIAN/postinst create mode 100755 DEBIAN/postrm create mode 100755 DEBIAN/preinst create mode 100755 DEBIAN/prerm create mode 100755 scripts/dev/create_package.sh diff --git a/.gitignore b/.gitignore index 6ad66132a..85163fd72 100644 --- a/.gitignore +++ b/.gitignore @@ -136,6 +136,9 @@ venv.bak/ *.a *.lib +# Packages +packages/ + # Executables *.exe *.out diff --git a/CMakeLists.txt b/CMakeLists.txt index b798c087d..4aebc8c2f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -102,32 +102,36 @@ file(APPEND "${DiscoPoP_SOURCE_DIR}/discopop_library/ConfigProvider/assets/build file(APPEND "${DiscoPoP_SOURCE_DIR}/discopop_library/ConfigProvider/assets/build_config.py" "DP_BRANCH_TRACKING=\"${DP_BRANCH_TRACKING}\"\n") -# print DiscoPoP configuration -file(READ ${DiscoPoP_SOURCE_DIR}/discopop_library/ConfigProvider/assets/build_config.py DiscoPoP_CONFIGURATION) -string(REGEX REPLACE "\n$" "" DiscoPoP_CONFIGURATION "${DiscoPoP_CONFIGURATION}") -string(REGEX REPLACE "\n" "\n " DiscoPoP_CONFIGURATION "${DiscoPoP_CONFIGURATION}") -message(STATUS "DiscoPoP configuration:\n ${DiscoPoP_CONFIGURATION}") - -# install DiscoPoP python modules -find_package(Python3 REQUIRED COMPONENTS Interpreter) - -# check if python tkinter module is available -execute_process( - COMMAND ${Python3_EXECUTABLE} -c "import tkinter" - RESULT_VARIABLE TKINTER_AVAILABLE_EXIT_CODE -) -if(${TKINTER_AVAILABLE_EXIT_CODE}) - message(FATAL_ERROR "Python module 'tkinter' not found. Please install the 'python3-tk' package via a package manager.") -endif() +if(NOT ${IS_DEB_INSTALL} STREQUAL "") + message(STATUS "performing installation from .deb package") +else() + # print DiscoPoP configuration + file(READ ${DiscoPoP_SOURCE_DIR}/discopop_library/ConfigProvider/assets/build_config.py DiscoPoP_CONFIGURATION) + string(REGEX REPLACE "\n$" "" DiscoPoP_CONFIGURATION "${DiscoPoP_CONFIGURATION}") + string(REGEX REPLACE "\n" "\n " DiscoPoP_CONFIGURATION "${DiscoPoP_CONFIGURATION}") + message(STATUS "DiscoPoP configuration:\n ${DiscoPoP_CONFIGURATION}") + + # install DiscoPoP python modules + find_package(Python3 REQUIRED COMPONENTS Interpreter) + + # check if python tkinter module is available + execute_process( + COMMAND ${Python3_EXECUTABLE} -c "import tkinter" + RESULT_VARIABLE TKINTER_AVAILABLE_EXIT_CODE + ) + if(${TKINTER_AVAILABLE_EXIT_CODE}) + message(FATAL_ERROR "Python module 'tkinter' not found. Please install the 'python3-tk' package via a package manager.") + endif() -# install DiscoPoP python modules -message(STATUS "Installing DiscoPoP python modules") -execute_process( - COMMAND ${Python3_EXECUTABLE} -m pip install ${DiscoPoP_SOURCE_DIR} - RESULT_VARIABLE DP_INSTALLATION_EXIT_CODE - OUTPUT_VARIABLE DP_INSTALLATION_OUTPUT -) -# check if installation of DiscoPoP Modules was successful -if(${DP_INSTALLATION_EXIT_CODE}) - message(FATAL_ERROR "${DP_INSTALLATION_OUTPUT}") + # install DiscoPoP python modules + message(STATUS "Installing DiscoPoP python modules") + execute_process( + COMMAND ${Python3_EXECUTABLE} -m pip install ${DiscoPoP_SOURCE_DIR} + RESULT_VARIABLE DP_INSTALLATION_EXIT_CODE + OUTPUT_VARIABLE DP_INSTALLATION_OUTPUT + ) + # check if installation of DiscoPoP Modules was successful + if(${DP_INSTALLATION_EXIT_CODE}) + message(FATAL_ERROR "${DP_INSTALLATION_OUTPUT}") + endif() endif() diff --git a/DEBIAN/control.raw b/DEBIAN/control.raw new file mode 100755 index 000000000..4916f9bfc --- /dev/null +++ b/DEBIAN/control.raw @@ -0,0 +1,6 @@ +Package: discopop +Maintainer: Lukas Rothenberger +Depends: libc6,python3-tk,python3,pipx +Architecture: amd64 +Homepage: http://example.com +Description: A program that prints hello \ No newline at end of file diff --git a/DEBIAN/postinst b/DEBIAN/postinst new file mode 100755 index 000000000..7326ac056 --- /dev/null +++ b/DEBIAN/postinst @@ -0,0 +1,35 @@ +DP_DIR=/opt/DiscoPoP +chmod 777 ${DP_DIR} +DP_BUILD_DIR=/opt/DiscoPoP/build +mkdir -p ${DP_BUILD_DIR} +chmod 777 ${DP_BUILD_DIR} +cd ${DP_BUILD_DIR} +echo "Created DiscoPoP build dir: ${DP_BUILD_DIR}" + +echo "Downloading llvm 11.1.0" +mkdir third_party +cd third_party +wget https://github.com/llvm/llvm-project/releases/download/llvmorg-11.1.0/clang+llvm-11.1.0-x86_64-linux-gnu-ubuntu-20.10.tar.xz +tar -xvf clang+llvm-11.1.0-x86_64-linux-gnu-ubuntu-20.10.tar.xz +mv clang+llvm-11.1.0-x86_64-linux-gnu-ubuntu-20.10 llvm-11.1.0 +rm clang+llvm-11.1.0-x86_64-linux-gnu-ubuntu-20.10.tar.xz +LLVM_DIR=${DP_BUILD_DIR}/third_party/llvm-11.1.0 + +echo "Building DiscoPoP" +cd ${DP_BUILD_DIR} +cmake -DLLVM_DIST_PATH=${LLVM_DIR} -DIS_DEB_INSTALL="TRUE" .. +make -j + +chmod -R 777 ${DP_DIR} + +echo "Installing DiscoPoP python modules" +cd ${DP_DIR} +su ${SUDO_USER} -c "python3 -m pipx install ." + +echo "Creating symlinks" +su ${SUDO_USER} -c "rm -f ~/.local/bin/disocpop_cc" +su ${SUDO_USER} -c "rm -f ~/.local/bin/disocpop_cxx" +su ${SUDO_USER} -c "rm -f ~/.local/bin/disocpop_cmake" +su ${SUDO_USER} -c "ln -sf ${DP_BUILD_DIR}/scripts/CC_wrapper.sh ~/.local/bin/discopop_cc" +su ${SUDO_USER} -c "ln -sf ${DP_BUILD_DIR}/scripts/CXX_wrapper.sh ~/.local/bin/discopop_cxx" +su ${SUDO_USER} -c "ln -sf ${DP_BUILD_DIR}/scripts/CMAKE_wrapper.sh ~/.local/bin/discopop_cmake" diff --git a/DEBIAN/postrm b/DEBIAN/postrm new file mode 100755 index 000000000..7d6fa117d --- /dev/null +++ b/DEBIAN/postrm @@ -0,0 +1,2 @@ +rm -rf /opt/DiscoPoP +su ${SUDO_USER} -c "python3 -m pipx uninstall discopop" \ No newline at end of file diff --git a/DEBIAN/preinst b/DEBIAN/preinst new file mode 100755 index 000000000..e69de29bb diff --git a/DEBIAN/prerm b/DEBIAN/prerm new file mode 100755 index 000000000..e69de29bb diff --git a/docs/How_to_contribute.md b/docs/How_to_contribute.md index 3c35cabb7..c44138358 100644 --- a/docs/How_to_contribute.md +++ b/docs/How_to_contribute.md @@ -43,6 +43,7 @@ Commit messages should follow the conventional commits format: [conventional com Execute the following steps in order to create a new DiscoPoP release: - Switch to the release branch (e.g. `release/1.2.3`) which shall be released - Update the version file in the repository (`discopop_library/global_data/version/VERSION`) +- Create a `.deb` package by executing `scripts/dev/create_package.sh`. The package will be created in `packages`. - Create a pull request to the `master` branch and validate the changes - Merge the pull request by rebasing and create a tag on the `master` branch with the name `v1.2.3` - Creating the tag triggers the automatic publication of the project to PyPi @@ -51,6 +52,7 @@ Execute the following steps in order to create a new DiscoPoP release: - Release tag: `v1.2.3` - Release title: `DiscoPoP Version 1.2.3` - Description should contain a summary of the most relevant changes + - Add the created `.deb` package to the list of files - If everything is fine, publish the new release ### Determining the Version Number diff --git a/scripts/CMakeLists.txt b/scripts/CMakeLists.txt index f0f49f6da..b077f7482 100644 --- a/scripts/CMakeLists.txt +++ b/scripts/CMakeLists.txt @@ -18,22 +18,27 @@ configure_file(MPI_CC_wrapper.sh MPI_CC_wrapper.sh COPYONLY) configure_file(MPI_CXX_wrapper.sh MPI_CXX_wrapper.sh COPYONLY) configure_file(MPI_LINKER_wrapper.sh MPI_LINKER_wrapper.sh COPYONLY) -# create symlinks to files -set(DP_LOCAL_BIN_DIR "$ENV{HOME}/.local/bin") -if(EXISTS ${DP_LOCAL_BIN_DIR}) - execute_process(COMMAND rm -f ${DP_LOCAL_BIN_DIR}/discopop_cc) - message(STATUS "Creating symlink ${DP_LOCAL_BIN_DIR}/discopop_cc to ${CMAKE_CURRENT_BINARY_DIR}/CC_wrapper.sh") - execute_process(COMMAND ln -sf ${CMAKE_CURRENT_BINARY_DIR}/CC_wrapper.sh ${DP_LOCAL_BIN_DIR}/discopop_cc) +if(NOT ${IS_DEB_INSTALL} STREQUAL "") + # create symlinks to files + message(STATUS "performing installation from .deb package") +else() + # create symlinks to files + set(DP_LOCAL_BIN_DIR "$ENV{HOME}/.local/bin") + if(EXISTS ${DP_LOCAL_BIN_DIR}) + execute_process(COMMAND rm -f ${DP_LOCAL_BIN_DIR}/discopop_cc) + message(STATUS "Creating symlink ${DP_LOCAL_BIN_DIR}/discopop_cc to ${CMAKE_CURRENT_BINARY_DIR}/CC_wrapper.sh") + execute_process(COMMAND ln -sf ${CMAKE_CURRENT_BINARY_DIR}/CC_wrapper.sh ${DP_LOCAL_BIN_DIR}/discopop_cc) - execute_process(COMMAND rm -f ${DP_LOCAL_BIN_DIR}/discopop_cxx) - message(STATUS "Creating symlink ${DP_LOCAL_BIN_DIR}/discopop_cxx to ${CMAKE_CURRENT_BINARY_DIR}/CXX_wrapper.sh") - execute_process(COMMAND ln -sf ${CMAKE_CURRENT_BINARY_DIR}/CXX_wrapper.sh ${DP_LOCAL_BIN_DIR}/discopop_cxx) + execute_process(COMMAND rm -f ${DP_LOCAL_BIN_DIR}/discopop_cxx) + message(STATUS "Creating symlink ${DP_LOCAL_BIN_DIR}/discopop_cxx to ${CMAKE_CURRENT_BINARY_DIR}/CXX_wrapper.sh") + execute_process(COMMAND ln -sf ${CMAKE_CURRENT_BINARY_DIR}/CXX_wrapper.sh ${DP_LOCAL_BIN_DIR}/discopop_cxx) - execute_process(COMMAND rm -f ${DP_LOCAL_BIN_DIR}/discopop_cmake) - message(STATUS "Creating symlink ${DP_LOCAL_BIN_DIR}/discopop_cmake to ${CMAKE_CURRENT_BINARY_DIR}/CMAKE_wrapper.sh") - execute_process(COMMAND ln -sf ${CMAKE_CURRENT_BINARY_DIR}/CMAKE_wrapper.sh ${DP_LOCAL_BIN_DIR}/discopop_cmake) -else() - message(WARNING "Creation of symlinks discopop_cc to ${CMAKE_CURRENT_BINARY_DIR}/CC_wrapper.sh not possible. Please create it manually.") - message(WARNING "Creation of symlinks discopop_cxx to ${CMAKE_CURRENT_BINARY_DIR}/CXX_wrapper.sh not possible. Please create it manually.") - message(WARNING "Creation of symlinks discopop_cmake to ${CMAKE_CURRENT_BINARY_DIR}/CMAKE_wrapper.sh not possible. Please create it manually.") + execute_process(COMMAND rm -f ${DP_LOCAL_BIN_DIR}/discopop_cmake) + message(STATUS "Creating symlink ${DP_LOCAL_BIN_DIR}/discopop_cmake to ${CMAKE_CURRENT_BINARY_DIR}/CMAKE_wrapper.sh") + execute_process(COMMAND ln -sf ${CMAKE_CURRENT_BINARY_DIR}/CMAKE_wrapper.sh ${DP_LOCAL_BIN_DIR}/discopop_cmake) + else() + message(WARNING "Creation of symlinks discopop_cc to ${CMAKE_CURRENT_BINARY_DIR}/CC_wrapper.sh not possible. Please create it manually.") + message(WARNING "Creation of symlinks discopop_cxx to ${CMAKE_CURRENT_BINARY_DIR}/CXX_wrapper.sh not possible. Please create it manually.") + message(WARNING "Creation of symlinks discopop_cmake to ${CMAKE_CURRENT_BINARY_DIR}/CMAKE_wrapper.sh not possible. Please create it manually.") + endif() endif() diff --git a/scripts/dev/create_package.sh b/scripts/dev/create_package.sh new file mode 100755 index 000000000..21f98b88f --- /dev/null +++ b/scripts/dev/create_package.sh @@ -0,0 +1,34 @@ +# create a temporary copy of the code to build the package +rm -rf tmp_package_build_dir +mkdir -p tmp_package_build_dir +cp -r * tmp_package_build_dir + +# modify folder structure to install DiscoPoP to /opt when installing the package +cd tmp_package_build_dir +mkdir opt +mkdir opt/DiscoPoP + +mv * opt/DiscoPoP +mv opt/DiscoPoP/DEBIAN . + +# add the Version tag to DEBIAN/control.raw to create DEBIAN/control +echo "$(cat DEBIAN/control.raw)" > DEBIAN/control +echo "Version: $(cat opt/DiscoPoP/discopop_library/global_data/version/VERSION)" >> DEBIAN/control +echo "" >> DEBIAN/control + +# delete build folder if exists +rm -rf opt/DiscoPoP/build +# delete packages folder if exists +rm -rf opt/DiscoPoP/packages +# cleanup +rm -rf opt/DiscoPoP/tmp_packages_build_dir + +# create packages folder +cd .. +mkdir -p packages +# build package +dpkg-deb --build tmp_package_build_dir packages/DiscoPoP.deb +chmod 775 packages/DiscoPoP.deb + +# cleanup +rm -rf tmp_package_build_dir \ No newline at end of file From 21a0c511f96015139de7db0aae6976bd9fcfc126 Mon Sep 17 00:00:00 2001 From: Lukas Rothenberger Date: Wed, 13 Nov 2024 23:56:08 +0100 Subject: [PATCH 04/21] fix: .deb creation files --- DEBIAN/postinst | 34 +++++++++++++++++++++++++++------- DEBIAN/postrm | 12 +++++++++++- scripts/dev/check-license.sh | 3 +++ 3 files changed, 41 insertions(+), 8 deletions(-) diff --git a/DEBIAN/postinst b/DEBIAN/postinst index 7326ac056..5f20ef6f6 100755 --- a/DEBIAN/postinst +++ b/DEBIAN/postinst @@ -17,19 +17,39 @@ LLVM_DIR=${DP_BUILD_DIR}/third_party/llvm-11.1.0 echo "Building DiscoPoP" cd ${DP_BUILD_DIR} -cmake -DLLVM_DIST_PATH=${LLVM_DIR} -DIS_DEB_INSTALL="TRUE" .. +cmake .. -DLLVM_DIST_PATH=${LLVM_DIR} -DIS_DEB_INSTALL="TRUE" -DDP_PTHREAD_COMPATIBILITY_MODE=0 -DDP_NUM_WORKERS=8 -DDP_RTLIB_VERBOSE=0 -DDP_MEMORY_REGION_DEALIASING=0 -DDP_BRANCH_TRACKING=0 -DDP_CALLSTACK_PROFILING=0 -DDP_STACK_ACCESS_DETECTION=0 -DDP_CALLSTACK_PROFILING_ENABLE_CUTOFF=1 -DDP_INTERNAL_TIMER=0 -DDP_HYBRID_PROFILING=1 -DDP_HYBRID_PROFILING_CUTOFF=0 -DDP_HYBRID_PROFILING_CUTOFF_IGNORE_PROBABILITY=1 -DDP_PROFILING_SAMPLING_PROBABILITY=0 -DDP_CALLTREE_PROFILING=1 -DDP_CALLTREE_PROFILING_METADATA_CUTOFF=5 -DDP_CALLTREE_PROFILING_METADATA_CUTOFF_IGNORE_PROBABILITY=1 make -j chmod -R 777 ${DP_DIR} -echo "Installing DiscoPoP python modules" +echo "Setting up DiscoPoP python venv" cd ${DP_DIR} -su ${SUDO_USER} -c "python3 -m pipx install ." +su ${SUDO_USER} -c "python3 -m venv venv" +VENV_PYTHON=${DP_DIR}/venv/bin/python3 + +echo "Installing DiscoPoP python modules" +su ${SUDO_USER} -c "${VENV_PYTHON} -m pip install . -v" + +# +#echo "Creating symlinks" +su ${SUDO_USER} -c "rm -f ~/.local/bin/discopop_cc" +su ${SUDO_USER} -c "rm -f ~/.local/bin/discopop_cxx" +su ${SUDO_USER} -c "rm -f ~/.local/bin/discopop_cmake" -echo "Creating symlinks" -su ${SUDO_USER} -c "rm -f ~/.local/bin/disocpop_cc" -su ${SUDO_USER} -c "rm -f ~/.local/bin/disocpop_cxx" -su ${SUDO_USER} -c "rm -f ~/.local/bin/disocpop_cmake" su ${SUDO_USER} -c "ln -sf ${DP_BUILD_DIR}/scripts/CC_wrapper.sh ~/.local/bin/discopop_cc" su ${SUDO_USER} -c "ln -sf ${DP_BUILD_DIR}/scripts/CXX_wrapper.sh ~/.local/bin/discopop_cxx" su ${SUDO_USER} -c "ln -sf ${DP_BUILD_DIR}/scripts/CMAKE_wrapper.sh ~/.local/bin/discopop_cmake" + +su ${SUDO_USER} -c "rm -f ~/.local/bin/discopop_auto_tuner" +su ${SUDO_USER} -c "rm -f ~/.local/bin/discopop_config_provider" +su ${SUDO_USER} -c "rm -f ~/.local/bin/discopop_explorer" +su ${SUDO_USER} -c "rm -f ~/.local/bin/discopop_optimizer" +su ${SUDO_USER} -c "rm -f ~/.local/bin/discopop_patch_applicator" +su ${SUDO_USER} -c "rm -f ~/.local/bin/discopop_patch_generator" + +su ${SUDO_USER} -c "ln -sf ${DP_DIR}/venv/bin/discopop_auto_tuner ~/.local/bin/discopop_auto_tuner" +su ${SUDO_USER} -c "ln -sf ${DP_DIR}/venv/bin/discopop_config_provider ~/.local/bin/discopop_config_provider" +su ${SUDO_USER} -c "ln -sf ${DP_DIR}/venv/bin/discopop_explorer ~/.local/bin/discopop_explorer" +su ${SUDO_USER} -c "ln -sf ${DP_DIR}/venv/bin/discopop_optimizer ~/.local/bin/discopop_optimizer" +su ${SUDO_USER} -c "ln -sf ${DP_DIR}/venv/bin/discopop_patch_applicator ~/.local/bin/discopop_patch_applicator" +su ${SUDO_USER} -c "ln -sf ${DP_DIR}/venv/bin/discopop_patch_generator ~/.local/bin/discopop_patch_generator" diff --git a/DEBIAN/postrm b/DEBIAN/postrm index 7d6fa117d..41de91dbe 100755 --- a/DEBIAN/postrm +++ b/DEBIAN/postrm @@ -1,2 +1,12 @@ rm -rf /opt/DiscoPoP -su ${SUDO_USER} -c "python3 -m pipx uninstall discopop" \ No newline at end of file + +su ${SUDO_USER} -c "rm -f ~/.local/bin/discopop_cc" +su ${SUDO_USER} -c "rm -f ~/.local/bin/discopop_cxx" +su ${SUDO_USER} -c "rm -f ~/.local/bin/discopop_cmake" + +su ${SUDO_USER} -c "rm -f ~/.local/bin/discopop_auto_tuner" +su ${SUDO_USER} -c "rm -f ~/.local/bin/discopop_config_provider" +su ${SUDO_USER} -c "rm -f ~/.local/bin/discopop_explorer" +su ${SUDO_USER} -c "rm -f ~/.local/bin/discopop_optimizer" +su ${SUDO_USER} -c "rm -f ~/.local/bin/discopop_patch_applicator" +su ${SUDO_USER} -c "rm -f ~/.local/bin/discopop_patch_generator" diff --git a/scripts/dev/check-license.sh b/scripts/dev/check-license.sh index 28af2511c..8673f4ba1 100755 --- a/scripts/dev/check-license.sh +++ b/scripts/dev/check-license.sh @@ -47,6 +47,9 @@ for file in "$@"; do # third-party software [[ "$file" = *"third_party/"* ]] && continue + # DEBIAN files for .deb creation + [[ "$file" = *"DEBIAN/"* ]] && continue + # check for the license tag in the first 20 lines of the file FILE_ERROR="" From 181f6ce4226870665344a03a7e308980dfffd8eb Mon Sep 17 00:00:00 2001 From: Lukas Rothenberger Date: Thu, 14 Nov 2024 00:36:32 +0100 Subject: [PATCH 05/21] doc: .deb description --- DEBIAN/control.raw | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/DEBIAN/control.raw b/DEBIAN/control.raw index 4916f9bfc..b67b54c0c 100755 --- a/DEBIAN/control.raw +++ b/DEBIAN/control.raw @@ -1,6 +1,6 @@ Package: discopop -Maintainer: Lukas Rothenberger -Depends: libc6,python3-tk,python3,pipx -Architecture: amd64 -Homepage: http://example.com -Description: A program that prints hello \ No newline at end of file +Maintainer: Lukas Rothenberger +Depends: libc6,python3-tk,python3 +Architecture: all +Homepage: https://github.com/discopop-project/discopop +Description: DiscoPoP is an open-source tool that helps software developers parallelize their programs with threads. It is a joint project of the Laboratory for Parallel Programming @ TU Darmstadt and the Software Analytics and Pervasive Parallelism Lab at Iowa State University. From a1ac24f8813ce457ed1c75a037d039b577014bdf Mon Sep 17 00:00:00 2001 From: Lukas Rothenberger Date: Thu, 14 Nov 2024 01:29:37 +0100 Subject: [PATCH 06/21] fix: build files --- CMakeLists.txt | 35 +++++++++++++++++++++++++++++++++-- scripts/dev/create_package.sh | 12 +++++++++++- 2 files changed, 44 insertions(+), 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 4aebc8c2f..d438a2127 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -114,9 +114,17 @@ else() # install DiscoPoP python modules find_package(Python3 REQUIRED COMPONENTS Interpreter) + # setup DiscoPoP venv + message(STATUS "Setting up DiscoPoP python venv: ${DiscoPoP_SOURCE_DIR}/venv") + execute_process( + COMMAND ${Python3_EXECUTABLE} -m venv ${DiscoPoP_SOURCE_DIR}/venv + ) + set(Python3_VENV_EXECUTABLE ${DiscoPoP_SOURCE_DIR}/venv/bin/python3) + + # check if python tkinter module is available execute_process( - COMMAND ${Python3_EXECUTABLE} -c "import tkinter" + COMMAND ${Python3_VENV_EXECUTABLE} -c "import tkinter" RESULT_VARIABLE TKINTER_AVAILABLE_EXIT_CODE ) if(${TKINTER_AVAILABLE_EXIT_CODE}) @@ -126,7 +134,7 @@ else() # install DiscoPoP python modules message(STATUS "Installing DiscoPoP python modules") execute_process( - COMMAND ${Python3_EXECUTABLE} -m pip install ${DiscoPoP_SOURCE_DIR} + COMMAND ${Python3_VENV_EXECUTABLE} -m pip install ${DiscoPoP_SOURCE_DIR} RESULT_VARIABLE DP_INSTALLATION_EXIT_CODE OUTPUT_VARIABLE DP_INSTALLATION_OUTPUT ) @@ -134,4 +142,27 @@ else() if(${DP_INSTALLATION_EXIT_CODE}) message(FATAL_ERROR "${DP_INSTALLATION_OUTPUT}") endif() + + # create symlinks for python executables + message(STATUS "Creating symlinks for DiscoPoP python executables") + set(DP_LOCAL_BIN_DIR "$ENV{HOME}/.local/bin") + execute_process(COMMAND rm -f ${DP_LOCAL_BIN_DIR}/discopop_auto_tuner) + execute_process(COMMAND rm -f ${DP_LOCAL_BIN_DIR}/discopop_config_provider) + execute_process(COMMAND rm -f ${DP_LOCAL_BIN_DIR}/discopop_explorer) + execute_process(COMMAND rm -f ${DP_LOCAL_BIN_DIR}/discopop_optimizer) + execute_process(COMMAND rm -f ${DP_LOCAL_BIN_DIR}/discopop_patch_applicator) + execute_process(COMMAND rm -f ${DP_LOCAL_BIN_DIR}/discopop_patch_generator) + message(STATUS "--> discopop_auto_tuner") + execute_process(COMMAND ln -sf ${DiscoPoP_SOURCE_DIR}/venv/bin/discopop_auto_tuner ${DP_LOCAL_BIN_DIR}/discopop_auto_tuner) + message(STATUS "--> discopop_config_provider") + execute_process(COMMAND ln -sf ${DiscoPoP_SOURCE_DIR}/venv/bin/discopop_config_provider ${DP_LOCAL_BIN_DIR}/discopop_config_provider) + message(STATUS "--> discopop_explorer") + execute_process(COMMAND ln -sf ${DiscoPoP_SOURCE_DIR}/venv/bin/discopop_explorer ${DP_LOCAL_BIN_DIR}/discopop_explorer) + message(STATUS "--> discopop_optimizer") + execute_process(COMMAND ln -sf ${DiscoPoP_SOURCE_DIR}/venv/bin/discopop_optimizer ${DP_LOCAL_BIN_DIR}/discopop_optimizer) + message(STATUS "--> discopop_patch_applicator") + execute_process(COMMAND ln -sf ${DiscoPoP_SOURCE_DIR}/venv/bin/discopop_patch_applicator ${DP_LOCAL_BIN_DIR}/discopop_patch_applicator) + message(STATUS "--> discopop_patch_generator") + execute_process(COMMAND ln -sf ${DiscoPoP_SOURCE_DIR}/venv/bin/discopop_patch_generator ${DP_LOCAL_BIN_DIR}/discopop_patch_generator) + endif() diff --git a/scripts/dev/create_package.sh b/scripts/dev/create_package.sh index 21f98b88f..a3a862d55 100755 --- a/scripts/dev/create_package.sh +++ b/scripts/dev/create_package.sh @@ -1,3 +1,11 @@ +# 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. + # create a temporary copy of the code to build the package rm -rf tmp_package_build_dir mkdir -p tmp_package_build_dir @@ -20,6 +28,8 @@ echo "" >> DEBIAN/control rm -rf opt/DiscoPoP/build # delete packages folder if exists rm -rf opt/DiscoPoP/packages +# delete venv folder if exists +rm -rf opt/DiscoPoP/venv # cleanup rm -rf opt/DiscoPoP/tmp_packages_build_dir @@ -31,4 +41,4 @@ dpkg-deb --build tmp_package_build_dir packages/DiscoPoP.deb chmod 775 packages/DiscoPoP.deb # cleanup -rm -rf tmp_package_build_dir \ No newline at end of file +rm -rf tmp_package_build_dir From c04ebb5e64c0210f22c83678556c7182c841929e Mon Sep 17 00:00:00 2001 From: Lukas Rothenberger Date: Thu, 14 Nov 2024 12:58:51 +0100 Subject: [PATCH 07/21] fix: github CI --- .github/workflows/ci.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index bee5e9422..b5e78371d 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -111,7 +111,7 @@ jobs: - name: C++ unit tests run: | build/test/unit_tests/DiscoPoP_UT - + execute_end_to_end_tests: runs-on: ubuntu-20.04 name: Execute end-to-end tests @@ -158,6 +158,7 @@ jobs: - name: Python end-to-end-tests run: | + . venv/bin/activate python -m unittest -v -k *.end_to_end.* update_wiki-build: name: "Update Wiki - Build" From 5cbb0fdac26bd1b704540f758423c26ab541c0c4 Mon Sep 17 00:00:00 2001 From: Lukas Rothenberger Date: Thu, 14 Nov 2024 15:41:11 +0100 Subject: [PATCH 08/21] doc: release preparation --- DEBIAN/postinst | 2 +- README.md | 22 +++++++++---------- discopop_library/global_data/version/VERSION | 2 +- docs/setup/discopop.md | 14 ++++++++++-- .../preventing_2/src/FileMapping.txt | 1 + 5 files changed, 26 insertions(+), 15 deletions(-) create mode 100644 test/end_to_end/do_all/calls/second_order/preventing_2/src/FileMapping.txt diff --git a/DEBIAN/postinst b/DEBIAN/postinst index 5f20ef6f6..ab067e4f7 100755 --- a/DEBIAN/postinst +++ b/DEBIAN/postinst @@ -18,7 +18,7 @@ LLVM_DIR=${DP_BUILD_DIR}/third_party/llvm-11.1.0 echo "Building DiscoPoP" cd ${DP_BUILD_DIR} cmake .. -DLLVM_DIST_PATH=${LLVM_DIR} -DIS_DEB_INSTALL="TRUE" -DDP_PTHREAD_COMPATIBILITY_MODE=0 -DDP_NUM_WORKERS=8 -DDP_RTLIB_VERBOSE=0 -DDP_MEMORY_REGION_DEALIASING=0 -DDP_BRANCH_TRACKING=0 -DDP_CALLSTACK_PROFILING=0 -DDP_STACK_ACCESS_DETECTION=0 -DDP_CALLSTACK_PROFILING_ENABLE_CUTOFF=1 -DDP_INTERNAL_TIMER=0 -DDP_HYBRID_PROFILING=1 -DDP_HYBRID_PROFILING_CUTOFF=0 -DDP_HYBRID_PROFILING_CUTOFF_IGNORE_PROBABILITY=1 -DDP_PROFILING_SAMPLING_PROBABILITY=0 -DDP_CALLTREE_PROFILING=1 -DDP_CALLTREE_PROFILING_METADATA_CUTOFF=5 -DDP_CALLTREE_PROFILING_METADATA_CUTOFF_IGNORE_PROBABILITY=1 -make -j +make -j 4 chmod -R 777 ${DP_DIR} diff --git a/README.md b/README.md index 51ccc421a..2831e632d 100644 --- a/README.md +++ b/README.md @@ -34,25 +34,25 @@ For a brief introduction to the command line tools, please refer to the [tools o For detailed information on the gathered and stored data as well as the tools themselves, please refer to [data](https://discopop-project.github.io/discopop/Data) and the pages of the individual tools in the [tools overview](https://discopop-project.github.io/discopop/Tools). ## TL;DR -This example installs DiscoPoP, instruments and builds the provided example, analyzes the results, and prints the identified parallelization suggestions to the console. +If you are interested in installing DiscoPoP as a `developer`, please refer to the [DiscoPoP setup wiki page](https://discopop-project.github.io/discopop/setup/discopop/). + +The following example installs DiscoPoP for `users`, instruments and builds the provided example, analyzes the results, and prints the identified parallelization suggestions to the console. In case any issues arise during the process, please refer to the detailed [setup instructions](https://discopop-project.github.io/discopop/Setup), contact us via GitHub messages, or get in contact by mail to [discopop-support@lists.parallel.informatik.tu-darmstadt.de](mailto:discopop-support@lists.parallel.informatik.tu-darmstadt.de). + +### Prerequisites +- Download `.deb` package from [latest Release](https://github.com/discopop-project/discopop/releases/latest) +### Example ``` -# setup DiscoPoP -git clone git@github.com:discopop-project/discopop.git -cd discopop -mkdir build && cd build -DP_BUILD=$(pwd) -cmake .. && make +# install package +sudo apt install ./.deb # instrument and build the example code -cd ../example -mkdir build && cd build && cmake -DCMAKE_CXX_COMPILER=${DP_BUILD}/scripts/CXX_wrapper.sh .. && make +cd /opt/DiscoPoP/example +mkdir build && cd build && cmake -DCMAKE_CXX_COMPILER=discopop_cxx .. && make # execute instrumented code ./cmake_example # identify parallel patterns cd .discopop discopop_explorer -# create applicable patches from patterns -discopop_patch_generator # print patches to the console for f in $(find patch_generator -maxdepth 1 -type d); do echo "SUGGESTION: $f" diff --git a/discopop_library/global_data/version/VERSION b/discopop_library/global_data/version/VERSION index fcdb2e109..1454f6ed4 100644 --- a/discopop_library/global_data/version/VERSION +++ b/discopop_library/global_data/version/VERSION @@ -1 +1 @@ -4.0.0 +4.0.1 diff --git a/docs/setup/discopop.md b/docs/setup/discopop.md index 521d1130c..d975dd30f 100644 --- a/docs/setup/discopop.md +++ b/docs/setup/discopop.md @@ -5,7 +5,16 @@ parent: Setup nav_order: 1 --- -# DiscoPoP Setup +# DiscoPoP Setup - Package +- Proposed method of installation for `users` of DiscoPoP +- Download the `.deb` package of choice from [releases](https://github.com/discopop-project/discopop/releases). + - Packages for different targets and configurations might become available in the future +- Install via a package manager of choice (example: `sudo apt install ./.deb`) +- Uninstall via a package manager of choice (example: `sudo apt remove discopop`) + + +# DiscoPoP Setup - Manual +- Proposed method of installation for `developers` of DiscoPoP ## Prerequisites - LLVM/clang version 11 - Python version 3.6 or greater @@ -47,5 +56,6 @@ where `` can consist of any combination of the following flags and ## Testing the installation To test the installation, it is possible to execute the provided set of unit tests. ``` -python -m unittest -v +cd +venv/bin/python -m unittest -v ``` diff --git a/test/end_to_end/do_all/calls/second_order/preventing_2/src/FileMapping.txt b/test/end_to_end/do_all/calls/second_order/preventing_2/src/FileMapping.txt new file mode 100644 index 000000000..e0d0aacbe --- /dev/null +++ b/test/end_to_end/do_all/calls/second_order/preventing_2/src/FileMapping.txt @@ -0,0 +1 @@ +1 /home/lukas/git/discopop/test/end_to_end/do_all/calls/second_order/preventing_2/src/code.cpp From 715e80146acfce1842a96d8f367304b9e55eca48 Mon Sep 17 00:00:00 2001 From: Lukas Rothenberger Date: Thu, 14 Nov 2024 15:50:02 +0100 Subject: [PATCH 09/21] doc: add version number to package name --- scripts/dev/create_package.sh | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/scripts/dev/create_package.sh b/scripts/dev/create_package.sh index a3a862d55..36d167a1f 100755 --- a/scripts/dev/create_package.sh +++ b/scripts/dev/create_package.sh @@ -37,8 +37,10 @@ rm -rf opt/DiscoPoP/tmp_packages_build_dir cd .. mkdir -p packages # build package -dpkg-deb --build tmp_package_build_dir packages/DiscoPoP.deb -chmod 775 packages/DiscoPoP.deb +VERSION=$(cat discopop_library/global_data/version/VERSION) +PACKAGE_NAME="discopop-${VERSION}.deb" +dpkg-deb --build tmp_package_build_dir packages/${PACKAGE_NAME} +chmod 775 packages/${PACKAGE_NAME} # cleanup rm -rf tmp_package_build_dir From eb01d7430531b714358bdf51fc50cb4d14ff50c1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?A=2E=20Hei=C3=9F?= Date: Tue, 26 Nov 2024 17:52:13 +0100 Subject: [PATCH 10/21] --plot-pet for profiling --- discopop_explorer/__main__.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/discopop_explorer/__main__.py b/discopop_explorer/__main__.py index 583caa323..765aafdb2 100644 --- a/discopop_explorer/__main__.py +++ b/discopop_explorer/__main__.py @@ -108,6 +108,10 @@ def parse_args() -> ExplorerArguments: experimental_parser.add_argument( "--enable-statistics", action="store_true", help="Disable the calculation and storing of statistics for code and generated suggestions." ) + experimental_parser.add_argument( + "--plot-pet", type=str, nargs="?", default=None, const="explorer/pet_plot.gexf", + help="Plot PET as GEXF file. If a path is given, the PET plot is written to the given file, otherwise to pet_plot.gexf" + ) # fmt: on arguments = parser.parse_args() @@ -135,6 +139,7 @@ def parse_args() -> ExplorerArguments: arguments.dump_pet = get_path_or_none(arguments.path, arguments.dump_pet) arguments.dump_detection_result = get_path_or_none(arguments.path, arguments.dump_detection_result) arguments.microbench_file = get_path_or_none(arguments.path, arguments.microbench_file) + arguments.plot_pet = get_path_or_none(arguments.path, arguments.plot_pet) return ExplorerArguments( discopop_build_path=arguments.dp_build_path, From d840d03727d26ac4bc431f9562c73e9f0455a7fe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?A=2E=20Hei=C3=9F?= Date: Tue, 26 Nov 2024 18:24:50 +0100 Subject: [PATCH 11/21] Updates --- discopop_explorer/__main__.py | 3 ++- discopop_explorer/discopop_explorer.py | 8 ++++++++ discopop_explorer/functions/PEGraph/output/gephi.py | 4 ++-- 3 files changed, 12 insertions(+), 3 deletions(-) diff --git a/discopop_explorer/__main__.py b/discopop_explorer/__main__.py index 765aafdb2..45d57d121 100644 --- a/discopop_explorer/__main__.py +++ b/discopop_explorer/__main__.py @@ -110,7 +110,7 @@ def parse_args() -> ExplorerArguments: ) experimental_parser.add_argument( "--plot-pet", type=str, nargs="?", default=None, const="explorer/pet_plot.gexf", - help="Plot PET as GEXF file. If a path is given, the PET plot is written to the given file, otherwise to pet_plot.gexf" + help="Plots PET as a GEXF file. If a path is given, the PET plot is written to the given file, otherwise to pet_plot.gexf" ) # fmt: on @@ -167,6 +167,7 @@ def parse_args() -> ExplorerArguments: load_existing_doall_and_reduction_patterns=arguments.load_existing_doall_and_reduction_patterns, collect_statistics=arguments.enable_statistics, jobs=arguments.jobs, + enable_pet_plot_file=arguments.plot_pet, ) diff --git a/discopop_explorer/discopop_explorer.py b/discopop_explorer/discopop_explorer.py index 929bde644..c043050dd 100644 --- a/discopop_explorer/discopop_explorer.py +++ b/discopop_explorer/discopop_explorer.py @@ -21,6 +21,7 @@ import pstats2 # type:ignore from pluginbase import PluginBase # type: ignore from discopop_explorer.functions.PEGraph.output.json import dump_to_pickled_json +from discopop_explorer.functions.PEGraph.output.gephi import dump_to_gephi_file from discopop_explorer.utilities.statistics.collect_statistics import collect_statistics from discopop_library.ArgumentClasses.GeneralArguments import GeneralArguments # type: ignore from discopop_library.FolderStructure.setup import setup_explorer @@ -74,6 +75,7 @@ class ExplorerArguments(GeneralArguments): microbench_file: Optional[str] load_existing_doall_and_reduction_patterns: bool collect_statistics: bool + enable_pet_plot_file: Optional[str] # None means no dump, otherwise the path def __post_init__(self) -> None: self.__validate() @@ -303,6 +305,12 @@ def run(arguments: ExplorerArguments) -> None: stats = pstats2.Stats(profile, stream=f).sort_stats("tottime").reverse_order() stats.print_stats() + if arguments.enable_pet_plot_file is not None: + with open(arguments.enable_pet_plot_file, "w+") as f: + f.write(dump_to_gephi_file(res.pet)) + f.flush() + f.close() + except BaseException as be: # required to correctly write profiling data if the program terminates # print profiling results diff --git a/discopop_explorer/functions/PEGraph/output/gephi.py b/discopop_explorer/functions/PEGraph/output/gephi.py index 7eb231215..db2f37627 100644 --- a/discopop_explorer/functions/PEGraph/output/gephi.py +++ b/discopop_explorer/functions/PEGraph/output/gephi.py @@ -12,7 +12,7 @@ import networkx as nx # type: ignore -def dump_to_gephi_file(pet: PEGraphX, name: str = "pet.gexf") -> None: +def dump_to_gephi_file(pet: PEGraphX) -> None: """Note: Destroys the PETGraph!""" # replace node data with label for node_id in pet.g.nodes: @@ -29,4 +29,4 @@ def dump_to_gephi_file(pet: PEGraphX, name: str = "pet.gexf") -> None: if dep.dtype is None: raise ValueError("dep.dtype has no type name!") pet.g.edges[edge]["dep_type"] = str(dep.dtype.name) - nx.write_gexf(pet.g, name) + nx.write_gexf(pet.g) From ecb6ec40a3741c7c0be724802ee475432512c9c7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?A=2E=20Hei=C3=9F?= Date: Tue, 26 Nov 2024 20:34:35 +0100 Subject: [PATCH 12/21] update 2 --- discopop_explorer/discopop_explorer.py | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/discopop_explorer/discopop_explorer.py b/discopop_explorer/discopop_explorer.py index c043050dd..bde32d308 100644 --- a/discopop_explorer/discopop_explorer.py +++ b/discopop_explorer/discopop_explorer.py @@ -75,6 +75,7 @@ class ExplorerArguments(GeneralArguments): microbench_file: Optional[str] load_existing_doall_and_reduction_patterns: bool collect_statistics: bool + enable_gephi_file: Optional[str] enable_pet_plot_file: Optional[str] # None means no dump, otherwise the path def __post_init__(self) -> None: @@ -266,6 +267,12 @@ def run(arguments: ExplorerArguments) -> None: f.flush() f.close() + if arguments.enable_pet_plot_file is not None: + with open(arguments.enable_pet_plot_file, "w+") as f: + f.write(dump_to_gephi_file(res.pet)) + f.flush() + f.close() + if arguments.enable_json_file is None: print(str(res)) else: @@ -305,12 +312,6 @@ def run(arguments: ExplorerArguments) -> None: stats = pstats2.Stats(profile, stream=f).sort_stats("tottime").reverse_order() stats.print_stats() - if arguments.enable_pet_plot_file is not None: - with open(arguments.enable_pet_plot_file, "w+") as f: - f.write(dump_to_gephi_file(res.pet)) - f.flush() - f.close() - except BaseException as be: # required to correctly write profiling data if the program terminates # print profiling results From 584984f66ba554606834580f90e733431c0ce6ff Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?A=2E=20Hei=C3=9F?= Date: Tue, 26 Nov 2024 23:40:00 +0100 Subject: [PATCH 13/21] path hardcoded --- discopop_explorer/discopop_explorer.py | 14 +++++++------- .../functions/PEGraph/output/gephi.py | 4 ++-- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/discopop_explorer/discopop_explorer.py b/discopop_explorer/discopop_explorer.py index bde32d308..ec0baa33f 100644 --- a/discopop_explorer/discopop_explorer.py +++ b/discopop_explorer/discopop_explorer.py @@ -75,7 +75,7 @@ class ExplorerArguments(GeneralArguments): microbench_file: Optional[str] load_existing_doall_and_reduction_patterns: bool collect_statistics: bool - enable_gephi_file: Optional[str] + #enable_gephi_file: Optional[str] enable_pet_plot_file: Optional[str] # None means no dump, otherwise the path def __post_init__(self) -> None: @@ -267,12 +267,6 @@ def run(arguments: ExplorerArguments) -> None: f.flush() f.close() - if arguments.enable_pet_plot_file is not None: - with open(arguments.enable_pet_plot_file, "w+") as f: - f.write(dump_to_gephi_file(res.pet)) - f.flush() - f.close() - if arguments.enable_json_file is None: print(str(res)) else: @@ -303,6 +297,12 @@ def run(arguments: ExplorerArguments) -> None: print(sympyExpr) print(sympyExpr.free_symbols) + if arguments.enable_pet_plot_file is not None: + with open(arguments.enable_pet_plot_file, "w+") as f: + f.write(dump_to_gephi_file(res.pet, "explorer/pet_plot.gexf")) + f.flush() + f.close() + # print profiling results if arguments.enable_profiling_dump_file is not None: profile.disable() diff --git a/discopop_explorer/functions/PEGraph/output/gephi.py b/discopop_explorer/functions/PEGraph/output/gephi.py index db2f37627..187d8c424 100644 --- a/discopop_explorer/functions/PEGraph/output/gephi.py +++ b/discopop_explorer/functions/PEGraph/output/gephi.py @@ -12,7 +12,7 @@ import networkx as nx # type: ignore -def dump_to_gephi_file(pet: PEGraphX) -> None: +def dump_to_gephi_file(pet: PEGraphX, name: str) -> None: """Note: Destroys the PETGraph!""" # replace node data with label for node_id in pet.g.nodes: @@ -29,4 +29,4 @@ def dump_to_gephi_file(pet: PEGraphX) -> None: if dep.dtype is None: raise ValueError("dep.dtype has no type name!") pet.g.edges[edge]["dep_type"] = str(dep.dtype.name) - nx.write_gexf(pet.g) + nx.write_gexf(pet.g, name) From 67811eb7f57fa12dac5bfd99ff862bb3c6677056 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?A=2E=20Hei=C3=9F?= Date: Wed, 27 Nov 2024 14:56:00 +0100 Subject: [PATCH 14/21] enable... verschoben --- discopop_explorer/discopop_explorer.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/discopop_explorer/discopop_explorer.py b/discopop_explorer/discopop_explorer.py index ec0baa33f..fb7646826 100644 --- a/discopop_explorer/discopop_explorer.py +++ b/discopop_explorer/discopop_explorer.py @@ -261,6 +261,12 @@ def run(arguments: ExplorerArguments) -> None: f.flush() f.close() + if arguments.enable_pet_plot_file is not None: + with open(arguments.enable_pet_plot_file, "w+") as f: + f.write(dump_to_gephi_file(res.pet, "explorer/pet_plot.gexf")) + f.flush() + f.close() + if arguments.enable_detection_result_dump_file is not None: with open(arguments.enable_detection_result_dump_file, "w+") as f: f.write(res.dump_to_pickled_json()) @@ -297,12 +303,6 @@ def run(arguments: ExplorerArguments) -> None: print(sympyExpr) print(sympyExpr.free_symbols) - if arguments.enable_pet_plot_file is not None: - with open(arguments.enable_pet_plot_file, "w+") as f: - f.write(dump_to_gephi_file(res.pet, "explorer/pet_plot.gexf")) - f.flush() - f.close() - # print profiling results if arguments.enable_profiling_dump_file is not None: profile.disable() From 6372666efbd78c2af34656a05645efcb763f3fec Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?A=2E=20Hei=C3=9F?= Date: Wed, 27 Nov 2024 15:05:13 +0100 Subject: [PATCH 15/21] Trial with pet.g --- discopop_explorer/discopop_explorer.py | 5 +---- discopop_explorer/functions/PEGraph/output/gephi.py | 6 +++++- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/discopop_explorer/discopop_explorer.py b/discopop_explorer/discopop_explorer.py index fb7646826..66b9e556d 100644 --- a/discopop_explorer/discopop_explorer.py +++ b/discopop_explorer/discopop_explorer.py @@ -262,10 +262,7 @@ def run(arguments: ExplorerArguments) -> None: f.close() if arguments.enable_pet_plot_file is not None: - with open(arguments.enable_pet_plot_file, "w+") as f: - f.write(dump_to_gephi_file(res.pet, "explorer/pet_plot.gexf")) - f.flush() - f.close() + dump_to_gephi_file(res.pet, "explorer/pet_plot.gexf") if arguments.enable_detection_result_dump_file is not None: with open(arguments.enable_detection_result_dump_file, "w+") as f: diff --git a/discopop_explorer/functions/PEGraph/output/gephi.py b/discopop_explorer/functions/PEGraph/output/gephi.py index 187d8c424..660e8dc51 100644 --- a/discopop_explorer/functions/PEGraph/output/gephi.py +++ b/discopop_explorer/functions/PEGraph/output/gephi.py @@ -29,4 +29,8 @@ def dump_to_gephi_file(pet: PEGraphX, name: str) -> None: if dep.dtype is None: raise ValueError("dep.dtype has no type name!") pet.g.edges[edge]["dep_type"] = str(dep.dtype.name) - nx.write_gexf(pet.g, name) + # nx.write_gexf(pet.g, name) + with open("explorer/pet_plot.gexf", "w+") as f: + f.write(pet.g) + f.flush() + f.close() From 3ee1c9b8e2e18aa9986e4f632d7432dc30bb8682 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?A=2E=20Hei=C3=9F?= Date: Wed, 27 Nov 2024 15:06:52 +0100 Subject: [PATCH 16/21] Trial without --- discopop_explorer/functions/PEGraph/output/gephi.py | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/discopop_explorer/functions/PEGraph/output/gephi.py b/discopop_explorer/functions/PEGraph/output/gephi.py index 660e8dc51..5f077a946 100644 --- a/discopop_explorer/functions/PEGraph/output/gephi.py +++ b/discopop_explorer/functions/PEGraph/output/gephi.py @@ -29,8 +29,4 @@ def dump_to_gephi_file(pet: PEGraphX, name: str) -> None: if dep.dtype is None: raise ValueError("dep.dtype has no type name!") pet.g.edges[edge]["dep_type"] = str(dep.dtype.name) - # nx.write_gexf(pet.g, name) - with open("explorer/pet_plot.gexf", "w+") as f: - f.write(pet.g) - f.flush() - f.close() + nx.write_gexf(pet.g, name) \ No newline at end of file From 5f18ab51bff157c9fb9a516a217f43a3a0bec1ee Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?A=2E=20Hei=C3=9F?= Date: Wed, 11 Dec 2024 13:06:02 +0100 Subject: [PATCH 17/21] comments --- discopop_explorer/__main__.py | 4 ++-- discopop_explorer/discopop_explorer.py | 2 ++ 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/discopop_explorer/__main__.py b/discopop_explorer/__main__.py index 45d57d121..99cfd1586 100644 --- a/discopop_explorer/__main__.py +++ b/discopop_explorer/__main__.py @@ -109,8 +109,8 @@ def parse_args() -> ExplorerArguments: "--enable-statistics", action="store_true", help="Disable the calculation and storing of statistics for code and generated suggestions." ) experimental_parser.add_argument( - "--plot-pet", type=str, nargs="?", default=None, const="explorer/pet_plot.gexf", - help="Plots PET as a GEXF file. If a path is given, the PET plot is written to the given file, otherwise to pet_plot.gexf" + "--plot-pet", type=str, nargs="?", default="explorer/pet_plot.gexf", + help="Plots PET as a GEXF file. The PET plot is written to pet_plot.gexf" ) # fmt: on diff --git a/discopop_explorer/discopop_explorer.py b/discopop_explorer/discopop_explorer.py index 66b9e556d..1ae6fe4bd 100644 --- a/discopop_explorer/discopop_explorer.py +++ b/discopop_explorer/discopop_explorer.py @@ -261,6 +261,8 @@ def run(arguments: ExplorerArguments) -> None: f.flush() f.close() + # experimental + # dumps gexf plot of pet if arguments.enable_pet_plot_file is not None: dump_to_gephi_file(res.pet, "explorer/pet_plot.gexf") From bc9604b6315d1bbfbc7fdb5b91e05870f6e49d46 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?A=2E=20Hei=C3=9F?= Date: Wed, 11 Dec 2024 13:11:02 +0100 Subject: [PATCH 18/21] clean up --- discopop_explorer/__main__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/discopop_explorer/__main__.py b/discopop_explorer/__main__.py index 99cfd1586..7d8a0b78c 100644 --- a/discopop_explorer/__main__.py +++ b/discopop_explorer/__main__.py @@ -109,7 +109,7 @@ def parse_args() -> ExplorerArguments: "--enable-statistics", action="store_true", help="Disable the calculation and storing of statistics for code and generated suggestions." ) experimental_parser.add_argument( - "--plot-pet", type=str, nargs="?", default="explorer/pet_plot.gexf", + "--plot-pet", help="Plots PET as a GEXF file. The PET plot is written to pet_plot.gexf" ) # fmt: on From 933a0676716e945533cc986c80929df2dcf0c901 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?A=2E=20Hei=C3=9F?= Date: Wed, 11 Dec 2024 13:13:17 +0100 Subject: [PATCH 19/21] clean up 2 --- discopop_explorer/__main__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/discopop_explorer/__main__.py b/discopop_explorer/__main__.py index 7d8a0b78c..f554d01a9 100644 --- a/discopop_explorer/__main__.py +++ b/discopop_explorer/__main__.py @@ -109,7 +109,7 @@ def parse_args() -> ExplorerArguments: "--enable-statistics", action="store_true", help="Disable the calculation and storing of statistics for code and generated suggestions." ) experimental_parser.add_argument( - "--plot-pet", + "--plot-pet", type=str, default="explorer/pet_plot.gexf", help="Plots PET as a GEXF file. The PET plot is written to pet_plot.gexf" ) # fmt: on From 68b441d2f84fc7b310fdcfcae8417ea1dbdc2a94 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?A=2E=20Hei=C3=9F?= Date: Wed, 11 Dec 2024 13:23:33 +0100 Subject: [PATCH 20/21] Test change --- discopop_explorer/__main__.py | 2 +- discopop_explorer/discopop_explorer.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/discopop_explorer/__main__.py b/discopop_explorer/__main__.py index f554d01a9..a3680af25 100644 --- a/discopop_explorer/__main__.py +++ b/discopop_explorer/__main__.py @@ -109,7 +109,7 @@ def parse_args() -> ExplorerArguments: "--enable-statistics", action="store_true", help="Disable the calculation and storing of statistics for code and generated suggestions." ) experimental_parser.add_argument( - "--plot-pet", type=str, default="explorer/pet_plot.gexf", + "--plot-pet", type=str, nargs="?", default=None, const="explorer/pet_plot.gexf", help="Plots PET as a GEXF file. The PET plot is written to pet_plot.gexf" ) # fmt: on diff --git a/discopop_explorer/discopop_explorer.py b/discopop_explorer/discopop_explorer.py index 1ae6fe4bd..20fbf6391 100644 --- a/discopop_explorer/discopop_explorer.py +++ b/discopop_explorer/discopop_explorer.py @@ -264,7 +264,7 @@ def run(arguments: ExplorerArguments) -> None: # experimental # dumps gexf plot of pet if arguments.enable_pet_plot_file is not None: - dump_to_gephi_file(res.pet, "explorer/pet_plot.gexf") + dump_to_gephi_file(res.pet, arguments.enable_pet_plot_file) if arguments.enable_detection_result_dump_file is not None: with open(arguments.enable_detection_result_dump_file, "w+") as f: From 3a99e1faf3db814b33278a4f242becf06d4ea87f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?A=2E=20Hei=C3=9F?= Date: Wed, 11 Dec 2024 13:29:44 +0100 Subject: [PATCH 21/21] comment clean up --- discopop_explorer/__main__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/discopop_explorer/__main__.py b/discopop_explorer/__main__.py index a3680af25..6f078d65c 100644 --- a/discopop_explorer/__main__.py +++ b/discopop_explorer/__main__.py @@ -110,7 +110,7 @@ def parse_args() -> ExplorerArguments: ) experimental_parser.add_argument( "--plot-pet", type=str, nargs="?", default=None, const="explorer/pet_plot.gexf", - help="Plots PET as a GEXF file. The PET plot is written to pet_plot.gexf" + help="Plots PET as a GEXF file. If a path is given (file extension has to be .gexf), the PET Graph is written to the given file, otherwise to pet_plot.gexf" ) # fmt: on