Skip to content

Commit d7e1942

Browse files
authored
Merge pull request #139 from Flow-IPC/flow-106_gh-jobs-parallel
GitHub CI pipeline: Parallelize core build step for 2x+ decrease in build time. / Pulling in submodules: <flow: -same-> <ipc_shm+ipc_sal: Eliminate issue in CMake build of test/demo program which made it unreliable in a parallelized build.> / Eliminate issue in CMake build of test/demo programs which made them unreliable in a parallelized build.
2 parents 3ec1925 + 9143b52 commit d7e1942

File tree

7 files changed

+30
-12
lines changed

7 files changed

+30
-12
lines changed

conanfile.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
# permissions and limitations under the License.
1717

1818
from conan import ConanFile
19+
from conan.tools.build import build_jobs
1920
from conan.tools.cmake import CMake, cmake_layout, CMakeDeps, CMakeToolchain
2021

2122
def load_version_from_file(version_path): # Now takes version_path as an argument
@@ -124,11 +125,11 @@ def build(self):
124125

125126
# Cannot use cmake.build(...) because not possible to pass make arguments like --keep-going.
126127
if self.options.build:
127-
self.run("cmake --build . -- --keep-going VERBOSE=1")
128+
self.run(f"cmake --build . -- --keep-going VERBOSE=1 -j{build_jobs(self)}")
128129
if self.options.doc:
129130
# Note: `flow_doc_public flow_doc_full` could also be added here and work; however
130131
# we leave that to `flow` and its own Conan setup.
131-
self.run("cmake --build . -- ipc_doc_public ipc_doc_full --keep-going VERBOSE=1")
132+
self.run(f"cmake --build . -- ipc_doc_public ipc_doc_full --keep-going VERBOSE=1 -j{build_jobs(self)}")
132133

133134
def requirements(self):
134135
if self.options.build:

flow

Submodule flow updated 1089 files

ipc_shm

ipc_shm_arena_lend

test/suite/perf_demo/CMakeLists.txt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,9 @@ find_package(CapnProto CONFIG REQUIRED)
2121
set(CAPNPC_IMPORT_DIRS ${FLOW_LIKE_META_ROOT_ipc_transport_structured}/src)
2222
capnp_generate_cpp(capnp_generated_srcs capnp_generated_hdrs_ignored "schema.capnp")
2323

24+
# Create a custom target that depends on the generated files.
25+
add_custom_target(perf_demo_schema_generation DEPENDS ${capnp_generated_srcs} ${capnp_generated_hdrs})
26+
2427
function(handle_binary name_sh jem_else_classic)
2528
if(jem_else_classic)
2629
set(name_pfx "shm_jemalloc")
@@ -32,6 +35,9 @@ function(handle_binary name_sh jem_else_classic)
3235
set(name "perf_demo_${name_sh}_${name_pfx}.exec") # Must match common.cpp constant values.
3336
add_executable(${name} common.cpp "main_${name_sh}.cpp" ${capnp_generated_srcs})
3437

38+
# Add explicit dependency on schema generation; otherwise things tend to go weird with a parallelized build.
39+
add_dependencies(${name} perf_demo_schema_generation)
40+
3541
target_include_directories(${name} PRIVATE ${CMAKE_CURRENT_BINARY_DIR})
3642
target_compile_definitions(${name} PRIVATE "JEM_ELSE_CLASSIC=${def_val}")
3743

test/suite/transport_test/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ find_package(CapnProto CONFIG REQUIRED)
2020

2121
# Test program: transport_test.
2222
# It's a compendium of tests and test tools for testing ipc::transport (including ipc::transport::struc)
23-
# and ipc::session. SHM modes are tested extensively.
23+
# and ipc::session. SHM modes are tested extensively.
2424
#
2525
# Please see ./README.txt.
2626

