Skip to content

Commit

Permalink
[Lint] Prohibit tabs in shell scripts
Browse files Browse the repository at this point in the history
Fix current violations
  • Loading branch information
malfet committed Dec 20, 2023
1 parent 22d7be5 commit 1b30e26
Show file tree
Hide file tree
Showing 8 changed files with 321 additions and 26 deletions.
23 changes: 23 additions & 0 deletions .lintrunner.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,26 @@ init_command = [
'ruff==0.1.1',
]
is_formatter = true

[[linter]]
code = 'TABS'
include_patterns = ['**/*.sh']
exclude_patterns = [
'**/*Makefile',
'common/install_rocm_drm.sh',
'.lintrunner.toml',
]
command = [
'python3',
'tools/linter/adapters/grep_linter.py',
# @lint-ignore TXT2
'--pattern= ',
'--linter-name=TABS',
'--error-name=saw some tabs',
'--replace-pattern=s/\t/ /',
"""--error-description=\
This line has tabs; please replace them with spaces.\
""",
'--',
'@{{PATHSFILE}}'
]
8 changes: 4 additions & 4 deletions common/install_cuda.sh
Original file line number Diff line number Diff line change
Expand Up @@ -146,11 +146,11 @@ while test $# -gt 0
do
case "$1" in
11.8) install_118; prune_118
;;
;;
12.1) install_121; prune_121
;;
*) echo "bad argument $1"; exit 1
;;
;;
*) echo "bad argument $1"; exit 1
;;
esac
shift
done
4 changes: 2 additions & 2 deletions conda/build_pytorch.sh
Original file line number Diff line number Diff line change
Expand Up @@ -264,8 +264,8 @@ else
# TODO, simplify after anaconda fixes their cudatoolkit versioning inconsistency.
# see: https://github.com/conda-forge/conda-forge.github.io/issues/687#issuecomment-460086164
if [[ "$desired_cuda" == "12.1" ]]; then
export CONDA_CUDATOOLKIT_CONSTRAINT=" - pytorch-cuda >=12.1,<12.2 # [not osx]"
export MAGMA_PACKAGE=" - magma-cuda121 # [not osx and not win]"
export CONDA_CUDATOOLKIT_CONSTRAINT=" - pytorch-cuda >=12.1,<12.2 # [not osx]"
export MAGMA_PACKAGE=" - magma-cuda121 # [not osx and not win]"
elif [[ "$desired_cuda" == "11.8" ]]; then
export CONDA_CUDATOOLKIT_CONSTRAINT=" - pytorch-cuda >=11.8,<11.9 # [not osx]"
export MAGMA_PACKAGE=" - magma-cuda118 # [not osx and not win]"
Expand Down
22 changes: 11 additions & 11 deletions conda/pytorch-nightly/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -56,18 +56,18 @@ if [[ -n "$build_with_cuda" ]]; then
export USE_STATIC_CUDNN=1 # links cudnn statically (driven by tools/setup_helpers/cudnn.py)

if [[ $CUDA_VERSION == 11.8* ]]; then
TORCH_CUDA_ARCH_LIST="$TORCH_CUDA_ARCH_LIST;3.7+PTX;9.0"
#for cuda 11.8 we use cudnn 8.7
#which does not have single static libcudnn_static.a deliverable to link with
export USE_STATIC_CUDNN=0
#for cuda 11.8 include all dynamic loading libraries
DEPS_LIST=(/usr/local/cuda/lib64/libcudnn*.so.8 /usr/local/cuda-11.8/extras/CUPTI/lib64/libcupti.so.11.8)
TORCH_CUDA_ARCH_LIST="$TORCH_CUDA_ARCH_LIST;3.7+PTX;9.0"
#for cuda 11.8 we use cudnn 8.7
#which does not have single static libcudnn_static.a deliverable to link with
export USE_STATIC_CUDNN=0
#for cuda 11.8 include all dynamic loading libraries
DEPS_LIST=(/usr/local/cuda/lib64/libcudnn*.so.8 /usr/local/cuda-11.8/extras/CUPTI/lib64/libcupti.so.11.8)
elif [[ $CUDA_VERSION == 12.1* ]]; then
# cuda 12 does not support sm_3x
TORCH_CUDA_ARCH_LIST="$TORCH_CUDA_ARCH_LIST;9.0"
# for cuda 12.1 we use cudnn 8.8 and include all dynamic loading libraries
export USE_STATIC_CUDNN=0
DEPS_LIST=(/usr/local/cuda/lib64/libcudnn*.so.8 /usr/local/cuda-12.1/extras/CUPTI/lib64/libcupti.so.12)
# cuda 12 does not support sm_3x
TORCH_CUDA_ARCH_LIST="$TORCH_CUDA_ARCH_LIST;9.0"
# for cuda 12.1 we use cudnn 8.8 and include all dynamic loading libraries
export USE_STATIC_CUDNN=0
DEPS_LIST=(/usr/local/cuda/lib64/libcudnn*.so.8 /usr/local/cuda-12.1/extras/CUPTI/lib64/libcupti.so.12)
fi
if [[ -n "$OVERRIDE_TORCH_CUDA_ARCH_LIST" ]]; then
TORCH_CUDA_ARCH_LIST="$OVERRIDE_TORCH_CUDA_ARCH_LIST"
Expand Down
2 changes: 1 addition & 1 deletion ffmpeg/recipe/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ fi
--disable-static \
--enable-version3 \
--enable-zlib \
--enable-libmp3lame
--enable-libmp3lame

