diff --git a/BUILD.md b/BUILD.md
index 844a563a90..5a053650a5 100644
--- a/BUILD.md
+++ b/BUILD.md
@@ -1,78 +1,17 @@
# RAFT Build and Development Guide
+- [Building and running tests](#building-and-running-tests)
- [Usage of RAFT by downstream projects](#usage-of-raft-by-downstream-projects)
- [C++ Integration](#c-integration)
- [Python/Cython Integration](#pythoncython-integration)
-- [Building and running tests](#building-and-running-tests)
- [CI Process](#ci-process)
- [Developer Guide](#developer-guide)
- [Local Development](#local-development)
- [Submitting PRs](#submitting-prs)
+## Building and installing RAFT
-
-## Usage of RAFT by downstream projects
-
-### C++ Integration
-
-C++ RAFT is a header only library, so it can be easily configured using CMake by consuming libraries. Since this repo is intended to be included by downstream repos, the recommended way of accomplishing that is using CMake's git cloning functionality:
-
-
-```cmake
-if(DEFINED ENV{RAFT_PATH})
- message(STATUS "RAFT_PATH environment variable detected.")
- message(STATUS "RAFT_DIR set to $ENV{RAFT_PATH}")
- set(RAFT_DIR ENV{RAFT_PATH})
-
-else(DEFINED ENV{RAFT_PATH})
- message(STATUS "RAFT_PATH environment variable NOT detected, cloning RAFT")
- set(RAFT_GIT_DIR ${CMAKE_CURRENT_BINARY_DIR}/raft CACHE STRING "Path to RAFT repo")
-
- ExternalProject_Add(raft
- GIT_REPOSITORY git@github.com:rapidsai/raft.git
- GIT_TAG pinned_commit/git_tag/branch
- PREFIX ${RAFT_GIT_DIR}
- CONFIGURE_COMMAND ""
- BUILD_COMMAND ""
- INSTALL_COMMAND "")
-
- set(RAFT_INCLUDE_DIR ${RAFT_GIT_DIR}/src/raft/cpp/include CACHE STRING "RAFT include variable")
-endif(DEFINED ENV{RAFT_PATH})
-
-```
-
-This create the variable `$RAFT_INCLUDE_DIR` variable that can be used in `include_directories`, and then the related header files can be included when needed.
-
-### Python/Cython Integration
-
-RAFT's Python and Cython code have been designed to be included in projects that use RAFT, as opposed to be distributed by itself as a Python package. To use:
-
-- The file `setuputils.py` is included in RAFT's `python` folder. Copy the file to your repo, in a location where it can be imported by `setup.py`
-- In your setup.py, use the function `use_raft_package`, for example for cuML:
-
-
-```python
-# Optional location of C++ build folder that can be configured by the user
-libcuml_path = get_environment_option('CUML_BUILD_PATH')
-# Optional location of RAFT that can be confugred by the user
-raft_path = get_environment_option('RAFT_PATH')
-
-use_raft_package(raft_path, libcuml_path)
-```
-
-The usage of RAFT by the consuming repo's python code follows the rules:
-1. If the environment variable `RAFT_PATH` points to the RAFT repo, then that will be used.
-2. If there is a C++ build folder that has cloned RAFT already, setup.py will use that RAFT.
-3. If none of the above happened, then setup.py will clone RAFT and use it directly.
-
-- After `setup.py` calls the `use_raft_package` function, the RAFT python code will be included (via a symlink) in the consuming repo package, under a raft subfolder. So for example, `cuml` python package includes RAFT in `cuml.raft`.
-
-
-## Building and running tests
-
-Since RAFT is not meant to create any artifact on itself, but be included in other projects, the build infrastructure is focused only on testing.
-
-The base folder in the repository contains a `build.sh` script that builds both the C++ and Python code, which is the recommended way of building the tests.
+C++ RAFT is a header-only library but provides the option of building shared libraries with template instantiations for common types to speed up compile times for larger projects. The recommended way to build and install RAFT is to use the `build.sh` script in the root of the repository. This script can build both the C++ and Python code and provides options for building and installing the shared libraries.
To run C++ tests:
@@ -87,64 +26,77 @@ cd python
python -m pytest raft
```
-To build manually, you can also use `CMake` and setup.py directly. For C++:
+To build manually, you can also use `CMake` and setup.py directly.
+
+For C++, the `RAFT_COMPILE_LIBRARIES` option can be used to compile the shared libraries. Shared libraries are provided for the `nn` and `distance` packages currently. The `nn` package requires FAISS, which will be built from source if it is not already installed. FAISS can optionally be statically compiled into the `nn` shared library with the `RAFT_USE_FAISS_STATIC` option.
+To install RAFT into a specific location, use `CMAKE_INSTALL_PREFIX`. The snippet below will install it into the current conda environment.
```bash
cd cpp
mkdir build
cd build
-cmake ..
+cmake -DRAFT_COMPILE_LIBRARIES=ON -DRAFT_USE_FAISS_STATIC=OFF -DCMAKE_INSTALL_PREFIX=$CONDA_PREFIX ../
+make install
```
-There is no `install` target currently.
-
For python:
```bash
cd python
python setup.py build_ext --inplace
+python setup.py install
```
+## Using RAFT in downstream projects
-## CI Process
-
-PRs submitted to RAFT will always run the RAFT tests (once GPUCI is enabled). Additionally, RAFT has convenience functionality to run tests of the following projects that use RAFT: cuML and cuGraph.
-
-To run these other tests, turn `ON` the variables in `ci/prtest.config` in your PR:
-
-```bash
-RUN_CUGRAPH_LIBCUGRAPH_TESTS=OFF
-RUN_CUGRAPH_PYTHON_TESTS=OFF
-
-RUN_CUML_LIBCUML_TESTS=OFF
-RUN_CUML_PRIMS_TESTS=OFF
-RUN_CUML_PYTHON_TESTS=OFF
-```
-
-This will make it so that CI in the PR will clone and build the respective repository, but the repository **will be built using the fork/branch of RAFT in the PR**. This allows to test changes in RAFT without the need of opening PRs in the other repositories.
-
-Before merging the PR, those variables need to be returned to `OFF`.
-
-
-## Developer Guide
-
-### Local Development
+### C++ Integration
-To help working with RAFT and consuming projects as seamless as possible, this section describes how a typical workflow looks like and gives some guidelines for developers working in projects that affect code in both RAFT and at least one downstream repository.
+Use RAFT in cmake projects with `find_package(raft)` for header-only operation and the `raft::raft` target will be available for configuring linking and `RAFT_INCLUDE_DIR` will be available for includes. Note that if any packages are used which require downstream dependencies, such as the `nn` package requiring FAISS, these dependencies will have be installed and configured in cmake independently.
-Using as an example developer working on cuML and RAFT, we recommend the following:
+Use `find_package(raft COMPONENTS nn, distance)` to enable the shared libraries and pass dependencies through separate targets for each component. In this example, `raft::distance` and `raft::nn` targets will be available for configuring linking paths. These targets will also pass through any transitive dependencies (such as FAISS in the case of the `nn` package).
-- Create two working folders: one containing the cloned cuML repository and the other the cloned RAFT one.
-- Create environment variable `RAFT_PATH` pointing to the location of the RAFT path.
-- Work on same named branches in both repos/folders.
+### Building RAFT C++ from source
-This will facilitate development, and the `RAFT_PATH` variable will make it so that the downstream repository, in this case cuML, builds using the locally cloned RAFT (as descrbed in the first step).
+RAFT uses the [RAPIDS cmake](https://github.com/rapidsai/rapids-cmake) library, so it can be easily included into downstream projects. RAPIDS cmake provides a convenience layer around the [Cmake Package Manager (CPM)](https://github.com/cpm-cmake/CPM.cmake). The following example is similar to building RAFT itself from source but allows it to be done in cmake, providing the `raft::raft` target for includes by default. The `COMPILE_LIBRARIES` option enables the building of the shared libraries
-### Submitting PRs Guidelines
+```cmake
+function(find_and_configure_raft)
+
+ set(oneValueArgs VERSION FORK PINNED_TAG USE_RAFT_NN USE_FAISS_STATIC COMPILE_LIBRARIES)
+ cmake_parse_arguments(PKG "${options}" "${oneValueArgs}"
+ "${multiValueArgs}" ${ARGN} )
+
+ rapids_cpm_find(raft ${PKG_VERSION}
+ GLOBAL_TARGETS raft::raft
+ BUILD_EXPORT_SET proj-exports
+ INSTALL_EXPORT_SET proj-exports
+ CPM_ARGS
+ GIT_REPOSITORY https://github.com/${PKG_FORK}/raft.git
+ GIT_TAG ${PKG_PINNED_TAG}
+ SOURCE_SUBDIR cpp
+ FIND_PACKAGE_ARGUMENTS "COMPONENTS ${RAFT_COMPONENTS}"
+ OPTIONS
+ "BUILD_TESTS OFF"
+ "RAFT_USE_FAISS_STATIC ${PKG_USE_FAISS_STATIC}"
+ "NVTX ${NVTX}"
+ "RAFT_COMPILE_LIBRARIES ${COMPILE_LIBRARIES}"
+
+ )
+
+endfunction()
+
+# Change pinned tag here to test a commit in CI
+# To use a different RAFT locally, set the CMake variable
+# CPM_raft_SOURCE=/path/to/local/raft
+find_and_configure_raft(VERSION 22.02.00
+ FORK rapidsai
+ PINNED_TAG branch-22.02
+ USE_RAFT_NN NO
+ USE_FAISS_STATIC NO
+ COMPILE_LIBRARIES NO
+)
+```
-If you have changes to both RAFT and at least one downstream repo, then:
+### Python/Cython Integration
-- It is recommended to open a PR to both repositories (for visibility and CI tests).
-- Change the pinned branch/commit in the downstream repo PR to point to the fork and branch used for the RAFT PR to make CI run tests
-- If your changes might affect usage of RAFT by other downnstream repos, alert reviewers and open a github issue or PR in that downstream repo as approproate.
-- The PR to RAFT will be merged first, so that the downstream repo PR pinned branch/commit can be returned to the main RAFT branch and run CI with it.
+Once installed, RAFT's Python library can be imported and used directly.
\ No newline at end of file
diff --git a/DEVELOPER_GUIDE.md b/DEVELOPER_GUIDE.md
new file mode 100644
index 0000000000..a045d13991
--- /dev/null
+++ b/DEVELOPER_GUIDE.md
@@ -0,0 +1,24 @@
+# Developer Guide
+
+## Local Development
+
+Devloping features and fixing bugs for the RAFT library itself is straightforward and only requires building and installing the relevant RAFT artifacts.
+
+The process for working on a CUDA/C++ feature which spans RAFT and one or more consumers can vary slightly depending on whether the consuming project relies on a source build (as outlined in the [BUILD](BUILD.md#building-raft-c-from-source) docs). In such a case, the option `CPM_raft_SOURCE=/path/to/raft/source` can be passed to the cmake of the consuming project in order to build the local RAFT from source. The PR with relevant changes to the consuming project can also pin the RAFT version temporarily by explicitly changing the `FORK` and `PINNED_TAG` arguments to the RAFT branch containing their changes when invoking `find_and_configure_raft`. The pin should be reverted after the changed is merged to the RAFT project and before it is merged to the dependent project(s) downstream.
+
+If building a feature which spans projects and not using the source build in cmake, the RAFT changes (both C++ and Python) will need to be installed into the environment of the consuming project before they can be used. The ideal integration of RAFT into consuming projects will enable both the source build in the consuming project only for this case but also rely on a more stable packaging (such as conda packaging) otherwise.
+
+## API stability
+
+Since RAFT is a core library with multiple consumers, it's important that the public APIs maintain stability across versions and any changes to them are done with caution, adding new functions and deprecating the old functions over a couple releases as necessary.
+
+The public APIs should be lightweight wrappers around calls to private APIs inside the `detail` namespace.
+
+## Testing
+
+It's important for RAFT to maintain a high test coverage in order to minimize the potential for downstream projects to encounter unexpected build or runtime behavior as a result of changes. A well-defined public API can help maintain compile-time stability but means more focus should be placed on testing the functional requirements and verifying execution on the various edge cases within RAFT itself. Ideally, bug fixes and new features should be able to be made to RAFT independently of the consuming projects.
+
+
+## Documentation
+
+Public APIs always require documentation, since those will be exposed directly to users. In addition to summarizing the purpose of each class / function in the public API, the arguments (and relevant templates) should be documented along with brief usage examples.
\ No newline at end of file
diff --git a/README.md b/README.md
index 8091c345e1..c0eeab75e5 100755
--- a/README.md
+++ b/README.md
@@ -1,6 +1,7 @@
#
RAFT: RAPIDS Analytics Framework Toolkit
-RAFT is a library containing building-blocks for rapid composition of RAPIDS Analytics. These building-blocks include shared representations, mathematical computational primitives, and utilities that accelerate building analytics and data science algorithms in the RAPIDS ecosystem. Both the C++ and Python components can be included in consuming libraries, providing building-blocks for both dense and sparse matrix formats in the following general categories:
+RAFT is a library containing building-blocks for rapid composition of RAPIDS Analytics. These building-blocks include shared representations, mathematical computational primitives, and utilities that accelerate building analytics and data science algorithms in the RAPIDS ecosystem. Both the C++ and Python components can be included in consuming libraries, providing operations for both dense and sparse matrix formats in the following general categories:
+
#####
| Category | Description / Examples |
| --- | --- |
@@ -17,11 +18,13 @@ the maintenance burden by maximizing reuse across projects. RAFT relies on the [
like other projects in the RAPIDS ecosystem, eases the burden of configuring different allocation strategies globally
across the libraries that use it. RMM also provides RAII wrappers around device arrays that handle the allocation and cleanup.
+## RAFT's primary goals are to be fast, simple, reusable, composable, and comprehensive.
+
## Getting started
-Refer to the [Build and Development Guide](BUILD.md) for details on RAFT's design, building, testing and development guidelines.
+Refer to the [Build](BUILD.md) instructions for details on building and including the RAFT library in downstream projects. The [Developer Guide](DEVELOPER_GUIDE.md) contains details on the developer guidelines, workflows, and principals. If you are interested in contributing to the RAFT project, please read our [Contributing guidelines](CONTRIBUTING.md).
-Most of the primitives in RAFT accept a `raft::handle_t` object for the management of resources which are expensive to create, such CUDA streams, stream pools, and handles to other CUDA libraries like `cublas` and `cusolver`.
+Most of the primitives in RAFT accept a `raft::handle_t` object for the management of resources which are expensive to create, such CUDA streams, stream pools, and handles to other CUDA libraries like `cublas` and `cusolver`.
### C++ Example
@@ -58,37 +61,8 @@ raft::distance::pairwise_distance(handle, input.data(), input.data(),
The folder structure mirrors other RAPIDS repos (cuDF, cuML, cuGraph...), with the following folders:
+- `ci`: Scripts for running CI in PRs
+- `conda`: conda recipes and development conda environments
- `cpp`: Source code for all C++ code. The code is currently header-only, therefore it is in the `include` folder (with no `src`).
+- `docs`: Source code and scripts for building library documentation
- `python`: Source code for all Python source code.
-- `ci`: Scripts for running CI in PRs
-
-[comment]: <> (TODO: This needs to be updated after the public API is established)
-[comment]: <> (The library layout contains the following structure:)
-
-[comment]: <> (```bash)
-
-[comment]: <> (cpp/include/raft)
-
-[comment]: <> ( |------------ comms [communication abstraction layer])
-
-[comment]: <> ( |------------ distance [dense pairwise distances])
-
-[comment]: <> ( |------------ linalg [dense linear algebra])
-
-[comment]: <> ( |------------ matrix [dense matrix format])
-
-[comment]: <> ( |------------ random [random matrix generation])
-
-[comment]: <> ( |------------ sparse [sparse matrix and graph algorithms])
-
-[comment]: <> ( |------------ spatial [spatial algorithms])
-
-[comment]: <> ( |------------ spectral [spectral clustering])
-
-[comment]: <> ( |------------ stats [statistics primitives])
-
-[comment]: <> ( |------------ handle.hpp [raft handle])
-
-[comment]: <> (```)
-
-
diff --git a/build.sh b/build.sh
index a609670419..5b9a1c4ba0 100755
--- a/build.sh
+++ b/build.sh
@@ -18,14 +18,14 @@ ARGS=$*
# script, and that this script resides in the repo dir!
REPODIR=$(cd $(dirname $0); pwd)
-VALIDARGS="clean cppraft pyraft cppdocs -v -g --allgpuarch --nvtx --show_depr_warn -h --buildgtest --buildfaiss"
+VALIDARGS="clean cppraft pyraft docs -v -g --allgpuarch --nvtx --show_depr_warn -h --buildgtest --buildfaiss"
HELP="$0 [ ...] [ ...]
where is:
clean - remove all existing build artifacts and configuration (start over)
cppraft - build the cuml C++ code only. Also builds the C-wrapper library
around the C++ code.
pyraft - build the cuml Python package
- cppdocs - build the C++ doxygen documentation
+ docs - build the documentation
and is:
-v - verbose build mode
-g - build for debug
@@ -38,6 +38,7 @@ HELP="$0 [ ...] [ ...]
default action (no args) is to build both cppraft and pyraft targets
"
CPP_RAFT_BUILD_DIR=${REPODIR}/cpp/build
+SPHINX_BUILD_DIR=${REPODIR}/docs
PY_RAFT_BUILD_DIR=${REPODIR}/python/build
PYTHON_DEPS_CLONE=${REPODIR}/python/external_repositories
BUILD_DIRS="${CPP_RAFT_BUILD_DIR} ${PY_RAFT_BUILD_DIR} ${PYTHON_DEPS_CLONE}"
@@ -131,14 +132,10 @@ if (( ${CLEAN} == 1 )); then
cd ${REPODIR}
fi
-if hasArg cppdocs; then
- cd ${CPP_RAFT_BUILD_DIR}
- cmake --build ${CPP_RAFT_BUILD_DIR} --target docs_raft
-fi
################################################################################
# Configure for building all C++ targets
-if (( ${NUMARGS} == 0 )) || hasArg cppraft; then
+if (( ${NUMARGS} == 0 )) || hasArg cppraft || hasArg docs; then
if (( ${BUILD_ALL_GPU_ARCH} == 0 )); then
RAFT_CMAKE_CUDA_ARCHITECTURES="NATIVE"
echo "Building for the architecture of the GPU in the system..."
@@ -155,14 +152,15 @@ if (( ${NUMARGS} == 0 )) || hasArg cppraft; then
-DBUILD_GTEST=${BUILD_GTEST} \
-DBUILD_STATIC_FAISS=${BUILD_STATIC_FAISS}
-
- # Run all c++ targets at once
- cmake --build ${CPP_RAFT_BUILD_DIR} -j${PARALLEL_LEVEL} ${MAKE_TARGETS} ${VERBOSE_FLAG}
+ if hasArg cppraft; then
+ # Run all c++ targets at once
+ cmake --build ${CPP_RAFT_BUILD_DIR} -j${PARALLEL_LEVEL} ${MAKE_TARGETS} ${VERBOSE_FLAG}
+ fi
fi
# Build and (optionally) install the cuml Python package
-if (( ${NUMARGS} == 0 )) || hasArg pyraft; then
+if (( ${NUMARGS} == 0 )) || hasArg pyraft || hasArg docs; then
cd ${REPODIR}/python
if [[ ${INSTALL_TARGET} != "" ]]; then
@@ -171,3 +169,9 @@ if (( ${NUMARGS} == 0 )) || hasArg pyraft; then
python setup.py build_ext -j${PARALLEL_LEVEL:-1} --inplace --library-dir=${LIBCUML_BUILD_DIR} ${SINGLEGPU}
fi
fi
+
+if hasArg docs; then
+ cmake --build ${CPP_RAFT_BUILD_DIR} --target docs_raft
+ cd ${SPHINX_BUILD_DIR}
+ make html
+fi
diff --git a/ci/gpu/build.sh b/ci/gpu/build.sh
index 77987e65be..1c8d7797ad 100644
--- a/ci/gpu/build.sh
+++ b/ci/gpu/build.sh
@@ -1,5 +1,5 @@
#!/bin/bash
-# Copyright (c) 2020-2021, NVIDIA CORPORATION.
+# Copyright (c) 2020-2022, NVIDIA CORPORATION.
#########################################
# cuML GPU build and test script for CI #
#########################################
@@ -53,6 +53,7 @@ gpuci_mamba_retry install -c conda-forge -c rapidsai -c rapidsai-nightly -c nvid
"libcusolver>=11.2.1" \
"cudf=${MINOR_VERSION}" \
"rmm=${MINOR_VERSION}" \
+ "breathe" \
"dask-cudf=${MINOR_VERSION}" \
"dask-cuda=${MINOR_VERSION}" \
"ucx-py=${UCX_PY_VERSION}" \
@@ -90,8 +91,8 @@ export LD_LIBRARY_PATH=$CONDA_PREFIX/lib:$LD_LIBRARY_PATH
gpuci_logger "Build C++ and Python targets"
"$WORKSPACE/build.sh" cppraft pyraft -v
-gpuci_logger "Building doxygen C++ docs"
-"$WORKSPACE/build.sh" cppdocs -v
+gpuci_logger "Building docs"
+"$WORKSPACE/build.sh" docs -v
gpuci_logger "Resetting LD_LIBRARY_PATH"
diff --git a/conda/environments/raft_dev_cuda11.0.yml b/conda/environments/raft_dev_cuda11.0.yml
index 93134c6367..460ba7c1fb 100644
--- a/conda/environments/raft_dev_cuda11.0.yml
+++ b/conda/environments/raft_dev_cuda11.0.yml
@@ -21,6 +21,7 @@ dependencies:
- pip
- pip:
- sphinx_markdown_tables
+ - breathe
- git+https://github.com/dask/dask.git@main
- git+https://github.com/dask/distributed.git@main
diff --git a/conda/environments/raft_dev_cuda11.2.yml b/conda/environments/raft_dev_cuda11.2.yml
index ced3aa2ed1..a1e9ad650f 100644
--- a/conda/environments/raft_dev_cuda11.2.yml
+++ b/conda/environments/raft_dev_cuda11.2.yml
@@ -21,6 +21,7 @@ dependencies:
- pip
- pip:
- sphinx_markdown_tables
+ - breathe
- git+https://github.com/dask/dask.git@main
- git+https://github.com/dask/distributed.git@main
diff --git a/conda/environments/raft_dev_cuda11.4.yml b/conda/environments/raft_dev_cuda11.4.yml
index 54d2680295..c88f480e56 100644
--- a/conda/environments/raft_dev_cuda11.4.yml
+++ b/conda/environments/raft_dev_cuda11.4.yml
@@ -21,6 +21,7 @@ dependencies:
- pip
- pip:
- sphinx_markdown_tables
+ - breathe
- git+https://github.com/dask/dask.git@main
- git+https://github.com/dask/distributed.git@main
diff --git a/conda/environments/raft_dev_cuda11.5.yml b/conda/environments/raft_dev_cuda11.5.yml
index 152f3a8db5..fb9468adcc 100644
--- a/conda/environments/raft_dev_cuda11.5.yml
+++ b/conda/environments/raft_dev_cuda11.5.yml
@@ -21,6 +21,7 @@ dependencies:
- pip
- pip:
- sphinx_markdown_tables
+ - breathe
- git+https://github.com/dask/dask.git@main
- git+https://github.com/dask/distributed.git@main
diff --git a/cpp/CMakeLists.txt b/cpp/CMakeLists.txt
index efebfff429..9387589f73 100644
--- a/cpp/CMakeLists.txt
+++ b/cpp/CMakeLists.txt
@@ -1,5 +1,5 @@
#=============================================================================
-# Copyright (c) 2020-2021, NVIDIA CORPORATION.
+# Copyright (c) 2020-2022, NVIDIA CORPORATION.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -238,6 +238,6 @@ endif()
# - doxygen targets ----------------------------------------------------------
include(cmake/doxygen.cmake)
-add_doxygen_target(IN_DOXYFILE Doxyfile.in
+add_doxygen_target(IN_DOXYFILE doxygen/Doxyfile.in
OUT_DOXYFILE ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile
CWD ${CMAKE_CURRENT_BINARY_DIR})
diff --git a/cpp/Doxyfile.in b/cpp/doxygen/Doxyfile.in
similarity index 98%
rename from cpp/Doxyfile.in
rename to cpp/doxygen/Doxyfile.in
index 0918e12e4f..eb27b2d02c 100644
--- a/cpp/Doxyfile.in
+++ b/cpp/doxygen/Doxyfile.in
@@ -281,7 +281,8 @@ OPTIMIZE_OUTPUT_VHDL = NO
# Note that for custom extensions you also need to set FILE_PATTERNS otherwise
# the files are not read by doxygen.
-EXTENSION_MAPPING =
+EXTENSION_MAPPING = cu=C++ \
+ cuh=C++
# If the MARKDOWN_SUPPORT tag is enabled then doxygen pre-processes all comments
# according to the Markdown format, which allows for more readable
@@ -771,7 +772,8 @@ WARN_LOGFILE =
# spaces. See also FILE_PATTERNS and EXTENSION_MAPPING
# Note: If this tag is empty the current directory is searched.
-INPUT = @CMAKE_CURRENT_SOURCE_DIR@/include \
+INPUT = @CMAKE_CURRENT_SOURCE_DIR@/doxygen/main_page.md \
+ @CMAKE_CURRENT_SOURCE_DIR@/include \
# This tag can be used to specify the character encoding of the source files
# that doxygen parses. Internally doxygen uses the UTF-8 encoding. Doxygen uses
@@ -811,7 +813,9 @@ RECURSIVE = YES
# Note that relative paths are relative to the directory from which doxygen is
# run.
-EXCLUDE =
+EXCLUDE = @CMAKE_CURRENT_SOURCE_DIR@/include/raft/sparse/linalg/symmetrize.hpp \ # Contains device code
+ @CMAKE_CURRENT_SOURCE_DIR@/include/raft/sparse/csr.hpp \ # Contains device code
+ @CMAKE_CURRENT_SOURCE_DIR@/include/raft/sparse/cusparse_wrappers.h
# The EXCLUDE_SYMLINKS tag can be used to select whether or not files or
# directories that are symbolic links (a Unix file system feature) are excluded
@@ -827,8 +831,9 @@ EXCLUDE_SYMLINKS = NO
# Note that the wildcards are matched against the file with absolute path, so to
# exclude all test directories for example use the pattern */test/*
-EXCLUDE_PATTERNS = **/detail/** \
- **/spectral/**
+EXCLUDE_PATTERNS = */detail/* \
+ */specializations/* \
+ */spectral/*
# The EXCLUDE_SYMBOLS tag can be used to specify one or more symbol names
# (namespaces, classes, functions, etc.) that should be excluded from the
@@ -839,7 +844,9 @@ EXCLUDE_PATTERNS = **/detail/** \
# Note that the wildcards are matched against the file with absolute path, so to
# exclude all test directories use the pattern */test/*
-EXCLUDE_SYMBOLS =
+EXCLUDE_SYMBOLS = detail \
+ csr_adj_graph \
+ csr_adj_graph_batched
# The EXAMPLE_PATH tag can be used to specify one or more files or directories
# that contain example code fragments that are included (see the \include
@@ -921,7 +928,7 @@ FILTER_SOURCE_PATTERNS =
# (index.html). This can be useful if you have a project on for instance GitHub
# and want to reuse the introduction page also for the doxygen output.
-USE_MDFILE_AS_MAINPAGE =
+USE_MDFILE_AS_MAINPAGE = @CMAKE_CURRENT_SOURCE_DIR@/doxygen/main_page.md
#---------------------------------------------------------------------------
# Configuration options related to source browsing
@@ -1131,7 +1138,7 @@ HTML_STYLESHEET =
# list). For an example see the documentation.
# This tag requires that the tag GENERATE_HTML is set to YES.
-HTML_EXTRA_STYLESHEET =
+HTML_EXTRA_STYLESHEET = @CMAKE_CURRENT_SOURCE_DIR@/doxygen/rapids.css
# The HTML_EXTRA_FILES tag can be used to specify one or more extra images or
# other source files which should be copied to the HTML output directory. Note
@@ -1152,7 +1159,7 @@ HTML_EXTRA_FILES =
# Minimum value: 0, maximum value: 359, default value: 220.
# This tag requires that the tag GENERATE_HTML is set to YES.
-HTML_COLORSTYLE_HUE = 220
+HTML_COLORSTYLE_HUE = 266
# The HTML_COLORSTYLE_SAT tag controls the purity (or saturation) of the colors
# in the HTML output. For a value of 0 the output will use grayscales only. A
@@ -1160,7 +1167,7 @@ HTML_COLORSTYLE_HUE = 220
# Minimum value: 0, maximum value: 255, default value: 100.
# This tag requires that the tag GENERATE_HTML is set to YES.
-HTML_COLORSTYLE_SAT = 100
+HTML_COLORSTYLE_SAT = 255
# The HTML_COLORSTYLE_GAMMA tag controls the gamma correction applied to the
# luminance component of the colors in the HTML output. Values below 100
@@ -1171,7 +1178,7 @@ HTML_COLORSTYLE_SAT = 100
# Minimum value: 40, maximum value: 240, default value: 80.
# This tag requires that the tag GENERATE_HTML is set to YES.
-HTML_COLORSTYLE_GAMMA = 80
+HTML_COLORSTYLE_GAMMA = 52
# If the HTML_TIMESTAMP tag is set to YES then the footer of each generated HTML
# page will contain the date and time when the page was generated. Setting this
@@ -1182,6 +1189,17 @@ HTML_COLORSTYLE_GAMMA = 80
HTML_TIMESTAMP = NO
+# If the HTML_DYNAMIC_MENUS tag is set to YES then the generated HTML
+# documentation will contain a main index with vertical navigation menus that
+# are dynamically created via JavaScript. If disabled, the navigation index will
+# consists of multiple levels of tabs that are statically embedded in every HTML
+# page. Disable this option to support browsers that do not have JavaScript,
+# like the Qt help browser.
+# The default value is: YES.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+HTML_DYNAMIC_MENUS = YES
+
# If the HTML_DYNAMIC_SECTIONS tag is set to YES then the generated HTML
# documentation will contain sections that can be hidden and shown after the
# page has loaded.
@@ -1885,7 +1903,7 @@ MAN_LINKS = NO
# captures the structure of the code including all documentation.
# The default value is: NO.
-GENERATE_XML = NO
+GENERATE_XML = YES
# The XML_OUTPUT tag is used to specify where the XML pages will be put. If a
# relative path is entered the value of OUTPUT_DIRECTORY will be put in front of
diff --git a/cpp/doxygen/main_page.md b/cpp/doxygen/main_page.md
new file mode 100644
index 0000000000..070a8f1f1d
--- /dev/null
+++ b/cpp/doxygen/main_page.md
@@ -0,0 +1,14 @@
+# libraft
+
+RAFT (RAPIDS Analytics Framework Toolkit) is a library containing building-blocks for rapid composition of RAPIDS Analytics. These building-blocks include shared representations, mathematical computational primitives, and utilities that accelerate building analytics and data science algorithms in the RAPIDS ecosystem. Both the C++ and Python components can be included in consuming libraries, providing building-blocks for both dense and sparse matrix formats in the following general categories:
+
+#####
+| Category | Description / Examples |
+| --- | --- |
+| **Data Formats** | tensor representations and conversions for both sparse and dense formats |
+| **Data Generation** | graph, spatial, and machine learning dataset generation |
+| **Dense Operations** | linear algebra, statistics |
+| **Spatial** | pairwise distances, nearest neighbors, neighborhood / proximity graph construction |
+| **Sparse/Graph Operations** | linear algebra, statistics, slicing, msf, spectral embedding/clustering, slhc, vertex degree |
+| **Solvers** | eigenvalue decomposition, least squares, lanczos |
+| **Tools** | multi-node multi-gpu communicator, utilities |
diff --git a/cpp/doxygen/rapids.css b/cpp/doxygen/rapids.css
new file mode 100644
index 0000000000..57b6de692a
--- /dev/null
+++ b/cpp/doxygen/rapids.css
@@ -0,0 +1,119 @@
+/*
+ * Copyright (c) 2022, NVIDIA CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/* sm-dox is the CSS class Doxygen uses for the main navigation menu bar */
+.sm-dox {
+ background-image:none; /* override Doxygen background images */
+ background-color: #7306ff; /* rapids.ai menu background purple */
+}
+
+/* Menu links */
+.sm-dox a,
+.sm-dox a:focus,
+.sm-dox a:hover,
+.sm-dox a:active,
+.sm-dox a.highlighted {
+ background-image:none; /* override Doxygen background images */
+ color: white; /* rapids.ai menu white font */
+ font-family:"Open Sans",sans-serif; /* rapids.ai menu font family */
+ /* rapids.ai uppercase menus, no decoration or shadows, 1em size */
+ text-decoration: none;
+ text-transform: uppercase;
+ text-shadow: none;
+ font-weight: normal;
+ font-size: 1em;
+}
+
+.sm-dox a:hover {
+ background-image:none; /* override Doxygen background images */
+ color: #a785e7; /* rapids.ai menu text hover color */
+ -webkit-transition: all 0.3s ease-in-out; /* rapids.ai menu fade when hover */
+ -moz-transition: all 0.3s ease-in-out;
+ -o-transition: all 0.3s ease-in-out;
+ transition: all 0.3s ease-in-out;
+}
+
+/* These are the triangles to the right of menus that open up. Make them match the font/fade */
+.sm-dox a span.sub-arrow {
+ border-top-color: white;
+}
+
+.sm-dox a:hover span.sub-arrow {
+ border-top-color: #a785e7; /* rapids.ai menu text hover color */
+ -webkit-transition: all 0.3s ease-in-out; /* rapids.ai menu fade when hover */
+ -moz-transition: all 0.3s ease-in-out;
+ -o-transition: all 0.3s ease-in-out;
+ transition: all 0.3s ease-in-out;
+}
+
+/* sm-dox ul is the drop-down menus that appear when you mouse over hierarchical menus.
+ Make these white but highlight hovered items with rapids purple background and white text. */
+.sm-dox ul a {
+ font-size: 1em;
+}
+
+.sm-dox ul a:hover {
+ background-image:none;
+ background-color: #7306ff;
+ font-size: 1em;
+ text-shadow: none;
+ -webkit-transition: all 0.3s ease-in-out;
+ -moz-transition: all 0.3s ease-in-out;
+ -o-transition: all 0.3s ease-in-out;
+ transition: all 0.3s ease-in-out;
+}
+
+/* Sub menu (underneath the main Doxygen bar) is a ul with class navpath that shows
+ the C++ class hierarchy.
+*/
+.navpath ul
+{
+ font-size: 13px; /* Bigger than Doxygen default looks a bit better */
+ background-image:none; /* Override Doxygen gradient background image */
+ background-color: #FAF6FF; /* A nearly white RAPIDS purple background */
+ border-top:none; /* Override Doxygen top border for class hierarchy menu since
+ it doesn't match the menu above. */
+}
+
+/* Note we don't override the background on li tags here because we want to keep the ">"
+ background images Doxygen uses here as separators */
+.navpath li.navelem {
+ background-color: #FAF6FF; /* A nearly white RAPIDS purple background */
+}
+
+/* Add some CSS to make class / function lists nicer in the presence of long templated names */
+
+.directory td.entry {
+ white-space: normal; /* Allow text wrapping for long class names */
+ min-width: 512px; /* But don't wrap them too much. */
+
+ /* This indent and padding causes any long class names that are wrapped to be indented on
+ wrapped lines */
+ text-indent: -65px;
+ padding-left: 55px;
+}
+
+/* Prevent arrows from being negatively indented */
+.arrow {
+ text-indent: 0px;
+ padding-left: 10px;
+}
+
+/* Prevent icons from being negatively indented */
+.icona {
+ text-indent: 0px;
+ padding-left: 0px;
+}
\ No newline at end of file
diff --git a/docs/Makefile b/docs/Makefile
new file mode 100644
index 0000000000..b242888a67
--- /dev/null
+++ b/docs/Makefile
@@ -0,0 +1,20 @@
+# Minimal makefile for Sphinx documentation
+#
+
+# You can set these variables from the command line.
+SPHINXOPTS = -Dbreath_projects.RAFT=../cpp/build/xml
+SPHINXBUILD = sphinx-build
+SPHINXPROJ = RAFT
+SOURCEDIR = source
+BUILDDIR = build
+
+# Put it first so that "make" without argument is like "make help".
+help:
+ @$(SPHINXBUILD) -M help -v "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
+
+.PHONY: help Makefile
+
+# Catch-all target: route all unknown targets to Sphinx using the new
+# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
+%: Makefile
+ @$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
diff --git a/docs/README.md b/docs/README.md
new file mode 100644
index 0000000000..ced8e63938
--- /dev/null
+++ b/docs/README.md
@@ -0,0 +1,14 @@
+# Building Documentation
+## Building locally:
+
+#### [Build and install RAFT](../BUILD.md)
+
+#### Generate the docs
+```shell script
+bash build.sh docs
+```
+
+#### Once the process finishes, documentation can be found in build/html
+```shell script
+xdg-open build/html/index.html`
+```
\ No newline at end of file
diff --git a/docs/make.bat b/docs/make.bat
new file mode 100644
index 0000000000..0bc0dee103
--- /dev/null
+++ b/docs/make.bat
@@ -0,0 +1,36 @@
+@ECHO OFF
+
+pushd %~dp0
+
+REM Command file for Sphinx documentation
+
+if "%SPHINXBUILD%" == "" (
+ set SPHINXBUILD=sphinx-build
+)
+set SOURCEDIR=source
+set BUILDDIR=build
+set SPHINXPROJ=cuML
+
+if "%1" == "" goto help
+
+%SPHINXBUILD% >NUL 2>NUL
+if errorlevel 9009 (
+ echo.
+ echo.The 'sphinx-build' command was not found. Make sure you have Sphinx
+ echo.installed, then set the SPHINXBUILD environment variable to point
+ echo.to the full path of the 'sphinx-build' executable. Alternatively you
+ echo.may add the Sphinx directory to PATH.
+ echo.
+ echo.If you don't have Sphinx installed, grab it from
+ echo.http://sphinx-doc.org/
+ exit /b 1
+)
+
+%SPHINXBUILD% -M %1 %SOURCEDIR% %BUILDDIR% %SPHINXOPTS%
+goto end
+
+:help
+%SPHINXBUILD% -M help %SOURCEDIR% %BUILDDIR% %SPHINXOPTS%
+
+:end
+popd
diff --git a/docs/source/_static/copybutton.css b/docs/source/_static/copybutton.css
new file mode 100644
index 0000000000..5eef6e366d
--- /dev/null
+++ b/docs/source/_static/copybutton.css
@@ -0,0 +1,42 @@
+/* This contains code with copyright by the scikit-learn project, subject to
+the license in /thirdparty/LICENSES/LICENSE.scikit_learn */
+
+/* copybutton */
+/* Adds "Show/Hide Output" button to Examples */
+
+.copybutton {
+ cursor: pointer;
+ position: absolute;
+ top: 0px;
+ right: 0px;
+ border: 1px solid rgb(221, 221, 221);
+ color: rgb(221, 221, 221);
+ font-family: monospace;
+ padding-left: 0.2rem;
+ padding-right: 0.2rem;
+}
+
+div.highlight:hover span.copybutton::after {
+ background: #3F556B;
+ border-radius: 0.25rem;
+ color: white;
+ content: attr(title);
+ padding: 0.25rem;
+ position: absolute;
+ z-index: 98;
+ width: 100px;
+ font-size: 0.7rem;
+ top: 0;
+ right: 0;
+}
+
+/* copy buttonn */
+div.highlight:hover span.copybutton {
+ background-color: #3F556B;
+ color: white;
+}
+
+div.highlight:hover span.copybutton:hover {
+ background-color: #20252B;
+}
+
diff --git a/docs/source/_static/example_mod.js b/docs/source/_static/example_mod.js
new file mode 100644
index 0000000000..77dc618a82
--- /dev/null
+++ b/docs/source/_static/example_mod.js
@@ -0,0 +1,61 @@
+// This contains code with copyright by the scikit-learn project, subject to
+// the license in /thirdparty/LICENSES/LICENSE.scikit_learn
+
+$(document).ready(function () {
+ /* Add a [>>>] button on the top-right corner of code samples to hide
+ * the >>> and ... prompts and the output and thus make the code
+ * copyable. */
+ var div = $('.highlight-python .highlight,' +
+ '.highlight-python3 .highlight,' +
+ '.highlight-pycon .highlight,' +
+ '.highlight-default .highlight')
+ var pre = div.find('pre');
+
+ // get the styles from the current theme
+ pre.parent().parent().css('position', 'relative');
+ var hide_text = 'Hide prompts and outputs';
+ var show_text = 'Show prompts and outputs';
+
+ // create and add the button to all the code blocks that contain >>>
+ div.each(function (index) {
+ var jthis = $(this);
+ if (jthis.find('.gp').length > 0) {
+ var button = $('>>>');
+ button.attr('title', hide_text);
+ button.data('hidden', 'false');
+ jthis.prepend(button);
+ }
+ // tracebacks (.gt) contain bare text elements that need to be
+ // wrapped in a span to work with .nextUntil() (see later)
+ jthis.find('pre:has(.gt)').contents().filter(function () {
+ return ((this.nodeType == 3) && (this.data.trim().length > 0));
+ }).wrap('');
+ });
+
+ // define the behavior of the button when it's clicked
+ $('.copybutton').click(function (e) {
+ e.preventDefault();
+ var button = $(this);
+ if (button.data('hidden') === 'false') {
+ // hide the code output
+ button.parent().find('.go, .gp, .gt').hide();
+ button.next('pre')
+ .find('.gt')
+ .nextUntil('.gp, .go')
+ .css('visibility', 'hidden');
+ button.css('text-decoration', 'line-through');
+ button.attr('title', show_text);
+ button.data('hidden', 'true');
+ } else {
+ // show the code output
+ button.parent().find('.go, .gp, .gt').show();
+ button.next('pre')
+ .find('.gt')
+ .nextUntil('.gp, .go')
+ .css('visibility', 'visible');
+ button.css('text-decoration', 'none');
+ button.attr('title', hide_text);
+ button.data('hidden', 'false');
+ }
+ });
+});
\ No newline at end of file
diff --git a/docs/source/_static/infoboxes.css b/docs/source/_static/infoboxes.css
new file mode 100644
index 0000000000..4cc597bd28
--- /dev/null
+++ b/docs/source/_static/infoboxes.css
@@ -0,0 +1,87 @@
+/* This contains code with copyright by the scikit-learn project, subject to
+the license in /thirdparty/LICENSES/LICENSE.scikit_learn */
+
+/* info boxes */
+
+div.topic {
+ padding: 0.5rem;
+ background-color: #eee;
+ margin-bottom: 1rem;
+ border-radius: 0.25rem;
+ border: 1px solid #CCC;
+}
+
+div.topic p {
+ margin-bottom: 0.25rem;
+}
+
+div.topic dd {
+ margin-bottom: 0.25rem;
+}
+
+p.topic-title {
+ font-weight: bold;
+ margin-bottom: 0.5rem;
+}
+
+div.topic > ul.simple {
+ margin-bottom: 0.25rem;
+}
+
+p.admonition-title {
+ margin-right: 0.5rem;
+ font-weight: bold;
+ display: inline;
+}
+
+p.admonition-title:after {
+ content: ":";
+}
+
+div.admonition p.admonition-title + p, div.deprecated p {
+ display: inline;
+}
+
+div.admonition, div.deprecated {
+ padding: 0.5rem;
+ border-radius: 0.5rem;
+ border: 1px solid #ddd;
+ margin-bottom: 1rem;
+}
+
+div.admonition {
+ background-color: #eee;
+}
+
+div.admonition p, div.admonition dl, div.admonition dd {
+ margin-bottom: 0
+}
+
+div.deprecated {
+ color: #b94a48;
+ background-color: #F3E5E5;
+ border: 1px solid #eed3d7;
+}
+
+div.seealso {
+ background-color: #FFFBE8;
+ border: 1px solid #fbeed5;
+ color: #AF8A4B;
+}
+
+div.versionchanged {
+ margin-top: 0.5rem;
+ padding: 0.5rem;
+ background-color: #FFFBE8;
+ border: 1px solid #fbeed5;
+ border-radius: 0.5rem;
+}
+
+div.versionchanged p {
+ margin-bottom: 0;
+}
+
+dt.label {
+ float: left;
+ padding-right: 0.5rem;
+}
\ No newline at end of file
diff --git a/docs/source/_static/params.css b/docs/source/_static/params.css
new file mode 100644
index 0000000000..dc5cb96406
--- /dev/null
+++ b/docs/source/_static/params.css
@@ -0,0 +1,9 @@
+/* Mirrors the change in:
+ * https://github.com/sphinx-doc/sphinx/pull/5976
+ * which is not showing up in our theme.
+ */
+.classifier:before {
+ font-style: normal;
+ margin: 0.5em;
+ content: ":";
+}
diff --git a/docs/source/_static/references.css b/docs/source/_static/references.css
new file mode 100644
index 0000000000..225cf13ba9
--- /dev/null
+++ b/docs/source/_static/references.css
@@ -0,0 +1,23 @@
+
+/* Fix references to not look like parameters */
+dl.citation > dt.label {
+ display: unset !important;
+ float: left !important;
+ border: unset !important;
+ background: unset !important;
+ padding: unset !important;
+ margin: unset !important;
+ font-size: unset !important;
+ line-height: unset !important;
+ padding-right: 0.5rem !important;
+}
+
+/* Add opening bracket */
+dl.citation > dt.label > span::before {
+ content: "[";
+}
+
+/* Add closing bracket */
+dl.citation > dt.label > span::after {
+ content: "]";
+}
\ No newline at end of file
diff --git a/docs/source/conf.py b/docs/source/conf.py
new file mode 100644
index 0000000000..22979b102b
--- /dev/null
+++ b/docs/source/conf.py
@@ -0,0 +1,215 @@
+#!/usr/bin/env python3
+# -*- coding: utf-8 -*-
+#
+# Copyright (c) 2018-2022, NVIDIA CORPORATION.
+#
+# This file is execfile()d with the current directory set to its
+# containing dir.
+#
+# Note that not all possible configuration values are present in this
+# autogenerated file.
+#
+# All configuration values have a default; values that are commented out
+# serve to show the default.
+
+# If extensions (or modules to document with autodoc) are in another directory,
+# add these directories to sys.path here. If the directory is relative to the
+# documentation root, use os.path.abspath to make it absolute, like shown here.
+#
+import os
+import sys
+
+# If extensions (or modules to document with autodoc) are in another
+# directory, add these directories to sys.path here. If the directory
+# is relative to the documentation root, use os.path.abspath to make it
+# absolute, like shown here.
+sys.path.insert(0, os.path.abspath('sphinxext'))
+sys.path.insert(0, os.path.abspath('../../python'))
+
+from github_link import make_linkcode_resolve # noqa
+
+
+# -- General configuration ------------------------------------------------
+
+# If your documentation needs a minimal Sphinx version, state it here.
+#
+# needs_sphinx = '1.0'
+
+# Add any Sphinx extension module names here, as strings. They can be
+# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
+# ones.
+extensions = [
+ 'numpydoc',
+ 'sphinx.ext.autodoc',
+ 'sphinx.ext.autosummary',
+ 'sphinx.ext.doctest',
+ 'sphinx.ext.intersphinx',
+ 'sphinx.ext.linkcode',
+ "IPython.sphinxext.ipython_console_highlighting",
+ "IPython.sphinxext.ipython_directive",
+ "breathe",
+ "recommonmark",
+ "sphinx_markdown_tables",
+]
+
+breathe_default_project = "RAFT"
+breathe_projects = {
+ "RAFT": "../../cpp/build/xml/",
+}
+ipython_mplbackend = "str"
+
+# Add any paths that contain templates here, relative to this directory.
+templates_path = ['_templates']
+
+# generate autosummary even if no references
+# autosummary_generate = True
+
+# The suffix(es) of source filenames.
+# You can specify multiple suffix as a list of string:
+#
+# source_suffix = ['.rst', '.md']
+source_suffix = {".rst": "restructuredtext", ".md": "markdown"}
+
+# The master toctree document.
+master_doc = 'index'
+
+# General information about the project.
+project = 'raft'
+copyright = '2022, nvidia'
+author = 'nvidia'
+
+# The version info for the project you're documenting, acts as replacement for
+# |version| and |release|, also used in various other places throughout the
+# built documents.
+#
+# The short X.Y version.
+version = '22.02'
+# The full version, including alpha/beta/rc tags.
+release = '22.02.00'
+
+# The language for content autogenerated by Sphinx. Refer to documentation
+# for a list of supported languages.
+#
+# This is also used if you do content translation via gettext catalogs.
+# Usually you set "language" from the command line for these cases.
+language = None
+
+# List of patterns, relative to source directory, that match files and
+# directories to ignore when looking for source files.
+# This patterns also effect to html_static_path and html_extra_path
+exclude_patterns = []
+
+# The name of the Pygments (syntax highlighting) style to use.
+pygments_style = 'sphinx'
+
+# If true, `todo` and `todoList` produce output, else they produce nothing.
+todo_include_todos = False
+
+# -- Options for HTML output ----------------------------------------------
+
+# The theme to use for HTML and HTML Help pages. See the documentation for
+# a list of builtin themes.
+#
+
+html_theme = 'sphinx_rtd_theme'
+
+# on_rtd is whether we are on readthedocs.org
+on_rtd = os.environ.get('READTHEDOCS', None) == 'True'
+
+if not on_rtd:
+ # only import and set the theme if we're building docs locally
+ # otherwise, readthedocs.org uses their theme by default,
+ # so no need to specify it
+ import sphinx_rtd_theme
+ html_theme = 'sphinx_rtd_theme'
+ html_theme_path = [sphinx_rtd_theme.get_html_theme_path()]
+
+# Theme options are theme-specific and customize the look and feel of a theme
+# further. For a list of options available for each theme, see the
+# documentation.
+#
+# html_theme_options = {}
+
+# Add any paths that contain custom static files (such as style sheets) here,
+# relative to this directory. They are copied after the builtin static files,
+# so a file named "default.css" will overwrite the builtin "default.css".
+html_static_path = ['_static']
+
+html_js_files = ["example_mod.js"]
+
+# -- Options for HTMLHelp output ------------------------------------------
+
+# Output file base name for HTML help builder.
+htmlhelp_basename = 'raftdoc'
+
+# -- Options for LaTeX output ---------------------------------------------
+
+latex_elements = {
+ # The paper size ('letterpaper' or 'a4paper').
+ #
+ # 'papersize': 'letterpaper',
+
+ # The font size ('10pt', '11pt' or '12pt').
+ #
+ # 'pointsize': '10pt',
+
+ # Additional stuff for the LaTeX preamble.
+ #
+ # 'preamble': '',
+
+ # Latex figure (float) alignment
+ #
+ # 'figure_align': 'htbp',
+}
+
+# Grouping the document tree into LaTeX files. List of tuples
+# (source start file, target name, title,
+# author, documentclass [howto, manual, or own class]).
+latex_documents = [
+ (master_doc, 'raft.tex', 'RAFT Documentation', 'nvidia', 'manual'),
+]
+
+# -- Options for manual page output ---------------------------------------
+
+# One entry per manual page. List of tuples
+# (source start file, name, description, authors, manual section).
+man_pages = [(master_doc, 'raft', 'RAFT Documentation', [author], 1)]
+
+# -- Options for Texinfo output -------------------------------------------
+
+# Grouping the document tree into Texinfo files. List of tuples
+# (source start file, target name, title, author,
+# dir menu entry, description, category)
+texinfo_documents = [
+ (master_doc, 'raft', 'RAFT Documentation', author, 'raft',
+ 'One line description of project.', 'Miscellaneous'),
+]
+
+# Example configuration for intersphinx: refer to the Python standard library.
+intersphinx_mapping = {
+ "python": ('https://docs.python.org/', None),
+ "scipy": ('https://docs.scipy.org/doc/scipy/reference', None)
+}
+
+# Config numpydoc
+numpydoc_show_inherited_class_members = False
+numpydoc_class_members_toctree = False
+
+
+def setup(app):
+ app.add_css_file('copybutton.css')
+ app.add_css_file('infoboxes.css')
+ app.add_css_file('params.css')
+ app.add_css_file('references.css')
+
+
+# The following is used by sphinx.ext.linkcode to provide links to github
+linkcode_resolve = make_linkcode_resolve(
+ 'raft', 'https://github.com/rapidsai/raft'
+ 'raft/blob/{revision}/python/'
+ '{package}/{path}#L{lineno}')
+
+# Set the default role for interpreted code (anything surrounded in `single
+# backticks`) to be a python object. See
+# https://www.sphinx-doc.org/en/master/usage/configuration.html#confval-default_role
+default_role = "py:obj"
diff --git a/docs/source/cpp_api.rst b/docs/source/cpp_api.rst
new file mode 100644
index 0000000000..6d951587d9
--- /dev/null
+++ b/docs/source/cpp_api.rst
@@ -0,0 +1,14 @@
+~~~~~~~~~~~~~~~~~~~~~~
+RAFT C++ API Reference
+~~~~~~~~~~~~~~~~~~~~~~
+
+
+.. _api:
+
+.. toctree::
+ :maxdepth: 4
+
+ cpp_api/core.rst
+ cpp_api/spatial.rst
+ cpp_api/nn.rst
+ cpp_api/sparse.rst
\ No newline at end of file
diff --git a/docs/source/cpp_api/core.rst b/docs/source/cpp_api/core.rst
new file mode 100644
index 0000000000..13a4dca267
--- /dev/null
+++ b/docs/source/cpp_api/core.rst
@@ -0,0 +1,13 @@
+Core
+====
+
+This page provides C++ class references for the publicly-exposed elements of the core package.
+
+
+
+handle_t
+########
+
+.. doxygenclass:: raft::handle_t
+ :project: RAFT
+ :members:
diff --git a/docs/source/cpp_api/distributed.rst b/docs/source/cpp_api/distributed.rst
new file mode 100644
index 0000000000..e69de29bb2
diff --git a/docs/source/cpp_api/linalg.rst b/docs/source/cpp_api/linalg.rst
new file mode 100644
index 0000000000..e69de29bb2
diff --git a/docs/source/cpp_api/nn.rst b/docs/source/cpp_api/nn.rst
new file mode 100644
index 0000000000..79d8dd1ad3
--- /dev/null
+++ b/docs/source/cpp_api/nn.rst
@@ -0,0 +1,14 @@
+Nearest Neighbors
+=================
+
+This page provides C++ class references for the publicly-exposed elements of the nearest neighbors package.
+
+
+
+nearest neighbors
+#################
+
+.. doxygennamespace:: raft::spatial::knn
+ :project: RAFT
+ :members:
+
diff --git a/docs/source/cpp_api/sparse.rst b/docs/source/cpp_api/sparse.rst
new file mode 100644
index 0000000000..91e553426b
--- /dev/null
+++ b/docs/source/cpp_api/sparse.rst
@@ -0,0 +1,14 @@
+Sparse
+======
+
+This page provides C++ class references for the publicly-exposed elements of the sparse package.
+
+
+
+raft::sparse
+############
+
+.. doxygennamespace:: raft::sparse
+ :project: RAFT
+ :members:
+
diff --git a/docs/source/cpp_api/spatial.rst b/docs/source/cpp_api/spatial.rst
new file mode 100644
index 0000000000..410267e528
--- /dev/null
+++ b/docs/source/cpp_api/spatial.rst
@@ -0,0 +1,13 @@
+Spatial
+=======
+
+This page provides C++ class references for the publicly-exposed elements of the spatial package.
+
+
+
+distance
+########
+
+.. doxygennamespace:: raft::distance
+ :project: RAFT
+
diff --git a/docs/source/cpp_api/stats.rst b/docs/source/cpp_api/stats.rst
new file mode 100644
index 0000000000..e69de29bb2
diff --git a/docs/source/cuda_cpp.rst b/docs/source/cuda_cpp.rst
new file mode 100644
index 0000000000..3737875a27
--- /dev/null
+++ b/docs/source/cuda_cpp.rst
@@ -0,0 +1,11 @@
+CUDA/C++ API
+============
+
+RAFT is header-only but provides optional shared libraries to speed up compile times for larger projects.
+
+.. _api:
+
+.. toctree::
+ :maxdepth: 4
+
+ cpp_api.rst
diff --git a/docs/source/index.rst b/docs/source/index.rst
new file mode 100644
index 0000000000..85798a9b47
--- /dev/null
+++ b/docs/source/index.rst
@@ -0,0 +1,24 @@
+Welcome to RAFT's documentation!
+=================================
+
+
+RAFT (RAPIDS Analytics Framework Toolkit) is a Python and CUDA/C++ library containing building-blocks, mathematical primitives, and utilities for accelerating the composition of RAPIDS analytics.
+
+
+
+.. toctree::
+ :maxdepth: 2
+ :caption: Contents:
+
+ raft_intro.rst
+ cpp_api.rst
+ python_api.rst
+
+
+
+Indices and tables
+==================
+
+* :ref:`genindex`
+* :ref:`modindex`
+* :ref:`search`
diff --git a/docs/source/python.rst b/docs/source/python.rst
new file mode 100644
index 0000000000..3909403ff0
--- /dev/null
+++ b/docs/source/python.rst
@@ -0,0 +1,11 @@
+Python API
+==========
+
+
+
+.. toctree::
+ :maxdepth: 2
+ :caption: Contents:
+
+ python_api.rst
+
diff --git a/docs/source/python_api.rst b/docs/source/python_api.rst
new file mode 100644
index 0000000000..fb8be78c7a
--- /dev/null
+++ b/docs/source/python_api.rst
@@ -0,0 +1,17 @@
+~~~~~~~~~~~~~~~~~~~
+RAFT API Reference
+~~~~~~~~~~~~~~~~~~~
+
+.. role:: py(code)
+ :language: python
+ :class: highlight
+
+
+Multi-Node Multi-GPU Infrastructure
+===================================
+
+Dask-based Communicator
+-----------------------
+
+.. autoclass:: raft.dask.common.Comms
+ :members:
diff --git a/docs/source/sphinxext/github_link.py b/docs/source/sphinxext/github_link.py
new file mode 100644
index 0000000000..a7a46fdd9d
--- /dev/null
+++ b/docs/source/sphinxext/github_link.py
@@ -0,0 +1,146 @@
+# This contains code with copyright by the scikit-learn project, subject to the
+# license in /thirdparty/LICENSES/LICENSE.scikit_learn
+
+import inspect
+import os
+import re
+import subprocess
+import sys
+from functools import partial
+from operator import attrgetter
+
+orig = inspect.isfunction
+
+
+# See https://opendreamkit.org/2017/06/09/CythonSphinx/
+def isfunction(obj):
+
+ orig_val = orig(obj)
+
+ new_val = hasattr(type(obj), "__code__")
+
+ if (orig_val != new_val):
+ return new_val
+
+ return orig_val
+
+
+inspect.isfunction = isfunction
+
+REVISION_CMD = 'git rev-parse --short HEAD'
+
+source_regex = re.compile(r"^File: (.*?) \(starting at line ([0-9]*?)\)$",
+ re.MULTILINE)
+
+
+def _get_git_revision():
+ try:
+ revision = subprocess.check_output(REVISION_CMD.split()).strip()
+ except (subprocess.CalledProcessError, OSError):
+ print('Failed to execute git to get revision')
+ return None
+ return revision.decode('utf-8')
+
+
+def _linkcode_resolve(domain, info, package, url_fmt, revision):
+ """Determine a link to online source for a class/method/function
+
+ This is called by sphinx.ext.linkcode
+
+ An example with a long-untouched module that everyone has
+ >>> _linkcode_resolve('py', {'module': 'tty',
+ ... 'fullname': 'setraw'},
+ ... package='tty',
+ ... url_fmt='http://hg.python.org/cpython/file/'
+ ... '{revision}/Lib/{package}/{path}#L{lineno}',
+ ... revision='xxxx')
+ 'http://hg.python.org/cpython/file/xxxx/Lib/tty/tty.py#L18'
+ """
+
+ if revision is None:
+ return
+ if domain not in ('py', 'pyx'):
+ return
+ if not info.get('module') or not info.get('fullname'):
+ return
+
+ class_name = info['fullname'].split('.')[0]
+ module = __import__(info['module'], fromlist=[class_name])
+ obj = attrgetter(info['fullname'])(module)
+
+ # Unwrap the object to get the correct source
+ # file in case that is wrapped by a decorator
+ obj = inspect.unwrap(obj)
+
+ fn: str = None
+ lineno: str = None
+
+ try:
+ fn = inspect.getsourcefile(obj)
+ except Exception:
+ fn = None
+ if not fn:
+ try:
+ fn = inspect.getsourcefile(sys.modules[obj.__module__])
+ except Exception:
+ fn = None
+
+ if not fn:
+ # Possibly Cython code. Search docstring for source
+ m = source_regex.search(obj.__doc__)
+
+ if (m is not None):
+ source_file = m.group(1)
+ lineno = m.group(2)
+
+ # fn is expected to be the absolute path.
+ fn = os.path.relpath(source_file, start=package)
+ print("{}:{}".format(
+ os.path.abspath(os.path.join("..", "python", "cuml", fn)),
+ lineno))
+ else:
+ return
+ else:
+ # Test if we are absolute or not (pyx are relative)
+ if (not os.path.isabs(fn)):
+ # Should be relative to docs right now
+ fn = os.path.abspath(os.path.join("..", "python", fn))
+
+ # Convert to relative from module root
+ fn = os.path.relpath(fn,
+ start=os.path.dirname(
+ __import__(package).__file__))
+
+ # Get the line number if we need it. (Can work without it)
+ if (lineno is None):
+ try:
+ lineno = inspect.getsourcelines(obj)[1]
+ except Exception:
+
+ # Can happen if its a cyfunction. See if it has `__code__`
+ if (hasattr(obj, "__code__")):
+ lineno = obj.__code__.co_firstlineno
+ else:
+ lineno = ''
+ return url_fmt.format(revision=revision,
+ package=package,
+ path=fn,
+ lineno=lineno)
+
+
+def make_linkcode_resolve(package, url_fmt):
+ """Returns a linkcode_resolve function for the given URL format
+
+ revision is a git commit reference (hash or name)
+
+ package is the name of the root module of the package
+
+ url_fmt is along the lines of ('https://github.com/USER/PROJECT/'
+ 'blob/{revision}/{package}/'
+ '{path}#L{lineno}')
+ """
+ revision = _get_git_revision()
+ return partial(_linkcode_resolve,
+ revision=revision,
+ package=package,
+ url_fmt=url_fmt)