Skip to content

Commit e71c533

Browse files
authored
Use cmake to build scoreboard (#303)
- Adjust CMake implementation to be able to build without USE_<MPI/OMP/STL/TBB> - Use CMake to build scoreboard instead of running Python script directly
1 parent 98be298 commit e71c533

File tree

9 files changed

+60
-4
lines changed

9 files changed

+60
-4
lines changed

.github/workflows/pages.yml

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,14 +51,17 @@ jobs:
5151
- name: Install dependencies
5252
run: |
5353
python3 -m pip install -r requirements.txt
54-
- name: Build scoreboard
54+
- name: CMake configure
5555
run: |
56-
python3 scoreboard/main.py
56+
cmake -S . -B build -DUSE_SCOREBOARD=ON
57+
- name: CMake build
58+
run: |
59+
cmake --build build --parallel
5760
- name: Upload artifact
5861
uses: actions/upload-artifact@v4
5962
with:
6063
name: scoreboard
61-
path: ./scoreboard/
64+
path: ./build/scoreboard/html/
6265
deploy-pages:
6366
if: github.ref == 'refs/heads/master'
6467
needs:

CMakeLists.txt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,12 @@ message( STATUS "PPC step: Setup external projects" )
2424
include(cmake/opencv.cmake)
2525
include(cmake/gtest.cmake)
2626

27+
############################ Scoreboard #############################
28+
29+
message( STATUS "PPC step: Setup scoreboard generator" )
30+
include(cmake/scoreboard.cmake)
31+
add_subdirectory(scoreboard)
32+
2733
############################## Headers ##############################
2834

2935
message( STATUS "PPC step: Setup headers" )

cmake/boost.cmake

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,9 @@
11
# Build Core Boost components
2+
3+
if(NOT USE_SEQ AND NOT USE_MPI AND NOT USE_OMP AND NOT USE_TBB AND NOT USE_STL)
4+
return()
5+
endif()
6+
27
SUBDIRLIST(subdirs ${CMAKE_SOURCE_DIR}/3rdparty/boost/libs)
38
foreach(subd ${subdirs})
49
include_directories(${CMAKE_SOURCE_DIR}/3rdparty/boost/libs/${subd}/include)

cmake/gtest.cmake

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
11
# Build googletest components
2+
if(NOT USE_SEQ AND NOT USE_MPI AND NOT USE_OMP AND NOT USE_TBB AND NOT USE_STL)
3+
return()
4+
endif()
5+
26
include_directories(${CMAKE_SOURCE_DIR}/3rdparty/googletest/googletest/include)
37
include(ExternalProject)
48
ExternalProject_Add(ppc_googletest

cmake/opencv.cmake

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
# Build OpenCV components
22
# core highgui imgcodecs imgproc videoio
3+
4+
if(NOT USE_SEQ AND NOT USE_MPI AND NOT USE_OMP AND NOT USE_TBB AND NOT USE_STL)
5+
return()
6+
endif()
7+
38
include(ExternalProject)
49
include_directories(${CMAKE_SOURCE_DIR}/3rdparty/opencv/include)
510
if(WIN32)

cmake/scoreboard.cmake

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
option(USE_SCOREBOARD OFF)
2+
if( USE_SCOREBOARD )
3+
find_package(Python REQUIRED
4+
COMPONENTS Interpreter)
5+
endif( USE_SCOREBOARD )

modules/CMakeLists.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
if(NOT USE_SEQ AND NOT USE_MPI AND NOT USE_OMP AND NOT USE_TBB AND NOT USE_STL)
2+
return()
3+
endif()
4+
15
message(STATUS "Modules")
26

37
SUBDIRLIST(subdirs ${CMAKE_CURRENT_SOURCE_DIR})

scoreboard/CMakeLists.txt

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
if (NOT USE_SCOREBOARD)
2+
return()
3+
endif()
4+
5+
file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/html)
6+
set(OUTPUT_DIR ${CMAKE_CURRENT_BINARY_DIR}/html)
7+
8+
add_custom_target(generate_scoreboard ALL
9+
COMMAND ${Python_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/main.py -o ${OUTPUT_DIR}
10+
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
11+
COMMENT "Running main.py"
12+
)
13+
14+
add_custom_command(TARGET generate_scoreboard POST_BUILD
15+
COMMAND ${CMAKE_COMMAND} -E copy_directory
16+
${CMAKE_CURRENT_SOURCE_DIR}/static
17+
${OUTPUT_DIR}/static
18+
COMMENT "Copying static directory to binary directory"
19+
)

scoreboard/main.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
from pathlib import Path
22
from collections import defaultdict
3+
import argparse
34

45
task_types = ['all', 'mpi', 'omp', 'seq', 'stl', 'tbb']
56

@@ -76,7 +77,11 @@
7677
</html>
7778
"""
7879

79-
output_file = Path('scoreboard/index.html')
80+
parser = argparse.ArgumentParser(description='Generate HTML scoreboard.')
81+
parser.add_argument('-o', '--output', type=str, required=True, help='Output file path')
82+
args = parser.parse_args()
83+
84+
output_file = Path(args.output) / "index.html"
8085
with open(output_file, 'w') as file:
8186
file.write(html_content)
8287

0 commit comments

Comments
 (0)