Skip to content

Commit

Permalink
GPU and CPU runs can now work simultaneously out of the box. Also imp…
Browse files Browse the repository at this point in the history
…roved output format.
  • Loading branch information
iankoulski committed Apr 23, 2019
1 parent 702a250 commit 3cfd564
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 3 deletions.
9 changes: 6 additions & 3 deletions .env
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,10 @@
source .fun

if [ -z "${PROCESSOR_TYPE}" ]; then
export PROCESSOR_TYPE=CPU
export PROCESSOR_TYPE=cpu
else
# Always use lowercase
export PROCESSOR_TYPE=${PROCESSOR_TYPE,,}
fi

# Proxy settings [optional] - set if your network requires a proxy to connect to the Internet
Expand All @@ -28,7 +31,7 @@ export VERSION=latest
export TAG=$(if [ -z "${VERSION}" ]; then echo "${PROCESSOR_TYPE}"; else echo ":${VERSION}${PROCESSOR_TYPE}"; fi)
## BUILD_OPTS: [optional] - arguments for the docker image build command
export BUILD_OPTS="--build-arg http_proxy=${http_proxy} --build-arg https_proxy=${https_proxy} --build-arg no_proxy=${no_proxy}"
if [ "${PROCESSOR_TYPE}" == "GPU" ]; then
if [ "${PROCESSOR_TYPE^^}" == "GPU" ]; then
export BUILD_OPTS="${BUILD_OPTS} -f Dockerfile-GPU"
fi
# Docker container runtime settings
Expand All @@ -43,7 +46,7 @@ export VOL_MAP="-v $(pwd):/wd"
export NETWORK=
## RUN_OPTS [optional] - additional options to specify with the run comman. Example -e POSTGRES_DB=dbname
export RUN_OPTS="-e http_proxy=$http_proxy -e https_proxy=$https_proxy -e no_proxy=$no_proxy"
if [ "${PROCESSOR_TYPE}" == "GPU" ]; then
if [ "${PROCESSOR_TYPE^^}" == "GPU" ]; then
export RUN_OPTS="${RUN_OPTS} --runtime=nvidia -e LC_ALL=C.UTF-8 -e LANG=C.UTF-8"
fi

15 changes: 15 additions & 0 deletions recognize.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,21 @@ if [ "${1}" == "--help" ]; then
exit 0
fi

echo ""
echo "==========================================="
echo "Processor: ${PROCESSOR_TYPE}"
echo "Face recognition start time:"
date
STARTTIME=$(date +%s)
echo ""

./run.sh face_recognition /wd/data/known_people /wd/data/images/$1 --show-distance True --tolerance 0.586 --cpus -1 | grep -v None

echo ""
echo "Face recognition end time: "
date
ENDTIME=$(date +%s)
echo "Total elapsed: $(($ENDTIME - $STARTTIME)) seconds"
echo "==========================================="
echo ""

1 change: 1 addition & 0 deletions run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,6 @@ else
MODE="-it --rm"
fi

echo "docker container run ${RUN_OPTS} ${CONTAINER_NAME} ${MODE} ${NETWORK} ${PORT_MAP} ${VOL_MAP} ${REGISTRY}${IMAGE}${TAG} $@"
docker container run ${RUN_OPTS} ${CONTAINER_NAME} ${MODE} ${NETWORK} ${PORT_MAP} ${VOL_MAP} ${REGISTRY}${IMAGE}${TAG} $@

0 comments on commit 3cfd564

Please sign in to comment.