Unverified Commit 6093cc5b authored by Rhett Ying's avatar Rhett Ying Committed by GitHub
Browse files

[Dev] enable to specify torch version when create conda env (#5430)

* [Dev] enable to specify torch version when create conda env

* Update script/create_dev_conda_env.sh

* Update script/create_dev_conda_env.sh
parent 7b766393
...@@ -11,6 +11,7 @@ examples: ...@@ -11,6 +11,7 @@ examples:
bash $0 -c bash $0 -c
bash $0 -g 11.7 bash $0 -g 11.7
bash $0 -g 11.7 -p 3.8 bash $0 -g 11.7 -p 3.8
bash $0 -g 11.7 -p 3.8 -t 1.13.0
Create a developement environment for DGL developers. Create a developement environment for DGL developers.
...@@ -25,6 +26,8 @@ OPTIONS: ...@@ -25,6 +26,8 @@ OPTIONS:
-o Save environment YAML file to specified path. -o Save environment YAML file to specified path.
-p Create dev environment based on specified python version. -p Create dev environment based on specified python version.
-s Run silently which indicates always 'yes' for any confirmation. -s Run silently which indicates always 'yes' for any confirmation.
-t Create dev environment based on specified PyTorch version such
as '1.13.0'.
EOF EOF
} }
...@@ -48,7 +51,7 @@ confirm() { ...@@ -48,7 +51,7 @@ confirm() {
} }
# Parse flags. # Parse flags.
while getopts "cdfg:ho:p:s" flag; do while getopts "cdfg:ho:p:st:" flag; do
case "${flag}" in case "${flag}" in
c) c)
cpu=1 cpu=1
...@@ -75,6 +78,9 @@ while getopts "cdfg:ho:p:s" flag; do ...@@ -75,6 +78,9 @@ while getopts "cdfg:ho:p:s" flag; do
s) s)
always_yes=1 always_yes=1
;; ;;
t)
torch_version=${OPTARG}
;;
:) :)
echo "Error: -${OPTARG} requires an argument." echo "Error: -${OPTARG} requires an argument."
exit 1 exit 1
...@@ -96,9 +102,13 @@ if [[ -z ${cuda_version} && -z ${cpu} ]]; then ...@@ -96,9 +102,13 @@ if [[ -z ${cuda_version} && -z ${cpu} ]]; then
exit 1 exit 1
fi fi
if [[ -z "${torch_version}" ]]; then
torch_version=${TORCH_VERSION}
fi
# Set up CPU mode. # Set up CPU mode.
if [[ ${cpu} -eq 1 ]]; then if [[ ${cpu} -eq 1 ]]; then
torchversion=${TORCH_VERSION}"+cpu" torchversion=${torch_version}"+cpu"
name="dgl-dev-cpu" name="dgl-dev-cpu"
fi fi
...@@ -113,7 +123,7 @@ if [[ -n ${cuda_version} ]]; then ...@@ -113,7 +123,7 @@ if [[ -n ${cuda_version} ]]; then
echo "Confirm the installed CUDA version matches the specified one." echo "Confirm the installed CUDA version matches the specified one."
[[ -n "${always_yes}" ]] || confirm [[ -n "${always_yes}" ]] || confirm
torchversion=${TORCH_VERSION}"+cu"${cuda_version//[-._]/} torchversion=${torch_version}"+cu"${cuda_version//[-._]/}
name="dgl-dev-gpu" name="dgl-dev-gpu"
fi fi
......
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