# (This is set by default in the Docker images we build, so you don't
# need to set it yourself.
+# shellcheck disable=SC2034
COMPACT_JOB_NAME="${BUILD_ENVIRONMENT}"
+
source "$(dirname "${BASH_SOURCE[0]}")/common.sh"
echo "Clang version:"
# (This is set by default in the Docker images we build, so you don't
# need to set it yourself.
+# shellcheck disable=SC2034
COMPACT_JOB_NAME="${BUILD_ENVIRONMENT}"
+
source "$(dirname "${BASH_SOURCE[0]}")/common.sh"
# For distributed, four environmental configs:
fi
if [[ "$BUILD_ENVIRONMENT" == *pytorch-linux-xenial-py3-clang5-asan* ]]; then
- exec "$(dirname "${BASH_SOURCE[0]}")/build-asan.sh" $*
+ exec "$(dirname "${BASH_SOURCE[0]}")/build-asan.sh" "$@"
fi
echo "Python version:"
# gcc 7 with sccache seems to have intermittent OOM issue if all cores are used
if [ -z "$MAX_JOBS" ]; then
if ([[ "$BUILD_ENVIRONMENT" == *cuda* ]] || [[ "$BUILD_ENVIRONMENT" == *gcc7* ]]) && which sccache > /dev/null; then
- export MAX_JOBS=`expr $(nproc) - 1`
+ export MAX_JOBS=$(($(nproc) - 1))
fi
fi
sccache --zero-stats
function sccache_epilogue() {
echo '=================== sccache compilation log ==================='
- python $(dirname "${BASH_SOURCE[0]}")/print_sccache_log.py ~/sccache_error.log
+ python "$(dirname "${BASH_SOURCE[0]}")/print_sccache_log.py" ~/sccache_error.log
echo '=========== If your build fails, please take a look at the log above for possible reasons ==========='
sccache --show-stats
sccache --stop-server || true
#!/bin/bash
+# shellcheck disable=SC2034
COMPACT_JOB_NAME="docker-build-test"
+
source "$(dirname "${BASH_SOURCE[0]}")/common.sh"
docker build -t pytorch .
#!/bin/bash
+# shellcheck disable=SC2034
COMPACT_JOB_NAME="${BUILD_ENVIRONMENT}"
+
export PATH="/usr/local/bin:$PATH"
source "$(dirname "${BASH_SOURCE[0]}")/common.sh"
#!/bin/bash
+# shellcheck disable=SC2034
COMPACT_JOB_NAME="${BUILD_ENVIRONMENT}"
+
source "$(dirname "${BASH_SOURCE[0]}")/common.sh"
export PATH="/usr/local/bin:$PATH"
# (This is set by default in the Docker images we build, so you don't
# need to set it yourself.
+# shellcheck disable=SC2034
COMPACT_JOB_NAME="${BUILD_ENVIRONMENT}"
+
source "$(dirname "${BASH_SOURCE[0]}")/common.sh"
echo "Testing pytorch (distributed only)"
TIMEFORMAT=%R
# runtime=$( { time ($@ &> /dev/null); } 2>&1 1>/dev/null)
- runtime=$( { time $@; } 2>&1 1>/dev/null)
+ runtime=$( { time "$@"; } 2>&1 1>/dev/null)
if [[ $runtime == *"Error"* ]]; then
exit 1
fi
SAMPLE_ARRAY=()
NUM_RUNS=$1
- for (( i=1; i<=$NUM_RUNS; i++ )) do
+ for (( i=1; i<=NUM_RUNS; i++ )) do
runtime=$(get_runtime_of_command python main.py)
SAMPLE_ARRAY+=(${runtime})
done
cd ../../..
- stats=$(python ../get_stats.py ${SAMPLE_ARRAY[@]})
+ stats=$(python ../get_stats.py "${SAMPLE_ARRAY[@]}")
echo "Runtime stats in seconds:"
echo $stats
SAMPLE_ARRAY=()
NUM_RUNS=$1
- for (( i=1; i<=$NUM_RUNS; i++ )) do
+ for (( i=1; i<=NUM_RUNS; i++ )) do
runtime=$(get_runtime_of_command python main.py --epochs 1 --no-log)
echo $runtime
SAMPLE_ARRAY+=(${runtime})
cd ../..
- stats=$(python ../get_stats.py ${SAMPLE_ARRAY[@]})
+ stats=$(python ../get_stats.py "${SAMPLE_ARRAY[@]}")
echo "Runtime stats in seconds:"
echo $stats
+#!/bin/bash
+
. ./common.sh
test_cpu_speed_torch () {
fi
if ! python perf-tests/modules/test_cpu_torch.py ${ARGS}; then
- echo "To reproduce this regression, run \`cd .jenkins/pytorch/perf_test/ && bash "${FUNCNAME[0]}".sh\` on your local machine and compare the runtime before/after your code change."
+ echo "To reproduce this regression, run \`cd .jenkins/pytorch/perf_test/ && bash ${FUNCNAME[0]}.sh\` on your local machine and compare the runtime before/after your code change."
exit 1
fi
}
+#!/bin/bash
+
. ./common.sh
test_cpu_speed_torch_tensor () {
fi
if ! python perf-tests/modules/test_cpu_torch_tensor.py ${ARGS}; then
- echo "To reproduce this regression, run \`cd .jenkins/pytorch/perf_test/ && bash "${FUNCNAME[0]}".sh\` on your local machine and compare the runtime before/after your code change."
+ echo "To reproduce this regression, run \`cd .jenkins/pytorch/perf_test/ && bash ${FUNCNAME[0]}.sh\` on your local machine and compare the runtime before/after your code change."
exit 1
fi
}
SAMPLE_ARRAY=()
NUM_RUNS=$1
- for (( i=1; i<=$NUM_RUNS; i++ )) do
+ for (( i=1; i<=NUM_RUNS; i++ )) do
runtime=$(get_runtime_of_command python cudnn_lstm.py --skip-cpu-governor-check)
echo $runtime
SAMPLE_ARRAY+=(${runtime})
cd ../..
- stats=$(python ../get_stats.py ${SAMPLE_ARRAY[@]})
+ stats=$(python ../get_stats.py "${SAMPLE_ARRAY[@]}")
echo "Runtime stats in seconds:"
echo $stats
SAMPLE_ARRAY=()
NUM_RUNS=$1
- for (( i=1; i<=$NUM_RUNS; i++ )) do
+ for (( i=1; i<=NUM_RUNS; i++ )) do
runtime=$(get_runtime_of_command python lstm.py --skip-cpu-governor-check)
echo $runtime
SAMPLE_ARRAY+=(${runtime})
cd ../..
- stats=$(python ../get_stats.py ${SAMPLE_ARRAY[@]})
+ stats=$(python ../get_stats.py "${SAMPLE_ARRAY[@]}")
echo "Runtime stats in seconds:"
echo $stats
SAMPLE_ARRAY=()
NUM_RUNS=$1
- for (( i=1; i<=$NUM_RUNS; i++ )) do
+ for (( i=1; i<=NUM_RUNS; i++ )) do
runtime=$(get_runtime_of_command python mlstm.py --skip-cpu-governor-check)
echo $runtime
SAMPLE_ARRAY+=(${runtime})
cd ../..
- stats=$(python ../get_stats.py ${SAMPLE_ARRAY[@]})
+ stats=$(python ../get_stats.py "${SAMPLE_ARRAY[@]}")
echo "Runtime stats in seconds:"
echo $stats
# Needs warm up to get accurate number
python main.py --epochs 1 --no-log
- for (( i=1; i<=$NUM_RUNS; i++ )) do
+ for (( i=1; i<=NUM_RUNS; i++ )) do
runtime=$(get_runtime_of_command python main.py --epochs 1 --no-log)
echo $runtime
SAMPLE_ARRAY+=(${runtime})
cd ../..
- stats=$(python ../get_stats.py ${SAMPLE_ARRAY[@]})
+ stats=$(python ../get_stats.py "${SAMPLE_ARRAY[@]}")
echo "Runtime stats in seconds:"
echo $stats
SAMPLE_ARRAY=()
NUM_RUNS=$1
- for (( i=1; i<=$NUM_RUNS; i++ )) do
+ for (( i=1; i<=NUM_RUNS; i++ )) do
runtime=$(get_runtime_of_command python main.py --cuda --epochs 1)
echo $runtime
SAMPLE_ARRAY+=(${runtime})
cd ../..
- stats=$(python ../get_stats.py ${SAMPLE_ARRAY[@]})
+ stats=$(python ../get_stats.py "${SAMPLE_ARRAY[@]}")
echo "Runtime stats in seconds:"
echo $stats
#!/bin/bash
+# shellcheck disable=SC2034
COMPACT_JOB_NAME="short-perf-test-cpu"
-source "$(dirname "${BASH_SOURCE[0]}")/common.sh"
+
+SCRIPT_PARENT_DIR=$(dirname "${BASH_SOURCE[0]}")
+
+# shellcheck source=.jenkins/pytorch/common.sh
+source "$SCRIPT_PARENT_DIR/common.sh"
cd .jenkins/pytorch/perf_test
#!/bin/bash
+# shellcheck disable=SC2034
COMPACT_JOB_NAME="short-perf-test-gpu"
+
source "$(dirname "${BASH_SOURCE[0]}")/common.sh"
pushd .jenkins/pytorch/perf_test
# (This is set by default in the Docker images we build, so you don't
# need to set it yourself.
+# shellcheck disable=SC2034
COMPACT_JOB_NAME="${BUILD_ENVIRONMENT}"
+
source "$(dirname "${BASH_SOURCE[0]}")/common.sh"
echo "Testing pytorch"
exit 1
fi
+# shellcheck disable=SC2034
COMPACT_JOB_NAME=pytorch-win-ws2016-cuda9-cudnn7-py3-build
SCRIPT_PARENT_DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
#!/bin/bash -ex
+# shellcheck disable=SC2034
COMPACT_JOB_NAME=pytorch-win-ws2016-cuda9-cudnn7-py3-test
SCRIPT_PARENT_DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
--- /dev/null
+#!/bin/bash -xe
+
+# One may want to invoke this script locally as follows:
+#
+# .jenkins/run-shellcheck.sh --color=always | less -R
+
+
+EXCLUSIONS=SC2086,SC1091,SC2155,SC1090,SC2164,SC1003
+
+find .jenkins/pytorch -name *.sh | xargs shellcheck --exclude=$EXCLUSIONS --external-sources "$@" || true
python: "3.6"
dist: xenial
script: cd .circleci && ./ensure-consistency.py
+ - name: "Shellcheck Jenkins scripts"
+ dist: xenial
+ install: sudo apt-get install -y shellcheck
+ script: .jenkins/run-shellcheck.sh
- name: "Ensure no tabs"
python: "2.7"
script: