Skip to content
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

Utilize all the cores when building and running tests #127

Merged
merged 2 commits into from
Sep 22, 2016
Merged
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
3 changes: 2 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@ ENDIF (NOT CLANG_URL)
set(CMAKE_MACOSX_RPATH 1)

IF (NOT NUM_BUILD_THREADS)
SET(NUM_BUILD_THREADS 8)
include(ProcessorCount)
ProcessorCount(NUM_BUILD_THREADS)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@pfultz2 Would it make sense if we separate this variable to 2:

  • NUM_BUILD_THREADS sets the number of cores used for building HCC
  • NUM_TEST_THREADS sets the number of cores used for testing HCC

To my empirical experience, setting NUM_BUILD_THREADS to number of available CPU cores "times 2" yields the best CPU utilization on my build cluster consisting of 3 x86 boxes.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yea, it already is two separate variables. The NUM_BUILD_THREADS does not affect the threads for testing. Right now, I just called the variable N, but it does make sense to rename it to NUM_TEST_THREADS.

ENDIF(NOT NUM_BUILD_THREADS)

include (EnsureLLVMisPresent)
Expand Down
5 changes: 4 additions & 1 deletion tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,11 @@ if(POLICY CMP0037)
cmake_policy(SET CMP0037 OLD)
endif()

include(ProcessorCount)
ProcessorCount(N)

add_custom_target(test
COMMAND python ${LLVM_ROOT}/bin/llvm-lit -j 8 --path ${LLVM_TOOLS_DIR} -sv ${CMAKE_CURRENT_BINARY_DIR}
COMMAND python ${LLVM_ROOT}/bin/llvm-lit -j ${N} --path ${LLVM_TOOLS_DIR} -sv ${CMAKE_CURRENT_BINARY_DIR}
# DEPENDS ${CPPAMP_GTEST_LIB}
COMMENT "Running HCC regression tests")

Expand Down