Skip to content
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
8 changes: 7 additions & 1 deletion build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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 --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"
VALIDARGS="clean libcuopt libmps_parser cuopt_mps_parser cuopt cuopt_server cuopt_sh_client docs deb -a -b -g -fsanitize -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)
Expand All @@ -44,6 +44,7 @@ HELP="$0 [<target> ...] [<flag> ...]
-g - build for debug
-a - Enable assertion (by default in debug mode)
-b - Build with benchmark settings
-fsanitize - Build with sanitizer
-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
Expand Down Expand Up @@ -85,6 +86,7 @@ BUILD_DISABLE_DEPRECATION_WARNING=ON
BUILD_ALL_GPU_ARCH=0
BUILD_CI_ONLY=0
BUILD_LP_ONLY=0
BUILD_SANITIZER=0
SKIP_C_PYTHON_ADAPTERS=0
SKIP_TESTS_BUILD=0
SKIP_ROUTING_BUILD=0
Expand Down Expand Up @@ -235,6 +237,9 @@ if hasArg --build-lp-only; then
BUILD_LP_ONLY=1
SKIP_ROUTING_BUILD=1 # Automatically skip routing when building LP-only
fi
if hasArg -fsanitize; then
BUILD_SANITIZER=1
fi
if hasArg --skip-c-python-adapters; then
SKIP_C_PYTHON_ADAPTERS=1
fi
Expand Down Expand Up @@ -345,6 +350,7 @@ if buildAll || hasArg libcuopt; then
-DCMAKE_BUILD_TYPE=${BUILD_TYPE} \
-DFETCH_RAPIDS=${FETCH_RAPIDS} \
-DBUILD_LP_ONLY=${BUILD_LP_ONLY} \
-DBUILD_SANITIZER=${BUILD_SANITIZER} \
-DSKIP_C_PYTHON_ADAPTERS=${SKIP_C_PYTHON_ADAPTERS} \
-DBUILD_TESTS=$((1 - ${SKIP_TESTS_BUILD})) \
-DSKIP_ROUTING_BUILD=${SKIP_ROUTING_BUILD} \
Expand Down
9 changes: 9 additions & 0 deletions cpp/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,15 @@ if(CMAKE_COMPILER_IS_GNUCXX)
list(APPEND CUOPT_CXX_FLAGS -Werror -Wno-error=deprecated-declarations)
endif(CMAKE_COMPILER_IS_GNUCXX)

# To use sanitizer with cuda runtime, one must follow a few steps:
# 1. Find libasan.so with "gcc -print-file-name=libasan.so"
# 2. Run the binary with env var set: LD_PRELOAD=$PATH_TO_LIBASAN ASAN_OPTIONS='protect_shadow_gap=0:replace_intrin=0'
# 3. (Optional) To run with a debugger (gdb or cuda-gdb) use the additional ASAN option alloc_dealloc_mismatch=0
if(BUILD_SANITIZER)
list(APPEND CUOPT_CXX_FLAGS -fsanitize=address,undefined -fno-omit-frame-pointer -g -Wno-error=maybe-uninitialized)
add_link_options(-fsanitize=address,undefined)
endif(BUILD_SANITIZER)

if(DEFINE_ASSERT)
add_definitions(-DASSERT_MODE)
endif(DEFINE_ASSERT)
Expand Down