"git@developer.sourcefind.cn:OpenDAS/bitsandbytes.git" did not exist on "1571110648dc5b0e603316c9ce2b0f16ac85cdbb"
Unverified Commit ccbc30fd authored by Hongzhi (Steve), Chen's avatar Hongzhi (Steve), Chen Committed by GitHub
Browse files

[Dev] Create a script for building dgl from source. (#5294)


Co-authored-by: default avatarUbuntu <ubuntu@ip-172-31-28-63.ap-northeast-1.compute.internal>
parent 2bbca12a
#!/bin/bash
set -e
usage() {
cat << EOF
usage: bash $0 OPTIONS
examples:
Start a CPU only build: bash $0 -c
Start a CUDA build: bash $0 -g
Build incrementally: bash $0
Remove all intermediate output and restart a CPU only build: bash $0 -c -r
Build DGL. By default, build incrementally on top of the current state.
OPTIONS:
-h Show this message.
-c Restart CPU only build.
-g Restart CUDA build.
-r Remove all intermediate output.
EOF
}
# Parse flags.
while getopts "cghr" flag; do
if [[ ${flag} == "c" ]]; then
cuda="OFF"
elif [[ ${flag} == "g" ]]; then
cuda="ON"
elif [[ ${flag} == "r" ]]; then
remove="YES"
elif [[ ${flag} == "h" ]]; then
usage
exit 0
else
usage
exit 1
fi
done
if [[ -z ${DGL_HOME} ]]; then
echo "ERROR: Please make sure environment variable DGL_HOME is set correctly."
exit 1
fi
if [[ ! ${PWD} == ${DGL_HOME} ]]; then
echo "ERROR: This script only works properly from DGL root directory."
echo " Current: ${PWD}"
echo "DGL_HOME: ${DGL_HOME}"
exit 1
fi
if [[ ${remove} == "YES" ]]; then
rm -rf build
fi
if [[ -z ${cuda} ]]; then
if [[ -d build ]]; then
cd build
else
echo "ERROR: No existing build status found, unable to build incrementally."
usage
exit 1
fi
else
mkdir -p build
cd build
cmake -DUSE_CUDA=${cuda} ..
fi
if [[ ${PWD} == "${DGL_HOME}/build" ]]; then
make -j
else
echo "ERROR: unexpected working directory."
echo " Current: ${PWD}"
echo "Expected: ${DGL_HOME}/build"
fi
exit 0
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment