Skip to content

Add more powerful running support #1

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
34 changes: 34 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
build

# Prerequisites
*.d

# Compiled Object files
*.slo
*.lo
*.o
*.obj

# Precompiled Headers
*.gch
*.pch

# Compiled Dynamic libraries
*.so
*.dylib
*.dll

# Fortran module files
*.mod
*.smod

# Compiled Static libraries
*.lai
*.la
# *.a
*.lib

# Executables
*.exe
*.out
*.app
58 changes: 58 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
cmake_minimum_required(VERSION 3.18)

project("dpc2sim" LANGUAGES C CXX)

set(CMAKE_EXPORT_COMPILE_COMMANDS ON)

set(CMAKE_CXX_STANDARD 17)

# set(CMAKE_BUILD_TYPE "Release")
set(CMAKE_BUILD_TYPE "Debug")

# ######################################################################################################################
# SET LOCAL OPTIONS
# ######################################################################################################################

if(CMAKE_BUILD_TYPE STREQUAL "Release")
add_compile_options(-O3)
else()
add_compile_options(-Og -g -Wall -Wextra)
add_compile_options(-fsanitize=address -fno-omit-frame-pointer)
add_link_options(-fsanitize=address -fno-omit-frame-pointer)
add_compile_definitions(DEBUG)
endif(CMAKE_BUILD_TYPE STREQUAL "Release")
add_compile_options(-Wno-unused-parameter)
add_link_options(-no-pie)

file(GLOB PREFETCHERS_CC example_prefetchers/*.cc)
file(GLOB TRACE_FILES traces/*.dpc.gz)

find_library(libdpc2sim dpc2sim ${CMAKE_SOURCE_DIR}/lib)
find_program(RUNNER runner.sh ${CMAKE_SOURCE_DIR})

add_custom_target(sim-all)

foreach(PREFETCHER IN LISTS PREFETCHERS_CC)
get_filename_component(PREFETCHER_NAME ${PREFETCHER} NAME_WLE)
string(REPLACE "_prefetcher" "" PREFETCHER_NAME ${PREFETCHER_NAME})
set(PREFETCHER_EXE "dpc2sim-${PREFETCHER_NAME}")

add_executable(${PREFETCHER_EXE} ${PREFETCHER} lib/dpc2sim.a)
target_link_libraries(${PREFETCHER_EXE} PRIVATE ${libdpc2sim})

add_custom_target(sim-${PREFETCHER_NAME})
add_dependencies(sim-all sim-${PREFETCHER_NAME})

foreach(TRACE IN LISTS TRACE_FILES)
get_filename_component(TRACE_NAME ${TRACE} NAME_WLE)
string(REPLACE "_trace2.dpc" "" TRACE_NAME ${TRACE_NAME})

add_custom_target(
sim-${PREFETCHER_NAME}-${TRACE_NAME}
${RUNNER} ${CMAKE_BINARY_DIR}/data ${PREFETCHER_NAME}-${TRACE_NAME} ${CMAKE_BINARY_DIR}/${PREFETCHER_EXE} ${TRACE}
DEPENDS ${RUNNER} ${PREFETCHER_EXE})
add_dependencies(sim-${PREFETCHER_NAME} sim-${PREFETCHER_NAME}-${TRACE_NAME})
endforeach()

endforeach()

Binary file added lib/libdpc2sim.a
Binary file not shown.
30 changes: 30 additions & 0 deletions runner.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
#!/bin/bash

if [ $# -ne 4 ]; then
echo $#
echo "Parameter not ok"
exit -1
fi

OUTPUT_DIR=$1
TEST_NAME=$2
PREFETCHER_EXE=$3
TRACE2_GZ=$4

if [ ! -d "$OUTPUT_DIR" ]; then
mkdir -p "$OUTPUT_DIR"
fi

if [ ! -f "$PREFETCHER_EXE" ]; then
echo "$PREFETCHER_EXE does not exist."
exit -1
fi

if [ ! -f "$TRACE2_GZ" ]; then
echo "$TRACE2_GZ does not exist."
exit -1
fi

LOG_NAME=$TEST_NAME-$(date +%Y%m%d%H%M%S).log

script $OUTPUT_DIR/$LOG_NAME -c "zcat $TRACE2_GZ | $PREFETCHER_EXE"