代码拉取完成,页面将自动刷新
#!/bin/bash
echo "-> Running build docker image script..."
HOST_CUDA_VERSION=$(nvcc --version | sed -n 's/^.*release \([0-9\.]\+\).*$/\1/p')
echo "-> Running on host with cuda:$HOST_CUDA_VERSION"
PYTORCH_CUDA_VERSION=$HOST_CUDA_VERSION
DOCKER_CUDA_VERSION=$DOCKER_CUDA_VERSION
while getopts ":d:p:" opt; do
case $opt in
d) DOCKER_CUDA_VERSION="$OPTARG"
echo "-> using nvidia/cuda docker image with version $OPTARG"
;;
p) PYTORCH_CUDA_VERSION="$OPTARG"
echo "-> using pytorch with cuda toolkit with version $OPTARG"
;;
\?) echo "Invalid option -$OPTARG" >&2
;;
esac
done
if [ "$PYTORCH_CUDA_VERSION" != "$DOCKER_CUDA_VERSION" ]
then
echo "-> ! WARNING ! possible mismatch for local cuda version, docker image and pytorch cuda toolkit installer!"
echo " pytorch_v($PYTORCH_CUDA_VERSION) / docker_cuda_v($DOCKER_CUDA_VERSION)"
fi
cp environment.yml environment_backup.yml
awk -v cuda_ver="$PYTORCH_CUDA_VERSION" '{sub(/\${CUDA_TOOLKIT_VERSION}/, cuda_ver)}1' environment_backup.yml > environment.yml
docker build -t "buzz-based-anomaly:cuda-$DOCKER_CUDA_VERSION" . --build-arg CUDA_VERSION="$DOCKER_CUDA_VERSION"
mv environment_backup.yml environment.yml
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。