-
Notifications
You must be signed in to change notification settings - Fork 9.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update distributed example tests in
run_python_examples.sh
(#1250)
* Fix distributed test * fix parallel scripts * install dill * remove dill * run 2 gpu * remove gpucount, use default * Add examples to distributed examples * refactor distributed test * fx ERRORS overwriting * run with base dir * remove distributed from run_python_examples.sh * move basedir to source * separate init --------- Co-authored-by: Sirut Buasai <[email protected]>
- Loading branch information
1 parent
911816c
commit c49554c
Showing
3 changed files
with
52 additions
and
77 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
#!/usr/bin/env bash | ||
# This script contains utility functions and initialize exmaple scripts. | ||
# Eg: run_python_examples.sh, run_distributed_examples.sh | ||
|
||
BASE_DIR="$(pwd)/$(dirname $0)" | ||
EXAMPLES=$(echo $1 | sed -e 's/ //g') | ||
|
||
# Redirect 'python' calls to 'python3' | ||
python() { | ||
command python3 "$@" | ||
} | ||
|
||
ERRORS=${ERRORS-""} | ||
|
||
function error() { | ||
ERR=$1 | ||
if [ "" == "$ERRORS" ]; then | ||
ERRORS="$ERR" | ||
else | ||
ERRORS="$ERRORS\n$ERR" | ||
fi | ||
} | ||
|
||
function install_deps() { | ||
echo "installing requirements" | ||
cat $BASE_DIR/*/requirements.txt | \ | ||
sort -u | \ | ||
# testing the installed version of torch, so don't pip install it. | ||
grep -vE '^torch$' | \ | ||
pip install -r /dev/stdin || \ | ||
{ error "failed to install dependencies"; exit 1; } | ||
} | ||
|
||
function start() { | ||
EXAMPLE=${FUNCNAME[1]} | ||
cd $BASE_DIR/$EXAMPLE | ||
echo "Running example: $EXAMPLE" | ||
} |