-
-
Notifications
You must be signed in to change notification settings - Fork 160
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #178 from klimkin/feature/build-with-cmake
- Loading branch information
Showing
41 changed files
with
336 additions
and
391 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
cmake_minimum_required(VERSION 3.4) | ||
project(coz C CXX) | ||
|
||
enable_testing() | ||
|
||
set(CMAKE_CXX_STANDARD 11) | ||
set(CMAKE_CXX_STANDARD_REQUIRED ON) | ||
set(CONAN_CMAKE_SILENT_OUTPUT ON) | ||
|
||
list(APPEND CMAKE_MODULE_PATH ${PROJECT_BINARY_DIR} ${PROJECT_SOURCE_DIR}/cmake) | ||
|
||
find_package(Threads REQUIRED) | ||
find_package(libelfin REQUIRED) | ||
|
||
add_compile_options(-gdwarf-3) | ||
|
||
add_subdirectory(libcoz) | ||
|
||
option(BUILD_BENCHMARKS "Build benchmarks" OFF) | ||
if(BUILD_BENCHMARKS) | ||
if(NOT (CMAKE_BUILD_TYPE STREQUAL "Debug" OR CMAKE_BUILD_TYPE STREQUAL "RelWithDebInfo")) | ||
message(FATAL_ERROR "Build benchmarks with debug information - use Debug or RelWithDebInfo") | ||
endif() | ||
find_package(SQLite3 REQUIRED) | ||
find_package(BZip2 REQUIRED) | ||
add_subdirectory(benchmarks) | ||
endif() | ||
|
||
option(INSTALL_COZ "Enable installation of coz. (Projects embedding coz may want to turn this OFF.)" ON) | ||
if(INSTALL_COZ) | ||
include(GNUInstallDirs) | ||
install(PROGRAMS coz DESTINATION bin) | ||
install(FILES LICENSE.md DESTINATION licenses) | ||
install(FILES cmake/coz-profilerConfig.cmake DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake) | ||
endif() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
function(add_coz_run_target name) | ||
set(one_value_args "") | ||
set(multi_value_args COMMAND) | ||
set(options "") | ||
cmake_parse_arguments(COZ_RUN "${options}" "${one_value_args}" "${multi_value_args}" ${ARGN}) | ||
|
||
add_custom_target(${name} | ||
COMMENT "Running coz for ${name}" | ||
COMMAND ${PROJECT_SOURCE_DIR}/coz run --- ${COZ_RUN_COMMAND} | ||
WORKING_DIRECTORY ${PROJECT_BINARY_DIR} | ||
DEPENDS coz) | ||
endfunction() | ||
|
||
file(GLOB cmake_files */CMakeLists.txt) | ||
foreach(filepath ${cmake_files}) | ||
get_filename_component(dir ${filepath} DIRECTORY) | ||
add_subdirectory(${dir}) | ||
endforeach(filepath) |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
#!/bin/sh | ||
|
||
set -e | ||
rm -f profile.coz | ||
|
||
$@ | ||
|
||
grep -q "time=" profile.coz || { echo failure: valid profile.coz not generated; exit 1; } | ||
grep -q "throughput-point" profile.coz || { echo failure: throughput-point not found in profile; exit 1; } | ||
grep -q -P "samples\tlocation=" profile.coz || { echo failure: samples not found in profile; exit 1; } | ||
echo success: benchmark generated valid profile.coz |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
add_executable(histogram histogram-pthread.c) | ||
target_link_libraries(histogram PRIVATE coz-instrumentation pthread) | ||
|
||
add_custom_command( | ||
COMMENT "Downloading histogram inputs" | ||
OUTPUT | ||
histogram_datafiles/small.bmp | ||
histogram_datafiles/large.bmp | ||
COMMAND wget -cq http://csl.stanford.edu/~christos/data/histogram.tar.gz | ||
COMMAND tar xzf histogram.tar.gz) | ||
|
||
add_custom_target(histogram_datafiles | ||
DEPENDS | ||
histogram_datafiles/small.bmp | ||
histogram_datafiles/large.bmp) | ||
|
||
add_coz_run_target(run_histogram_large | ||
COMMAND $<TARGET_FILE:histogram> ${CMAKE_CURRENT_BINARY_DIR}/histogram_datafiles/large.bmp) | ||
add_dependencies(run_histogram_large histogram_datafiles) | ||
|
||
add_coz_run_target(run_histogram_small | ||
COMMAND $<TARGET_FILE:histogram> ${CMAKE_CURRENT_BINARY_DIR}/histogram_datafiles/small.bmp) | ||
add_dependencies(run_histogram_small histogram_datafiles) |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
add_executable(kmeans kmeans-pthread.c) | ||
target_link_libraries(kmeans PRIVATE coz-instrumentation pthread) | ||
|
||
add_coz_run_target(run_kmeans_small COMMAND $<TARGET_FILE:kmeans> -d 3 -c 100 -p 10000 -s 100) | ||
add_coz_run_target(run_kmeans_large COMMAND $<TARGET_FILE:kmeans> -d 3 -c 100 -p 100000 -s 1000) | ||
|
||
add_test( | ||
NAME test_run_kmeans | ||
COMMAND ${PROJECT_SOURCE_DIR}/benchmarks/check-output.sh ${PROJECT_SOURCE_DIR}/coz run --- $<TARGET_FILE:kmeans> | ||
WORKING_DIRECTORY ${PROJECT_BINARY_DIR}) |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
add_executable(linear_regression linear_regression-pthread.c) | ||
target_link_libraries(linear_regression PRIVATE coz-instrumentation pthread) | ||
|
||
add_custom_command( | ||
COMMENT "Downloading linear_regression inputs" | ||
OUTPUT | ||
linear_regression_datafiles/key_file_500MB.txt | ||
linear_regression_datafiles/key_file_50MB.txt | ||
COMMAND wget -cq http://csl.stanford.edu/~christos/data/linear_regression.tar.gz | ||
COMMAND tar xzf linear_regression.tar.gz) | ||
|
||
add_custom_target(linear_regression_datafiles | ||
DEPENDS | ||
linear_regression_datafiles/key_file_500MB.txt | ||
linear_regression_datafiles/key_file_50MB.txt) | ||
|
||
add_coz_run_target(run_linear_regression_large | ||
COMMAND $<TARGET_FILE:linear_regression> ${CMAKE_CURRENT_BINARY_DIR}/linear_regression_datafiles/key_file_500MB.txt) | ||
add_dependencies(run_linear_regression_large linear_regression_datafiles) | ||
|
||
add_coz_run_target(run_linear_regression_small | ||
COMMAND $<TARGET_FILE:linear_regression> ${CMAKE_CURRENT_BINARY_DIR}/linear_regression_datafiles/key_file_50MB.txt) | ||
add_dependencies(run_linear_regression_small linear_regression_datafiles) |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
add_executable(matrix_multiply matrix_multiply-pthread.c) | ||
target_link_libraries(matrix_multiply PRIVATE coz-instrumentation pthread) | ||
target_compile_options(matrix_multiply PRIVATE -Wno-format) | ||
|
||
add_custom_command( | ||
COMMENT "Generating bench input" | ||
OUTPUT ${PROJECT_BINARY_DIR}/matrix_file_A_1000.txt ${PROJECT_BINARY_DIR}/matrix_file_B_1000.txt | ||
BYPRODUCTS ${PROJECT_BINARY_DIR}/matrix_file_out_pthreads_1000.txt | ||
COMMAND ${CMAKE_CURRENT_BINARY_DIR}/matrix_multiply 1000 -create_files > /dev/null | ||
WORKING_DIRECTORY ${PROJECT_BINARY_DIR} | ||
DEPENDS matrix_multiply) | ||
add_custom_target(matrix_multiply_large_datafiles | ||
DEPENDS ${PROJECT_BINARY_DIR}/matrix_file_A_1000.txt ${PROJECT_BINARY_DIR}/matrix_file_B_1000.txt) | ||
|
||
add_custom_command( | ||
COMMENT "Generating test input" | ||
OUTPUT ${PROJECT_BINARY_DIR}/matrix_file_A_400.txt ${PROJECT_BINARY_DIR}/matrix_file_B_400.txt | ||
BYPRODUCTS ${PROJECT_BINARY_DIR}/matrix_file_out_pthreads_400.txt | ||
COMMAND ${CMAKE_CURRENT_BINARY_DIR}/matrix_multiply 400 -create_files > /dev/null | ||
WORKING_DIRECTORY ${PROJECT_BINARY_DIR} | ||
DEPENDS matrix_multiply) | ||
add_custom_target(matrix_multiply_small_datafiles | ||
DEPENDS ${PROJECT_BINARY_DIR}/matrix_file_A_400.txt ${PROJECT_BINARY_DIR}/matrix_file_B_400.txt) | ||
|
||
add_coz_run_target(run_matrix_multiply_large | ||
COMMAND $<TARGET_FILE:matrix_multiply> 1000 > /dev/null) | ||
add_dependencies(run_matrix_multiply_large matrix_multiply_large_datafiles) | ||
|
||
add_coz_run_target(run_matrix_multiply_small | ||
COMMAND $<TARGET_FILE:matrix_multiply> 400 > /dev/null) | ||
add_dependencies(run_matrix_multiply_small matrix_multiply_small_datafiles) |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
add_executable(pbzip2 BZ2StreamScanner.cpp ErrorContext.cpp pbzip2.cpp) | ||
target_link_libraries(pbzip2 PRIVATE BZip2::BZip2 coz-instrumentation pthread) | ||
target_compile_options(pbzip2 PRIVATE -Wno-format) | ||
|
||
set(datafiles ${CMAKE_CURRENT_BINARY_DIR}/../linear_regression/linear_regression_datafiles) | ||
|
||
add_coz_run_target(run_pbzip2_large | ||
COMMAND $<TARGET_FILE:pbzip2> -c < ${datafiles}/key_file_500MB.txt > ${CMAKE_CURRENT_BINARY_DIR}/key_file_500MB_compressed.bz2) | ||
add_dependencies(run_pbzip2_large linear_regression_datafiles) | ||
|
||
add_coz_run_target(run_pbzip2_small | ||
COMMAND $<TARGET_FILE:pbzip2> -c < ${datafiles}/key_file_50MB.txt > ${CMAKE_CURRENT_BINARY_DIR}/key_file_50MB_compressed.bz2) | ||
add_dependencies(run_pbzip2_small linear_regression_datafiles) | ||
|
Oops, something went wrong.