Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat/print config #597

Merged
merged 5 commits into from
Jun 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ endif()

# Print DiscoPoP version to be installed
file(READ ${CMAKE_CURRENT_LIST_DIR}/discopop_library/global_data/version/VERSION DiscoPoP_VERSION)
string(REGEX REPLACE "\n$" "" DiscoPoP_VERSION "${DiscoPoP_VERSION}")
message(STATUS "DiscoPoP version: ${DiscoPoP_VERSION}")

if(NOT ${LLVM_DIST_PATH} STREQUAL "")
Expand Down Expand Up @@ -82,10 +83,25 @@ file(APPEND "${DiscoPoP_BINARY_DIR}/build_config.txt" "PYTHON_EXECUTABLE=${Pytho
# save build_config.py to discopop_library/ConfigProvider/assets for easy accessibility and global use
file(REMOVE "${DiscoPoP_SOURCE_DIR}/discopop_library/ConfigProvider/assets/build_config.py")
file(TOUCH "${DiscoPoP_SOURCE_DIR}/discopop_library/ConfigProvider/assets/build_config.py")
file(APPEND "${DiscoPoP_SOURCE_DIR}/discopop_library/ConfigProvider/assets/build_config.py" "DP_VERSION=\"${DiscoPoP_VERSION}\"\n")
file(APPEND "${DiscoPoP_SOURCE_DIR}/discopop_library/ConfigProvider/assets/build_config.py" "DP_BUILD=\"${DiscoPoP_BINARY_DIR}\"\n")
file(APPEND "${DiscoPoP_SOURCE_DIR}/discopop_library/ConfigProvider/assets/build_config.py" "DP_SOURCE=\"${DiscoPoP_SOURCE_DIR}\"\n")
file(APPEND "${DiscoPoP_SOURCE_DIR}/discopop_library/ConfigProvider/assets/build_config.py" "LLVM_BIN_DIR=\"${LLVM_TOOLS_BINARY_DIR}\"\n")
file(APPEND "${DiscoPoP_SOURCE_DIR}/discopop_library/ConfigProvider/assets/build_config.py" "PYTHON_EXECUTABLE=\"${Python3_EXECUTABLE}\"\n")
file(APPEND "${DiscoPoP_SOURCE_DIR}/discopop_library/ConfigProvider/assets/build_config.py" "DP_HYBRID_PROFILING=\"${DP_HYBRID_PROFILING}\"\n")
file(APPEND "${DiscoPoP_SOURCE_DIR}/discopop_library/ConfigProvider/assets/build_config.py" "DP_PTHREAD_COMPATIBILITY_MODE=\"${DP_PTHREAD_COMPATIBILITY_MODE}\"\n")
file(APPEND "${DiscoPoP_SOURCE_DIR}/discopop_library/ConfigProvider/assets/build_config.py" "DP_RTLIB_VERBOSE=\"${DP_RTLIB_VERBOSE}\"\n")
file(APPEND "${DiscoPoP_SOURCE_DIR}/discopop_library/ConfigProvider/assets/build_config.py" "DP_NUM_WORKERS=\"${DP_NUM_WORKERS}\"\n")
file(APPEND "${DiscoPoP_SOURCE_DIR}/discopop_library/ConfigProvider/assets/build_config.py" "DP_INTERNAL_TIMER=\"${DP_INTERNAL_TIMER}\"\n")
file(APPEND "${DiscoPoP_SOURCE_DIR}/discopop_library/ConfigProvider/assets/build_config.py" "DP_MEMORY_REGION_DEALIASING=\"${DP_MEMORY_REGION_DEALIASING}\"\n")
file(APPEND "${DiscoPoP_SOURCE_DIR}/discopop_library/ConfigProvider/assets/build_config.py" "DP_STACK_ACCESS_DETECTION=\"${DP_STACK_ACCESS_DETECTION}\"\n")
file(APPEND "${DiscoPoP_SOURCE_DIR}/discopop_library/ConfigProvider/assets/build_config.py" "DP_CALLSTACK_PROFILING=\"${DP_CALLSTACK_PROFILING}\"\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)
Expand Down
5 changes: 3 additions & 2 deletions DiscoPoP/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,11 @@ add_llvm_library(LLVMDiscoPoP MODULE

# forward compiler flags
if(DEFINED DP_HYBRID_PROFILING)
message("Defined DP_HYBRID_PROFILING=" ${DP_HYBRID_PROFILING})
target_compile_definitions(LLVMDiscoPoP PUBLIC DP_HYBRID_PROFILING=${DP_HYBRID_PROFILING})
if(${DP_HYBRID_PROFILING} EQUAL 0)
message(STATUS "WARNING: DiscoPoP configuration: DP_HYBRID_PROFILING disabled. Reduces profiling speed.")
endif()
else()
target_compile_definitions(LLVMDiscoPoP PUBLIC DP_HYBRID_PROFILING=1)
message("Default defined DP_HYBRID_PROFILING=1")
endif()
# end of compiler flags
1 change: 1 addition & 0 deletions discopop_library/ConfigProvider/ConfigProviderArguments.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ class ConfigProviderArguments(object):
return_dp_build_dir: bool
return_dp_source_dir: bool
return_llvm_bin_dir: bool
return_full_config: bool
return_version_string: bool

def __post_init__(self):
Expand Down
3 changes: 3 additions & 0 deletions discopop_library/ConfigProvider/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ def parse_args() -> ConfigProviderArguments:
help="Return the path to the DiscoPoP source directory")
mutually_exclusive.add_argument("--llvm-bin-dir", action="store_true",
help="Return the path to the LLVM bin directory")
mutually_exclusive.add_argument("-f", "--full", action="store_true",
help="Return the full configuration")
mutually_exclusive.add_argument("-v", "--version", action="store_true",
help="Return the version string of the DiscoPoP library")
# EXPERIMENTAL FLAGS:
Expand All @@ -34,6 +36,7 @@ def parse_args() -> ConfigProviderArguments:
return_dp_build_dir=arguments.dp_build_dir,
return_dp_source_dir=arguments.dp_source_dir,
return_llvm_bin_dir=arguments.llvm_bin_dir,
return_full_config=arguments.full,
return_version_string=arguments.version,
)

Expand Down
12 changes: 12 additions & 0 deletions discopop_library/ConfigProvider/config_provider.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
# the 3-Clause BSD License. See the LICENSE file in the package base
# directory for details.

import os
from pathlib import Path
from discopop_library.ConfigProvider.ConfigProviderArguments import ConfigProviderArguments
from discopop_library.ConfigProvider.assets.build_config import DP_BUILD, DP_SOURCE, LLVM_BIN_DIR # type: ignore
from discopop_library.global_data.version.utils import get_version
Expand All @@ -20,6 +22,16 @@ def run(arguments: ConfigProviderArguments) -> str:
return DP_SOURCE # type: ignore
elif arguments.return_llvm_bin_dir:
return LLVM_BIN_DIR # type: ignore
elif arguments.return_full_config:
ret_str = ""
assets_path = os.path.join(Path(__file__).parent.absolute(), "assets", "build_config.py")
with open(assets_path, "r") as f:
for line in f.readlines():
ret_str += line
# remove trailing \n
if ret_str[-1] == "\n":
ret_str = ret_str[:-1]
return ret_str
elif arguments.return_version_string:
return get_version()
else:
Expand Down
12 changes: 10 additions & 2 deletions discopop_library/PatchGenerator/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,14 +49,22 @@ def parse_args() -> PatchGeneratorArguments:
# determine DP build path
arguments.dp_build_path = run_config_provider(
ConfigProviderArguments(
return_dp_build_dir=True, return_dp_source_dir=False, return_llvm_bin_dir=False, return_version_string=False
return_dp_build_dir=True,
return_dp_source_dir=False,
return_llvm_bin_dir=False,
return_full_config=False,
return_version_string=False,
)
)

# determine LLVM_BIN_DIR
llvm_bin_dir = run_config_provider(
ConfigProviderArguments(
return_dp_build_dir=False, return_dp_source_dir=False, return_llvm_bin_dir=True, return_version_string=False
return_dp_build_dir=False,
return_dp_source_dir=False,
return_llvm_bin_dir=True,
return_full_config=False,
return_version_string=False,
)
)
# determine CC
Expand Down
5 changes: 5 additions & 0 deletions rtlib/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ add_library(DiscoPoP_RT STATIC
if(DEFINED DP_PTHREAD_COMPATIBILITY_MODE)
if(NOT ${DP_PTHREAD_COMPATIBILITY_MODE} EQUAL 0)
target_compile_definitions(DiscoPoP_RT PUBLIC DP_PTHREAD_COMPATIBILITY_MODE=${DP_PTHREAD_COMPATIBILITY_MODE})
message(STATUS "WARNING: DiscoPoP configuration: DP_PTHREAD_COMPATIBILITY_MODE enabled. Reduces profiling speed.")
endif()
endif()

Expand All @@ -69,24 +70,28 @@ endif()
if(DEFINED DP_INTERNAL_TIMER)
if(NOT ${DP_INTERNAL_TIMER} EQUAL 0)
target_compile_definitions(DiscoPoP_RT PUBLIC DP_INTERNAL_TIMER=${DP_INTERNAL_TIMER})
message(STATUS "WARNING: DiscoPoP configuration: DP_INTERNAL_TIMER enabled. Debug setting. Reduces profiling speed.")
endif()
endif()

if(DEFINED DP_MEMORY_REGION_DEALIASING)
if(NOT ${DP_MEMORY_REGION_DEALIASING} EQUAL 0)
target_compile_definitions(DiscoPoP_RT PUBLIC DP_MEMORY_REGION_DEALIASING=${DP_MEMORY_REGION_DEALIASING})
message(STATUS "WARNING: DiscoPoP configuration: DP_MEMORY_REGION_DEALIASING enabled. Reduces profiling speed.")
endif()
endif()

if(DEFINED DP_STACK_ACCESS_DETECTION)
if(NOT ${DP_STACK_ACCESS_DETECTION} EQUAL 0)
target_compile_definitions(DiscoPoP_RT PUBLIC DP_STACK_ACCESS_DETECTION=${DP_STACK_ACCESS_DETECTION})
message(STATUS "WARNING: DiscoPoP configuration: DP_STACK_ACCESS_DETECTION enabled. Reduces profiling speed.")
endif()
endif()

if(DEFINED DP_CALLSTACK_PROFILING)
if(NOT ${DP_CALLSTACK_PROFILING} EQUAL 0)
target_compile_definitions(DiscoPoP_RT PUBLIC DP_CALLSTACK_PROFILING=${DP_CALLSTACK_PROFILING})
message(STATUS "WARNING: DiscoPoP configuration: DP_CALLSTACK_PROFILING enabled. Reduces profiling speed.")
endif()
endif()

Expand Down
1 change: 1 addition & 0 deletions test/do_all/backwards_array_access/test.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ def test(self):
return_dp_build_dir=True,
return_dp_source_dir=False,
return_llvm_bin_dir=False,
return_full_config=False,
return_version_string=False,
)
)
Expand Down
1 change: 1 addition & 0 deletions test/do_all/calls/LULESH_proxy/test.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ def test(self):
return_dp_build_dir=True,
return_dp_source_dir=False,
return_llvm_bin_dir=False,
return_full_config=False,
return_version_string=False,
)
)
Expand Down
1 change: 1 addition & 0 deletions test/do_all/calls/above_nesting_level_3/test.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ def test(self):
return_dp_build_dir=True,
return_dp_source_dir=False,
return_llvm_bin_dir=False,
return_full_config=False,
return_version_string=False,
)
)
Expand Down
1 change: 1 addition & 0 deletions test/do_all/calls/allowing/test.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ def test(self):
return_dp_build_dir=True,
return_dp_source_dir=False,
return_llvm_bin_dir=False,
return_full_config=False,
return_version_string=False,
)
)
Expand Down
1 change: 1 addition & 0 deletions test/do_all/calls/allowing_2/test.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ def test(self):
return_dp_build_dir=True,
return_dp_source_dir=False,
return_llvm_bin_dir=False,
return_full_config=False,
return_version_string=False,
)
)
Expand Down
1 change: 1 addition & 0 deletions test/do_all/calls/preventing/simple/test.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ def test(self):
return_dp_build_dir=True,
return_dp_source_dir=False,
return_llvm_bin_dir=False,
return_full_config=False,
return_version_string=False,
)
)
Expand Down
1 change: 1 addition & 0 deletions test/do_all/calls/second_order/allowing/test.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ def test(self):
return_dp_build_dir=True,
return_dp_source_dir=False,
return_llvm_bin_dir=False,
return_full_config=False,
return_version_string=False,
)
)
Expand Down
1 change: 1 addition & 0 deletions test/do_all/calls/second_order/allowing_2/test.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ def test(self):
return_dp_build_dir=True,
return_dp_source_dir=False,
return_llvm_bin_dir=False,
return_full_config=False,
return_version_string=False,
)
)
Expand Down
1 change: 1 addition & 0 deletions test/do_all/calls/second_order/preventing/test.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ def test(self):
return_dp_build_dir=True,
return_dp_source_dir=False,
return_llvm_bin_dir=False,
return_full_config=False,
return_version_string=False,
)
)
Expand Down
1 change: 1 addition & 0 deletions test/do_all/calls/second_order/preventing_2/test.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ def test(self):
return_dp_build_dir=True,
return_dp_source_dir=False,
return_llvm_bin_dir=False,
return_full_config=False,
return_version_string=False,
)
)
Expand Down
1 change: 1 addition & 0 deletions test/do_all/daxpy/test.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ def test(self):
return_dp_build_dir=True,
return_dp_source_dir=False,
return_llvm_bin_dir=False,
return_full_config=False,
return_version_string=False,
)
)
Expand Down
1 change: 1 addition & 0 deletions test/do_all/negative/nested/OMPSCR/c_Mandelbrot/test.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ def test(self):
return_dp_build_dir=True,
return_dp_source_dir=False,
return_llvm_bin_dir=False,
return_full_config=False,
return_version_string=False,
)
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ def test(self):
return_dp_build_dir=True,
return_dp_source_dir=False,
return_llvm_bin_dir=False,
return_full_config=False,
return_version_string=False,
)
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ def test(self):
return_dp_build_dir=True,
return_dp_source_dir=False,
return_llvm_bin_dir=False,
return_full_config=False,
return_version_string=False,
)
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ def test(self):
return_dp_build_dir=True,
return_dp_source_dir=False,
return_llvm_bin_dir=False,
return_full_config=False,
return_version_string=False,
)
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ def test(self):
return_dp_build_dir=True,
return_dp_source_dir=False,
return_llvm_bin_dir=False,
return_full_config=False,
return_version_string=False,
)
)
Expand Down
1 change: 1 addition & 0 deletions test/do_all/simple/nested/depth_2/negative/test.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ def test(self):
return_dp_build_dir=True,
return_dp_source_dir=False,
return_llvm_bin_dir=False,
return_full_config=False,
return_version_string=False,
)
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ def test(self):
return_dp_build_dir=True,
return_dp_source_dir=False,
return_llvm_bin_dir=False,
return_full_config=False,
return_version_string=False,
)
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ def test(self):
return_dp_build_dir=True,
return_dp_source_dir=False,
return_llvm_bin_dir=False,
return_full_config=False,
return_version_string=False,
)
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ def test(self):
return_dp_build_dir=True,
return_dp_source_dir=False,
return_llvm_bin_dir=False,
return_full_config=False,
return_version_string=False,
)
)
Expand Down
1 change: 1 addition & 0 deletions test/do_all/simple/not_nested/negative/minimal/test.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ def test(self):
return_dp_build_dir=True,
return_dp_source_dir=False,
return_llvm_bin_dir=False,
return_full_config=False,
return_version_string=False,
)
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ def test(self):
return_dp_build_dir=True,
return_dp_source_dir=False,
return_llvm_bin_dir=False,
return_full_config=False,
return_version_string=False,
)
)
Expand Down
1 change: 1 addition & 0 deletions test/do_all/simple/not_nested/positive/test.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ def test(self):
return_dp_build_dir=True,
return_dp_source_dir=False,
return_llvm_bin_dir=False,
return_full_config=False,
return_version_string=False,
)
)
Expand Down
1 change: 1 addition & 0 deletions test/do_all/stack_access/nested/positive/test.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ def test(self):
return_dp_build_dir=True,
return_dp_source_dir=False,
return_llvm_bin_dir=False,
return_full_config=False,
return_version_string=False,
)
)
Expand Down
1 change: 1 addition & 0 deletions test/do_all/stack_access/various/case_0/test.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ def test(self):
return_dp_build_dir=True,
return_dp_source_dir=False,
return_llvm_bin_dir=False,
return_full_config=False,
return_version_string=False,
)
)
Expand Down
1 change: 1 addition & 0 deletions test/do_all/stack_access/various/case_1/test.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ def test(self):
return_dp_build_dir=True,
return_dp_source_dir=False,
return_llvm_bin_dir=False,
return_full_config=False,
return_version_string=False,
)
)
Expand Down
1 change: 1 addition & 0 deletions test/do_all/stack_access/various/case_2/test.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ def test(self):
return_dp_build_dir=True,
return_dp_source_dir=False,
return_llvm_bin_dir=False,
return_full_config=False,
return_version_string=False,
)
)
Expand Down
1 change: 1 addition & 0 deletions test/do_all/stack_access/various/case_3/test.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ def test(self):
return_dp_build_dir=True,
return_dp_source_dir=False,
return_llvm_bin_dir=False,
return_full_config=False,
return_version_string=False,
)
)
Expand Down
1 change: 1 addition & 0 deletions test/do_all/stack_access/various/case_4/test.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ def test(self):
return_dp_build_dir=True,
return_dp_source_dir=False,
return_llvm_bin_dir=False,
return_full_config=False,
return_version_string=False,
)
)
Expand Down
Loading
Loading