Skip to content

Commit

Permalink
Merge pull request #3 from pfnet/pfnci
Browse files Browse the repository at this point in the history
Add pfnci configuration
  • Loading branch information
xuzijian629 authored Jul 3, 2023
2 parents 8ff2531 + 26a0167 commit d344b00
Show file tree
Hide file tree
Showing 4 changed files with 83 additions and 0 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,5 @@
pytorch
pytorch-build
pytorch-install
libtorch.zip
.cache
19 changes: 19 additions & 0 deletions .pfnci/config.pbtxt
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
configs {
key: "sold.gpu",
value {
requirement {
cpu: 8
memory: 32
disk: 50
gpu: 1
}
checkout_strategy {
ignore_gitignore: true
include_dot_git: true
}
time_limit: {
seconds: 3600
}
command: "bash .pfnci/run_gpu_test.sh"
}
}
51 changes: 51 additions & 0 deletions .pfnci/run_gpu_test.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
#!/bin/bash
set -eux

LIBTORCH_VERSION=${LIBTORCH_VERSION:-1.13.0}
LIBTORCH_ARCH=${LIBTORCH_ARCH:-cu117}
OS=${OS:-ubuntu22.04}

cat >> test.sh <<'EOF'
#!/bin/bash
set -eux
nvidia-smi
apt-get update && apt-get install -y \
python3 \
python3-pip \
cmake \
clang-format \
rsync \
git \
ninja-build \
g++-aarch64-linux-gnu \
qemu \
qemu-system-aarch64 \
qemu-user \
wget \
unzip
pip3 install pytest numpy cmake-format
./run-format.sh
./download-libtorch.sh
LIBTORCH_DIR=$(pwd)/pytorch-install/libtorch
mkdir build && cd build && \
cmake .. \
-GNinja \
-DSOLD_PYBIND_TEST=ON \
-DSOLD_LIBTORCH_TEST=ON \
-DCMAKE_PREFIX_PATH=${LIBTORCH_DIR}/share/cmake/Torch/
ninja
ctest --output-on-failure
EOF

docker run --gpus=all --rm \
-v $(pwd):/sold \
-w /sold \
-e LIBTORCH_VERSION=${LIBTORCH_VERSION} \
-e LIBTORCH_ARCH=${LIBTORCH_ARCH} \
nvidia/cuda:11.7.1-cudnn8-devel-${OS} \
/bin/bash /sold/test.sh
12 changes: 12 additions & 0 deletions download-libtorch.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#! /bin/bash -ex

LIBTORCH_ARCH=${LIBTORCH_ARCH:-"cu117"}
LIBTORCH_ABI="-cxx11-abi"
LIBTORCH_LIBOPT="-shared-with-deps"
LIBTORCH_VERSION=${LIBTORCH_VERSION:-"1.13.0"}
LIBTORCH_ZIP_SUFFIX="%2B${LIBTORCH_ARCH}"

URL="https://download.pytorch.org/libtorch${LIBTORCH_RELEASE_TYPE}/${LIBTORCH_ARCH}/libtorch${LIBTORCH_ABI}${LIBTORCH_OSNAME}${LIBTORCH_LIBOPT}-${LIBTORCH_VERSION}${LIBTORCH_ZIP_SUFFIX}.zip"

wget -O libtorch.zip "${URL}"
unzip libtorch.zip -d pytorch-install

0 comments on commit d344b00

Please sign in to comment.