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
114 changes: 114 additions & 0 deletions .clang-format
Original file line number Diff line number Diff line change
@@ -0,0 +1,114 @@
# The primary clang-format config file.
# TODO(afuller): Set these settings when they aren't broken:
# - AllowShortBlocksOnASingleLine: Empty
---
AccessModifierOffset: -1
AlignAfterOpenBracket: AlwaysBreak
AlignConsecutiveMacros: false
AlignConsecutiveAssignments: false
AlignConsecutiveBitFields: false
AlignConsecutiveDeclarations: false
AlignEscapedNewlines: Left
AlignOperands: DontAlign
AlignTrailingComments: false
AllowAllArgumentsOnNextLine: true
AllowAllConstructorInitializersOnNextLine: true
AllowAllParametersOfDeclarationOnNextLine: false
AllowShortEnumsOnASingleLine: true
AllowShortBlocksOnASingleLine: Never
AllowShortCaseLabelsOnASingleLine: false
AllowShortFunctionsOnASingleLine: Empty
AllowShortLambdasOnASingleLine: All
AllowShortIfStatementsOnASingleLine: Never
AllowShortLoopsOnASingleLine: false
AlwaysBreakAfterReturnType: None
AlwaysBreakBeforeMultilineStrings: true
AlwaysBreakTemplateDeclarations: Yes
BinPackArguments: false
BinPackParameters: false
BreakBeforeBinaryOperators: None
BreakBeforeBraces: Attach
BreakInheritanceList: BeforeColon
BreakBeforeTernaryOperators: true
BreakConstructorInitializers: BeforeColon
BreakAfterJavaFieldAnnotations: false
BreakStringLiterals: false
ColumnLimit: 80
CommentPragmas: '^ IWYU pragma:'
CompactNamespaces: false
ConstructorInitializerAllOnOneLineOrOnePerLine: true
ConstructorInitializerIndentWidth: 4
ContinuationIndentWidth: 4
Cpp11BracedListStyle: true
DeriveLineEnding: true
DerivePointerAlignment: false
DisableFormat: false
FixNamespaceComments: true
ForEachMacros:
- FOR_EACH
- FOR_EACH_R
- FOR_EACH_RANGE
IncludeBlocks: Preserve
IncludeCategories:
- Regex: '^<.*\.h(pp)?>'
Priority: 1
- Regex: '^<.*'
Priority: 2
- Regex: '.*'
Priority: 3
IndentCaseLabels: true
IndentCaseBlocks: false
IndentGotoLabels: true
IndentPPDirectives: None
IndentExternBlock: AfterExternBlock
IndentWidth: 2
IndentWrappedFunctionNames: false
InsertTrailingCommas: None
JavaScriptQuotes: Leave
JavaScriptWrapImports: true
KeepEmptyLinesAtTheStartOfBlocks: false
MacroBlockBegin: ''
MacroBlockEnd: ''
MaxEmptyLinesToKeep: 1
NamespaceIndentation: None
ObjCBinPackProtocolList: Auto
ObjCBlockIndentWidth: 2
ObjCBreakBeforeNestedBlockParam: true
ObjCSpaceAfterProperty: false
ObjCSpaceBeforeProtocolList: false
PenaltyBreakAssignment: 2
PenaltyBreakBeforeFirstCallParameter: 1
PenaltyBreakComment: 300
PenaltyBreakFirstLessLess: 120
PenaltyBreakString: 1000
PenaltyBreakTemplateDeclaration: 10
PenaltyExcessCharacter: 1000000
PenaltyReturnTypeOnItsOwnLine: 200
PointerAlignment: Left
ReflowComments: true
SortIncludes: true
SortUsingDeclarations: true
SpaceAfterCStyleCast: false
SpaceAfterLogicalNot: false
SpaceAfterTemplateKeyword: true
SpaceBeforeAssignmentOperators: true
SpaceBeforeCpp11BracedList: false
SpaceBeforeCtorInitializerColon: true
SpaceBeforeInheritanceColon: true
SpaceBeforeParens: ControlStatements
SpaceBeforeRangeBasedForLoopColon: true
SpaceInEmptyBlock: false
SpaceInEmptyParentheses: false
SpacesBeforeTrailingComments: 1
SpacesInAngles: false
SpacesInConditionalStatement: false
SpacesInContainerLiterals: true
SpacesInCStyleCastParentheses: false
SpacesInParentheses: false
SpacesInSquareBrackets: false
SpaceBeforeSquareBrackets: false
Standard: Latest
TabWidth: 8
UseCRLF: false
UseTab: Never
...
4 changes: 2 additions & 2 deletions .github/workflows/docs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ jobs:
build-docs:
if: github.repository_owner == 'meta-pytorch'
name: Build Documentation
runs-on: linux.g5.12xlarge.nvidia.gpu
runs-on: linux.12xlarge
container:
image: nvidia/cuda:12.8.1-devel-ubuntu24.04
timeout-minutes: 30
Expand Down Expand Up @@ -72,7 +72,7 @@ jobs:
path: docs/build/html/

