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
4 changes: 2 additions & 2 deletions .clang-format
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ AlignTrailingComments: true
AllowAllArgumentsOnNextLine: true
AllowAllConstructorInitializersOnNextLine: true
AllowAllParametersOfDeclarationOnNextLine: true
AllowShortBlocksOnASingleLine: true
AllowShortBlocksOnASingleLine: true
AllowShortCaseLabelsOnASingleLine: true
AllowShortEnumsOnASingleLine: true
AllowShortFunctionsOnASingleLine: All
Expand All @@ -27,7 +27,7 @@ AlwaysBreakAfterDefinitionReturnType: None
AlwaysBreakAfterReturnType: None
AlwaysBreakBeforeMultilineStrings: true
AlwaysBreakTemplateDeclarations: Yes
BinPackArguments: false
BinPackArguments: false
BinPackParameters: false
BraceWrapping:
AfterClass: false
Expand Down
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ A clear and concise description of what you expected to happen.
- Environment location: [Bare-metal, Docker, Cloud(specify cloud provider)]
- Method of cuOpt install: [conda, Docker, or from source]
- If method of install is [Docker], provide `docker pull` & `docker run` commands used


**Additional context**
Add any other context about the problem here.
4 changes: 2 additions & 2 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,12 @@ Note: The pull request title will be included in the CHANGELOG.
## Checklist

- [ ] I am familiar with the [Contributing Guidelines](https://github.com/NVIDIA/cuopt/blob/HEAD/CONTRIBUTING.md).
- Testing
- Testing
- [ ] New or existing tests cover these changes
- [ ] Added tests
- [ ] Created an issue to follow-up
- [ ] NA
- Documentation
- [ ] The documentation is up to date with these changes
- [ ] Added new documentation
- [ ] Added new documentation
- [ ] NA
2 changes: 0 additions & 2 deletions .github/workflows/nightly.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -75,5 +75,3 @@ jobs:
-f sha=${SHA} \
-f date=${DATE} \
-f build_type=nightly


6 changes: 3 additions & 3 deletions .github/workflows/service_nightly.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: Build Managed service docker, deploy and test

on:
workflow_dispatch:
inputs:
Expand Down Expand Up @@ -33,7 +33,7 @@ permissions:

jobs:
managed-service-nightly-amd:
name: Managed service nightly build for AMD64 architecture
name: Managed service nightly build for AMD64 architecture
env:
GH_TOKEN: ${{ github.token }}
RAPIDS_BUILD_TYPE: ${{ inputs.build_type }}
Expand Down Expand Up @@ -117,7 +117,7 @@ jobs:
docker push nvcr.io/0616513341838337/cuopt:25.08

managed-service-nightly-arm:
name: Managed service nightly build for ARM architecture
name: Managed service nightly build for ARM architecture
env:
GH_TOKEN: ${{ github.token }}
RAPIDS_BUILD_TYPE: ${{ inputs.build_type }}
Expand Down
40 changes: 27 additions & 13 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,19 @@
# limitations under the License.

repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: 'v5.0.0'
hooks:
- id: end-of-file-fixer
files: \.(mps|json|yaml|yml|txt)$
exclude: ^datasets/.*\.(mps|json|yaml|yml|txt)$
- id: trailing-whitespace
files: \.(mps|json|yaml|yml|txt)$
exclude: ^datasets/.*\.(mps|json|yaml|yml|txt)$
- id: check-builtin-literals
- id: check-executables-have-shebangs
- id: check-json
- id: check-yaml
- repo: https://github.com/PyCQA/isort
rev: 5.12.0
hooks:
Expand Down Expand Up @@ -54,19 +67,6 @@ repos:
docs|
notebooks
)
- repo: https://github.com/rapidsai/pre-commit-hooks
rev: v0.6.0
hooks:
- id: verify-copyright
files: |
(?x)
[.](cmake|cpp|cu|cuh|h|hpp|sh|pxd|py|pyx)$|
CMakeLists[.]txt$|
meta[.]yaml$
exclude: |
(?x)^(
^cpp/tests/utilities/cxxopts.hpp
)
- repo: https://github.com/pre-commit/mirrors-clang-format
rev: v20.1.4
hooks:
Expand All @@ -84,6 +84,20 @@ repos:
hooks:
- id: shellcheck
args: ["--severity=warning"]
- repo: https://github.com/rapidsai/pre-commit-hooks
rev: v0.6.0
hooks:
- id: verify-copyright
files: |
(?x)
[.](cmake|cpp|cu|cuh|h|hpp|sh|pxd|py|pyx)$|
CMakeLists[.]txt$|
recipe[.]yaml$
exclude: |
(?x)^(
^cpp/tests/utilities/cxxopts.hpp
)


default_language_version:
python: python3
4 changes: 2 additions & 2 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,7 @@ This will add the device debug symbols for this object file in `libcuopt.so`. Y
## Adding dependencies

Please refer to the [dependencies.yaml](dependencies.yaml) file for details on how to add new dependencies.
Add any new dependencies in the `dependencies.yaml` file. It takes care of conda, requirements (pip based dependencies) and pyproject.
Add any new dependencies in the `dependencies.yaml` file. It takes care of conda, requirements (pip based dependencies) and pyproject.
Please don't try to add dependencies directly to environment.yaml files under `conda/environments` directory and pyproject.toml files under `python` directories.

## Code Formatting
Expand Down Expand Up @@ -314,5 +314,5 @@ You can skip these checks with `git commit --no-verify` or with the short versio

(d) I understand and agree that this project and the contribution are public and that a record of the contribution (including all personal information I submit with it, including my sign-off) is maintained indefinitely and may be redistributed consistent with this project or the open source license(s) involved.
```


4 changes: 2 additions & 2 deletions benchmarks/linear_programming/utils/get_datasets.py
Original file line number Diff line number Diff line change
Expand Up @@ -155,11 +155,11 @@
"netlib"
],
"dlr1" : [
"http://plato.asu.edu/ftp/lptestset/dlr1.mps.bz2",
"http://plato.asu.edu/ftp/lptestset/dlr1.mps.bz2",
"mps"
],
"dlr2" : [
"http://plato.asu.edu/ftp/lptestset/dlr2.mps.bz2",
"http://plato.asu.edu/ftp/lptestset/dlr2.mps.bz2",
"mps"
],
"energy1" : ["", "mps"], # Kept secret by Mittlemman
Expand Down
2 changes: 1 addition & 1 deletion conda/README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Conda Recipes and Environment
# Conda Recipes and Environment

This directory contains the conda recipes for the cuOpt packages which are used to build the conda packages in CI.

Expand Down
4 changes: 2 additions & 2 deletions cpp/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -312,7 +312,7 @@ target_compile_options(cuopt_cli
)

target_include_directories(cuopt_cli
PRIVATE
PRIVATE
"${CMAKE_CURRENT_SOURCE_DIR}/src"
PUBLIC
"$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>"
Expand All @@ -327,7 +327,7 @@ target_link_libraries(cuopt_cli
)
set_property(TARGET cuopt_cli PROPERTY INSTALL_RPATH "$ORIGIN/../${lib_dir}")

# FIXME:: Is this the right way?
# FIXME:: Is this the right way?
install(TARGETS cuopt_cli
DESTINATION ${CMAKE_INSTALL_BINDIR})

Expand Down
2 changes: 1 addition & 1 deletion cpp/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,5 +57,5 @@ cpp/

The MPS parser is a standalone module that parses MPS files and converts them into a format that can be used by the cuOpt library.

It is located in the `libmps_parser` directory. This also contains the `CMakeLists.txt` file to build the module.
It is located in the `libmps_parser` directory. This also contains the `CMakeLists.txt` file to build the module.

2 changes: 1 addition & 1 deletion cpp/cmake/thirdparty/cccl_override.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@
"version" : "2.8.2"
}
}
}
}
78 changes: 39 additions & 39 deletions cpp/docs/DEVELOPER_GUIDE.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# cuOpt C++ Developer Guide

This document serves as a guide for contributors to cuOpt C++ code. Developers should also refer
This document serves as a guide for contributors to cuOpt C++ code. Developers should also refer
to these additional files for further documentation of cuOpt best practices.

* [Documentation Guide](TODO) for guidelines on documenting cuOpt code.
Expand All @@ -18,12 +18,12 @@ This section defines terminology used within cuOpt

# Directory Structure and File Naming

External/public cuOpt APIs are grouped into an appropriately titled
header file in `cuopt/cpp/include/cuopt`. For example, `cuopt/cpp/include/cuopt/routing/data_model_view.hpp`
contains the definition of the routing data model object. Note the `.hpp`
External/public cuOpt APIs are grouped into an appropriately titled
header file in `cuopt/cpp/include/cuopt`. For example, `cuopt/cpp/include/cuopt/routing/data_model_view.hpp`
contains the definition of the routing data model object. Note the `.hpp`
file extension used to indicate a C++ header file.

Header files should use the `#pragma once` include guard.
Header files should use the `#pragma once` include guard.

