-
Notifications
You must be signed in to change notification settings - Fork 3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
27 changed files
with
260 additions
and
85 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,112 @@ | ||
#!/bin/bash | ||
|
||
CUDA_VERSIONS="10.2,11.3,11.6,11.7" | ||
TORCH_VERSION="1.12.0" | ||
|
||
usage() { | ||
cat << EOF | ||
usage: bash $0 OPTIONS | ||
examples: | ||
bash $0 -c | ||
bash $0 -g 11.7 | ||
Created a developement environment for DGL developers. | ||
OPTIONS: | ||
-h Show this message. | ||
-c Create dev environment in CPU mode. | ||
-g Create dev environment in GPU mode with specified CUDA version, | ||
supported: $CUDA_VERSIONS. | ||
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 | ||
} | ||
|
||
# Parsing flags. | ||
while getopts "cg:h" flag; do | ||
if [[ $flag == "c" ]]; then | ||
cpu=1 | ||
elif [[ $flag == "g" ]]; then | ||
gpu=$OPTARG | ||
elif [[ $flag == "h" ]]; then | ||
usage | ||
exit 0 | ||
else | ||
usage | ||
exit 1 | ||
fi | ||
done | ||
|
||
if [[ -n $gpu && $cpu -eq 1 ]]; then | ||
echo "Only one mode can be specified." | ||
exit 1 | ||
fi | ||
|
||
if [[ -z $gpu && -z $cpu ]]; then | ||
usage | ||
exit 1 | ||
fi | ||
|
||
# Set up CPU mode. | ||
if [[ $cpu -eq 1 ]]; then | ||
torchversion=${TORCH_VERSION}"+cpu" | ||
name="dgl-dev-cpu" | ||
fi | ||
|
||
# Set up GPU mode. | ||
if [[ -n $gpu ]]; then | ||
if ! validate ${CUDA_VERSIONS} ${gpu}; then | ||
echo "Error: Invalid CUDA version." | ||
usage | ||
exit 1 | ||
fi | ||
|
||
echo "Confirm the installed CUDA version matches the specified one." | ||
confirm | ||
|
||
torchversion=${TORCH_VERSION}"+cu"${gpu//[-._]/} | ||
name="dgl-dev-gpu" | ||
fi | ||
|
||
echo "Confirm you are excuting the script from your DGL root directory." | ||
echo "Current working directory: $PWD" | ||
confirm | ||
|
||
# Prepare the conda environment yaml file. | ||
rand=$(echo "$RANDOM" | md5sum | head -c 20) | ||
mkdir -p /tmp/$rand | ||
cp script/dgl_dev.yml.template /tmp/$rand/dgl_dev.yml | ||
sed -i "s|__NAME__|$name|g" /tmp/$rand/dgl_dev.yml | ||
sed -i "s|__TORCH_VERSION__|$torchversion|g" /tmp/$rand/dgl_dev.yml | ||
sed -i "s|__DGL_HOME__|$PWD|g" /tmp/$rand/dgl_dev.yml | ||
|
||
# Ask for final confirmation. | ||
echo "--------------------------------------------------" | ||
cat /tmp/$rand/dgl_dev.yml | ||
echo "--------------------------------------------------" | ||
echo "Create a conda enviroment with the config?" | ||
confirm | ||
|
||
# Create conda environment. | ||
conda env create -f /tmp/$rand/dgl_dev.yml | ||
|
||
# Clean up created tmp conda environment yaml file. | ||
rm -rf /tmp/$rand | ||
exit 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
name: __NAME__ | ||
dependencies: | ||
- python=3.7.0 | ||
- pip | ||
- pip: | ||
- --find-links https://download.pytorch.org/whl/torch_stable.html | ||
- cython | ||
- filelock | ||
- matplotlib | ||
- networkx | ||
- nltk | ||
- nose | ||
- numpy | ||
- ogb | ||
- pandas | ||
- psutil | ||
- pyarrow | ||
- pydantic | ||
- pytest | ||
- pyyaml | ||
- rdflib | ||
- requests[security] | ||
- scikit-learn | ||
- scipy | ||
- torch==__TORCH_VERSION__ | ||
- torchmetrics | ||
- tqdm | ||
variables: | ||
DGL_HOME: __DGL_HOME__ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,6 @@ | ||
import sys | ||
|
||
import backend as F | ||
import pytest | ||
import torch | ||
|
||
from dgl.sparse import diag | ||
|
Oops, something went wrong.