Skip to content

Commit

Permalink
More renames.
Browse files Browse the repository at this point in the history
  • Loading branch information
bdice committed Jan 18, 2025
1 parent fb6c759 commit d094655
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ repos:
exclude: .*/thirdparty/.*
- id: include-check
name: include-check
entry: python ./cpp/scripts/include_checker.py cpp/bench cpp/include cpp/test
entry: python ./cpp/scripts/include_checker.py cpp/bench cpp/include cpp/tests
pass_filenames: false
language: python
additional_dependencies: [gitpython]
Expand Down
2 changes: 1 addition & 1 deletion cpp/tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ function(ConfigureTest)
target_compile_definitions(${TEST_NAME} PRIVATE "RAFT_DISABLE_CUDA")
endif()

target_include_directories(${TEST_NAME} PUBLIC "$<BUILD_INTERFACE:${RAFT_SOURCE_DIR}/test>")
target_include_directories(${TEST_NAME} PUBLIC "$<BUILD_INTERFACE:${RAFT_SOURCE_DIR}/tests>")

rapids_test_add(
NAME ${TEST_NAME}
Expand Down
12 changes: 6 additions & 6 deletions docs/source/developer_guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ This will bring up an interactive prompt to select which spelling fixes to apply

Manually, run the following to bulk-fix include style issues:
```bash
python ./cpp/scripts/include_checker.py --inplace [cpp/include cpp/test ... list of folders which you want to fix]
python ./cpp/scripts/include_checker.py --inplace [cpp/include cpp/tests ... list of folders which you want to fix]
```

### Copyright header
Expand Down Expand Up @@ -298,9 +298,9 @@ RAFT is a heavily templated library. Several core functions are expensive to com

**Macros.** We define the macros `RAFT_COMPILED` and `RAFT_EXPLICIT_INSTANTIATE_ONLY`. The `RAFT_COMPILED` macro is defined by `CMake` when compiling code that (1) is part of `libraft.so` or (2) is linked with `libraft.so`. It indicates that a precompiled `libraft.so` is present at runtime.

The `RAFT_EXPLICIT_INSTANTIATE_ONLY` macro is defined by `CMake` during compilation of `libraft.so` itself. When defined, it indicates that implicit instantiations of expensive function templates are forbidden (they result in a compiler error). In the RAFT project, we additionally define this macro during compilation of the tests and benchmarks.
The `RAFT_EXPLICIT_INSTANTIATE_ONLY` macro is defined by `CMake` during compilation of `libraft.so` itself. When defined, it indicates that implicit instantiations of expensive function templates are forbidden (they result in a compiler error). In the RAFT project, we additionally define this macro during compilation of the tests and benchmarks.

Below, we summarize which combinations of `RAFT_COMPILED` and `RAFT_EXPLICIT_INSTANTIATE_ONLY` are used in practice and what the effect of the combination is.
Below, we summarize which combinations of `RAFT_COMPILED` and `RAFT_EXPLICIT_INSTANTIATE_ONLY` are used in practice and what the effect of the combination is.

| RAFT_COMPILED | RAFT_EXPLICIT_INSTANTIATE_ONLY | Which targets |
|---------------|--------------------------------|------------------------------------------------------------------------------------------------------|
Expand Down Expand Up @@ -349,7 +349,7 @@ The file `expensive-ext.cuh` contains the following:
#ifdef RAFT_EXPLICIT_INSTANTIATE_ONLY
namespace raft {
// (1) define templates to raise an error in case of accidental instantiation
// (1) define templates to raise an error in case of accidental instantiation
template <typename T> void expensive(T arg) RAFT_EXPLICIT;
} // namespace raft
#endif //RAFT_EXPLICIT_INSTANTIATE_ONLY
Expand All @@ -371,7 +371,7 @@ template void raft::expensive<int>(int);
template void raft::expensive<float>(float);
```

**Design considerations**:
**Design considerations**:

1. In the `-ext.cuh` header, do not include implementation headers. Only include function parameter types and types that are used to instantiate the templates. If a primitive takes custom parameter types, define them in a separate header called `<primitive_name>_types.hpp`. (see [Common Design Considerations](https://github.com/rapidsai/raft/blob/7b065aff81a0b1976e2a9e2f3de6690361a1111b/docs/source/developer_guide.md#common-design-considerations)).

Expand All @@ -381,7 +381,7 @@ template void raft::expensive<float>(float);

4. If a header file defines multiple expensive templates, it can be that one of them is not instantiated. In this case, **do define** the template with `RAFT_EXPLICIT` in the `-ext` header. This way, when the template is instantiated, the developer gets a helpful error message instead of a confusing "function not found".

This header structure was proposed in [issue #1416](https://github.com/rapidsai/raft/issues/1416), which contains more background on the motivation of this structure and the mechanics of C++ template instantiation.
This header structure was proposed in [issue #1416](https://github.com/rapidsai/raft/issues/1416), which contains more background on the motivation of this structure and the mechanics of C++ template instantiation.

## Testing

Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ ignore_missing_imports = true
# they are imported by a checked file.
follow_imports = "skip"
exclude = [
"pylibraft/pylibraft/test",
"pylibraft/pylibraft/tests",
]

[tool.codespell]
Expand Down

0 comments on commit d094655

Please sign in to comment.