Skip to content

Commit e5a0650

Browse files
Fixed Make Being Called With Multiple Threads
CMake was calling another Make command, but was explicitly passing the number of threads to use. Make files should not pass the number of threads to use since it may cause more threads to be consumed than what the user intended. For example, if the user used `make -j10`, the parent make would use 10 threads, and the child make would also use 10 threads; but this is not what the user wanted. I think CMake recognized this and was suppressing this behaviour anyways. I believe that CMake will pass the number of threads for the child make to use anyways, but in a way that would prevent the above issue. Removed the ability to set the number of threads for Yosys builds to handle the warning.
1 parent eb4968a commit e5a0650

File tree

2 files changed

+9
-7
lines changed

2 files changed

+9
-7
lines changed

CMakeLists.txt

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -418,11 +418,13 @@ if(${WITH_PARMYS}) # define cmake params to compile Yosys
418418
set(MAKE_PROGRAM "make")
419419
endif()
420420

421-
if(NOT DEFINED "${CMAKE_BUILD_PARALLEL_LEVEL}")
422-
set(CUSTOM_BUILD_PARALLEL_LEVEL 16)
423-
else()
424-
set(CUSTOM_BUILD_PARALLEL_LEVEL "${CMAKE_BUILD_PARALLEL_LEVEL}")
425-
endif()
421+
# Commented out since a make file should not call another make command with
422+
# threads. It should pass this information from the parent automatically.
423+
# if(NOT DEFINED "${CMAKE_BUILD_PARALLEL_LEVEL}")
424+
# set(CUSTOM_BUILD_PARALLEL_LEVEL 16)
425+
# else()
426+
# set(CUSTOM_BUILD_PARALLEL_LEVEL "${CMAKE_BUILD_PARALLEL_LEVEL}")
427+
# endif()
426428
add_subdirectory(yosys)
427429
endif()
428430

yosys/CMakeLists.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ add_custom_command(OUTPUT yosys-bin
2020
# -C ${CMAKE_CURRENT_BINARY_DIR}
2121
# -f ${CMAKE_CURRENT_SOURCE_DIR}/Makefile #(out-of-tree) build directory
2222
PREFIX=${CMAKE_BINARY_DIR}
23-
-j${CUSTOM_BUILD_PARALLEL_LEVEL}
23+
# -j${CUSTOM_BUILD_PARALLEL_LEVEL}
2424
> /dev/null
2525

2626
COMMAND ${MAKE_PROGRAM} install ENABLE_ABC=0
@@ -43,4 +43,4 @@ add_custom_target(yosys ALL DEPENDS yosys-bin)
4343
# INTERFACE_INCLUDE_DIRECTORIES ${YOSYS_INCLUDE_DIRS})
4444

4545

46-
#install(FILES ${BINARY_LIB_FILE1} DESTINATION ${CMAKE_CURRENT_BINARY_DIR})
46+
#install(FILES ${BINARY_LIB_FILE1} DESTINATION ${CMAKE_CURRENT_BINARY_DIR})

0 commit comments

Comments
 (0)