-
Notifications
You must be signed in to change notification settings - Fork 113
Faster engine compile time #316
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
Changes from all commits
fa32ca4
4baece1
0e3191a
3a9bac7
7bc2ce4
2ad2c73
ec33c0f
33e9344
3a3e7c9
50e56b8
c241602
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -27,7 +27,7 @@ REPODIR=$(cd "$(dirname "$0")"; pwd) | |
| LIBCUOPT_BUILD_DIR=${LIBCUOPT_BUILD_DIR:=${REPODIR}/cpp/build} | ||
| LIBMPS_PARSER_BUILD_DIR=${LIBMPS_PARSER_BUILD_DIR:=${REPODIR}/cpp/libmps_parser/build} | ||
|
|
||
| VALIDARGS="clean libcuopt libmps_parser cuopt_mps_parser cuopt cuopt_server cuopt_sh_client docs deb -a -b -g -v -l= --verbose-pdlp [--cmake-args=\\\"<args>\\\"] [--cache-tool=<tool>] -n --allgpuarch --ci-only-arch --show_depr_warn -h --help" | ||
| VALIDARGS="clean libcuopt libmps_parser cuopt_mps_parser cuopt cuopt_server cuopt_sh_client docs deb -a -b -g -v -l= --verbose-pdlp --build-lp-only --no-fetch-rapids --skip-c-python-adapters --skip-tests-build --skip-routing-build --skip-fatbin-write [--cmake-args=\\\"<args>\\\"] [--cache-tool=<tool>] -n --allgpuarch --ci-only-arch --show_depr_warn -h --help" | ||
| HELP="$0 [<target> ...] [<flag> ...] | ||
| where <target> is: | ||
| clean - remove all existing build artifacts and configuration (start over) | ||
|
|
@@ -45,8 +45,14 @@ HELP="$0 [<target> ...] [<flag> ...] | |
| -a - Enable assertion (by default in debug mode) | ||
| -b - Build with benchmark settings | ||
| -n - no install step | ||
| --no-fetch-rapids - don't fetch rapids dependencies | ||
| -l= - log level. Options are: TRACE | DEBUG | INFO | WARN | ERROR | CRITICAL | OFF. Default=INFO | ||
| --verbose-pdlp - verbose mode for pdlp solver | ||
| --build-lp-only - build only linear programming components, excluding routing package and MIP-specific files | ||
| --skip-c-python-adapters - skip building C and Python adapter files (cython_solve.cu and cuopt_c.cpp) | ||
| --skip-tests-build - disable building of all tests | ||
| --skip-routing-build - skip building routing components | ||
| --skip-fatbin-write - skip the fatbin write | ||
| --cache-tool=<tool> - pass the build cache tool (eg: ccache, sccache, distcc) that will be used | ||
| to speedup the build process. | ||
| --cmake-args=\\\"<args>\\\" - pass arbitrary list of CMake configuration options (escape all quotes in argument) | ||
|
|
@@ -78,6 +84,11 @@ INSTALL_TARGET=install | |
| BUILD_DISABLE_DEPRECATION_WARNING=ON | ||
| BUILD_ALL_GPU_ARCH=0 | ||
| BUILD_CI_ONLY=0 | ||
| BUILD_LP_ONLY=0 | ||
| SKIP_C_PYTHON_ADAPTERS=0 | ||
| SKIP_TESTS_BUILD=0 | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Dow we need to add option to skip BUILD_MIP_BENCHMARKS
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think we can keep this for now and see if someone needs it |
||
| SKIP_ROUTING_BUILD=0 | ||
| WRITE_FATBIN=1 | ||
| CACHE_ARGS=() | ||
| PYTHON_ARGS_FOR_INSTALL=("-m" "pip" "install" "--no-build-isolation" "--no-deps") | ||
| LOGGING_ACTIVE_LEVEL="INFO" | ||
|
|
@@ -208,6 +219,9 @@ fi | |
| if hasArg -n; then | ||
| INSTALL_TARGET="" | ||
| fi | ||
| if hasArg --no-fetch-rapids; then | ||
| FETCH_RAPIDS=OFF | ||
| fi | ||
| if hasArg --allgpuarch; then | ||
| BUILD_ALL_GPU_ARCH=1 | ||
| fi | ||
|
|
@@ -217,6 +231,22 @@ fi | |
| if hasArg --show_depr_warn; then | ||
| BUILD_DISABLE_DEPRECATION_WARNING=OFF | ||
| fi | ||
| if hasArg --build-lp-only; then | ||
| BUILD_LP_ONLY=1 | ||
| SKIP_ROUTING_BUILD=1 # Automatically skip routing when building LP-only | ||
| fi | ||
| if hasArg --skip-c-python-adapters; then | ||
| SKIP_C_PYTHON_ADAPTERS=1 | ||
| fi | ||
| if hasArg --skip-tests-build; then | ||
| SKIP_TESTS_BUILD=1 | ||
| fi | ||
| if hasArg --skip-routing-build; then | ||
| SKIP_ROUTING_BUILD=1 | ||
| fi | ||
| if hasArg --skip-fatbin-write; then | ||
| WRITE_FATBIN=0 | ||
| fi | ||
|
|
||
| function contains_string { | ||
| local search_string="$1" | ||
|
|
@@ -264,6 +294,12 @@ if [ ${BUILD_CI_ONLY} -eq 1 ] && [ ${BUILD_ALL_GPU_ARCH} -eq 1 ]; then | |
| exit 1 | ||
| fi | ||
|
|
||
| if [ ${BUILD_LP_ONLY} -eq 1 ] && [ ${SKIP_C_PYTHON_ADAPTERS} -eq 0 ]; then | ||
| echo "ERROR: When using --build-lp-only, you must also specify --skip-c-python-adapters" | ||
| echo "The C and Python adapter files (cython_solve.cu and cuopt_c.cpp) are not compatible with LP-only builds" | ||
| exit 1 | ||
| fi | ||
|
|
||
| if [ ${BUILD_ALL_GPU_ARCH} -eq 1 ]; then | ||
| CUOPT_CMAKE_CUDA_ARCHITECTURES="RAPIDS" | ||
| echo "Building for *ALL* supported GPU architectures..." | ||
|
|
@@ -308,6 +344,12 @@ if buildAll || hasArg libcuopt; then | |
| -DDISABLE_DEPRECATION_WARNING=${BUILD_DISABLE_DEPRECATION_WARNING} \ | ||
| -DCMAKE_BUILD_TYPE=${BUILD_TYPE} \ | ||
| -DFETCH_RAPIDS=${FETCH_RAPIDS} \ | ||
| -DBUILD_LP_ONLY=${BUILD_LP_ONLY} \ | ||
| -DSKIP_C_PYTHON_ADAPTERS=${SKIP_C_PYTHON_ADAPTERS} \ | ||
| -DBUILD_TESTS=$((1 - ${SKIP_TESTS_BUILD})) \ | ||
| -DSKIP_ROUTING_BUILD=${SKIP_ROUTING_BUILD} \ | ||
| -DWRITE_FATBIN=${WRITE_FATBIN} \ | ||
| "${CACHE_ARGS[@]}" \ | ||
| "${EXTRA_CMAKE_ARGS[@]}" \ | ||
| "${REPODIR}"/cpp | ||
| if hasArg -n; then | ||
|
|
||
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -52,11 +52,19 @@ option(CMAKE_CUDA_LINEINFO "Enable the -lineinfo option for nvcc useful for cuda | |||||
| option(BUILD_TESTS "Configure CMake to build tests" ON) | ||||||
| option(DISABLE_OPENMP "Disable OpenMP" OFF) | ||||||
| option(CUDA_STATIC_RUNTIME "Statically link the CUDA toolkit runtime and libraries" OFF) | ||||||
| option(BUILD_LP_ONLY "Build only linear programming components, exclude routing and MIP-specific files" OFF) | ||||||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Missing BUILD_TESTS
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Build test is above. We had it already but it was not used and not working in practice
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Good catch for the BUILD_FATBIN! |
||||||
| option(SKIP_C_PYTHON_ADAPTERS "Skip building C and Python adapter files (cython_solve.cu and cuopt_c.cpp)" OFF) | ||||||
| option(SKIP_ROUTING_BUILD "Skip building routing components" OFF) | ||||||
| option(WRITE_FATBIN "Enable fatbin writing" ON) | ||||||
|
|
||||||
| message(VERBOSE "cuOpt: Enable nvcc -lineinfo: ${CMAKE_CUDA_LINEINFO}") | ||||||
| message(VERBOSE "cuOpt: Build cuOpt unit-tests: ${BUILD_TESTS}") | ||||||
| message(VERBOSE "cuOpt: Build cuOpt multigpu tests: ${BUILD_TESTS}") | ||||||
| message(VERBOSE "cuOpt: Disable OpenMP: ${DISABLE_OPENMP}") | ||||||
| message(VERBOSE "cuOpt: Build LP-only mode: ${BUILD_LP_ONLY}") | ||||||
| message(VERBOSE "cuOpt: Skip C/Python adapters: ${SKIP_C_PYTHON_ADAPTERS}") | ||||||
| message(VERBOSE "cuOpt: Skip routing build: ${SKIP_ROUTING_BUILD}") | ||||||
| message(VERBOSE "cuOpt: fatbin: ${WRITE_FATBIN}") | ||||||
|
|
||||||
| # ################################################################################################## | ||||||
| # - compiler options ------------------------------------------------------------------------------ | ||||||
|
|
@@ -209,15 +217,17 @@ target_compile_options(cuopt | |||||
| "$<$<COMPILE_LANGUAGE:CUDA>:${CUOPT_CUDA_FLAGS}>" | ||||||
| ) | ||||||
|
|
||||||
| file(WRITE "${CUOPT_BINARY_DIR}/fatbin.ld" | ||||||
| [=[ | ||||||
| SECTIONS | ||||||
| { | ||||||
| .nvFatBinSegment : { *(.nvFatBinSegment) } | ||||||
| .nv_fatbin : { *(.nv_fatbin) } | ||||||
| } | ||||||
| ]=]) | ||||||
| target_link_options(cuopt PRIVATE "${CUOPT_BINARY_DIR}/fatbin.ld") | ||||||
| if(WRITE_FATBIN) | ||||||
| file(WRITE "${CUOPT_BINARY_DIR}/fatbin.ld" | ||||||
| [=[ | ||||||
| SECTIONS | ||||||
| { | ||||||
| .nvFatBinSegment : { *(.nvFatBinSegment) } | ||||||
| .nv_fatbin : { *(.nv_fatbin) } | ||||||
| } | ||||||
| ]=]) | ||||||
| target_link_options(cuopt PRIVATE "${CUOPT_BINARY_DIR}/fatbin.ld") | ||||||
| endif() | ||||||
|
|
||||||
| add_library(cuopt::cuopt ALIAS cuopt) | ||||||
| # ################################################################################################## | ||||||
|
|
@@ -361,44 +371,63 @@ if(Doxygen_FOUND) | |||||
| endif() | ||||||
|
|
||||||
|
|
||||||
| add_executable(cuopt_cli cuopt_cli.cpp) | ||||||
| target_compile_options(cuopt_cli | ||||||
| PRIVATE "$<$<COMPILE_LANGUAGE:CXX>:${CUOPT_CXX_FLAGS}>" | ||||||
| "$<$<COMPILE_LANGUAGE:CUDA>:${CUOPT_CUDA_FLAGS}>" | ||||||
| ) | ||||||
| if(NOT BUILD_LP_ONLY) | ||||||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should this be
Suggested change
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. No I confirm we don't want to have cuopt_cli if we are in lp_only mode since there is a call to the MIP solver |
||||||
| add_executable(cuopt_cli cuopt_cli.cpp) | ||||||
| target_compile_options(cuopt_cli | ||||||
| PRIVATE "$<$<COMPILE_LANGUAGE:CXX>:${CUOPT_CXX_FLAGS}>" | ||||||
| "$<$<COMPILE_LANGUAGE:CUDA>:${CUOPT_CUDA_FLAGS}>" | ||||||
| ) | ||||||
|
|
||||||
| target_include_directories(cuopt_cli | ||||||
| PRIVATE | ||||||
| "${CMAKE_CURRENT_SOURCE_DIR}/src" | ||||||
| PUBLIC | ||||||
| "$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>" | ||||||
| "$<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}/include>" | ||||||
| "$<INSTALL_INTERFACE:include>" | ||||||
| ) | ||||||
| target_include_directories(cuopt_cli | ||||||
| PRIVATE | ||||||
| "${CMAKE_CURRENT_SOURCE_DIR}/src" | ||||||
| PUBLIC | ||||||
| "$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>" | ||||||
| "$<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}/include>" | ||||||
| "$<INSTALL_INTERFACE:include>" | ||||||
| ) | ||||||
|
|
||||||
| target_link_libraries(cuopt_cli | ||||||
| PUBLIC | ||||||
| cuopt | ||||||
| OpenMP::OpenMP_CXX | ||||||
| PRIVATE | ||||||
| papilo-core | ||||||
| ) | ||||||
| set_property(TARGET cuopt_cli PROPERTY INSTALL_RPATH "$ORIGIN/../${lib_dir}") | ||||||
| target_link_libraries(cuopt_cli | ||||||
| PUBLIC | ||||||
| cuopt | ||||||
| OpenMP::OpenMP_CXX | ||||||
| PRIVATE | ||||||
| papilo-core | ||||||
| ) | ||||||
| set_property(TARGET cuopt_cli PROPERTY INSTALL_RPATH "$ORIGIN/../${lib_dir}") | ||||||
|
|
||||||
| # adds the cuopt_cli executable to the runtime deb package | ||||||
| install(TARGETS cuopt_cli | ||||||
| COMPONENT runtime | ||||||
| RUNTIME DESTINATION ${_BIN_DEST} | ||||||
| ) | ||||||
| # adds the cuopt_cli executable to the runtime deb package | ||||||
| install(TARGETS cuopt_cli | ||||||
| COMPONENT runtime | ||||||
| RUNTIME DESTINATION ${_BIN_DEST} | ||||||
| ) | ||||||
| endif() | ||||||
|
|
||||||
|
|
||||||
| option(BUILD_MIP_BENCHMARKS "Build MIP benchmarks" OFF) | ||||||
| if(BUILD_MIP_BENCHMARKS AND NOT BUILD_LP_ONLY) | ||||||
| add_executable(solve_MIP ../benchmarks/linear_programming/cuopt/run_mip.cpp) | ||||||
| target_compile_options(solve_MIP | ||||||
| PRIVATE "$<$<COMPILE_LANGUAGE:CXX>:${CUOPT_CXX_FLAGS}>" | ||||||
| "$<$<COMPILE_LANGUAGE:CUDA>:${CUOPT_CUDA_FLAGS}>" | ||||||
| ) | ||||||
| target_link_libraries(solve_MIP | ||||||
| PUBLIC | ||||||
| cuopt | ||||||
| OpenMP::OpenMP_CXX | ||||||
| PRIVATE | ||||||
| papilo-core | ||||||
| ) | ||||||
| endif() | ||||||
|
|
||||||
| option(BUILD_BENCHMARKS "Build benchmarks" ON) | ||||||
| if(BUILD_BENCHMARKS) | ||||||
| add_executable(solve_MPS_file ../benchmarks/linear_programming/cuopt/run_mip.cpp) | ||||||
| target_compile_options(solve_MPS_file | ||||||
| option(BUILD_LP_BENCHMARKS "Build LP benchmarks" OFF) | ||||||
| if(BUILD_LP_BENCHMARKS) | ||||||
| add_executable(solve_LP ../benchmarks/linear_programming/cuopt/run_pdlp.cu) | ||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. For benchmarking, I think we should directly use the cuopt_cli, because that's what everyone will use
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The issue I have is run_pdlp has more options that cuopt_cli |
||||||
| target_compile_options(solve_LP | ||||||
| PRIVATE "$<$<COMPILE_LANGUAGE:CXX>:${CUOPT_CXX_FLAGS}>" | ||||||
| "$<$<COMPILE_LANGUAGE:CUDA>:${CUOPT_CUDA_FLAGS}>" | ||||||
| ) | ||||||
| target_link_libraries(solve_MPS_file | ||||||
| target_link_libraries(solve_LP | ||||||
| PUBLIC | ||||||
| cuopt | ||||||
| OpenMP::OpenMP_CXX | ||||||
|
|
||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -84,15 +84,17 @@ target_compile_options(mps_parser | |
| PRIVATE "$<$<COMPILE_LANGUAGE:CXX>:${MPS_PARSER_CXX_FLAGS}>" | ||
| ) | ||
|
|
||
| file(WRITE "${MPS_PARSER_BINARY_DIR}/fatbin.ld" | ||
| [=[ | ||
| SECTIONS | ||
| { | ||
| .nvFatBinSegment : { *(.nvFatBinSegment) } | ||
| .nv_fatbin : { *(.nv_fatbin) } | ||
| } | ||
| ]=]) | ||
| target_link_options(mps_parser PRIVATE "${MPS_PARSER_BINARY_DIR}/fatbin.ld") | ||
| if(WRITE_FATBIN) | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Remove this always?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What do you mean? Remove the fatbin writing completly?
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think he is asking, by default currently this was disabled, so do we need to disable it by default might be the question. Think I also had asked this question.
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. And you have changed it if I am not wrong. |
||
| file(WRITE "${MPS_PARSER_BINARY_DIR}/fatbin.ld" | ||
| [=[ | ||
| SECTIONS | ||
| { | ||
| .nvFatBinSegment : { *(.nvFatBinSegment) } | ||
| .nv_fatbin : { *(.nv_fatbin) } | ||
| } | ||
| ]=]) | ||
| target_link_options(mps_parser PRIVATE "${MPS_PARSER_BINARY_DIR}/fatbin.ld") | ||
| endif() | ||
|
|
||
| add_library(cuopt::mps_parser ALIAS mps_parser) | ||
|
|
||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's start using cuopt_cli here? That's what Hans would be using as well.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same comment as below
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here, you are not using any of those additional settings/options from run_pdlp right? We can still use run_pdlp for when benchmarking with those settings.