From 2cd26084cd650dc341af3a5d398278f577bf40da Mon Sep 17 00:00:00 2001 From: Peter Debacker Date: Fri, 3 Feb 2023 14:04:37 +0100 Subject: [PATCH 1/7] tell cmake to include boost libs --- core/CMakeLists.txt | 1 + mss/CMakeLists.txt | 1 + 2 files changed, 2 insertions(+) diff --git a/core/CMakeLists.txt b/core/CMakeLists.txt index a32f1752..311efca2 100644 --- a/core/CMakeLists.txt +++ b/core/CMakeLists.txt @@ -20,3 +20,4 @@ add_library(core CPUFactory.cpp CPUTopology.cpp ) + target_include_directories(core SYSTEM PRIVATE ${Boost_INCLUDE_DIRS}) diff --git a/mss/CMakeLists.txt b/mss/CMakeLists.txt index a25aaf60..fc92368b 100644 --- a/mss/CMakeLists.txt +++ b/mss/CMakeLists.txt @@ -3,3 +3,4 @@ add_library(mss BIU.cpp MSS.cpp ) +target_include_directories(mss SYSTEM PRIVATE ${Boost_INCLUDE_DIRS}) From 6299f22bafb1c90776ec973c16b22b495d09cc86 Mon Sep 17 00:00:00 2001 From: Peter Debacker Date: Fri, 3 Feb 2023 16:26:30 +0100 Subject: [PATCH 2/7] fixed boost include for tests --- core/CMakeLists.txt | 2 +- test/core/common/CMakeLists.txt | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/core/CMakeLists.txt b/core/CMakeLists.txt index 311efca2..26a75441 100644 --- a/core/CMakeLists.txt +++ b/core/CMakeLists.txt @@ -20,4 +20,4 @@ add_library(core CPUFactory.cpp CPUTopology.cpp ) - target_include_directories(core SYSTEM PRIVATE ${Boost_INCLUDE_DIRS}) +target_include_directories(core SYSTEM PRIVATE ${Boost_INCLUDE_DIRS}) diff --git a/test/core/common/CMakeLists.txt b/test/core/common/CMakeLists.txt index e87ba6cb..353bb6cf 100644 --- a/test/core/common/CMakeLists.txt +++ b/test/core/common/CMakeLists.txt @@ -4,3 +4,4 @@ project(common_test) add_library(common_test SourceUnit.cpp ) +target_include_directories(common_test SYSTEM PRIVATE ${Boost_INCLUDE_DIRS}) From 4795d0bfc65832684f66179172851c7c48f57d89 Mon Sep 17 00:00:00 2001 From: Peter Debacker Date: Fri, 10 Feb 2023 08:43:42 +0100 Subject: [PATCH 3/7] using the FindSparta.cmake which sparta installs to find libs and includes --- CMakeLists.txt | 22 ++++++++-------------- core/CMakeLists.txt | 1 + mss/CMakeLists.txt | 1 + test/core/dispatch/CMakeLists.txt | 3 +-- test/sim/CMakeLists.txt | 3 +-- 5 files changed, 12 insertions(+), 18 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 437ae70b..a9a87f29 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -2,7 +2,7 @@ cmake_minimum_required(VERSION 3.16) set (CMAKE_CXX_STANDARD 17) set (CMAKE_CXX_STANDARD_REQUIRED ON) -project(olympia CXX) +project(olympia C CXX) add_compile_options ( -Werror -Wall -Wextra -Winline -Winit-self -Wno-unused-function @@ -11,10 +11,12 @@ add_compile_options ( -Werror ################################################################################ # Set up Sparta -if (NOT SPARTA_BASE) - message (FATAL_ERROR "Need to define the location of the Sparta: cmake -DSPARTA_BASE=\"/path/to/sparta\"") -endif () -include (${SPARTA_BASE}/cmake/sparta-config.cmake) +if(IS_DIRECTORY ${SPARTA_SEARCH_DIR}) + set(CMAKE_MODULE_PATH "${SPARTA_SEARCH_DIR}/lib/cmake/sparta" ${CMAKE_MODULE_PATH}) +else() + message (STATUS "If needed, please provide the location where sparta is installed: -DSPARTA_SEARCH_DIR=") +endif() +find_package(Sparta REQUIRED) ################################################################################ # Set up STF library @@ -45,12 +47,6 @@ else() message (FATAL_ERROR "Please provide a CMAKE_BUILD_TYPE: -DCMAKE_BUILD_TYPE=Release|Debug|Profile") endif() -# Sparta/STF linking -link_directories ( - ${SPARTA_BASE}/${SPARTA_BUILD_TYPE} - ${SPARTA_BASE}/${SPARTA_BUILD_TYPE}/simdb - ) - # Profile build flags set(CMAKE_CXX_FLAGS_PROFILE "-O3 -pg -g -ftime-trace") set(CMAKE_CXX_FLAGS_FASTDEBUG "-O3 -g") @@ -59,8 +55,6 @@ set(CMAKE_CXX_FLAGS_FASTDEBUG "-O3 -g") include_directories (core mss) include_directories (SYSTEM mavis) include_directories (SYSTEM stf_lib) -include_directories (SYSTEM ${SPARTA_BASE}) -include_directories (SYSTEM ${SPARTA_BASE}/simdb/include) # The Core, MSS, and the simulator add_subdirectory(core) @@ -77,7 +71,7 @@ add_executable(olympia sim/OlympiaSim.cpp sim/main.cpp ) -target_link_libraries (olympia core mss ${Sparta_LIBS} ${STF_LINK_LIBS}) +target_link_libraries (olympia core mss SPARTA::sparta ${STF_LINK_LIBS}) if (CMAKE_BUILD_TYPE MATCHES "^[Rr]elease") target_link_options (olympia PUBLIC -flto) target_compile_options (olympia PUBLIC -flto) diff --git a/core/CMakeLists.txt b/core/CMakeLists.txt index 26a75441..a7062672 100644 --- a/core/CMakeLists.txt +++ b/core/CMakeLists.txt @@ -21,3 +21,4 @@ add_library(core CPUTopology.cpp ) target_include_directories(core SYSTEM PRIVATE ${Boost_INCLUDE_DIRS}) +target_link_libraries(core PUBLIC SPARTA::sparta) diff --git a/mss/CMakeLists.txt b/mss/CMakeLists.txt index fc92368b..7eeafc0c 100644 --- a/mss/CMakeLists.txt +++ b/mss/CMakeLists.txt @@ -4,3 +4,4 @@ add_library(mss MSS.cpp ) target_include_directories(mss SYSTEM PRIVATE ${Boost_INCLUDE_DIRS}) +target_link_libraries(mss PUBLIC SPARTA::sparta) diff --git a/test/core/dispatch/CMakeLists.txt b/test/core/dispatch/CMakeLists.txt index be1028b5..b5e556bc 100644 --- a/test/core/dispatch/CMakeLists.txt +++ b/test/core/dispatch/CMakeLists.txt @@ -3,14 +3,13 @@ project(Dispatch_test) add_executable(Dispatch_test Dispatch_test.cpp) target_link_libraries(Dispatch_test core common_test ${STF_LINK_LIBS} ${Sparta_LIBS}) -include(${SPARTA_BASE}/test/TestingMacros.cmake) - file(CREATE_LINK ${SIM_BASE}/mavis/json ${CMAKE_CURRENT_BINARY_DIR}/mavis_isa_files SYMBOLIC) file(CREATE_LINK ${SIM_BASE}/arches ${CMAKE_CURRENT_BINARY_DIR}/arches SYMBOLIC) file(CREATE_LINK ${CMAKE_CURRENT_SOURCE_DIR}/test_cores ${CMAKE_CURRENT_BINARY_DIR}/test_cores SYMBOLIC) file(CREATE_LINK ${CMAKE_CURRENT_SOURCE_DIR}/expected_output ${CMAKE_CURRENT_BINARY_DIR}/expected_output SYMBOLIC) # Single add per cycle +# Note: these macros get defined when find_package(Sparta) is called sparta_named_test(Dispatch_test_Run_Small Dispatch_test small_core.out -c test_cores/test_small_core.yaml) sparta_named_test(Dispatch_test_Run_Medium Dispatch_test medium_core.out -c test_cores/test_medium_core.yaml) sparta_named_test(Dispatch_test_Run_Big Dispatch_test big_core.out -c test_cores/test_big_core.yaml) diff --git a/test/sim/CMakeLists.txt b/test/sim/CMakeLists.txt index 6538a28b..80c91d25 100644 --- a/test/sim/CMakeLists.txt +++ b/test/sim/CMakeLists.txt @@ -1,7 +1,6 @@ project(olympia_test) -# Include the handy testing marcros defined in Sparta -include(${SPARTA_BASE}/test/TestingMacros.cmake) +# Note: these sparta_* macros/functions get defined when find_package(Sparta) is called # This line will make sure olympia is built before running the tests sparta_regress (olympia) From 88d020016f3787f9cc4ec0114c808f598b843388 Mon Sep 17 00:00:00 2001 From: Peter Debacker Date: Mon, 20 Feb 2023 17:02:13 +0100 Subject: [PATCH 4/7] tracking sparta PR #408, weightedcontextcounter is now in sparta/statistics --- core/Dispatch.hpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/core/Dispatch.hpp b/core/Dispatch.hpp index 1de48052..4fe4815d 100644 --- a/core/Dispatch.hpp +++ b/core/Dispatch.hpp @@ -14,10 +14,9 @@ #include "sparta/log/MessageSource.hpp" #include "sparta/statistics/Counter.hpp" #include "sparta/statistics/ContextCounter.hpp" +#include "sparta/statistics/WeightedContextCounter.hpp" #include "sparta/simulation/ResourceFactory.hpp" -#include "test/ContextCounter/WeightedContextCounter.hpp" - #include "Dispatcher.hpp" #include "CoreTypes.hpp" #include "InstGroup.hpp" From 86d45bf00eb71e9c8094df7370f60dcf0367a0fe Mon Sep 17 00:00:00 2001 From: Peter Debacker Date: Thu, 23 Feb 2023 08:16:23 +0100 Subject: [PATCH 5/7] CI should pick up sparta in default location after make install for sparta --- .github/actions/build/entrypoint.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/actions/build/entrypoint.sh b/.github/actions/build/entrypoint.sh index bbe3c6ad..b853fb54 100755 --- a/.github/actions/build/entrypoint.sh +++ b/.github/actions/build/entrypoint.sh @@ -26,7 +26,7 @@ if [ $? -ne 0 ]; then echo "ERROR: Cmake for Sparta framework failed" exit 1 fi -make -j2 +make -j2 install BUILD_SPARTA=$? if [ ${BUILD_SPARTA} -ne 0 ]; then echo "ERROR: build sparta FAILED!!!" @@ -36,7 +36,7 @@ fi cd ${GITHUB_WORKSPACE} mkdir $OLYMPIA_BUILD_TYPE cd $OLYMPIA_BUILD_TYPE -cmake .. -DCMAKE_BUILD_TYPE=$OLYMPIA_BUILD_TYPE -DGEN_DEBUG_INFO=OFF -DSPARTA_BASE=${GITHUB_WORKSPACE}/map/sparta +cmake .. -DCMAKE_BUILD_TYPE=$OLYMPIA_BUILD_TYPE -DGEN_DEBUG_INFO=OFF if [ $? -ne 0 ]; then echo "ERROR: Cmake for olympia failed" exit 1 From eb4182c91123e7841737e032c3fa8c11ff9f9c98 Mon Sep 17 00:00:00 2001 From: Peter Debacker Date: Fri, 24 Feb 2023 07:59:57 +0100 Subject: [PATCH 6/7] install sparta in github workspace area where we have permissions to write --- .github/actions/build/entrypoint.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/actions/build/entrypoint.sh b/.github/actions/build/entrypoint.sh index b853fb54..fbbf6426 100755 --- a/.github/actions/build/entrypoint.sh +++ b/.github/actions/build/entrypoint.sh @@ -21,7 +21,7 @@ mkdir -p release # Link step expects "release" as dir name ln -s release fastdebug ln -s release debug cd release -cmake .. -DCMAKE_BUILD_TYPE=$OLYMPIA_BUILD_TYPE -DGEN_DEBUG_INFO=OFF +cmake .. -DCMAKE_BUILD_TYPE=$OLYMPIA_BUILD_TYPE -DGEN_DEBUG_INFO=OFF -DCMAKE_INSTALL_PREFIX=${GITHUB_WORKSPACE}/sparta_installed if [ $? -ne 0 ]; then echo "ERROR: Cmake for Sparta framework failed" exit 1 @@ -36,7 +36,7 @@ fi cd ${GITHUB_WORKSPACE} mkdir $OLYMPIA_BUILD_TYPE cd $OLYMPIA_BUILD_TYPE -cmake .. -DCMAKE_BUILD_TYPE=$OLYMPIA_BUILD_TYPE -DGEN_DEBUG_INFO=OFF +cmake .. -DCMAKE_BUILD_TYPE=$OLYMPIA_BUILD_TYPE -DGEN_DEBUG_INFO=OFF -DSPARTA_SEARCH_DIR=${GITHUB_WORKSPACE}/sparta_installed if [ $? -ne 0 ]; then echo "ERROR: Cmake for olympia failed" exit 1 From 7fdb723f9e9a339ddd8711f3812a61b0dbb4644c Mon Sep 17 00:00:00 2001 From: Peter Debacker Date: Sat, 4 Mar 2023 08:13:33 +0100 Subject: [PATCH 7/7] no need to mark project as C, hdf5 find is fixed --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 399d0451..f697eab7 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -2,7 +2,7 @@ cmake_minimum_required(VERSION 3.17) set (CMAKE_CXX_STANDARD 17) set (CMAKE_CXX_STANDARD_REQUIRED ON) -project(olympia C CXX) +project(olympia CXX) add_compile_options ( -Werror -Wall -Wextra -Winline -Winit-self -Wno-unused-function