facebookresearch / detectron2

Detectron2 is a platform for object detection, segmentation and other visual recognition tasks.
https://detectron2.readthedocs.io/en/latest/
Apache License 2.0
30.4k stars 7.47k forks source link

Linter changes in clang-format 10 #1222

Open xkszltl opened 4 years ago

xkszltl commented 4 years ago

Linter corrects detectron2/layers/csrc/deformable/deform_conv_cuda.cu everytime. This file should be either excluded, or formatted in master.

Instructions To Reproduce the Issue:

# Checkout master
python3 -m pip install black=19.3b0 isort
./dev/linter.sh

Expected behavior:

No code change.

Environment:

------------------------  -------------------------------------------------------------------
sys.platform              linux
Python                    3.6.9 (default, Nov  7 2019, 10:44:02) [GCC 8.3.0]
numpy                     1.18.2
detectron2                0.1.1 @/mnt/Projects/PyTorchDetector/detectron2/detectron2
detectron2 compiler       GCC 7.5
detectron2 CUDA compiler  10.2
detectron2 arch flags     sm_70
DETECTRON2_ENV_MODULE     <not set>
PyTorch                   1.6.0a0+3fa53fa @/usr/local/lib/python3.6/dist-packages/torch
PyTorch debug build       False
CUDA available            True
GPU 0,1,2,3,4,5,6,7       Tesla V100-SXM2-32GB
CUDA_HOME                 /usr/local/cuda
NVCC                      Cuda compilation tools, release 10.2, V10.2.89
Pillow                    7.1.1
torchvision               0.6.0a0+abc1506 @/usr/local/lib/python3.6/dist-packages/torchvision
torchvision arch flags    sm_60, sm_61, sm_70
cv2                       4.2.0
------------------------  -------------------------------------------------------------------
PyTorch built with:
  - GCC 8.4
  - C++ Version: 201402
  - Intel(R) Math Kernel Library Version 2020.0.0 Product Build 20191122 for Intel(R) 64 architecture applications
  - Intel(R) MKL-DNN v1.2.0 (Git Hash 70f8b879ea7a0c38caedb3320b7c85e8497ff50d)
  - OpenMP 201511 (a.k.a. OpenMP 4.5)
  - NNPACK is enabled
  - CPU capability usage: AVX2
  - CUDA Runtime 10.2
  - NVCC architecture flags: -gencode;arch=compute_35,code=sm_35;-gencode;arch=compute_50,code=sm_50;-gencode;arch=compute_52,code=sm_52;-gencode;arch=compute_60,code=sm_60;-gencode;arch=compute_61,code=sm_61;-gencode;arch=compute_70,code=sm_70;-gencode;arch=compute_75,code=sm_75;-gencode;arch=compute_70,code=compute_70;-gencode;arch=compute_75,code=compute_75
  - CuDNN 7.6.5
  - Build settings: BLAS=MKL, BUILD_TYPE=Release, CXX_FLAGS= -fvisibility-inlines-hidden -fopenmp -DNDEBUG -DUSE_FBGEMM -DUSE_QNNPACK -DUSE_PYTORCH_QNNPACK -DUSE_XNNPACK -DUSE_INTERNAL_THREADPOOL_IMPL -O2 -fPIC -Wno-narrowing -Wall -Wextra -Werror=return-type -Wno-missing-field-initializers -Wno-type-limits -Wno-array-bounds -Wno-unknown-pragmas -Wno-sign-compare -Wno-unused-parameter -Wno-unused-variable -Wno-unused-function -Wno-unused-result -Wno-strict-overflow -Wno-strict-aliasing -Wno-error=deprecated-declarations -Wno-stringop-overflow -Wno-error=pedantic -Wno-error=redundant-decls -Wno-error=old-style-cast -fdiagnostics-color=always -faligned-new -Wno-unused-but-set-variable -Wno-maybe-uninitialized -fno-math-errno -fno-trapping-math -Werror=format -Wno-stringop-overflow, PERF_WITH_AVX=1, PERF_WITH_AVX2=1, PERF_WITH_AVX512=1, USE_CUDA=ON, USE_EXCEPTION_PTR=1, USE_GFLAGS=OFF, USE_GLOG=OFF, USE_MKL=ON, USE_MKLDNN=ON, USE_MPI=OFF, USE_NCCL=ON, USE_NNPACK=ON, USE_OPENMP=ON, USE_STATIC_DISPATCH=OFF, 
