Skip to content

ci: fix unbound CONDA_PREFIX in test_doc_examples.sh - #1462

Merged
rapids-bot[bot] merged 5 commits into
mainfrom
fix/conda-prefix-unbound
Jun 26, 2026
Merged

ci: fix unbound CONDA_PREFIX in test_doc_examples.sh#1462
rapids-bot[bot] merged 5 commits into
mainfrom
fix/conda-prefix-unbound

Conversation

@ramakrishnap-nv

@ramakrishnap-nv ramakrishnap-nv commented Jun 24, 2026

Copy link
Copy Markdown
Collaborator

@copy-pr-bot

copy-pr-bot Bot commented Jun 24, 2026

Copy link
Copy Markdown

Auto-sync is disabled for draft pull requests in this repository. Workflows must be run manually.

Contributors can view more details about this message here.

@ramakrishnap-nv ramakrishnap-nv self-assigned this Jun 24, 2026
@ramakrishnap-nv ramakrishnap-nv added bug Something isn't working non-breaking Introduces a non-breaking change labels Jun 24, 2026
@ramakrishnap-nv

Copy link
Copy Markdown
Collaborator Author

/ok to test 60ef2ce

@ramakrishnap-nv

Copy link
Copy Markdown
Collaborator Author

/ok to test fca6276

@ramakrishnap-nv
ramakrishnap-nv force-pushed the fix/conda-prefix-unbound branch from fca6276 to 6a9a7d9 Compare June 25, 2026 19:06
@ramakrishnap-nv

Copy link
Copy Markdown
Collaborator Author

/ok to test 6a9a7d9

@ramakrishnap-nv

Copy link
Copy Markdown
Collaborator Author

/ok to test 51de84a

ramakrishnap-nv and others added 2 commits June 25, 2026 14:34
CONDA_PREFIX is unset in wheel test environments. Use \${CONDA_PREFIX:-}
so the variable defaults to empty rather than tripping set -o nounset.
The search loop already skips empty entries, so behavior is unchanged
in conda environments.

Fixes #1459.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Signed-off-by: Ramakrishna Prabhu <ramakrishnap@nvidia.com>
The MIP C examples directory had .c files but no Makefile, causing
test_doc_examples.sh to mark all 2 examples as failed. The convex
examples Makefile is generic (auto-discovers .c files) so copy it here.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Signed-off-by: Ramakrishna Prabhu <ramakrishnap@nvidia.com>
@ramakrishnap-nv
ramakrishnap-nv force-pushed the fix/conda-prefix-unbound branch 2 times, most recently from fd1f3e4 to d0bf6f5 Compare June 25, 2026 21:19
@ramakrishnap-nv
ramakrishnap-nv marked this pull request as ready for review June 25, 2026 21:19
@ramakrishnap-nv
ramakrishnap-nv requested review from a team as code owners June 25, 2026 21:19
@coderabbitai

coderabbitai Bot commented Jun 25, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: 46652820-834e-404d-ab53-f59b89f4252c

📥 Commits

Reviewing files that changed from the base of the PR and between 1419b35 and 4732bd1.

📒 Files selected for processing (1)
  • ci/test_doc_examples.sh
🚧 Files skipped from review as they are similar to previous changes (1)
  • ci/test_doc_examples.sh

📝 Walkthrough

Walkthrough

The PR updates a shell script to handle an unset CONDA_PREFIX, adds a Makefile for cuOpt C MIP examples, and changes example commands to pass the library directory path to gcc -L.

Changes

cuOpt doc example updates

