Skip to content
Open
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
31 changes: 31 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,11 @@ $ meson setup <name_of_build_dir> \
-Ducx_path=/path/to/ucx \ # Custom UCX installation path
-Dinstall_headers=true \ # Install development headers
-Ddisable_gds_backend=false # Enable GDS backend

# CUDA GPU architecture targeting (example)
$ meson setup <name_of_build_dir> \
-Dcuda_args="-gencode=arch=compute_80,code=sm_80 -gencode=arch=compute_90,code=sm_90" \
-Dcuda_link_args="-gencode=arch=compute_80,code=sm_80 -gencode=arch=compute_90,code=sm_90"
```

Common build options:
Expand All @@ -123,6 +128,32 @@ Common build options:
- `disable_gds_backend`: Disable GDS backend (default: false)
- `cudapath_inc`, `cudapath_lib`: Custom CUDA paths
- `static_plugins`: Comma-separated list of plugins to build statically
- `cuda_args`: CUDA compiler arguments (default: targets compute_80 and compute_90)
- `cuda_link_args`: CUDA linker arguments (default: targets compute_80 and compute_90)

### CUDA GPU Architecture Configuration

NIXL automatically targets CUDA compute capabilities 8.0 (Ampere) and 9.0 (Hopper) by default.
To target specific GPU architectures or add additional ones, use the `cuda_args` and `cuda_link_args` options:

```bash
# Target specific architectures
$ meson setup build \
-Dcuda_args="-gencode=arch=compute_75,code=sm_75" \
-Dcuda_link_args="-gencode=arch=compute_75,code=sm_75"

# Target multiple architectures
$ meson setup build \
-Dcuda_args="-gencode=arch=compute_75,code=sm_75 -gencode=arch=compute_80,code=sm_80 -gencode=arch=compute_90,code=sm_90" \
-Dcuda_link_args="-gencode=arch=compute_75,code=sm_75 -gencode=arch=compute_80,code=sm_80 -gencode=arch=compute_90,code=sm_90"
```

Common CUDA compute capabilities:
- `compute_75,code=sm_75`: NVIDIA Turing (RTX 20xx, Tesla T4)
- `compute_80,code=sm_80`: NVIDIA Ampere (A100, RTX 30xx)
- `compute_86,code=sm_86`: NVIDIA Ampere (RTX 30xx consumer)
- `compute_89,code=sm_89`: NVIDIA Ada Lovelace (RTX 40xx)
- `compute_90,code=sm_90`: NVIDIA Hopper (H100)

### Building Documentation

Expand Down
37 changes: 25 additions & 12 deletions meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -82,24 +82,37 @@ else
endif

if cuda_dep.found()
add_languages('CUDA')
add_languages('cuda')
cuda = import('unstable-cuda')
nvcc = meson.get_compiler('cuda')

# Please extend with your arch if not present in the list
nvcc_flags = []
nvcc_flags += ['-gencode', 'arch=compute_80,code=sm_80']
nvcc_flags += ['-gencode', 'arch=compute_90,code=sm_90']
add_project_arguments(nvcc_flags, language: 'cuda')
# Set default CUDA architectures if not specified by user
# Users can override with cuda_args and cuda_link_args options
# See README.md for details and examples
cuda_args_option = get_option('cuda_args')
cuda_link_args_option = get_option('cuda_link_args')

cuda_args = [
'-gencode=arch=compute_80,code=sm_80',
'-gencode=arch=compute_90,code=sm_90'
]
cuda_link_args = [
'-gencode=arch=compute_80,code=sm_80',
'-gencode=arch=compute_90,code=sm_90'
]

# Apply defaults only if user hasn't specified custom args
if cuda_args_option == []
add_project_arguments(cuda_args, language: 'cuda')
endif

if cuda_link_args_option == []
add_project_link_arguments(cuda_link_args, language: 'cuda')
endif

# Refer to https://mesonbuild.com/Cuda-module.html
add_project_arguments('-forward-unknown-to-host-compiler', language: 'cuda')
add_project_arguments('-rdc=true', language: 'cuda')

nvcc_flags_link = []
nvcc_flags_link += ['-gencode=arch=compute_80,code=sm_80']
nvcc_flags_link += ['-gencode=arch=compute_90,code=sm_90']
add_project_link_arguments(nvcc_flags_link, language: 'cuda')
else
warning('CUDA not found. UCX backend will be built without CUDA support, and some plugins will be disabled.')
endif
Expand Down Expand Up @@ -177,7 +190,7 @@ if ucx_dep.found() and cuda_dep.found() and nvcc_prog.found()
have_gpu_side = cuda.compiles('''
#include <ucp/api/device/ucp_device_impl.h>
int main() { return 0; }
''', dependencies : ucx_dep, args: nvcc_flags)
''', dependencies : ucx_dep, args: cuda_args)

have_host_side = cpp.compiles('''
#include <ucp/api/device/ucp_host.h>
Expand Down