Skip to content
Open
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
43 changes: 1 addition & 42 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -93,47 +93,7 @@ jobs:
branch: ${{ inputs.branch }}
date: ${{ inputs.date }}
sha: ${{ inputs.sha }}
wheel-build-cuopt-mps-parser:
permissions:
actions: read
contents: read
id-token: write
packages: read
pull-requests: read
secrets: inherit # zizmor: ignore[secrets-inherit]
uses: rapidsai/shared-workflows/.github/workflows/wheels-build.yaml@cuda-13.2.0
with:
build_type: ${{ inputs.build_type || 'branch' }}
branch: ${{ inputs.branch }}
sha: ${{ inputs.sha }}
date: ${{ inputs.date }}
script: ci/build_wheel_cuopt_mps_parser.sh
package-name: cuopt_mps_parser
package-type: python
append-cuda-suffix: false
# need 1 build per Python version and arch (but CUDA version doesn't matter so choose the latest)
matrix_filter: 'group_by([.ARCH, (.PY_VER |split(".") | map(tonumber))])|map(max_by([(.CUDA_VER|split(".")|map(tonumber))]))'
wheel-publish-cuopt-mps-parser:
needs: wheel-build-cuopt-mps-parser
permissions:
actions: read
contents: read
id-token: write
packages: read
pull-requests: read
uses: rapidsai/shared-workflows/.github/workflows/wheels-publish.yaml@cuda-13.2.0
secrets:
CONDA_RAPIDSAI_WHEELS_NIGHTLY_TOKEN: ${{ secrets.CONDA_RAPIDSAI_WHEELS_NIGHTLY_TOKEN }}
RAPIDSAI_PYPI_TOKEN: ${{ secrets.RAPIDSAI_PYPI_TOKEN }}
with:
build_type: ${{ inputs.build_type || 'branch' }}
branch: ${{ inputs.branch }}
sha: ${{ inputs.sha }}
date: ${{ inputs.date }}
package-name: cuopt_mps_parser
package-type: python
wheel-build-libcuopt:
needs: wheel-build-cuopt-mps-parser
permissions:
actions: read
contents: read
Expand Down Expand Up @@ -171,7 +131,7 @@ jobs:
package-name: libcuopt
package-type: cpp
wheel-build-cuopt:
needs: [wheel-build-cuopt-mps-parser, wheel-build-libcuopt]
needs: [wheel-build-libcuopt]
permissions:
actions: read
contents: read
Expand Down Expand Up @@ -313,7 +273,6 @@ jobs:
needs:
- upload-conda
- wheel-publish-cuopt
- wheel-publish-cuopt-mps-parser
- wheel-publish-cuopt-server
- wheel-publish-cuopt-sh-client
- wheel-publish-libcuopt
Expand Down
30 changes: 3 additions & 27 deletions .github/workflows/pr.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ jobs:
- wheel-tests-cuopt
- wheel-build-cuopt-server
- wheel-tests-cuopt-server
- wheel-build-cuopt-mps-parser
- wheel-build-cuopt-sh-client
- test-self-hosted-server
permissions:
Expand Down Expand Up @@ -95,7 +94,6 @@ jobs:
conda_lean_filter: ${{ steps.set-filters.outputs.conda_lean_filter }}
conda_test_filter: ${{ steps.set-filters.outputs.conda_test_filter }}
wheel_lean_filter: ${{ steps.set-filters.outputs.wheel_lean_filter }}
mps_parser_filter: ${{ steps.set-filters.outputs.mps_parser_filter }}
libcuopt_filter: ${{ steps.set-filters.outputs.libcuopt_filter }}
cuopt_server_filter: ${{ steps.set-filters.outputs.cuopt_server_filter }}
cuopt_sh_client_filter: ${{ steps.set-filters.outputs.cuopt_sh_client_filter }}
Expand All @@ -109,15 +107,13 @@ jobs:
echo "conda_lean_filter=[map(select(.ARCH == \"amd64\" and .PY_VER == \"3.11\")) | max_by(.CUDA_VER | split(\".\") | map(tonumber))]" >> $GITHUB_OUTPUT
echo "conda_test_filter=[map(select(.ARCH == \"amd64\" and .PY_VER == \"3.13\")) | max_by(.CUDA_VER | split(\".\") | map(tonumber))]" >> $GITHUB_OUTPUT
echo "wheel_lean_filter=[map(select(.ARCH == \"amd64\" and .PY_VER == \"3.12\")) | max_by(.CUDA_VER | split(\".\") | map(tonumber))]" >> $GITHUB_OUTPUT
echo "mps_parser_filter=[map(select(.ARCH == \"amd64\" and .PY_VER == \"3.12\")) | max_by(.CUDA_VER | split(\".\") | map(tonumber))]" >> $GITHUB_OUTPUT
echo "libcuopt_filter=[map(select(.ARCH == \"amd64\" and .PY_VER == \"3.12\")) | max_by(.CUDA_VER | split(\".\") | map(tonumber))]" >> $GITHUB_OUTPUT
echo "cuopt_server_filter=[map(select(.ARCH == \"amd64\" and .PY_VER == \"3.12\")) | max_by(.CUDA_VER | split(\".\") | map(tonumber))]" >> $GITHUB_OUTPUT
echo "cuopt_sh_client_filter=[map(select(.ARCH == \"amd64\" and .PY_VER == \"3.12\")) | max_by(.CUDA_VER | split(\".\") | map(tonumber))]" >> $GITHUB_OUTPUT
else
echo "conda_lean_filter=." >> $GITHUB_OUTPUT
echo "conda_test_filter=." >> $GITHUB_OUTPUT
echo "wheel_lean_filter=." >> $GITHUB_OUTPUT
echo "mps_parser_filter=group_by([.ARCH, (.PY_VER |split(\".\") | map(tonumber))])|map(max_by([(.CUDA_VER|split(\".\")|map(tonumber))]))" >> $GITHUB_OUTPUT
echo "libcuopt_filter=group_by([.ARCH, (.CUDA_VER|split(\".\")|map(tonumber)|.[0])]) | map(max_by(.PY_VER|split(\".\")|map(tonumber)))" >> $GITHUB_OUTPUT
echo "cuopt_server_filter=map(select(.ARCH == \"amd64\")) | group_by(.CUDA_VER|split(\".\")|map(tonumber)|.[0]) | map(max_by([(.PY_VER|split(\".\")|map(tonumber)), (.CUDA_VER|split(\".\")|map(tonumber))]))" >> $GITHUB_OUTPUT
echo "cuopt_sh_client_filter=[map(select(.ARCH == \"amd64\")) | min_by((.PY_VER | split(\".\") | map(tonumber)), (.CUDA_VER | split(\".\") | map(-tonumber)))]" >> $GITHUB_OUTPUT
Expand Down Expand Up @@ -477,28 +473,8 @@ jobs:
artifact-name: "cuopt_docs"
container_image: "rapidsai/ci-conda:26.06-latest"
script: "ci/build_docs.sh"
wheel-build-cuopt-mps-parser:
needs: [compute-matrix-filters, changed-files]
# All wheel-build-* jobs feed the wheel test jobs, so they gate on the same group.
if: fromJSON(needs.changed-files.outputs.changed_file_groups).test_python_wheels
permissions:
actions: read
contents: read
id-token: write
packages: read
pull-requests: read
secrets: inherit # zizmor: ignore[secrets-inherit]
uses: rapidsai/shared-workflows/.github/workflows/wheels-build.yaml@cuda-13.2.0
with:
build_type: pull-request
script: ci/build_wheel_cuopt_mps_parser.sh
package-name: cuopt_mps_parser
package-type: python
append-cuda-suffix: false
# need 1 build per Python version and arch (but CUDA version doesn't matter so choose the latest)
matrix_filter: ${{ needs.compute-matrix-filters.outputs.mps_parser_filter }}
wheel-build-libcuopt:
needs: [wheel-build-cuopt-mps-parser, compute-matrix-filters, changed-files]
needs: [compute-matrix-filters, changed-files]
if: fromJSON(needs.changed-files.outputs.changed_file_groups).test_python_wheels
permissions:
actions: read
Expand All @@ -516,7 +492,7 @@ jobs:
build_type: pull-request
script: ci/build_wheel_libcuopt.sh
wheel-build-cuopt:
needs: [wheel-build-cuopt-mps-parser, wheel-build-libcuopt, compute-matrix-filters, changed-files]
needs: [wheel-build-libcuopt, compute-matrix-filters, changed-files]
if: fromJSON(needs.changed-files.outputs.changed_file_groups).test_python_wheels
permissions:
actions: read
Expand All @@ -533,7 +509,7 @@ jobs:
package-type: python
matrix_filter: ${{ needs.compute-matrix-filters.outputs.wheel_lean_filter }}
wheel-tests-cuopt:
needs: [wheel-build-cuopt, wheel-build-cuopt-mps-parser, wheel-build-cuopt-sh-client, changed-files, compute-matrix-filters]
needs: [wheel-build-cuopt, wheel-build-cuopt-sh-client, changed-files, compute-matrix-filters]
permissions:
actions: read
contents: read
Expand Down
11 changes: 5 additions & 6 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ conda activate ./.cuopt_env
pinnings are changed.

