Commit graph

147 commits

Author SHA1 Message Date
Zain Rizvi
5ef378a30f Fix out of date documentation & remove friction points (#78682)
Fixes various friction points with the documentation for onboarding new users and remove instructions that were no longer valid

Changes include:
- Listing prerequisites earlier, so that devs can ensure they're met before encountering error messages
- Removing linter invocations that are no longer valid
- Modifying instructions to install mkl packages to only apply to x86 based CPUs

[skip ci]
Pull Request resolved: https://github.com/pytorch/pytorch/pull/78682
Approved by: https://github.com/seemethere, https://github.com/janeyx99, https://github.com/malfet
2022-06-02 19:31:48 +00:00
lamhoangtung
cac16e2ee2 Minor typo in contributing doc fixed (#70284)
Hi. While looking at the contributing doc for pytorch in master. I saw a typo about installing `ccache` via `conda`. This tiny PR fixed it.

Hope this could help someone copy-paste the command faster!
Pull Request resolved: https://github.com/pytorch/pytorch/pull/70284
Approved by: https://github.com/janeyx99
2022-05-23 15:43:25 +00:00
Sarah Wang
86a0b9621b Added note about Dev Infra Office Hours in CONTRIBUTING.md (#76667) (#77883)
Fixes #76667

Pull Request resolved: https://github.com/pytorch/pytorch/pull/77883
Approved by: https://github.com/janeyx99, https://github.com/zengk95
2022-05-20 19:44:38 +00:00
Jane Xu
8d3e3ebc58 Add note about testing inconsistency
Mitigates #56396

The true fix would be https://github.com/pytorch/pytorch/pull/75608 but there are many issues to debug and this is a good step forward to at least clarify.
Pull Request resolved: https://github.com/pytorch/pytorch/pull/75620
Approved by: https://github.com/kit1980, https://github.com/seemethere, https://github.com/malfet
2022-04-12 00:54:18 +00:00
Sergii Dymchenko
e3f546af13 Remove flake8 pre-commit hook
Fixes #69500
See the issue for details.
Pull Request resolved: https://github.com/pytorch/pytorch/pull/75385
Approved by: https://github.com/seemethere, https://github.com/malfet
2022-04-07 19:01:30 +00:00
Jane Xu
4757ae4b9e Update SSH part of contributing. Fixes #75112
Fixes #75112

Pull Request resolved: https://github.com/pytorch/pytorch/pull/75132
Approved by: https://github.com/seemethere
2022-04-01 21:12:33 +00:00
Rohit Goswami
979a78f8b2 Sphinx panel
Fixes https://github.com/pytorch/pytorch/issues/73835.

The full context for this is detailed in the issue, but briefly:

- Adds `sphinx-panel`

Other PRs will demonstrate usage.
Pull Request resolved: https://github.com/pytorch/pytorch/pull/73836
Approved by: https://github.com/albanD
2022-03-07 14:50:09 +00:00
Kishan Savant
39483b5918 Updated CONTRIBUTING.md (#72044)
Summary:
Removed duplicate statements

Pull Request resolved: https://github.com/pytorch/pytorch/pull/72044

Reviewed By: albanD

Differential Revision: D33883764

Pulled By: mrshenli

fbshipit-source-id: db467b2adec6a62edf132a70f70e665a97266fa4
(cherry picked from commit aa38c8af79eea946cfb66ad6e3eff578363c48a4)
2022-02-02 16:13:38 +00:00
Tugsbayasgalan (Tugsuu) Manlaibaatar
8bdbe94344 Add forward compatability tests in CI (#64139)
Summary: Pull Request resolved: https://github.com/pytorch/pytorch/pull/64139

Test Plan: Imported from OSS

Reviewed By: mruberry

Differential Revision: D30626912

Pulled By: tugsbayasgalan

fbshipit-source-id: 781a88386701b42e2e86daaca0a779d1fc1c4df3
2022-01-05 23:40:06 -08:00
Andrey Talman
6c4437118b Deprecating Python 3.6 (#70493)
Summary:
Deprecating python 3.6 from documentation and from cmake

Pull Request resolved: https://github.com/pytorch/pytorch/pull/70493

Reviewed By: suo

Differential Revision: D33433118

Pulled By: atalman

fbshipit-source-id: c3adc7b75714efdb5b6acda5d4cddc068fb4a145
2022-01-05 11:46:32 -08:00
Michael Suo
1adb70c6f0 Revert D33409880: [pytorch][PR] Deprecating Python 3.6
Test Plan: revert-hammer

Differential Revision:
D33409880 (d95be99561)

Original commit changeset: 4f9123398960

Original Phabricator Diff: D33409880 (d95be99561)

fbshipit-source-id: 32dc1c3c07ef99a04fab7d0fb742cf4e6c4b718a
2022-01-04 16:37:09 -08:00
Andrey Talman
d95be99561 Deprecating Python 3.6 (#70493)
Summary:
Deprecating python 3.6 from documentation and from cmake

Pull Request resolved: https://github.com/pytorch/pytorch/pull/70493

Reviewed By: malfet

Differential Revision: D33409880

Pulled By: atalman

fbshipit-source-id: 4f912339896096be95b344724a4d9ae88cdf1a8f
2022-01-04 14:41:27 -08:00
Peter Bell
b08d64202a Remove THGeneral (#69041)
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/69041

`TH_CONCAT_{N}` is still being used by THP so I've moved that into
it's own header but all the compiled code is gone.

Test Plan: Imported from OSS

Reviewed By: anjali411

Differential Revision: D32872477

Pulled By: ngimel

fbshipit-source-id: 06c82d8f96dbcee0715be407c61dfc7d7e8be47a
2021-12-13 16:14:28 -08:00
Peter Bell
e279963eef Remove remaining THC code (#69039)
Summary: Pull Request resolved: https://github.com/pytorch/pytorch/pull/69039

Test Plan: Imported from OSS

Reviewed By: anjali411

Differential Revision: D32872476

Pulled By: ngimel

fbshipit-source-id: 7972aacc24aef9450fb59b707ed6396c501bcb31
2021-12-08 12:18:08 -08:00
Jan-Hendrik Ewers
81246ed01c Markdown was linking to repo rather than pytorch.org website (#68937)
Summary: Pull Request resolved: https://github.com/pytorch/pytorch/pull/68937

Reviewed By: samdow

Differential Revision: D32707264

Pulled By: soulitzer

fbshipit-source-id: c534f008087def33784dde701130769e2058aa9f
2021-11-30 11:51:24 -08:00
MalikIdreesHasanKhan
c541c69e89 Fix minor typo in contributing.md (#67855)
Summary:
Fixes #{issue number}
No issue number, minor change

Pull Request resolved: https://github.com/pytorch/pytorch/pull/67855

Reviewed By: malfet

Differential Revision: D32186689

Pulled By: driazati

fbshipit-source-id: 7cda19f66ff1312296d8310922bb0d221df81e46
2021-11-04 14:38:48 -07:00
Peter Bell
c66847afbe Add workaround for nvcc header dependecies bug (#62550)
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/62550

I noticed that running the build twice in a row resulted in ~80 CUDA files being
rebuilt. Running `ninja -d explain` shows
```
ninja explain: TH/generic/THStorage.h is dirty
ninja explain: TH/generic/THStorageCopy.h is dirty
ninja explain: THC/generic/THCStorage.h is dirty
ninja explain: THC/generic/THCStorageCopy.h is dirty
ninja explain: TH/generic/THTensor.h is dirty
ninja explain: THC/generic/THCTensor.h is dirty
ninja explain: THC/generic/THCTensorCopy.h is dirty
ninja explain: THC/generic/THCTensorMath.h is dirty
ninja explain: THC/generic/THCTensorMathMagma.h is dirty
ninja explain: THC/generic/THCTensorMathPairwise.h is dirty
ninja explain: THC/generic/THCTensorScatterGather.h is dirty
```

considering `ninja` is working relative to the `build` folder, these files don't
actually exist. I traced this back to the output of `nvcc -MD` containing
paths relative to the include directory, instead of being absolute.

This adds a little script to launch the compiler then resolve any relative paths
in the `.d` file before `ninja` looks at it. To use it, I run the build with
```
export CMAKE_CUDA_COMPILER_LAUNCHER="python;`pwd`/tools/nvcc_fix_deps.py;ccache"
```

There are some possible pit-falls here. The same relative path might work for
two include directories, and the compiler could pick a different one. Or,
the compiler might have additional implicit include directories that are needed
to resolve the path. However, this has worked perfectly in my testing and it's
completely opt-in so should be fine.

Test Plan: Imported from OSS

Reviewed By: ejguan

Differential Revision: D31503351

Pulled By: malfet

fbshipit-source-id: b184c4526679d976b93829b5715cafcb1c7db2ae
2021-10-11 09:07:12 -07:00
Horace He
7e7be526c9 Add TORCH_SHOW_CPP_STACKTRACES to Contributing.md (#64052)
Summary: Pull Request resolved: https://github.com/pytorch/pytorch/pull/64052

Reviewed By: ezyang

Differential Revision: D31107779

Pulled By: Chillee

fbshipit-source-id: 2ad8ad40cd48e54fe711863c3c74df884a2e2de7
2021-09-22 22:53:19 -07:00
Steven Jin
71ba76b1b5 Fix building docs instructions (#64508)
Summary:
Fixes #{64507}

Removed duplicate instruction and linted the file a bit (consistent spacing around codeblocks/headers, adding code types in codeblocks, remove `$` from bash code blocks when uncecessary).

Pull Request resolved: https://github.com/pytorch/pytorch/pull/64508

Reviewed By: raghuramank100

Differential Revision: D30791164

Pulled By: mrshenli

fbshipit-source-id: a00db32dcfdd1ecc194c836f31174c806062eb6d
2021-09-07 19:01:52 -07:00
David Riazati
7e88d0b370 Update explicit_ci_jobs to work with GHA (#64598)
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/64598

This adds a filter option rather than an all-or-nothing so it's easier to iterate on a specific job.

```bash
python tools/testing/explicit_ci_jobs.py --filter-gha '*generated-linux-*gcc5.4*'
```

See #64600 for an example usage

NB: If you regenerate the worfklows you will need to re-run that command to re-delete everything.

Test Plan: Imported from OSS

Reviewed By: janeyx99

Differential Revision: D30788850

Pulled By: driazati

fbshipit-source-id: a32c266bbd876c396665bceef9a0a961b4586564
2021-09-07 15:21:12 -07:00
Ansley Ussery
6831d8e379 Support Union in TorchScript (#64234)
Summary:
This PR is created to replace https://github.com/pytorch/pytorch/pull/53180 PR stack, which has all the review discussions. Reason for needing a replacement is due to a messy Sandcastle issue.

Pull Request resolved: https://github.com/pytorch/pytorch/pull/64234

Reviewed By: gmagogsfm

Differential Revision: D30656444

Pulled By: ansley

fbshipit-source-id: 77536c8bcc88162e2c72636026ca3c16891d669a
2021-09-03 06:12:24 -07:00
John Clow
b5b9ce146f Small fixes to the Contributing.txt (#63385)
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/63385

Correcting a mistake for the pytorch uninstall, and
adding an extra note for Darwin.

Test Plan: Imported from OSS

Reviewed By: janeyx99, heitorschueroff

Differential Revision: D30530234

fbshipit-source-id: e0f88a1725eeadabfb4b28c1da11e369ee878ab4
2021-08-25 14:50:37 -07:00
Yi Zhang
73431449b3 update readme and contributing.md (#63843)
Summary:
1. In fact, Visual Studio isn't supported as CMAKE generator
2. I was asked many times why there's error as 'Could NOT find OpenMP'
3. Add Newly added Best Practices link in contributing.md

Pull Request resolved: https://github.com/pytorch/pytorch/pull/63843

Reviewed By: seemethere, heitorschueroff

Differential Revision: D30514095

Pulled By: janeyx99

fbshipit-source-id: 76715a1d8c049122546e5a7778cafe54e4dfd5d6
2021-08-24 10:52:11 -07:00
Peter Bell
fc47497905 Simplify ccache instructions in CONTRIBUTING.md (#62549)
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/62549

When building CUDA files with native CMake support, it will respect the
`CMAKE_CUDA_COMPILER_LAUNCHER` setting. So, there's no need for symlinks.

Test Plan: Imported from OSS

Reviewed By: bdhirsh

Differential Revision: D30498488

Pulled By: malfet

fbshipit-source-id: 71c2ae9d4570cfac2a64d777bc95cda3764332a0
2021-08-23 17:47:38 -07:00
Peter Bell
560cd88195 Kill THCUNN (#63429)
Summary: Pull Request resolved: https://github.com/pytorch/pytorch/pull/63429

Test Plan: Imported from OSS

Reviewed By: mruberry

Differential Revision: D30441308

Pulled By: ngimel

fbshipit-source-id: 3ae342a2f8d5c7f8827b637c4055c5d1b0a1be26
2021-08-23 12:07:16 -07:00
Nikita Shulga
f2bf0f229f Revert D30359218: [pytorch][PR] [doc] pre-commit fix instructions
Test Plan: revert-hammer

Differential Revision:
D30359218 (4e1d84ae8f)

Original commit changeset: 61771babeac4

fbshipit-source-id: c2ac0a4a7463fafa03ad0b20bfb0701a8c1476c4
2021-08-19 16:48:04 -07:00
Stas Bekman
4e1d84ae8f [doc] pre-commit fix instructions (#61717)
Summary:
fix invalid instruction

Pull Request resolved: https://github.com/pytorch/pytorch/pull/61717

Reviewed By: zhouzhuojie, driazati

Differential Revision: D30359218

Pulled By: malfet

fbshipit-source-id: 61771babeac4d34425a61ce49f38a7099b521eec
2021-08-18 11:42:25 -07:00
Peter Bell
f70b9ee5de Advertise USE_PRECOMPILED_HEADERS in CONTRIBUTING.md (#62827)
Summary:
This option was added in https://github.com/pytorch/pytorch/issues/61940 and fits with this section's theme of improving build times.

I've also changed it to a `cmake_dependent_option` instead of `FATAL_ERROR`ing for older CMake versions.

Pull Request resolved: https://github.com/pytorch/pytorch/pull/62827

Reviewed By: astaff

Differential Revision: D30342102

Pulled By: malfet

fbshipit-source-id: 3095b44b7085aee8a884ec95cba9f8998d4442e7
2021-08-17 10:14:40 -07:00
Richard Zou
da36bbcd35 Add section to CONTRIBUTING.md explaining developer docs (#63228)
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/63228

It is a quick summary and links to a page on the Developer Wiki that has
more detail.

Test Plan: Imported from OSS

Reviewed By: SplitInfinity

Differential Revision: D30347109

Pulled By: zou3519

fbshipit-source-id: a6242986d275e5279ca3f61ade2294a132d268c4
2021-08-16 15:44:10 -07:00
Natalia Gimelshein
720a7a0d81 [hackathon] fix benchmarking script in CONTRIBUTING (#63199)
Summary:
[skip ci]
Per title

Pull Request resolved: https://github.com/pytorch/pytorch/pull/63199

Reviewed By: mruberry

Differential Revision: D30305487

Pulled By: ngimel

fbshipit-source-id: 2704c4f08ab976a55c9f8c2fe54cd4f3f39412cf
2021-08-13 09:50:48 -07:00
Gao, Xiang
a4af91b2fe Cleanup CUDA 10.1 and 10.0 support on CI (#62597)
Summary:
10.1 is removed in https://github.com/pytorch/pytorch/pull/56056

Pull Request resolved: https://github.com/pytorch/pytorch/pull/62597

Reviewed By: walterddr

Differential Revision: D30053902

Pulled By: seemethere

fbshipit-source-id: deb148e5e44c12b08c267a36fbd4a1afa138e6e4
2021-08-02 14:42:25 -07:00
Elton Leander Pinto
2a83f24027 Enable macos clang-tidy installs (#62214)
Summary:
This PR enables installing our custom MacOS clang-tidy binaries. It also updates related documentation.

The binaries are produced by [this CI job](https://github.com/pytorch/test-infra/blob/master/.github/workflows/clang-tidy-macos.yml), and are published to S3.

This PR does not handle versioning of the downloaded binaries as this is being worked on separately. See https://github.com/pytorch/test-infra/issues/73

Pull Request resolved: https://github.com/pytorch/pytorch/pull/62214

Test Plan:
On a MacOS machine, run
```bash
python3 -m tools.linter.install.clang_tidy
.clang-tidy-bin/clang-tidy --checks="*" --list-checks | grep "misc-max-tokens"
```

Reviewed By: janeyx99, mruberry

Differential Revision: D29917728

Pulled By: 1ntEgr8

fbshipit-source-id: 98d0d8b7a57bdebf0ebcdc83228ef391e8c6629e
2021-07-26 13:43:29 -07:00
Masaki Kozuki
7136a62b56 Add expecttest to CONTRIBUTING.md (#61163)
Summary:
Now expecttest is an independent library but `CONTRIBUTING.md` and `requirements.txt` do not mention the need of the library.

Related: https://github.com/pytorch/pytorch/pull/60658

Pull Request resolved: https://github.com/pytorch/pytorch/pull/61163

Reviewed By: heitorschueroff

Differential Revision: D29660296

Pulled By: ezyang

fbshipit-source-id: e2e86d42526c83bec7cdf7221e19fe83d9686103
2021-07-12 09:11:12 -07:00
Antonio Cuni
93d98ecef7 update the pytorch-gdb example so that it works on current master (#61175)
Summary:
As pointed out by https://github.com/pytorch/pytorch/pull/54339#issuecomment-872827580, the `pytorch-gdb` example is currently broken because the code has been refactored.

This PR updates the example so that it works again.

Pull Request resolved: https://github.com/pytorch/pytorch/pull/61175

Reviewed By: heitorschueroff

Differential Revision: D29660336

Pulled By: ezyang

fbshipit-source-id: 8bcd32fc583c0b28a705ef37203ce7ad4d636732
2021-07-12 08:57:18 -07:00
zhouzhuojie
6107cf3750 Add --jobs 0 for git submodule update (#61311)
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/61311

Pull Request resolved: https://github.com/pytorch/pytorch/pull/61152

Some related docs about `submodule.fetchJobs`
https://git-scm.com/docs/git-config#Documentation/git-config.txt-submodulefetchJobs

```
time git submodule update --init --recursive
________________________________________________________
Executed in  243.20 secs    fish           external
   usr time   49.64 secs  213.00 micros   49.64 secs
   sys time   29.27 secs  795.00 micros   29.27 secs
```

```
time git submodule update --init --recursive --jobs 4
________________________________________________________
Executed in  143.04 secs    fish           external
   usr time   51.06 secs  246.00 micros   51.06 secs
   sys time   30.96 secs  742.00 micros   30.96 secs
```

```
time git submodule update --init --recursive --jobs 8
________________________________________________________
Executed in  124.64 secs    fish           external
   usr time   51.76 secs  264.00 micros   51.76 secs
   sys time   30.49 secs  739.00 micros   30.49 secs

```

```
time git submodule update --init --recursive --jobs 0 # use all online cpus
 ________________________________________________________
Executed in  129.75 secs    fish           external
   usr time   51.64 secs  181.00 micros   51.64 secs
   sys time   31.49 secs  781.00 micros   31.49 secs

```

Test Plan: Imported from OSS

Reviewed By: 1ntEgr8

Differential Revision: D29560875

Pulled By: zhouzhuojie

fbshipit-source-id: 556027dffe744c66428075a8a1bf64683930aaaf
2021-07-07 16:28:18 -07:00
Elton Leander Pinto
a1ad28da10 Refactor clang_tidy.py (#61119)
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/61119

This change spilts the clang-tidy CI job into smaller steps and uses a
refactored version of the clang_tidy.py script.

The new folder structure is as follows:
```
tools/linter/clang_tidy
|_ __main__py
|_ requirements.txt
|_ run.py
|_ setup.sh
```

`__main__.py`

This script will run `tools/linter/clang_tidy/setup.sh` if a `build`
directory doesn't exist, mimicing what used to be done as a separate
step in the CI job.

After that, it will invoke `clang-tidy` with default arguments being
declared in the script itself (as opposed to declaring them in
lint.yml).

The reasoning behind this approach is two-fold:

- Make it easier to run `clang-tidy` locally using this script
- De-duplicate the option passing

`requirements.txt`

Contains a list of additional python dependencies needed by the
`clang-tidy` script.

`setup.sh`

If a build directory doesn't exist, this command will run the necessary
codegen and build commands for running `clang-tidy`

Example usage:
```
python3 tools/linter/clang_tidy --parallel
```
Notice that we don't have to put the `.py` at the end of `clang_tidy`.

Test Plan:
Run the following command:
```
python3 tools/linter/clang_tidy --paths torch/csrc/fx --parallel
```

Reviewed By: walterddr, janeyx99

Differential Revision: D29568582

Pulled By: 1ntEgr8

fbshipit-source-id: cd6d11c5cb8ba9f1344a87c35647a1cd8dd45b04
2021-07-06 16:02:11 -07:00
driazati
a0a9ea6598 Fix documentation preview instructions (#61080)
Summary:
People don't need to self host these anymore since we do it automatically in PRs

Pull Request resolved: https://github.com/pytorch/pytorch/pull/61080

Reviewed By: VitalyFedyunin, janeyx99

Differential Revision: D29506465

Pulled By: driazati

fbshipit-source-id: 45875cb229f8cc565a9a1405f52cef198ee0e687
2021-07-01 12:17:34 -07:00
Rong Rong (AI Infra)
7e619b9588 First step to rearrange files in tools folder (#60473)
Summary:
Changes including:
- introduced `linter/`, `testing/`, `stats/` folders in `tools/`
- move appropriate scripts into these folders
- change grepped references in the pytorch/pytorch repo

Next step
- introduce `build/` folder for build scripts

Pull Request resolved: https://github.com/pytorch/pytorch/pull/60473

Test Plan:
- CI (this is important b/c pytorch/test-infra also rely on some script reference.
- tools/tests/

Reviewed By: albanD

Differential Revision: D29352716

Pulled By: walterddr

fbshipit-source-id: bad40b5ce130b35dfd9e59b8af34f9025f3285fd
2021-06-24 10:13:58 -07:00
H1Gdev
d7d0fa2069 Fix typo. (#58728)
Summary:
Fix typo in docs and comments.

Pull Request resolved: https://github.com/pytorch/pytorch/pull/58728

Reviewed By: mruberry

Differential Revision: D28603612

Pulled By: H-Huang

fbshipit-source-id: b3cd8f6f19354201d597254d0b3cb4e2062471ab
2021-05-21 11:45:10 -07:00
Ansley Ussery
e8981e7c5d Improve CONTRIBUTING.md (#58396)
Summary: Pull Request resolved: https://github.com/pytorch/pytorch/pull/58396

Test Plan: Imported from OSS

Reviewed By: samestep

Differential Revision: D28476510

Pulled By: ansley

fbshipit-source-id: 3f45bee93dfeda06a44570305f9699bcafc45d2e
2021-05-17 12:36:38 -07:00
driazati
e385aa863a Add tools/ script to limit circleci to a set of jobs (#58001)
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/58001

Adds a script so that devs can generate a commit (at the base of a stack) that removes all CI jobs but the set that they care about. See CONTRIBUTING.md changes for usage

Test Plan: Imported from OSS

Reviewed By: mruberry

Differential Revision: D28359910

Pulled By: driazati

fbshipit-source-id: 2741570f2bab2c28f4a9d7aef727b1b2399d0ce1
2021-05-11 11:58:35 -07:00
Yi Zhang
cb1272a846 update doc in build section (#56686)
Summary:
Why:
To keep VS version always updated in README
1. update VS version link in CI. It's more convenient for my PR robot to update the version in README once the VS in CI is updated. and permlink isn't stable.
2. Move `building on legacy code` to development tips. The table is big and it looks the REAMD not updated at the first sight.

Pull Request resolved: https://github.com/pytorch/pytorch/pull/56686

Reviewed By: janeyx99

Differential Revision: D28272060

Pulled By: samestep

fbshipit-source-id: 4bb879ea2914cc8bcd68343a9ed230418e1f9268
2021-05-06 17:35:56 -07:00
davidriazati@fb.com
5e4dfd0140 Add quicklint make target (#56559)
Summary:
This queries the local git repo for changed files (any changed files, not just committed ones) and sends them to mypy/flake8 instead of the default (which is the whole repo, defined the .flake8 and mypy.ini files). This brings a good speedup (from 15 seconds with no cache to < 1 second from my local testing on this PR).

```bash
make quicklint -j 6
```

It should be noted that the results of this aren’t exactly what’s in the CI, since mypy and flake8 ignore the `include` and `exclude` parts of their config when an explicit list of files is passed in.
](https://our.intern.facebook.com/intern/diff/27901577/)
Pull Request resolved: https://github.com/pytorch/pytorch/pull/56559

Pulled By: driazati

Reviewed By: malfet

Differential Revision: D27901577

fbshipit-source-id: 99f351cdfe5aba007948aea2b8a78f683c5d8583
2021-04-21 13:47:25 -07:00
driazati
43eb21bff3 [skip ci] Add simple local actions runner (#56439)
Summary:
This pulls out shell scripts from an action and runs them locally as a first pass at https://github.com/pytorch/pytorch/issues/55847. A helper script extracts specific steps in some order and runs them:

```bash
$ time -p make lint -j 5  # run lint with 5 CPUs
python scripts/actions_local_runner.py \
        --file .github/workflows/lint.yml \
        --job 'flake8-py3' \
        --step 'Run flake8'
python scripts/actions_local_runner.py \
        --file .github/workflows/lint.yml \
        --job 'mypy' \
        --step 'Run mypy'
python scripts/actions_local_runner.py \
        --file .github/workflows/lint.yml \
        --job 'quick-checks' \
        --step 'Ensure no trailing spaces' \
        --step 'Ensure no tabs' \
        --step 'Ensure no non-breaking spaces' \
        --step 'Ensure canonical include' \
        --step 'Ensure no unqualified noqa' \
        --step 'Ensure no direct cub include' \
        --step 'Ensure correct trailing newlines'
python scripts/actions_local_runner.py \
        --file .github/workflows/lint.yml \
        --job 'cmakelint' \
        --step 'Run cmakelint'
quick-checks: Ensure no direct cub include
quick-checks: Ensure canonical include
quick-checks: Ensure no unqualified noqa
quick-checks: Ensure no non-breaking spaces
quick-checks: Ensure no tabs
quick-checks: Ensure correct trailing newlines
cmakelint: Run cmakelint
quick-checks: Ensure no trailing spaces
mypy: Run mypy
Success: no issues found in 1316 source files
Success: no issues found in 56 source files
flake8-py3: Run flake8
./test.py:1:1: F401 'torch' imported but unused
real 13.89
user 199.63
sys 6.08
```

Mypy/flake8 are by far the slowest, but that's mostly just because they're wasting a bunch of work linting the entire repo.

In followup, we could/should:
* Improve ergonomics (i.e. no output unless there are errors)
* Speed up lint by only linting files changes between origin and HEAD
* Add clang-tidy

Pull Request resolved: https://github.com/pytorch/pytorch/pull/56439

Reviewed By: samestep

Differential Revision: D27888027

Pulled By: driazati

fbshipit-source-id: d6f2a59a45e9d725566688bdac8e909210175996
2021-04-20 12:17:55 -07:00
Can Balioglu
2587a28bbd Improve the instructions on how to build the docs (#56018)
Summary:
This PR includes:

- A formatting change to make katex installation instructions more visible for Facebook employees.
- A short tip about how to start a lightweight HTTP server on a remote machine to browse the doc build artifacts.

Pull Request resolved: https://github.com/pytorch/pytorch/pull/56018

Reviewed By: H-Huang

Differential Revision: D27765157

Pulled By: cbalioglu

fbshipit-source-id: 67663de0ba7b742e0deb5358d1e45eea9edd840f
2021-04-14 08:47:43 -07:00
Yukio Siraichi
93bf0ae6fc Remove legacy constructor calls from pytorch codebase. (#54142)
Summary:
Follow up from https://github.com/pytorch/pytorch/issues/53889
Related to https://github.com/pytorch/pytorch/issues/47112

Removing every occurrence of the legacy constructor call present in PyTorch at:
- _docs_
- _benchmarks_
- _test_
- _caffe2_
- _CONTRIBUTING.md_

Pull Request resolved: https://github.com/pytorch/pytorch/pull/54142

Reviewed By: ngimel

Differential Revision: D27699450

Pulled By: mruberry

fbshipit-source-id: 530aa3f5746cc8bc1407d5d51b2bbd8075e30546
2021-04-11 15:45:17 -07:00
Your Name
fc45ff8177 [skip ci] Document '[skip ci]' (#55418)
Summary: Pull Request resolved: https://github.com/pytorch/pytorch/pull/55418

Test Plan: Imported from OSS

Reviewed By: janeyx99

Differential Revision: D27609269

Pulled By: driazati

fbshipit-source-id: 6ce562950ee35e029f0bfa3d0fffbbcc28265a7a
2021-04-08 15:36:29 -07:00
Ansley Ussery
0eba63ec93 Improve testing documentation in CONTRIBUTING.md (#54904)
Summary: Pull Request resolved: https://github.com/pytorch/pytorch/pull/54904

Test Plan: Imported from OSS

Reviewed By: samestep

Differential Revision: D27407009

Pulled By: ansley

fbshipit-source-id: ae69d8387b55f714fd105efe7c4ecbdd69674f65
2021-04-01 10:18:34 -07:00
Sam Estep
a74b10def9 Keep Markdown ToCs up to date (#54974)
Summary:
This PR uses [markdown-toc](https://github.com/jonschlinkert/markdown-toc#cli) to [automatically update the table of contents for `README.md` and `CONTRIBUTING.md`](https://github.com/pytorch/pytorch/pull/54904#issuecomment-809682134) in CI.

This keeps the same format already used in `README.md`. While it does slightly change the format for the ToC in `CONTRIBUTING.md`, the new format is actually just the same as the old format that was already being used prior to https://github.com/pytorch/pytorch/issues/51458.

Race condition with https://github.com/pytorch/pytorch/issues/54904.

Pull Request resolved: https://github.com/pytorch/pytorch/pull/54974

Test Plan: The new "Lint / toc" job in GitHub Actions [succeeds](https://github.com/pytorch/pytorch/pull/54974/checks?check_run_id=2238739005) on this PR, and [fails](https://github.com/pytorch/pytorch/pull/54976/checks?check_run_id=2238784022) on https://github.com/pytorch/pytorch/issues/54976 with an understandable error message.

Reviewed By: malfet

Differential Revision: D27468390

Pulled By: samestep

fbshipit-source-id: 14a73f42ed546d4310140b94ded14e099185d0e0
2021-03-31 10:36:09 -07:00
Sam Estep
eafa235582 Clarify and document commit choice for CI jobs (#54967)
Summary:
PRs https://github.com/pytorch/pytorch/issues/53652 and https://github.com/pytorch/pytorch/issues/54693 attempted to increase the consistency of our choice of commit (head vs merge) for CI on PRs, and have so far been unsuccessful. This PR takes a less ambitious approach to the problem by clarifying the choice in one specific way (see the following paragraph) and documenting it in `CONTRIBUTING.md`.

In addition to documentation, this PR also removes the current behavior of our GHA jobs that checkout the PR tip instead of the merge commit. At first glance, this behavior seems to increase consistency (by eliminating the special-case for `ghstack` PRs), but in reality, it actually just means that for non-`ghstack` PRs, the question "Which commit is used in CI?" has *two* answers instead of just one; see the description of https://github.com/pytorch/pytorch/issues/53652 for more details.

Once merged, this PR will unblock other PRs that add modify our GHA workflows in breaking ways, such as https://github.com/pytorch/pytorch/issues/54737.

Pull Request resolved: https://github.com/pytorch/pytorch/pull/54967

Test Plan: None.

Reviewed By: walterddr, seemethere

Differential Revision: D27435913

Pulled By: samestep

fbshipit-source-id: 405fb419cf015cf88107d5eb2498cfb5bcb7ce33
2021-03-30 11:47:40 -07:00