diff --git a/.github/workflows/main-arm64.yml b/.github/workflows/main-arm64.yml index da9f1ec..a076d94 100644 --- a/.github/workflows/main-arm64.yml +++ b/.github/workflows/main-arm64.yml @@ -17,6 +17,12 @@ jobs: runs-on: ubuntu-24.04-arm container: image: python:3.13 + env: + # cuOpt 26.12 nightly used while preparing the next release (same pin in both workflows). + # At release: set CUOPT_VERSION to the released version and delete the two UV_* lines. + CUOPT_VERSION: '26.12.0a93.post261116050548' + UV_PRERELEASE: allow + UV_EXTRA_INDEX_URL: https://pypi.anaconda.org/rapidsai-wheels-nightly/simple https://pypi.nvidia.com steps: - name: Checkout repository @@ -32,9 +38,20 @@ jobs: run: | mkdir -p venvs uv venv venvs/cu12 - uv pip install --python venvs/cu12 'libcuopt-mathopt-cu12==26.10.*' 'libcuopt-client==26.10.*' -qq + uv pip install --python venvs/cu12 "libcuopt-mathopt-cu12==$CUOPT_VERSION" "libcuopt-client==$CUOPT_VERSION" -qq + uv pip freeze --python venvs/cu12 | tee venvs/cu12-freeze.txt uv venv venvs/cu13 - uv pip install --python venvs/cu13 'libcuopt-mathopt-cu13==26.10.*' 'libcuopt-client==26.10.*' -qq + uv pip install --python venvs/cu13 "libcuopt-mathopt-cu13==$CUOPT_VERSION" "libcuopt-client==$CUOPT_VERSION" -qq + uv pip freeze --python venvs/cu13 | tee venvs/cu13-freeze.txt + + # Never publish release archives built from prerelease wheels + - name: Fail if a prerelease package would be released (only on tag push) + if: startsWith(github.ref, 'refs/tags/') + run: | + if grep -E '^[^=]+==[0-9.]*(a|b|rc|\.dev)[0-9]' venvs/cu12-freeze.txt venvs/cu13-freeze.txt; then + echo "Prerelease packages found; set CUOPT_VERSION to a released cuOpt version and remove the nightly UV_* settings." + exit 1 + fi # Get GAMS (ARM64 version) - name: Download and extract latest GAMS distribution @@ -88,6 +105,7 @@ jobs: cp venvs/cu12/lib/python3.13/site-packages/nvidia/nccl/lib/libnccl.so* release-cu12/ mkdir runtime-cu12 cp venvs/cu12/lib/python3.13/site-packages/nvidia/cu12/lib/libcudss.so* runtime-cu12/ + cp venvs/cu12/lib/python3.13/site-packages/nvidia/cuda_nvrtc/lib/libnvrtc*.so* runtime-cu12/ cp venvs/cu12/lib/python3.13/site-packages/nvidia/cusolver/lib/libcusolver.so* runtime-cu12/ cp venvs/cu12/lib/python3.13/site-packages/nvidia/cublas/lib/libcublas.so* runtime-cu12/ cp venvs/cu12/lib/python3.13/site-packages/nvidia/cublas/lib/libcublasLt.so* runtime-cu12/ @@ -111,6 +129,7 @@ jobs: cp venvs/cu13/lib/python3.13/site-packages/nvidia/nccl/lib/libnccl.so* release-cu13/ mkdir runtime-cu13 cp venvs/cu13/lib/python3.13/site-packages/nvidia/cu13/lib/libcudss.so* runtime-cu13/ + cp venvs/cu13/lib/python3.13/site-packages/nvidia/cu13/lib/libnvrtc*.so* runtime-cu13/ cp venvs/cu13/lib/python3.13/site-packages/nvidia/cu13/lib/libnvJitLink.so* runtime-cu13/ cp venvs/cu13/lib/python3.13/site-packages/nvidia/cu13/lib/libcublas.so* runtime-cu13/ cp venvs/cu13/lib/python3.13/site-packages/nvidia/cu13/lib/libcublasLt.so* runtime-cu13/ diff --git a/.github/workflows/main-x86_64.yml b/.github/workflows/main-x86_64.yml index c64231b..c7fd9d8 100644 --- a/.github/workflows/main-x86_64.yml +++ b/.github/workflows/main-x86_64.yml @@ -18,6 +18,12 @@ jobs: runs-on: ubuntu-latest container: image: python:3.13 + env: + # cuOpt 26.12 nightly used while preparing the next release (same pin in both workflows). + # At release: set CUOPT_VERSION to the released version and delete the two UV_* lines. + CUOPT_VERSION: '26.12.0a93.post261116050548' + UV_PRERELEASE: allow + UV_EXTRA_INDEX_URL: https://pypi.anaconda.org/rapidsai-wheels-nightly/simple https://pypi.nvidia.com steps: - name: Checkout repository @@ -36,9 +42,20 @@ jobs: run: | mkdir -p venvs uv venv venvs/cu12 - uv pip install --python venvs/cu12 'libcuopt-mathopt-cu12==26.10.*' 'libcuopt-client==26.10.*' -qq + uv pip install --python venvs/cu12 "libcuopt-mathopt-cu12==$CUOPT_VERSION" "libcuopt-client==$CUOPT_VERSION" -qq + uv pip freeze --python venvs/cu12 | tee venvs/cu12-freeze.txt uv venv venvs/cu13 - uv pip install --python venvs/cu13 'libcuopt-mathopt-cu13==26.10.*' 'libcuopt-client==26.10.*' -qq + uv pip install --python venvs/cu13 "libcuopt-mathopt-cu13==$CUOPT_VERSION" "libcuopt-client==$CUOPT_VERSION" -qq + uv pip freeze --python venvs/cu13 | tee venvs/cu13-freeze.txt + + # Never publish release archives built from prerelease wheels + - name: Fail if a prerelease package would be released (only on tag push) + if: startsWith(github.ref, 'refs/tags/') + run: | + if grep -E '^[^=]+==[0-9.]*(a|b|rc|\.dev)[0-9]' venvs/cu12-freeze.txt venvs/cu13-freeze.txt; then + echo "Prerelease packages found; set CUOPT_VERSION to a released cuOpt version and remove the nightly UV_* settings." + exit 1 + fi # Get GAMS - name: Download and extract latest GAMS distribution @@ -92,6 +109,7 @@ jobs: cp venvs/cu12/lib/python3.13/site-packages/nvidia/nccl/lib/libnccl.so* release-cu12/ mkdir runtime-cu12 cp venvs/cu12/lib/python3.13/site-packages/nvidia/cu12/lib/libcudss.so* runtime-cu12/ + cp venvs/cu12/lib/python3.13/site-packages/nvidia/cuda_nvrtc/lib/libnvrtc*.so* runtime-cu12/ cp venvs/cu12/lib/python3.13/site-packages/nvidia/cusolver/lib/libcusolver.so* runtime-cu12/ cp venvs/cu12/lib/python3.13/site-packages/nvidia/cublas/lib/libcublas.so* runtime-cu12/ cp venvs/cu12/lib/python3.13/site-packages/nvidia/cublas/lib/libcublasLt.so* runtime-cu12/ @@ -115,6 +133,7 @@ jobs: cp venvs/cu13/lib/python3.13/site-packages/nvidia/nccl/lib/libnccl.so* release-cu13/ mkdir runtime-cu13 cp venvs/cu13/lib/python3.13/site-packages/nvidia/cu13/lib/libcudss.so* runtime-cu13/ + cp venvs/cu13/lib/python3.13/site-packages/nvidia/cu13/lib/libnvrtc*.so* runtime-cu13/ cp venvs/cu13/lib/python3.13/site-packages/nvidia/cu13/lib/libnvJitLink.so* runtime-cu13/ cp venvs/cu13/lib/python3.13/site-packages/nvidia/cu13/lib/libcublas.so* runtime-cu13/ cp venvs/cu13/lib/python3.13/site-packages/nvidia/cu13/lib/libcublasLt.so* runtime-cu13/ diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 6b5c590..d263ccc 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -14,13 +14,16 @@ The link (`gmscuopt.c`) is built against the GAMS C API from a GAMS distribution ```bash python -m venv .venv -.venv/bin/pip install 'libcuopt-mathopt-cu13==26.10.*' 'libcuopt-client==26.10.*' +.venv/bin/pip install --pre \ + --extra-index-url=https://pypi.anaconda.org/rapidsai-wheels-nightly/simple \ + --extra-index-url=https://pypi.nvidia.com \ + 'libcuopt-mathopt-cu13==26.12.*' 'libcuopt-client==26.12.*' GAMSDIST=/path/to/gams ./build-link.sh ``` `build-link.sh` compiles `gmscuopt.out` for CUDA 13, sets its RPATH (needs `gcc` and `patchelf`), and copies it together with the cuOpt and CUDA libraries and the files from `assets/` into `$GAMSDIST`. Since that includes `gamsconfig_cuopt.yaml`, merge it into `gamsconfig.yaml` as described in the [README](README.md#manual-installation). The CI workflows in `.github/workflows` build the release archives for CUDA 12 and 13 on x86_64 and arm64. -New or changed cuOpt options go into `assets/optcuopt.def` and have to be passed on to cuOpt in `gmscuopt.c`. The option table of the cuOpt page in the GAMS documentation is generated from this file with `python3 optdef2md.py --source "GAMS-dev/cuoptlink-builder "`, which writes `optcuopt_s.md` and records the release in its header. +New or changed cuOpt options go into `assets/optcuopt.def`. The loop in `gmscuopt.c` forwards solver options by name and type; options handled by the link itself need explicit C code. The option table of the cuOpt page in the GAMS documentation is generated from this file with `python3 optdef2md.py --source "GAMS-dev/cuoptlink-builder "`, which writes `optcuopt_s.md` and records the release in its header. ## Testing diff --git a/assets/optcuopt.def b/assets/optcuopt.def index fd8adb6..0823703 100644 --- a/assets/optcuopt.def +++ b/assets/optcuopt.def @@ -73,6 +73,11 @@ augmented enumint 0 -1 1 4 Controls which linear system to solve in the barrier 0 1 solve the ADAT system (normal equations) 1 1 solve the augmented system eliminate_dense_columns boolean 0 1 1 4 Controls whether to eliminate dense columns from the constraint matrix before solving. Eliminating dense columns can improve performance by reducing fill-in during factorization. However, extra solves must be performed at each iteration +cudss_nd_nlevels integer 0 -1 -1 maxint 1 4 Controls the number of nested dissection levels in cuDSS ordering (-1 cuDSS default; explicit values must be at least 2, smaller values are ignored) +cudss_hybrid_execute_mode enumint 0 -1 1 4 Controls cuDSS hybrid CPU/GPU execution + -1 1 cuDSS default + 0 1 off + 1 1 on cudss_deterministic boolean 0 0 1 4 Controls whether cuDSS operates in deterministic mode. Deterministic mode ensures reproducible results across runs but may be slower barrier_dual_initial_point enumint 0 -1 1 4 Controls the method used to compute the dual initial point for the barrier solver. The choice of initial point will affect the number of iterations performed by barrier -1 1 automatic (default) cuOpt selects the best method @@ -99,7 +104,7 @@ primal_infeasible_tolerance double 0 1e-10 0 0.1 0 2 Unknown dual_infeasible_tolerance double 0 1e-10 0 0.1 0 2 Unknown miptrace string 1 "" 1 3 filename of MIP trace file which logs the best found (incumbent) and best bound over time mipstart boolean -1 0 1 3 whether it should be tried to use the initial variable levels as initial MIP solution -mip_heuristics_only boolean 0 0 1 3 Controls if only the GPU heuristics should be run +mip_heuristics_only boolean 0 0 1 3 Deprecated in cuOpt 26.12; accepted for compatibility but has no effect mip_scaling enumint 0 2 1 3 Controls if scaling should be applied to the MIP problem 0 1 no scaling 1 1 full scaling (objective + row) @@ -153,9 +158,9 @@ mip_hyper_heuristic_population_size integer 0 32 1 maxint 1 3 Controls maximum n mip_hyper_heuristic_num_cpufj_threads integer 0 8 0 maxint 1 3 Controls parallel CPU FJ climbers mip_hyper_heuristic_root_lp_time_ratio double 0 0.1 0 1 1 3 Controls fraction of total time for root LP mip_hyper_heuristic_root_lp_max_time double 0 15 0 maxdouble 1 3 Controls the hard cap on root LP seconds -mip_hyper_heuristic_rins_time_limit double 0 3 0 maxdouble 1 3 Controls per-call RINS sub-MIP time -mip_hyper_heuristic_rins_max_time_limit double 0 20 0 maxdouble 1 3 Controls ceiling for RINS adaptive time budget -mip_hyper_heuristic_rins_fix_rate double 0 0.5 0 1 1 3 Controls RINS variable fix rate +mip_hyper_heuristic_rins_time_limit double 0 3 0 maxdouble 1 3 Deprecated in cuOpt 26.12; accepted for compatibility but has no effect +mip_hyper_heuristic_rins_max_time_limit double 0 20 0 maxdouble 1 3 Deprecated in cuOpt 26.12; accepted for compatibility but has no effect +mip_hyper_heuristic_rins_fix_rate double 0 0.5 0 1 1 3 Deprecated in cuOpt 26.12; accepted for compatibility but has no effect mip_hyper_heuristic_stagnation_trigger integer 0 3 1 maxint 1 3 Controls FP loops w/o improvement before recombination mip_hyper_heuristic_max_iterations_without_improvement integer 0 8 1 maxint 1 3 Controls diversity step depth after stagnation mip_hyper_heuristic_initial_infeasibility_weight double 0 1000 1e-09 maxdouble 1 3 Controls constraint violation penalty seed @@ -188,6 +193,16 @@ mip_hyper_presolve_indicator_strengthening boolean 0 1 1 3 Controls whether impl mip_hyper_heuristic_presolve_max_rounds integer 0 -1 -1 maxint 1 3 Controls the Papilo presolve rounds cap in heuristics (<0 derives it from the problem, 0 keeps the Papilo default) mip_hyper_heuristic_papilo_probing_max_badgesize integer 0 -1 -1 maxint 1 3 Controls the ceiling on Papilo's probing minbadgesize in MIP presolve (<0 derives it from the problem, 0 leaves it uncapped) mip_hyper_diving_show_type boolean 0 0 1 3 log diving heuristic type when it finds a new incumbent +mip_hyper_bnb_bfs_workers_ratio double 0 0.5 0 1 1 3 Controls best-first search workers as a fraction of the branch-and-bound threads (at least 1 worker) +mip_hyper_bnb_diving_workers_ratio double 0 0.5 0 1 1 3 Controls diving workers as a fraction of the branch-and-bound threads (at least 1 worker) +mip_hyper_bnb_submip_workers_ratio double 0 0.125 0 1 1 3 Controls sub-MIP workers as a fraction of the branch-and-bound threads (at least 1 worker) +mip_hyper_bnb_steal_chance double 0 0.05 0 1 1 3 Controls the probability that a best-first worker steals nodes from another worker +mip_hyper_bnb_nodes_per_steal integer 0 10 1 maxint 1 3 Controls the number of nodes taken from another worker in each steal attempt +mip_hyper_bnb_max_steal_attempts integer 0 3 0 maxint 1 3 Controls the number of steal attempts before giving up +mip_hyper_bnb_root_heuristics enumint 0 -1 1 3 Controls root heuristics + -1 1 automatic + 0 1 disabled + 1 1 enabled mip_semi_continuous_big_m double 0 1e10 1 maxdouble 1 3 Controls the Big-M coefficient used when linearizing semi-continuous variable constraints * diff --git a/build-link.sh b/build-link.sh index c3d7ef7..c869bf4 100755 --- a/build-link.sh +++ b/build-link.sh @@ -66,6 +66,7 @@ cp "$SITE_PACKAGES"/libcuopt_mathopt_cu13.libs/libcudart-*.so* "$GAMSDIST/" cp "$SITE_PACKAGES"/rapids_logger/lib64/librapids_logger.so "$GAMSDIST/" cp "$SITE_PACKAGES"/librmm/lib64/librmm.so "$GAMSDIST/" cp "$SITE_PACKAGES"/nvidia/cu13/lib/libcudss.so* "$GAMSDIST/" +cp "$SITE_PACKAGES"/nvidia/cu13/lib/libnvrtc*.so* "$GAMSDIST/" cp "$SITE_PACKAGES"/nvidia/cu13/lib/libnvJitLink.so* "$GAMSDIST/" cp "$SITE_PACKAGES"/nvidia/cu13/lib/libcublas.so* "$GAMSDIST/" cp "$SITE_PACKAGES"/nvidia/cu13/lib/libcublasLt.so* "$GAMSDIST/"