## File extensions

Expand All @@ -41,8 +41,8 @@ algorithm APIs with a device execution policy (always `rmm::exec_policy` in cuOp

## Code and Documentation Style and Formatting

cuOpt code uses [snake_case](https://en.wikipedia.org/wiki/Snake_case) for all names except in a
few cases: unit tests and test case names may use Pascal case, aka
cuOpt code uses [snake_case](https://en.wikipedia.org/wiki/Snake_case) for all names except in a
few cases: unit tests and test case names may use Pascal case, aka
[UpperCamelCase](https://en.wikipedia.org/wiki/Camel_case). We do not use
[Hungarian notation](https://en.wikipedia.org/wiki/Hungarian_notation), except for the following examples:
* device data variables should be prefaced by d_ if it makes the intent clearer
Expand All @@ -61,20 +61,20 @@ class locations_t
}
```

C++ formatting is enforced using `clang-format`. You should configure `clang-format` on your
machine to use the `cuopt/cpp/.clang-format` configuration file, and run `clang-format` on all
changed code before committing it. The easiest way to do this is to configure your editor to
C++ formatting is enforced using `clang-format`. You should configure `clang-format` on your
machine to use the `cuopt/cpp/.clang-format` configuration file, and run `clang-format` on all
changed code before committing it. The easiest way to do this is to configure your editor to
"format on save".

Aspects of code style not discussed in this document and not automatically enforceable are typically
caught during code review, or not enforced.

### C++ Guidelines

In general, we recommend following
[C++ Core Guidelines](https://isocpp.github.io/CppCoreGuidelines/CppCoreGuidelines). We also
recommend watching Sean Parent's [C++ Seasoning talk](https://www.youtube.com/watch?v=W2tWOdzgXHA),
and we try to follow his rules: "No raw loops. No raw pointers. No raw synchronization primitives."
In general, we recommend following
[C++ Core Guidelines](https://isocpp.github.io/CppCoreGuidelines/CppCoreGuidelines). We also
recommend watching Sean Parent's [C++ Seasoning talk](https://www.youtube.com/watch?v=W2tWOdzgXHA),
and we try to follow his rules: "No raw loops. No raw pointers. No raw synchronization primitives."

* Prefer algorithms from STL and Thrust to raw loops.
* Prefer cuopt and RMM to raw pointers and raw memory allocation.
Expand All @@ -84,35 +84,35 @@ and we try to follow his rules: "No raw loops. No raw pointers. No raw synchroni

The following guidelines apply to organizing `#include` lines.

* Group includes by library (e.g. cuOpt, RMM, Thrust, STL). `clang-format` will respect the
* Group includes by library (e.g. cuOpt, RMM, Thrust, STL). `clang-format` will respect the
groupings and sort the individual includes within a group lexicographically.
* Separate groups by a blank line.
* Order the groups from "nearest" to "farthest". In other words, local includes, then includes
from other RAPIDS libraries, then includes from related libraries, like `<thrust/...>`, then
includes from dependencies installed with cuOpt, and then standard headers (for example `<string>`,
* Order the groups from "nearest" to "farthest". In other words, local includes, then includes
from other RAPIDS libraries, then includes from related libraries, like `<thrust/...>`, then
includes from dependencies installed with cuOpt, and then standard headers (for example `<string>`,
`<iostream>`).
* Use <> instead of "" unless the header is in the same directory as the source file.
* Tools like `clangd` often auto-insert includes when they can, but they usually get the grouping
and brackets wrong.
* Always check that includes are only necessary for the file in which they are included.
Try to avoid excessive including especially in header files. Double check this when you remove
* Always check that includes are only necessary for the file in which they are included.
Try to avoid excessive including especially in header files. Double check this when you remove
code.

# cuOpt Data Structures

Application data in cuOpt is contained in 3 objects for routing : data model, solver, and assignment.
Application data in cuOpt is contained in 3 objects for routing : data model, solver, and assignment.
There are a variety of other data structures you will use when developing cuOpt code.

## Views and Ownership

Resource ownership is an essential concept in cuOpt. In short, an "owning" object owns a
resource (such as device memory). It acquires that resource during construction and releases the
Resource ownership is an essential concept in cuOpt. In short, an "owning" object owns a
resource (such as device memory). It acquires that resource during construction and releases the
resource in destruction ([RAII](https://en.cppreference.com/w/cpp/language/raii)). A "non-owning"
object does not own resources. Any class in cuOpt with the `*_view` suffix is non-owning.

## `rmm::device_memory_resource`<a name="memory_resource"></a>

cuOpt allocates all device memory via RMM memory resources (MR). See the
cuOpt allocates all device memory via RMM memory resources (MR). See the
[RMM documentation](https://github.com/rapidsai/rmm/blob/main/README.md) for details.

## Streams
Expand All @@ -133,7 +133,7 @@ Similar to a `rmm::device_vector`, allocates a contiguous set of elements in dev
key differences:
- As an optimization, elements are uninitialized and no synchronization occurs at construction.
This limits the types `T` to trivially copyable types.
- All operations are stream ordered (i.e., they accept a `cuda_stream_view` specifying the stream
- All operations are stream ordered (i.e., they accept a `cuda_stream_view` specifying the stream
on which the operation is performed).

## Namespaces
Expand All @@ -148,12 +148,12 @@ namespace cuopt{

### Internal

Many functions are not meant for public use, so place them in either the `detail` or an *anonymous*
Many functions are not meant for public use, so place them in either the `detail` or an *anonymous*
namespace, depending on the situation.

#### `detail` namespace

Functions or objects that will be used across *multiple* translation units (i.e., source files),
Functions or objects that will be used across *multiple* translation units (i.e., source files),
should be exposed in an internal header file and placed in the `detail` namespace. Example:

```c++
Expand All @@ -167,7 +167,7 @@ void reusable_helper_function(...);

#### Anonymous namespace

Functions or objects that will only be used in a *single* translation unit should be defined in an
Functions or objects that will only be used in a *single* translation unit should be defined in an
*anonymous* namespace in the source file where it is used. Example:

```c++
Expand All @@ -177,12 +177,12 @@ void isolated_helper_function(...);
} // anonymous namespace
```

[**Anonymous namespaces should *never* be used in a header file.**](https://wiki.sei.cmu.edu/confluence/display/cplusplus/DCL59-CPP.+Do+not+define+an+unnamed+namespace+in+a+header+file)
[**Anonymous namespaces should *never* be used in a header file.**](https://wiki.sei.cmu.edu/confluence/display/cplusplus/DCL59-CPP.+Do+not+define+an+unnamed+namespace+in+a+header+file)

# Error Handling

cuOpt follows conventions (and provides utilities) enforcing compile-time and run-time
conditions and detecting and handling CUDA errors. Communication of errors is always via C++
cuOpt follows conventions (and provides utilities) enforcing compile-time and run-time
conditions and detecting and handling CUDA errors. Communication of errors is always via C++
exceptions.

## Runtime Conditions
Expand All @@ -194,13 +194,13 @@ Example usage:
CUOPT_EXPECTS(lhs.type() == rhs.type(), "Column type mismatch");
```

The first argument is the conditional expression expected to resolve to `true` under normal
conditions. If the conditional evaluates to `false`, then an error has occurred and an instance of `cuopt::logic_error` is thrown. The second argument to `CUOPT_EXPECTS` is a short description of the
error that has occurred and is used for the exception's `what()` message.
The first argument is the conditional expression expected to resolve to `true` under normal
conditions. If the conditional evaluates to `false`, then an error has occurred and an instance of `cuopt::logic_error` is thrown. The second argument to `CUOPT_EXPECTS` is a short description of the
error that has occurred and is used for the exception's `what()` message.

There are times where a particular code path, if reached, should indicate an error no matter what.
For example, often the `default` case of a `switch` statement represents an invalid alternative.
Use the `CUOPT_FAIL` macro for such errors. This is effectively the same as calling
There are times where a particular code path, if reached, should indicate an error no matter what.
For example, often the `default` case of a `switch` statement represents an invalid alternative.
Use the `CUOPT_FAIL` macro for such errors. This is effectively the same as calling
`CUOPT_EXPECTS(false, reason)`.

Example:
Expand All @@ -210,8 +210,8 @@ CUOPT_FAIL("This code path should not be reached.");

### CUDA Error Checking

Use the `RAFT_CUDA_TRY` macro to check for the successful completion of CUDA runtime API functions. This
macro throws a `cuopt::cuda_error` exception if the CUDA API return value is not `cudaSuccess`. The
Use the `RAFT_CUDA_TRY` macro to check for the successful completion of CUDA runtime API functions. This
macro throws a `cuopt::cuda_error` exception if the CUDA API return value is not `cudaSuccess`. The
thrown exception includes a description of the CUDA error code in it's `what()` message.

Example:
Expand Down
Loading