Skip to content
Closed
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
2 changes: 1 addition & 1 deletion benchmarks/linear_programming/utils/get_datasets.py
Original file line number Diff line number Diff line change
Expand Up @@ -693,7 +693,7 @@ def extract(file, dir, type):
raise Exception(f"Unknown file extension found for extraction {file}")
# download emps and compile
# Disable emps for now
if type == "netlib":
if type == "netlib" and False:
url = MittelmannInstances["emps"]
file = os.path.join(dir, "emps.c")
download(url, file)
Expand Down
112 changes: 112 additions & 0 deletions cpp/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,27 @@ create_logger_macros(CUOPT "cuopt::default_logger()" include/cuopt)

find_package(CUDSS REQUIRED)

# Find Protocol Buffers for remote solve support
find_package(Protobuf REQUIRED)
Copy link
Collaborator

Choose a reason for hiding this comment

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

We may need to add protobuf requirement to both cli and library in dependecies.yaml, conda/receipe/libcuopt

include_directories(${Protobuf_INCLUDE_DIRS})
include_directories(${CMAKE_CURRENT_BINARY_DIR})

# Generate C++ code from .proto file
set(PROTO_FILE "${CMAKE_CURRENT_SOURCE_DIR}/src/linear_programming/utilities/cuopt_remote.proto")
set(PROTO_SRCS "${CMAKE_CURRENT_BINARY_DIR}/cuopt_remote.pb.cc")
set(PROTO_HDRS "${CMAKE_CURRENT_BINARY_DIR}/cuopt_remote.pb.h")

add_custom_command(
OUTPUT "${PROTO_SRCS}" "${PROTO_HDRS}"
COMMAND ${Protobuf_PROTOC_EXECUTABLE}
ARGS --cpp_out ${CMAKE_CURRENT_BINARY_DIR}
--proto_path ${CMAKE_CURRENT_SOURCE_DIR}/src/linear_programming/utilities
${PROTO_FILE}
DEPENDS ${PROTO_FILE}
COMMENT "Generating C++ code from cuopt_remote.proto"
VERBATIM
)

if(BUILD_TESTS)
include(cmake/thirdparty/get_gtest.cmake)
endif()
Expand All @@ -219,6 +240,7 @@ if (HOST_LINEINFO)
endif()
add_library(cuopt SHARED
${CUOPT_SRC_FILES}
${PROTO_SRCS}
)

set_target_properties(cuopt
Expand Down Expand Up @@ -317,6 +339,7 @@ target_link_libraries(cuopt
raft::raft
cuopt::mps_parser
${CUDSS_LIB_FILE}
protobuf::libprotobuf
PRIVATE
${CUOPT_PRIVATE_CUDA_LIBS}
)
Expand Down Expand Up @@ -449,6 +472,95 @@ install(TARGETS cuopt_cli
COMPONENT runtime
RUNTIME DESTINATION ${_BIN_DEST}
)

# Remote solve server executable (synchronous)
add_executable(cuopt_remote_server cuopt_remote_server.cpp)
target_compile_options(cuopt_remote_server
PRIVATE "$<$<COMPILE_LANGUAGE:CXX>:${CUOPT_CXX_FLAGS}>"
)

target_include_directories(cuopt_remote_server
PRIVATE
"${CMAKE_CURRENT_SOURCE_DIR}/src"
PUBLIC
"$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>"
"$<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}/include>"
${CUDSS_INCLUDE}
"$<INSTALL_INTERFACE:include>"
)

target_link_libraries(cuopt_remote_server
PUBLIC
cuopt
OpenMP::OpenMP_CXX
${CUDSS_LIBRARIES}
PRIVATE
)
set_property(TARGET cuopt_remote_server PROPERTY INSTALL_RPATH "$ORIGIN/../${lib_dir}")

# Install the remote server
install(TARGETS cuopt_remote_server
COMPONENT runtime
RUNTIME DESTINATION ${_BIN_DEST}
)

# Async remote solve server executable
add_executable(cuopt_async_server cuopt_async_server.cpp ${PROTO_SRCS})
target_compile_options(cuopt_async_server
PRIVATE "$<$<COMPILE_LANGUAGE:CXX>:${CUOPT_CXX_FLAGS}>"
)

target_include_directories(cuopt_async_server
PRIVATE
"${CMAKE_CURRENT_SOURCE_DIR}/src"
PUBLIC
"$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>"
"$<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}/include>"
${CUDSS_INCLUDE}
"$<INSTALL_INTERFACE:include>"
)

target_link_libraries(cuopt_async_server
PUBLIC
OpenMP::OpenMP_CXX
protobuf::libprotobuf
rt
PRIVATE
)
set_property(TARGET cuopt_async_server PROPERTY INSTALL_RPATH "$ORIGIN/../${lib_dir}")

# Solver worker process
add_executable(cuopt_solver_worker cuopt_solver_worker.cpp ${PROTO_SRCS})
target_compile_options(cuopt_solver_worker
PRIVATE "$<$<COMPILE_LANGUAGE:CXX>:${CUOPT_CXX_FLAGS}>"
)

target_include_directories(cuopt_solver_worker
PRIVATE
"${CMAKE_CURRENT_SOURCE_DIR}/src"
PUBLIC
"$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>"
"$<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}/include>"
${CUDSS_INCLUDE}
"$<INSTALL_INTERFACE:include>"
)

target_link_libraries(cuopt_solver_worker
PUBLIC
cuopt
OpenMP::OpenMP_CXX
${CUDSS_LIBRARIES}
protobuf::libprotobuf
rt
PRIVATE
)
set_property(TARGET cuopt_solver_worker PROPERTY INSTALL_RPATH "$ORIGIN/../${lib_dir}")

# Install async server and worker
install(TARGETS cuopt_async_server cuopt_solver_worker
COMPONENT runtime
RUNTIME DESTINATION ${_BIN_DEST}
)
endif()


Expand Down
Loading
Loading