Skip to content

Commit

Permalink
Made 1bit support an optionally configurable build option for CNTK wh…
Browse files Browse the repository at this point in the history
…ich is off by default
  • Loading branch information
amitaga committed Jan 13, 2016
1 parent 07de5fa commit 9cf113d
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 0 deletions.
10 changes: 10 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -452,6 +452,16 @@ $(IMAGEREADER): $(IMAGEREADER_OBJ) | $(CNTKMATH_LIB)
$(CXX) $(LDFLAGS) -shared $(patsubst %,-L%, $(LIBDIR) $(LIBPATH)) $(patsubst %,$(RPATH)%, $(ORIGINDIR) $(LIBPATH)) -o $@ $^ -l$(CNTKMATH) -lopencv_core -lopencv_imgproc -lopencv_imgcodecs
endif
########################################
# 1bit SGD setup
########################################
ifeq ("$(CNTK_ENABLE_1BitSGD)","true")
INCLUDEPATH += $(SOURCEDIR)/1BitSGD
CPPFLAGS += -DQUANTIZED_GRADIENT_AGGREGATION
endif
########################################
# cntk
########################################
Expand Down
18 changes: 18 additions & 0 deletions configure
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,9 @@ opencv_path=
opencv_check=include/opencv2/opencv.hpp
mathlib=

default_use_1bitsgd=no
enable_1bitsgd=$default_use_1bitsgd

# List from best to worst choice
default_path_list="/usr /usr/local /opt /opt/local"

Expand Down Expand Up @@ -168,6 +171,7 @@ function show_help ()
echo " -h|--help this help"
echo " --with-build-top=directory build directory $(show_default $build_top)"
echo " --add directory add directory to library search path"
echo " --1bitsgd[=(yes|no)] use 1Bit SGD $(show_default $(default_use_1bitsgd))"
echo " --cuda[=(yes|no)] use cuda GPU $(show_default $(default_use_cuda))"
echo " --with-cuda[=directory] $(show_default $(find_cuda))"
echo " --with-cub[=directory] $(show_default $(find_cub))"
Expand Down Expand Up @@ -213,6 +217,17 @@ do
fi
default_path_list="$optarg $default_path_list"
;;
--1bitsgd*)
if test x$optarg = xyes || test x$optarg = xno
then
enable_1bitsgd=$optarg
else
echo "Invalid value for --1bitsgd $optarg"
show_help
exit
fi
;;

--cuda*)
if test x$optarg = xyes || test x$optarg = xno
then
Expand Down Expand Up @@ -528,6 +543,9 @@ fi
if test x$opencv_path != x ; then
echo OPENCV_PATH=$opencv_path >> $config
fi
if test $enable_1bitsgd = yes ; then
echo CNTK_ENABLE_1BitSGD=true >> $config
fi

# If we are not in the configure directory, generate a trampoline Makefile
makefile=$build_top/Makefile
Expand Down

0 comments on commit 9cf113d

Please sign in to comment.