# python3 -m pip show flake8 isort black      
Name: flake8
Version: 3.7.9
Summary: the modular source code checker: pep8, pyflakes and co
Home-page: https://gitlab.com/pycqa/flake8
Author: Tarek Ziade
Author-email: tarek@ziade.org
License: MIT
Location: /usr/local/lib/python3.6/dist-packages
Requires: entrypoints, pyflakes, mccabe, pycodestyle
Required-by: azureml-train-core
---
Name: isort
Version: 4.3.21
Summary: A Python utility / library to sort Python imports.
Home-page: https://github.com/timothycrosley/isort
Author: Timothy Crosley
Author-email: timothy.crosley@gmail.com
License: MIT
Location: /usr/local/lib/python3.6/dist-packages
Requires: 
Required-by: 
---
Name: black
Version: 19.3b0
Summary: The uncompromising code formatter.
Home-page: https://github.com/ambv/black
--- Logging error ---
Traceback (most recent call last):
  File "/usr/lib/python3.6/logging/__init__.py", line 996, in emit
    stream.write(msg)
UnicodeEncodeError: 'ascii' codec can't encode character '\u0141' in position 8: ordinal not in range(128)
Call stack:
  File "/usr/lib/python3.6/runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "/usr/lib/python3.6/runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "/usr/local/lib/python3.6/dist-packages/pip/__main__.py", line 19, in <module>
    sys.exit(_main())
  File "/usr/local/lib/python3.6/dist-packages/pip/_internal/cli/main.py", line 75, in main
    return command.main(cmd_args)
  File "/usr/local/lib/python3.6/dist-packages/pip/_internal/cli/base_command.py", line 105, in main
    return self._main(args)
  File "/usr/local/lib/python3.6/dist-packages/pip/_internal/cli/base_command.py", line 186, in _main
    status = self.run(options, args)
  File "/usr/local/lib/python3.6/dist-packages/pip/_internal/commands/show.py", line 50, in run
    results, list_files=options.files, verbose=options.verbose):
  File "/usr/local/lib/python3.6/dist-packages/pip/_internal/commands/show.py", line 157, in print_results
    write_output("Author: %s", dist.get('author', ''))
  File "/usr/local/lib/python3.6/dist-packages/pip/_internal/utils/misc.py", line 522, in write_output
    logger.info(msg, *args)
Message: 'Author: %s'
Arguments: ('\u0141ukasz Langa',)
Author-email: lukasz@langa.pl
License: MIT
Location: /usr/local/lib/python3.6/dist-packages
Requires: click, attrs, appdirs, toml
Required-by:
ppwwyyxx commented 4 years ago

Only clang-format would lint this file. What's your version of clang-format and what's the change you see?

It's working ok with

$ clang-format -version
clang-format version 3.9.1-19ubuntu1 (tags/RELEASE_391/rc2)
xkszltl commented 4 years ago

LLVM is built by us from latest release tag.

clang-format version 10.0.0 (https://github.com/llvm/llvm-project.git d32170dbd5b0d54436537b6b75beaf44324e0c28)
ppwwyyxx commented 4 years ago

I don't have clang 10 to test but clang 9 also works fine. If clang 10 changes the format, hopefully there is an option to set in .clang-format that can restore old format.

xkszltl commented 4 years ago

This is what it looks like:

image
xkszltl commented 4 years ago

Release note in case you need: https://releases.llvm.org/10.0.0/tools/clang/docs/ReleaseNotes.html#clang-format

ppwwyyxx commented 4 years ago

I can see now that clang-format 10 changes the style. Don't know if there is a way to configure it to use the old style.