test/suite/unit_test/CMakeLists.txt

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -30,14 +30,25 @@ find_package(CapnProto CONFIG REQUIRED)
3030
# ipc/shm/arena_lend/jemalloc/test/shm_pool_collection_test. (TODO: Is that a copy/paste error or accurate?)
3131

3232
# Make those binaries in very similar ways; call this for each.
33-
function(handle_binary name) # Load SRCS and CAPNP_SCHEMAS before calling.
33+
function(handle_binary name_root) # Load SRCS and CAPNP_SCHEMAS before calling.
34+
set(name "${name_root}.exec")
35+
3436
if(CAPNP_SCHEMAS)
3537
set(CAPNPC_SRC_PREFIX ${isal_root})
36-
capnp_generate_cpp(capnp_generated_srcs capnp_generated_hdrs_ignored ${CAPNP_SCHEMAS})
38+
capnp_generate_cpp(capnp_generated_srcs capnp_generated_hdrs ${CAPNP_SCHEMAS})
39+
40+
# Create a custom target that depends on the generated files.
41+
add_custom_target(${name_root}_schema_generation
42+
DEPENDS ${capnp_generated_srcs} ${capnp_generated_hdrs})
3743
endif()
3844

3945
add_executable(${name} ${SRCS} ${capnp_generated_srcs})
4046

47+
if(CAPNP_SCHEMAS)
48+
# Add explicit dependency on schema generation; otherwise things tend to go weird with a parallelized build.
49+
add_dependencies(${name} ${name_root}_schema_generation)
50+
endif()
51+
4152
# Test header files are *not* exported for user to include; rather they exist only to be cross-included by
4253
# each other (namely the support files are). For that to work add the source dir(s) into the include-path.
4354
target_include_directories(${name} PRIVATE
@@ -47,7 +58,7 @@ function(handle_binary name) # Load SRCS and CAPNP_SCHEMAS before calling.
4758
${FLOW_LIKE_META_ROOT_ipc_session}/src
4859
${FLOW_LIKE_META_ROOT_ipc_shm}/src
4960
${isal_root}
50-
# So that generated-above .capnp.h are found by SRCS' .cpps' `#include`s.:
61+
# So that generated-above .capnp.h are found by SRCS' .cpps' `#include`s:
5162
${CMAKE_CURRENT_BINARY_DIR})
5263

5364
# Do stuff we've resolved to do on all our targets.
@@ -101,14 +112,14 @@ set(SRCS
101112
set(CAPNP_SCHEMAS
102113
${isal_root}/ipc/session/standalone/shm/arena_lend/jemalloc/test/test_message.capnp
103114
${isal_root}/ipc/session/standalone/shm/arena_lend/jemalloc/test/test_session_metadata.capnp)
104-
handle_binary(libipc_unit_test.exec)
115+
handle_binary(libipc_unit_test)
105116

106117
set(SRCS
107118
${FLOW_LIKE_META_ROOT_flow}/src/flow/test/test_common_util.cpp
108119
${isal_root}/ipc/shm/arena_lend/test/test_borrower.cpp
109120
test_borrower_main.cpp)
110121
unset(CAPNP_SCHEMAS)
111-
handle_binary(libipc_test_borrower.exec)
122+
handle_binary(libipc_test_borrower)
112123

113124
set(SRCS
114125
${FLOW_LIKE_META_ROOT_flow}/src/flow/test/test_common_util.cpp
@@ -121,4 +132,4 @@ set(SRCS
121132
set(CAPNP_SCHEMAS
122133
${isal_root}/ipc/session/standalone/shm/arena_lend/jemalloc/test/test_message.capnp
123134
${isal_root}/ipc/session/standalone/shm/arena_lend/jemalloc/test/test_session_metadata.capnp)
124-
handle_binary(libipc_test_jemalloc_shm_session_server.exec)
135+
handle_binary(libipc_test_jemalloc_shm_session_server)

0 commit comments

Comments
 (0)