upload:
runs-on: linux.g5.4xlarge.nvidia.gpu
runs-on: linux.12xlarge
permissions:
# Grant write permission here so that the doc can be pushed to gh-pages branch
contents: write
Expand Down
77 changes: 77 additions & 0 deletions .github/workflows/lint.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
name: Lint

on:
push:
branches:
- main
pull_request:

jobs:
lint:
if: github.repository_owner == 'meta-pytorch'
name: lintrunner
runs-on: linux.12xlarge
container:
image: nvidia/cuda:12.8.1-devel-ubuntu24.04
timeout-minutes: 30
steps:
- name: Setup git
shell: bash -l {0}
run: |
set -eux

apt-get update
apt-get install -y git

# git doesn't like mixed ownership, override it
chown -R root:root .
- name: Checkout
uses: actions/checkout@v4
- name: Setup conda env
uses: conda-incubator/setup-miniconda@v2
with:
auto-update-conda: true
miniconda-version: "latest"
activate-environment: test
python-version: '3.14'
auto-activate: false
- name: Verify conda environment
shell: bash -l {0}
run: |
conda info
which python
which conda
- name: Update pip
shell: bash -l {0}
run: python -m pip install --upgrade pip
- name: Install pytorch
shell: bash -l {0}
run: pip install --pre torch torchvision torchaudio --index-url https://download.pytorch.org/whl/nightly/cu128
- name: Install Dependencies
shell: bash -l {0}
run: |
set -eux

conda install -y git
conda install -y -c conda-forge glog==0.4.0 gflags fmt
pip install cmake
export USE_NCCL=0
export USE_NCCLX=0
export USE_GLOO=0
export USE_SYSTEM_LIBS=1
pip install --no-build-isolation .[dev] -v
- name: Install Lint Dependencies
shell: bash -l {0}
run: |
set -eux

lintrunner init
- name: Lint
shell: bash -l {0}
run: |
set -eux

# for lintrunner debugging
export RUST_BACKTRACE=1

lintrunner --force-color --all-files -v
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,5 @@ third-party/
__pycache__/
*.so
dist/
.lintbin/
.pyre/
39 changes: 39 additions & 0 deletions .lintrunner.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
[[linter]]
code = "CLANGFORMAT"
include_patterns = [
"comms/torchcomms/**/*.hpp",
"comms/torchcomms/**/*.cpp",
]
exclude_patterns = []
init_command = [
"python3",
"tools/linter/adapters/pip_init.py",
"--dry-run={{DRYRUN}}",
"clang-format==21.1.2",
]
command = [
"python3",
"tools/linter/adapters/clangformat_linter.py",
"--",
"@{{PATHSFILE}}",
]
is_formatter = true

[[linter]]
code = 'PYRE'
include_patterns = [
"comms/torchcomms/**/*.py",
"comms/torchcomms/**/*.pyi",
]
command = [
'python3',
'tools/linter/adapters/pyre_linter.py',
'--',
'@{{PATHSFILE}}'
]
init_command = [
'bash',
'scripts/setup_pyre.sh',
'--dry-run={{DRYRUN}}',
]
is_formatter = false
20 changes: 20 additions & 0 deletions .pyre_configuration
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"exclude": [
".*/build/.*",
".*/docs/.*",
".*/setup.py",
".*/third-party/.*",
".*/comms/rcclx/.*",
".*/comms/ncclx/.*",
".*/comms/utils/.*"
],
"ignore_all_errors": [
],
"site_package_search_strategy": "all",
"source_directories": [
"scripts",
"comms"
],
"strict": false,
"version": "0.0.101749035478"
}
1 change: 1 addition & 0 deletions comms/torchcomms/_comms_gloo.pyi
1 change: 1 addition & 0 deletions comms/torchcomms/_comms_nccl.pyi
1 change: 1 addition & 0 deletions comms/torchcomms/_comms_ncclx.pyi
1 change: 1 addition & 0 deletions comms/torchcomms/_comms_rccl.pyi
1 change: 1 addition & 0 deletions comms/torchcomms/_comms_rcclx.pyi
6 changes: 6 additions & 0 deletions scripts/setup_pyre.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/bin/bash

set -ex

VERSION=$(grep "version" .pyre_configuration | sed -n -e 's/.*\(0\.0\.[0-9]*\).*/\1/p')
pip install pyre-check-nightly==$VERSION
1 change: 1 addition & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,7 @@ def build_cmake(self, ext):
"pytest",
"numpy",
"psutil",
"lintrunner",
],
}

Expand Down
Loading
Loading