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:
bash $0 -c
bash $0 -g 11.7
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.
......@@ -25,6 +26,8 @@ OPTIONS:
-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 '1.13.0'.
EOF
}
......@@ -48,7 +51,7 @@ confirm() {
}
# Parse flags.
while getopts "cdfg:ho:p:s" flag; do
while getopts "cdfg:ho:p:st:" flag; do
case "${flag}" in
c)
cpu=1
......@@ -75,6 +78,9 @@ while getopts "cdfg:ho:p:s" flag; do
s)
always_yes=1
;;
t)
torch_version=${OPTARG}
;;
:)
echo "Error: -${OPTARG} requires an argument."
exit 1
......@@ -96,9 +102,13 @@ if [[ -z ${cuda_version} && -z ${cpu} ]]; then
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"
torchversion=${torch_version}"+cpu"
name="dgl-dev-cpu"
fi
......@@ -113,7 +123,7 @@ if [[ -n ${cuda_version} ]]; then
echo "Confirm the installed CUDA version matches the specified one."
[[ -n "${always_yes}" ]] || confirm
torchversion=${TORCH_VERSION}"+cu"${cuda_version//[-._]/}
torchversion=${torch_version}"+cu"${cuda_version//[-._]/}
name="dgl-dev-gpu"
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