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
1 change: 1 addition & 0 deletions docs/api/f_api.rst
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ _________________________________
:f cudecompAutotuneGridMode grid_mode: which communication (transpose/halo) to use to autotune process grid (default: CUDECOMP_AUTOTUNE_GRID_TRANSPOSE)
:f cudecompDataType dtype: datatype to use during autotuning (default: CUDECOMP_DOUBLE)
:f logical allow_uneven_distributions: flag to control whether autotuning allows process grids that result in uneven distributions of elements across processes (default: true)
:f logical disable_mpi_backends: flag to disable MPI backend options during autotuning (default: false)
:f logical disable_nccl_backends: flag to disable NCCL backend options during autotuning (default: false)
:f logical disable_nvshmem_backends: flag to disable NVSHMEM backend options during autotuning (default: false)
:f real(c_double) skip_threshold: threshold used to skip testing slow configurations; skip configuration if :code:`skip_threshold * t > t_best`, where :code:`t` is the duration of the first timed trial for the configuration and :code:`t_best` is the average trial time of the current best configuration (default: 0.0)
Expand Down
9 changes: 6 additions & 3 deletions docs/autotuning.rst
Original file line number Diff line number Diff line change
Expand Up @@ -117,19 +117,22 @@ The :code:`dtype` entry in the options struct controls which data type cuDecomp

options%dtype = CUDECOMP_DOUBLE

The :code:`disable_nccl_backends` and :code:`disable_nvshmem_backends` entries are boolean flags controlling whether
the autotuner will test transpose and halo communication backends using the NCCL or NVSHMEM libraries respectively.
By default, these flags are set to false and NCCL and NVSHMEM backends are enabled.
The :code:`disable_mpi_backends`, :code:`disable_nccl_backends`, and :code:`disable_nvshmem_backends` entries are
boolean flags controlling whether the autotuner will test transpose and halo communication backends using the MPI,
NCCL, or NVSHMEM libraries respectively. These exclusions are applied after any backend environment-variable filter.
By default, these flags are set to false and all three backend families are enabled.

.. tabs::

.. code-tab:: c++

options.disable_mpi_backends = false;
options.disable_nccl_backends = false;
options.disable_nvshmem_backends = false;

.. code-tab:: fortran

options%disable_mpi_backends = .false.
options%disable_nccl_backends = .false.
options%disable_nvshmem_backends = .false.

Expand Down
40 changes: 40 additions & 0 deletions docs/env_vars.rst
Original file line number Diff line number Diff line change
Expand Up @@ -104,3 +104,43 @@ CUDECOMP_USE_COL_MAJOR_RANK_ORDER
When :code:`rank_order` is left at :code:`CUDECOMP_RANK_ORDER_DEFAULT`, this environment variable is still honored for
backward compatibility. Setting this variable to :code:`1` enables column-major rank assignment; otherwise rank assignment
is row-major. Explicit :code:`rank_order` settings take precedence over this environment variable.

CUDECOMP_AUTOTUNE_TRANSPOSE_BACKENDS
------------------------------------
(since v0.7.0)

:code:`CUDECOMP_AUTOTUNE_TRANSPOSE_BACKENDS` restricts the candidates used when transpose communication backends are
autotuned. Its value is a comma-separated inclusion list of uppercase backend names. Prefixing the complete value with
:code:`^` changes it to an exclusion list. Accepted names are :code:`MPI_P2P`, :code:`MPI_P2P_PL`, :code:`MPI_A2A`,
:code:`NCCL`, :code:`NCCL_PL`, :code:`NVSHMEM`, :code:`NVSHMEM_PL`, and :code:`NVSHMEM_SM`.

Default setting is unset (no additional backend filtering).

CUDECOMP_AUTOTUNE_HALO_BACKENDS
-------------------------------
(since v0.7.0)

:code:`CUDECOMP_AUTOTUNE_HALO_BACKENDS` restricts the candidates used when halo communication backends are autotuned.
Its value is a comma-separated inclusion list of uppercase backend names. Prefixing the complete value with :code:`^`
changes it to an exclusion list. Accepted names are :code:`MPI`, :code:`MPI_BLOCKING`, :code:`NCCL`, :code:`NVSHMEM`,
and :code:`NVSHMEM_BLOCKING`.

Default setting is unset (no additional backend filtering).

CUDECOMP_AUTOTUNE_P_ROW_RANGE
------------------------------
(since v0.7.0)

:code:`CUDECOMP_AUTOTUNE_P_ROW_RANGE` restricts process-grid autotuning to row dimensions in the inclusive range
:code:`<min>,<max>`.

Default setting is unset (no row-dimension restriction).

CUDECOMP_AUTOTUNE_P_COL_RANGE
------------------------------
(since v0.7.0)

:code:`CUDECOMP_AUTOTUNE_P_COL_RANGE` restricts process-grid autotuning to column dimensions in the inclusive range
:code:`<min>,<max>`.

Default setting is unset (no column-dimension restriction).
3 changes: 2 additions & 1 deletion include/cudecomp.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* SPDX-FileCopyrightText: Copyright (c) 2022-2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
* SPDX-FileCopyrightText: Copyright (c) 2022-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
* SPDX-License-Identifier: Apache-2.0
*
* Licensed under the Apache License, Version 2.0 (the "License");
Expand Down Expand Up @@ -158,6 +158,7 @@ typedef struct {
cudecompDataType_t dtype; ///< datatype to use during autotuning (default: CUDECOMP_DOUBLE)
bool allow_uneven_decompositions; ///< flag to control whether autotuning allows process grids that result in uneven
///< distributions of elements across processes (default: true)
bool disable_mpi_backends; ///< flag to disable MPI backend options during autotuning (default: false)
bool disable_nccl_backends; ///< flag to disable NCCL backend options during autotuning (default: false)
bool disable_nvshmem_backends; ///< flag to disable NVSHMEM backend options during autotuning (default: false)
double skip_threshold; ///< threshold used to skip testing slow configurations; skip configuration
Expand Down
12 changes: 11 additions & 1 deletion include/internal/autotune.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* SPDX-FileCopyrightText: Copyright (c) 2022-2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
* SPDX-FileCopyrightText: Copyright (c) 2022-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
* SPDX-License-Identifier: Apache-2.0
*
* Licensed under the Apache License, Version 2.0 (the "License");
Expand All @@ -18,9 +18,19 @@
#ifndef CUDECOMP_AUTOTUNE_H
#define CUDECOMP_AUTOTUNE_H

#include <array>
#include <cstdint>
#include <vector>

#include "cudecomp.h"

namespace cudecomp {
std::vector<cudecompTransposeCommBackend_t>
getAutotuneTransposeBackendCandidates(const cudecompGridDescAutotuneOptions_t* options);
std::vector<cudecompHaloCommBackend_t>
getAutotuneHaloBackendCandidates(const cudecompGridDescAutotuneOptions_t* options);
std::vector<std::array<int32_t, 2>> getAutotunePdimCandidates(int nranks, cudecompRankOrder_t rank_order);

void autotuneTransposeBackend(cudecompHandle_t handle, cudecompGridDesc_t grid_desc,
const cudecompGridDescAutotuneOptions_t* options);
void autotuneHaloBackend(cudecompHandle_t handle, cudecompGridDesc_t grid_desc,
Expand Down
Loading
Loading