make -j${CPU_COUNT}
make install -j${CPU_COUNT}
8 changes: 4 additions & 4 deletions manywheel/build_rocm.sh
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ ROCM_SO_FILES=(
"librccl.so"
"librocblas.so"
"librocfft.so"
"librocm_smi64.so"
"librocm_smi64.so"
"librocrand.so"
"librocsolver.so"
"librocsparse.so"
Expand Down Expand Up @@ -128,7 +128,7 @@ elif [[ "$OS_NAME" == *"Ubuntu"* ]]; then
LIBTINFO_PATH="/lib/x86_64-linux-gnu/libtinfo.so.6"
else
LIBTINFO_PATH="/lib/x86_64-linux-gnu/libtinfo.so.5"
fi
fi
LIBDRM_PATH="/usr/lib/x86_64-linux-gnu/libdrm.so.2"
LIBDRM_AMDGPU_PATH="/usr/lib/x86_64-linux-gnu/libdrm_amdgpu.so.1"
MAYBE_LIB64=lib
Expand Down Expand Up @@ -170,8 +170,8 @@ do
file_path=($(find $ROCM_HOME/ -name "$lib")) # Then search in ROCM_HOME
fi
if [[ -z $file_path ]]; then
echo "Error: Library file $lib is not found." >&2
exit 1
echo "Error: Library file $lib is not found." >&2
exit 1
fi
ROCM_SO_PATHS[${#ROCM_SO_PATHS[@]}]="$file_path" # Append lib to array
done
Expand Down
8 changes: 4 additions & 4 deletions manywheel/conda_build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ if ! ls /usr/local/cuda-7.5
then
echo "Downloading CUDA 7.5"
wget -c http://developer.download.nvidia.com/compute/cuda/7.5/Prod/local_installers/cuda_7.5.18_linux.run \
-O /remote/cuda_7.5.18_linux.run
-O /remote/cuda_7.5.18_linux.run

echo "Installing CUDA 7.5"
chmod +x /remote/cuda_7.5.18_linux.run
Expand All @@ -23,7 +23,7 @@ if ! ls /usr/local/cuda-8.0
then
echo "Downloading CUDA 8.0"
wget -c https://developer.nvidia.com/compute/cuda/8.0/Prod2/local_installers/cuda_8.0.61_375.26_linux-run \
-O /remote/cuda_8.0.61_linux-run
-O /remote/cuda_8.0.61_linux-run

echo "Installing CUDA 8.0"
chmod +x /remote/cuda_8.0.61_linux-run
Expand All @@ -39,7 +39,7 @@ if ! ls /usr/local/cuda-7.5/lib64/libcudnn.so.6.0.21
then
rm -rf /tmp/cuda
wget -c http://developer.download.nvidia.com/compute/redist/cudnn/v6.0/cudnn-7.5-linux-x64-v6.0.tgz \
-O /remote/cudnn-7.5-linux-x64-v6.0.tgz
-O /remote/cudnn-7.5-linux-x64-v6.0.tgz
pushd /tmp
tar -xvf /remote/cudnn-7.5-linux-x64-v6.0.tgz
cp -P /tmp/cuda/include/* /usr/local/cuda-7.5/include/
Expand All @@ -51,7 +51,7 @@ if ! ls /usr/local/cuda-8.0/lib64/libcudnn.so.6.0.21
then
rm -rf /tmp/cuda
wget -c http://developer.download.nvidia.com/compute/redist/cudnn/v6.0/cudnn-8.0-linux-x64-v6.0.tgz \
-O /remote/cudnn-8.0-linux-x64-v6.0.tgz
-O /remote/cudnn-8.0-linux-x64-v6.0.tgz
pushd /tmp
tar -xvf /remote/cudnn-8.0-linux-x64-v6.0.tgz
cp -P /tmp/cuda/include/* /usr/local/cuda-8.0/include/
Expand Down
Loading

0 comments on commit 1b30e26

Please sign in to comment.