chore: import upstream snapshot with attribution
This commit is contained in:
@@ -0,0 +1,92 @@
|
||||
#!/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 with extra cmake arguments: bash $0 -c -e '-DBUILD_TORCH=ON'
|
||||
|
||||
Build DGL. By default, build incrementally on top of the current state.
|
||||
|
||||
OPTIONS:
|
||||
-h Show this message.
|
||||
-c Restart CPU only build.
|
||||
-e Extra arguments of cmake.
|
||||
-g Restart CUDA build.
|
||||
-r Remove all intermediate output.
|
||||
-t Type of the build: dev, dogfood or release (default: dev).
|
||||
EOF
|
||||
}
|
||||
|
||||
# Parse flags.
|
||||
while getopts "ce:ghrt:" flag; do
|
||||
if [[ ${flag} == "c" ]]; then
|
||||
cuda="OFF"
|
||||
elif [[ ${flag} == "e" ]]; then
|
||||
extra_args=${OPTARG}
|
||||
elif [[ ${flag} == "g" ]]; then
|
||||
cuda="ON"
|
||||
elif [[ ${flag} == "r" ]]; then
|
||||
remove="YES"
|
||||
elif [[ ${flag} == "t" ]]; then
|
||||
build_type=${OPTARG}
|
||||
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
|
||||
rm -rf graphbolt/build
|
||||
rm -rf dgl_sparse/build
|
||||
rm -rf tensoradapter/pytorch/build
|
||||
fi
|
||||
|
||||
if [[ -z ${build_type} ]]; then
|
||||
build_type="dev"
|
||||
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 -DBUILD_TYPE=${build_type} -DUSE_CUDA=${cuda} ${extra_args} ..
|
||||
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
|
||||
@@ -0,0 +1,71 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -e
|
||||
|
||||
usage() {
|
||||
cat << EOF
|
||||
usage: bash $0 OPTIONS
|
||||
examples:
|
||||
Build doc with PyTorch-backend: bash $0 -p
|
||||
Build doc with MXNet-backend: bash $0 -m
|
||||
Build doc with TensorFlow-backend: bash $0 -t
|
||||
Build incrementally with PyTorch-backend: bash $0
|
||||
Remove all outputs and restart a PyTorch build: bash $0 -p -r
|
||||
|
||||
Build DGL documentation. By default, build incrementally on top of the current state.
|
||||
|
||||
OPTIONS:
|
||||
-h Show this message.
|
||||
-p Build doc with PyTorch backend.
|
||||
-m Build doc with MXNet backend.
|
||||
-t Build doc with TensorFlow backend.
|
||||
-r Remove all outputs.
|
||||
EOF
|
||||
}
|
||||
|
||||
backend="pytorch"
|
||||
|
||||
# Parse flags.
|
||||
while getopts "hpmtr" flag; do
|
||||
if [[ ${flag} == "p" ]]; then
|
||||
backend="pytorch"
|
||||
elif [[ ${flag} == "m" ]]; then
|
||||
backend="mxnet"
|
||||
elif [[ ${flag} == "t" ]]; then
|
||||
backend="tensorflow"
|
||||
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
|
||||
|
||||
cd ${DGL_HOME}/docs
|
||||
|
||||
if [[ ${remove} == "YES" ]]; then
|
||||
bash clean.sh
|
||||
fi
|
||||
|
||||
export DGLBACKEND=$backend
|
||||
export DGL_LIBRARY_PATH=${DGL_HOME}/build
|
||||
export PYTHONPATH=${DGL_HOME}/python:$PYTHONPATH
|
||||
|
||||
make $backend
|
||||
|
||||
exit 0
|
||||
@@ -0,0 +1,184 @@
|
||||
#!/bin/bash
|
||||
|
||||
readonly CUDA_VERSIONS="11.8,12.1,12.4"
|
||||
readonly TORCH_VERSION="2.1.0"
|
||||
readonly PYTHON_VERSION="3.10"
|
||||
|
||||
usage() {
|
||||
cat << EOF
|
||||
usage: bash $0 OPTIONS
|
||||
examples:
|
||||
bash $0 -c
|
||||
bash $0 -g 12.1
|
||||
bash $0 -g 12.1 -p 3.10
|
||||
bash $0 -g 12.1 -p 3.10 -t 2.1.0
|
||||
bash $0 -c -n dgl-dev-cpu
|
||||
|
||||
Create a developement environment for DGL developers.
|
||||
|
||||
OPTIONS:
|
||||
-h Show this message.
|
||||
-c Create dev environment in CPU mode.
|
||||
-d Only display environment YAML file instead of creating it.
|
||||
-f Force creation of environment (removing a previously existing
|
||||
environment of the same name).
|
||||
-g Create dev environment in GPU mode with specified CUDA version,
|
||||
supported: ${CUDA_VERSIONS}.
|
||||
-n Specify the name of the environment.
|
||||
-o Save environment YAML file to specified path.
|
||||
-p Create dev environment based on specified python version.
|
||||
-s Run silently which indicates always 'yes' for any confirmation.
|
||||
-t Create dev environment based on specified PyTorch version such
|
||||
as '2.0.0'.
|
||||
EOF
|
||||
}
|
||||
|
||||
validate() {
|
||||
values=$(echo "$1" | tr "," "\n")
|
||||
for value in ${values}
|
||||
do
|
||||
if [[ "${value}" == $2 ]]; then
|
||||
return 0
|
||||
fi
|
||||
done
|
||||
return 1
|
||||
}
|
||||
|
||||
confirm() {
|
||||
echo "Continue? [yes/no]:"
|
||||
read confirm
|
||||
if [[ ! ${confirm} == "yes" ]]; then
|
||||
exit 0
|
||||
fi
|
||||
}
|
||||
|
||||
# Parse flags.
|
||||
while getopts "cdfg:hn:o:p:st:" flag; do
|
||||
case "${flag}" in
|
||||
c)
|
||||
cpu=1
|
||||
;;
|
||||
d)
|
||||
dry_run=1
|
||||
;;
|
||||
f)
|
||||
force_create=1
|
||||
;;
|
||||
g)
|
||||
cuda_version=${OPTARG}
|
||||
;;
|
||||
h)
|
||||
usage
|
||||
exit 0
|
||||
;;
|
||||
n)
|
||||
name=${OPTARG}
|
||||
;;
|
||||
o)
|
||||
output_path=${OPTARG}
|
||||
;;
|
||||
p)
|
||||
python_version=${OPTARG}
|
||||
;;
|
||||
s)
|
||||
always_yes=1
|
||||
;;
|
||||
t)
|
||||
torch_version=${OPTARG}
|
||||
;;
|
||||
:)
|
||||
echo "Error: -${OPTARG} requires an argument."
|
||||
exit 1
|
||||
;;
|
||||
*)
|
||||
usage
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
if [[ -n ${cuda_version} && ${cpu} -eq 1 ]]; then
|
||||
echo "Only one mode can be specified."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [[ -z ${cuda_version} && -z ${cpu} ]]; then
|
||||
usage
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [[ -z "${torch_version}" ]]; then
|
||||
torch_version=${TORCH_VERSION}
|
||||
fi
|
||||
|
||||
# Set up CPU mode.
|
||||
if [[ ${cpu} -eq 1 ]]; then
|
||||
torchversion=${torch_version}"+cpu"
|
||||
if [[ -z "${name}" ]]; then
|
||||
name="dgl-dev-cpu"
|
||||
fi
|
||||
fi
|
||||
|
||||
# Set up GPU mode.
|
||||
if [[ -n ${cuda_version} ]]; then
|
||||
if ! validate ${CUDA_VERSIONS} ${cuda_version}; then
|
||||
echo "Error: Invalid CUDA version."
|
||||
usage
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "Confirm the installed CUDA version matches the specified one."
|
||||
[[ -n "${always_yes}" ]] || confirm
|
||||
|
||||
torchversion=${torch_version}"+cu"${cuda_version//[-._]/}
|
||||
if [[ -z "${name}" ]]; then
|
||||
name="dgl-dev-gpu-"${cuda_version//[-._]/}
|
||||
fi
|
||||
fi
|
||||
|
||||
# Set python version.
|
||||
if [[ -z "${python_version}" ]]; then
|
||||
python_version=${PYTHON_VERSION}
|
||||
fi
|
||||
|
||||
echo "Confirm you are excuting the script from your DGL root directory."
|
||||
echo "Current working directory: ${PWD}"
|
||||
[[ -n "${always_yes}" ]] || confirm
|
||||
|
||||
# Prepare the conda environment yaml file.
|
||||
rand=$(echo "${RANDOM}" | md5sum | head -c 20)
|
||||
mkdir -p /tmp/${rand}
|
||||
yaml_path="/tmp/${rand}/dgl_dev.yml"
|
||||
cp script/dgl_dev.yml.template ${yaml_path}
|
||||
sed -i "s|__NAME__|${name}|g" ${yaml_path}
|
||||
sed -i "s|__PYTHON_VERSION__|${python_version}|g" ${yaml_path}
|
||||
sed -i "s|__TORCH_VERSION__|${torchversion}|g" ${yaml_path}
|
||||
sed -i "s|__DGL_HOME__|${PWD}|g" ${yaml_path}
|
||||
|
||||
# Ask for final confirmation.
|
||||
echo "--------------------------------------------------"
|
||||
cat ${yaml_path}
|
||||
echo "--------------------------------------------------"
|
||||
echo "Create a conda enviroment with the config?"
|
||||
[[ -n "${always_yes}" ]] || confirm
|
||||
|
||||
# Save YAML file to specified path
|
||||
if [[ -n "${output_path}" ]]; then
|
||||
cp ${yaml_path} ${output_path}
|
||||
echo "Environment YAML file has been saved to ${output_path}."
|
||||
fi
|
||||
|
||||
# Create conda environment.
|
||||
if [[ -z "${dry_run}" ]]; then
|
||||
conda_args=""
|
||||
if [[ -n "${force_create}" ]]; then
|
||||
conda_args="${conda_args} --force "
|
||||
fi
|
||||
conda env create -f ${yaml_path} ${conda_args}
|
||||
else
|
||||
echo "Running in dry mode, so creation of conda environment is skipped."
|
||||
fi
|
||||
|
||||
# Clean up created tmp conda environment yaml file.
|
||||
rm -rf /tmp/${rand}
|
||||
exit 0
|
||||
@@ -0,0 +1,57 @@
|
||||
name: __NAME__
|
||||
channels:
|
||||
- conda-forge
|
||||
- defaults
|
||||
dependencies:
|
||||
- libstdcxx-ng>=9.5.0
|
||||
- python=__PYTHON_VERSION__
|
||||
- pip
|
||||
- graphviz
|
||||
- pandoc
|
||||
- pygraphviz
|
||||
- pip:
|
||||
- --find-links https://download.pytorch.org/whl/torch/
|
||||
- cmake>=3.18
|
||||
- cython
|
||||
- filelock
|
||||
- matplotlib
|
||||
- networkx
|
||||
- nltk
|
||||
- nose
|
||||
- numpy
|
||||
- ogb
|
||||
- pandas
|
||||
- psutil
|
||||
- pyarrow
|
||||
- pydantic>=2.0
|
||||
- pytest
|
||||
- pyyaml
|
||||
- rdflib
|
||||
- requests[security]
|
||||
- scikit-learn
|
||||
- scipy
|
||||
- torch==__TORCH_VERSION__
|
||||
- torcheval
|
||||
- torchmetrics
|
||||
- torch_geometric
|
||||
- tqdm
|
||||
- boto3 # AWS SDK for python
|
||||
- sphinx
|
||||
- sphinx-gallery
|
||||
- sphinx_rtd_theme
|
||||
- sphinx_copybutton
|
||||
- sphinxemoji
|
||||
- nbsphinx
|
||||
- nbsphinx-link
|
||||
- pillow
|
||||
- seaborn
|
||||
- jupyter_http_over_ws
|
||||
- ufmt
|
||||
- clang-format
|
||||
- pylint
|
||||
- lintrunner
|
||||
- jupyterlab
|
||||
- ipywidgets
|
||||
- expecttest
|
||||
variables:
|
||||
DGL_HOME: __DGL_HOME__
|
||||
@@ -0,0 +1,69 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -e
|
||||
|
||||
usage() {
|
||||
cat << EOF
|
||||
usage: bash $0 OPTIONS TARGETS
|
||||
examples:
|
||||
Run python tests on CPU: bash $0 -c tests/compute/test_subgraph.py
|
||||
Run python tests on GPU: bash $0 -g tests/compute/test_subgraph.py
|
||||
|
||||
Run DGL python tests.
|
||||
|
||||
OPTIONS:
|
||||
-h Show this message.
|
||||
-c Run python tests on CPU.
|
||||
-g Run python tests on GPU.
|
||||
EOF
|
||||
}
|
||||
|
||||
# Parse flags.
|
||||
while getopts "cgh" flag; do
|
||||
if [[ ${flag} == "c" ]]; then
|
||||
device="cpu"
|
||||
elif [[ ${flag} == "g" ]]; then
|
||||
device="gpu"
|
||||
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 [[ -z ${device} ]]; then
|
||||
echo "ERROR: Test device unspecified."
|
||||
usage
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Reset the index for non-option arguments.
|
||||
shift $(($OPTIND-1))
|
||||
|
||||
export DGLBACKEND=pytorch
|
||||
export DGL_LIBRARY_PATH=${DGL_HOME}/build
|
||||
export PYTHONPATH=${DGL_HOME}/python:${DGL_HOME}/tests:${DGL_HOME}/tests/python/pytorch/graphbolt:$PYTHONPATH
|
||||
export DGLTESTDEV=${device}
|
||||
export DGL_DOWNLOAD_DIR=${DGL_HOME}/_download
|
||||
|
||||
if [[ -z $@ ]]; then
|
||||
echo "ERROR: Missing test targets."
|
||||
usage
|
||||
exit 1
|
||||
fi
|
||||
|
||||
python3 -m pytest -v $@
|
||||
Reference in New Issue
Block a user