Layer / File(s) Summary
Shell script environment fallback
ci/test_doc_examples.sh
The SPDX header year range is updated and search_dirs uses ${CONDA_PREFIX:-} in the library search path setup.
Example Makefile build flow
docs/cuopt/source/cuopt-c/mip/examples/Makefile
The new Makefile adds usage text, compiler and linker settings, source discovery, phony targets, build rules, cleanup, and required-path validation for cuOpt C MIP examples.
Example command path updates
docs/cuopt/source/cuopt-c/mip/mip-examples.rst
The two MIP example setup command blocks change LIBCUOPT_LIBRARY_PATH to derive the library directory with dirname(...) before passing it to gcc -L.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~15 minutes

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title is concise and accurately describes the main fix to test_doc_examples.sh.
Description check ✅ Passed The description is relevant and matches the script fix and added example Makefile.
Linked Issues check ✅ Passed The CONDA_PREFIX fallback fixes the unbound-variable failure and satisfies the linked issue's requirement to handle non-conda environments.
Out of Scope Changes check ✅ Passed The Makefile and docs updates are consistent with the PR's stated goal and are not unrelated changes.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/conda-prefix-unbound

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@docs/cuopt/source/cuopt-c/mip/examples/Makefile`:
- Line 49: `LDFLAGS` in the MIP example Makefile assumes `LIBCUOPT_LIBRARY_PATH`
is a directory, but the documented setup can populate it with the full
`libcuopt.so` file path. Update the Makefile to normalize that variable before
using it with `-L` and `-Wl,-rpath`, or change the contract so
`LIBCUOPT_LIBRARY_PATH` is explicitly directory-only; use the `LDFLAGS`
assignment as the fix point and keep it consistent with the `mip-examples.rst`
setup instructions.
- Around line 58-69: The single-example build path bypasses the path validation
step, so `make <example_name>` can fail later with missing include/library flags
instead of a clear prerequisite message. Update the `Makefile` so `check-paths`
is also required by individual target builds, either by making `$(TARGETS)`
depend on it or by adding it to the `%: %.c` pattern rule alongside the existing
`all` target behavior. Keep the fix aligned with the `all` target and
`check-paths` logic so both full and single-example builds validate paths
consistently.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: afe6ab17-6bd6-4534-8204-e0aa7f618620

📥 Commits

Reviewing files that changed from the base of the PR and between 229c0d8 and b3ad39a.

📒 Files selected for processing (2)
  • ci/test_doc_examples.sh
  • docs/cuopt/source/cuopt-c/mip/examples/Makefile

Comment thread docs/cuopt/source/cuopt-c/mip/examples/Makefile
Comment thread docs/cuopt/source/cuopt-c/mip/examples/Makefile Outdated

@jameslamb jameslamb left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

It seems you might have included something you didn't mean to, will re-review once you clarify.

@@ -0,0 +1,148 @@
# SPDX-FileCopyrightText: Copyright (c) 2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

What's the goal with this file?

It seems totally unrelated to the title / description / linked issue.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Apologies, so it started with doc testing failing silently and once I fixed it, there was another error where one of the test missed a Cmake file, so I fixed that, but missed to update the description.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Suggested change
# SPDX-FileCopyrightText: Copyright (c) 2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
# SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.

Ok got it, thanks. It's 2026, so let's please fix the copyright year here.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Done — copyright updated to 2026.

@jameslamb jameslamb left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Approving so you have what you need to merge, do what you want with my small suggestions.

Comment on lines +29 to +35
# REQUIRED: Set these paths either:
# 1. As environment variables
# 2. On command line: make INCLUDE_PATH=... LIBCUOPT_LIBRARY_PATH=...
# 3. Uncomment and edit below for your system:
#
# INCLUDE_PATH = /path/to/cuopt/include
# LIBCUOPT_LIBRARY_PATH = /path/to/cuopt/lib

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

IMO it'd be simpler to just pick 1 way and document that that's how this works.

All this extra flexibility is just maintenance cost for no benefit unless you have a specific reason to want to support 3 different patterns.

The make INCLUDE_PATH=... form would be my preference.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Done — simplified to command-line only (make INCLUDE_PATH=... LIBCUOPT_LIBRARY_PATH=...), removed env-var and hardcoded options. Also removed the verbose help/list targets.

- Update copyright year to 2026
- Simplify Makefile to single path-setting method (make VAR=...)
- Add check-paths dependency to pattern rule so single-target builds
  also validate paths
- Fix mip-examples.rst: use dirname so LIBCUOPT_LIBRARY_PATH is a
  directory as expected by -L

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Signed-off-by: Ramakrishna Prabhu <ramakrishnap@nvidia.com>

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@docs/cuopt/source/cuopt-c/mip/mip-examples.rst`:
- Around line 25-26: The cuOpt examples are collecting every matching
libcuopt.so from find and passing the full list into dirname, which can produce
multiple library paths and break the later gcc -L usage. Update the libcuopt
path discovery in the relevant example blocks to select a single libcuopt.so
match first, then derive one directory from that single result, matching the
approach used in the doc-example flow. Use the existing LIBCUOPT_LIBRARY_PATH
setup and the later gcc invocation as the key spots to adjust so the examples
resolve one valid library path consistently.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: 20fe3b5c-be9c-4eec-81ea-47116bf3e36c

📥 Commits

Reviewing files that changed from the base of the PR and between b3ad39a and 1419b35.

📒 Files selected for processing (2)
  • docs/cuopt/source/cuopt-c/mip/examples/Makefile
  • docs/cuopt/source/cuopt-c/mip/mip-examples.rst

Comment on lines +25 to +26
# Find the libcuopt library directory and assign to LIBCUOPT_LIBRARY_PATH
LIBCUOPT_LIBRARY_PATH=$(dirname $(find / -name "libcuopt.so" 2>/dev/null))

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

Pick a single libcuopt.so match before deriving the directory.

Line 26 and Line 99 still feed every find result into dirname. On hosts with multiple cuOpt installs, that produces multiple directories, and the later gcc -L $LIBCUOPT_LIBRARY_PATH command splits them into separate arguments instead of one library path.

Proposed fix
-   LIBCUOPT_LIBRARY_PATH=$(dirname $(find / -name "libcuopt.so" 2>/dev/null))
+   LIBCUOPT_LIBRARY_PATH=$(find / -name "libcuopt.so" 2>/dev/null | head -n 1)
+   LIBCUOPT_LIBRARY_PATH=${LIBCUOPT_LIBRARY_PATH%/libcuopt.so}

As per path instructions, documentation changes should verify code examples compile and run correctly. Based on ci/test_doc_examples.sh:450-530, the doc-example flow also selects a single libcuopt.so hit before converting it to a directory.

Also applies to: 98-99

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@docs/cuopt/source/cuopt-c/mip/mip-examples.rst` around lines 25 - 26, The
cuOpt examples are collecting every matching libcuopt.so from find and passing
the full list into dirname, which can produce multiple library paths and break
the later gcc -L usage. Update the libcuopt path discovery in the relevant
example blocks to select a single libcuopt.so match first, then derive one
directory from that single result, matching the approach used in the doc-example
flow. Use the existing LIBCUOPT_LIBRARY_PATH setup and the later gcc invocation
as the key spots to adjust so the examples resolve one valid library path
consistently.

Source: Path instructions

@github-actions

github-actions Bot commented Jun 26, 2026

Copy link
Copy Markdown

CI Test Summary

✅ All 31 test job(s) passed.

@ramakrishnap-nv

Copy link
Copy Markdown
Collaborator Author

/merge

@rapids-bot
rapids-bot Bot merged commit c63882f into main Jun 26, 2026
181 of 183 checks passed
@ramakrishnap-nv ramakrishnap-nv added this to the 26.08 milestone Jul 8, 2026
@ramakrishnap-nv
ramakrishnap-nv deleted the fix/conda-prefix-unbound branch July 9, 2026 18:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working non-breaking Introduces a non-breaking change

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ci: test_doc_examples.sh fails silently in wheel-tests-cuopt-server due to unbound CONDA_PREFIX

3 participants