- A `build.sh` script is provided in `$CUOPT_HOME`. Running the script with no additional arguments
will install the `libmps_parser`, `libcuopt`, `cuopt_mps_parser`, `cuopt`, `cuopt-server`, `cuopt-sh-client` libraries and build the`documentation`. By default, the libraries are
will install the `libcuopt`, `cuopt`, `cuopt-server`, `cuopt-sh-client` libraries and build the`documentation`. By default, the libraries are
installed to the `$CONDA_PREFIX` directory. To install into a different location, set the location
in `$INSTALL_PREFIX`. Finally, note that the script depends on the `nvcc` executable being on your
path, or defined in `$CUDACXX`.
Expand All @@ -177,11 +177,10 @@ cd $CUOPT_HOME

# Choose one of the following commands, depending on whether
# you want to build and install the libcuopt C++ library only,
# or include the libcuopt and/or cuopt Python libraries:
# or include the cuopt Python libraries:

./build.sh # All the libraries
./build.sh libmps_parser # libmps_parser only
./build.sh libmps_parser libcuopt # libmps_parser and libcuopt only
./build.sh # All the libraries
./build.sh libcuopt # libcuopt C++ only
```

- For the complete list of libraries as well as details about the script usage, run the `help` command:
Expand All @@ -198,7 +197,7 @@ cd $CUOPT_HOME
This is only available to be built through source code and libcuopt is not being released as deb package in any official space.

```bash
./build.sh libmps_parser libcuopt deb
./build.sh libcuopt deb
```

#### Building for development
Expand Down
8 changes: 4 additions & 4 deletions benchmarks/linear_programming/cuopt/benchmark_helper.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@

#pragma once

#include <cuopt/linear_programming/io/parser.hpp>
#include <cuopt/linear_programming/optimization_problem_interface.hpp>
#include <cuopt/linear_programming/pdlp/pdlp_hyper_params.cuh>
#include <cuopt/linear_programming/pdlp/solver_solution.hpp>
#include <cuopt/linear_programming/solve.hpp>
#include <mps_parser/parser.hpp>

#include <raft/sparse/detail/cusparse_wrappers.h>
#include <raft/core/cusparse_macros.hpp>
Expand Down Expand Up @@ -205,7 +205,7 @@ std::vector<T> read_vector_from_file(const std::string& filename)
}

template <typename i_t, typename f_t>
void write_problem_info(const cuopt::mps_parser::mps_data_model_t<i_t, f_t>& op_problem,
void write_problem_info(const cuopt::linear_programming::io::mps_data_model_t<i_t, f_t>& op_problem,
const std::string& filename)
{
std::ofstream file(filename);
Expand Down Expand Up @@ -274,8 +274,8 @@ void mps_file_to_binary(const std::filesystem::path& filename)

std::string p = std::string(filename);

cuopt::mps_parser::mps_data_model_t<int, double> op_problem =
cuopt::mps_parser::parse_mps<int, double>(p);
cuopt::linear_programming::io::mps_data_model_t<int, double> op_problem =
cuopt::linear_programming::io::parse_mps<int, double>(p);

auto filename_string = filename.filename().string();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ struct violation {
};

bool test_constraint_and_variable_sanity(
const cuopt::mps_parser::mps_data_model_t<int, double>& op_problem,
const cuopt::linear_programming::io::mps_data_model_t<int, double>& op_problem,
const std::vector<double>& primal_vars,
double abs_tol,
double rel_tol,
Expand Down
7 changes: 4 additions & 3 deletions benchmarks/linear_programming/cuopt/run_mip.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@
#include "mip_test_instances.hpp"

#include <cstdio>
#include <cuopt/linear_programming/io/parser.hpp>
#include <cuopt/linear_programming/mip/solver_settings.hpp>
#include <cuopt/linear_programming/mip/solver_solution.hpp>
#include <cuopt/linear_programming/optimization_problem_interface.hpp>
#include <cuopt/linear_programming/solve.hpp>
#include <mps_parser/parser.hpp>
#include <utilities/logger.hpp>

#include <raft/core/handle.hpp>
Expand Down Expand Up @@ -166,12 +166,13 @@ int run_single_file(std::string file_path,
}

constexpr bool input_mps_strict = false;
cuopt::mps_parser::mps_data_model_t<int, double> mps_data_model;
cuopt::linear_programming::io::mps_data_model_t<int, double> mps_data_model;
bool parsing_failed = false;
{
CUOPT_LOG_INFO("running file %s on gpu : %d", base_filename.c_str(), device);
try {
mps_data_model = cuopt::mps_parser::parse_mps<int, double>(file_path, input_mps_strict);
mps_data_model =
cuopt::linear_programming::io::parse_mps<int, double>(file_path, input_mps_strict);
} catch (const std::logic_error& e) {
CUOPT_LOG_ERROR("MPS parser execption: %s", e.what());
parsing_failed = true;
Expand Down
6 changes: 3 additions & 3 deletions benchmarks/linear_programming/cuopt/run_pdlp.cu
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@
*/
/* clang-format on */

#include <cuopt/linear_programming/io/parser.hpp>
#include <cuopt/linear_programming/optimization_problem_interface.hpp>
#include <cuopt/linear_programming/pdlp/solver_solution.hpp>
#include <cuopt/linear_programming/solve.hpp>
#include <cuopt/linear_programming/solver_settings.hpp>
#include <mps_parser/parser.hpp>

#include <raft/sparse/detail/cusparse_wrappers.h>
#include <raft/core/cusparse_macros.hpp>
Expand Down Expand Up @@ -148,8 +148,8 @@ static int run_solver(const argparse::ArgumentParser& program, const raft::handl
}

// Parse MPS file
cuopt::mps_parser::mps_data_model_t<int, double> op_problem =
cuopt::mps_parser::parse_mps<int, double>(program.get<std::string>("--path"));
cuopt::linear_programming::io::mps_data_model_t<int, double> op_problem =
cuopt::linear_programming::io::parse_mps<int, double>(program.get<std::string>("--path"));

// Solve LP problem
bool problem_checking = true;
Expand Down
39 changes: 3 additions & 36 deletions build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,13 @@ ARGS=$*
# script, and that this script resides in the repo dir!
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 cuopt_grpc_server libmps_parser cuopt_mps_parser cuopt cuopt_server cuopt_sh_client docs deb -a -b -g -fsanitize -tsan -msan -v -l= --verbose-pdlp --build-lp-only --no-fetch-rapids --skip-c-python-adapters --skip-tests-build --skip-routing-build --skip-grpc-build --skip-fatbin-write --host-lineinfo [--cmake-args=\\\"<args>\\\"] [--cache-tool=<tool>] -n --allgpuarch --ci-only-arch --show_depr_warn -h --help"
VALIDARGS="clean libcuopt cuopt_grpc_server cuopt cuopt_server cuopt_sh_client docs deb -a -b -g -fsanitize -tsan -msan -v -l= --verbose-pdlp --build-lp-only --no-fetch-rapids --skip-c-python-adapters --skip-tests-build --skip-routing-build --skip-grpc-build --skip-fatbin-write --host-lineinfo [--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)
libcuopt - build the cuopt C++ code
cuopt_grpc_server - build only the gRPC server binary (configures + builds libcuopt as needed)
libmps_parser - build the libmps_parser C++ code
cuopt_mps_parser - build the cuopt_mps_parser python package
cuopt - build the cuopt Python package
cuopt_server - build the cuopt_server Python package
cuopt_sh_client - build cuopt self host client
Expand Down Expand Up @@ -55,19 +52,18 @@ HELP="$0 [<target> ...] [<flag> ...]
--show_depr_warn - show cmake deprecation warnings
-h - print this text

default action (no args) is to build and install 'libmps_parser', 'libcuopt', 'cuopt', 'cuopt_mps_parser', 'cuopt_server', and 'cuopt_sh_client' targets (pass 'docs' explicitly to build documentation)
default action (no args) is to build and install 'libcuopt', 'cuopt', 'cuopt_server', and 'cuopt_sh_client' targets (pass 'docs' explicitly to build documentation)

libcuopt build dir is: ${LIBCUOPT_BUILD_DIR}

Set env var LIBCUOPT_BUILD_DIR to override libcuopt build dir.
"
CUOPT_MPS_PARSER_BUILD_DIR=${REPODIR}/python/cuopt/cuopt/linear_programming/build
PY_LIBCUOPT_BUILD_DIR=${REPODIR}/python/libcuopt/build
CUOPT_BUILD_DIR=${REPODIR}/python/cuopt/build
CUOPT_SERVER_BUILD_DIR=${REPODIR}/python/cuopt_server/build
CUOPT_SH_CLIENT_BUILD_DIR=${REPODIR}/python/cuopt_self_hosted/build
DOCS_BUILD_DIR=${REPODIR}/docs/cuopt/build
BUILD_DIRS="${LIBCUOPT_BUILD_DIR} ${LIBMPS_PARSER_BUILD_DIR} ${CUOPT_BUILD_DIR} ${CUOPT_SERVER_BUILD_DIR} ${CUOPT_SERVICE_CLIENT_BUILD_DIR} ${CUOPT_SH_CLIENT_BUILD_DIR} ${CUOPT_MPS_PARSER_BUILD_DIR} ${PY_LIBCUOPT_BUILD_DIR} ${DOCS_BUILD_DIR}"
BUILD_DIRS="${LIBCUOPT_BUILD_DIR} ${CUOPT_BUILD_DIR} ${CUOPT_SERVER_BUILD_DIR} ${CUOPT_SERVICE_CLIENT_BUILD_DIR} ${CUOPT_SH_CLIENT_BUILD_DIR} ${PY_LIBCUOPT_BUILD_DIR} ${DOCS_BUILD_DIR}"
Comment thread
mlubin marked this conversation as resolved.

# Set defaults for vars modified by flags to this script
VERBOSE_FLAG=""
Expand Down Expand Up @@ -283,10 +279,6 @@ if ! contains_string "DFIND_CUOPT_CPP" "${EXTRA_CMAKE_ARGS[@]}"; then
EXTRA_CMAKE_ARGS+=("-DFIND_CUOPT_CPP=ON")
fi

if ! contains_string "DFIND_MPS_PARSER_CPP" "${EXTRA_CMAKE_ARGS[@]}"; then
EXTRA_CMAKE_ARGS+=("-DFIND_MPS_PARSER_CPP=ON")
fi

# If clean given, run it prior to any other steps
if hasArg clean; then
# If the dirs to clean are mounted dirs in a container, the
Expand Down Expand Up @@ -347,23 +339,6 @@ else
fi
fi

################################################################################
# Configure, build, and install libmps_parser
if buildAll || hasArg libmps_parser; then
mkdir -p "${LIBMPS_PARSER_BUILD_DIR}"
cd "${LIBMPS_PARSER_BUILD_DIR}"
cmake -DDEFINE_ASSERT=${DEFINE_ASSERT} \
-DCMAKE_INSTALL_PREFIX="${INSTALL_PREFIX}" \
"${CACHE_ARGS[@]}" \
"${REPODIR}"/cpp/libmps_parser/

if hasArg -n; then
cmake --build "${LIBMPS_PARSER_BUILD_DIR}" ${VERBOSE_FLAG}
else
cmake --build "${LIBMPS_PARSER_BUILD_DIR}" --target ${INSTALL_TARGET} ${VERBOSE_FLAG}
fi
fi

################################################################################
# Configure and build libcuopt (and optionally just the gRPC server)
if buildAll || hasArg libcuopt || hasArg cuopt_grpc_server; then
Expand Down Expand Up @@ -430,14 +405,6 @@ if buildAll || hasArg cuopt; then
python "${PYTHON_ARGS_FOR_INSTALL[@]}" .
fi

# Build and install the cuopt MPS parser Python package
if buildAll || hasArg cuopt_mps_parser; then
cd "${REPODIR}"/python/cuopt/cuopt/linear_programming

SKBUILD_CMAKE_ARGS="-DCMAKE_PREFIX_PATH=${INSTALL_PREFIX};-DCMAKE_LIBRARY_PATH=${LIBCUOPT_BUILD_DIR};-DCMAKE_CUDA_ARCHITECTURES=${CUOPT_CMAKE_CUDA_ARCHITECTURES};${EXTRA_CMAKE_ARGS[*]// /;}" \
python "${PYTHON_ARGS_FOR_INSTALL[@]}" .
fi

# Build and install the cuopt_server Python package
if buildAll || hasArg cuopt_server; then
cd "${REPODIR}"/python/cuopt_server
Expand Down
Loading
Loading