From 44ea7404b28009035707c28d5cad844fc7018318 Mon Sep 17 00:00:00 2001 From: Paul Meng Date: Sun, 11 Jan 2015 18:40:47 +0800 Subject: [PATCH 01/19] Add the depndency checking in `install-sh` script --- install-sh | 93 ++++++++++++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 86 insertions(+), 7 deletions(-) diff --git a/install-sh b/install-sh index 3f7cac0..3e6ee30 100755 --- a/install-sh +++ b/install-sh @@ -1,20 +1,99 @@ #!/bin/bash + +msg() { + echo "install-sh: $1" +} + +step_msg() { + msg + msg "$1" + msg +} + +warn() { + echo "install-sh: WARNING: $1" +} + +err() { + echo "install-sh: error: $1" + exit 1 +} + +need_cmd() { + if command -v $1 >/dev/null 2>&1 + then msg "found $1" + else err "need $1" + fi +} + + +probe() { + local V=$1 + shift + local P + local T + + for P + do + T=$(command -v $P 2>&1) + if [ $? -eq 0 ] + then + VER0=$($P --version 2>/dev/null | head -1 \ + | sed -e 's/[^0-9]*\([vV]\?[0-9.]\+[^ ]*\).*/\1/' ) + if [ $? -eq 0 -a "x${VER0}" != "x" ] + then + VER="($VER0)" + else + VER="" + fi + break + else + VER="" + T="" + fi + done + + eval $V=\$T +} + +probe_need() { + local V=$1 + probe $* + eval VV=\$$V + + if [ -z "$VV" ] + then + err "needed, but unable to find any of: $*" + fi +} + + +msg "looking for required commands" +need_cmd mkdir +need_cmd printf + +step_msg "looking for needed program" + +probe_need CFG_GIT git +probe_need CFG_WGET wget +probe_need CFG_UNZIP unzip + mkdir -p tools bin/ obj/ -wget http://nchc.dl.sourceforge.net/project/rapidxml/rapidxml/rapidxml%201.13/rapidxml-1.13.zip -P tools/ +$CFG_WGET http://nchc.dl.sourceforge.net/project/rapidxml/rapidxml/rapidxml%201.13/rapidxml-1.13.zip -P tools/ cd tools/ && unzip rapidxml-1.13.zip && cd - if [ "$1" == "--zip-only" ]; then - wget https://codeload.github.com/botonchou/utility/zip/master -O tools/utility.zip - unzip tools/utility.zip -d tools/ && mv tools/utility-master tools/utility + $CFG_WGET https://codeload.github.com/botonchou/utility/zip/master -O tools/utility.zip + $CFG_UNZIP tools/utility.zip -d tools/ && mv tools/utility-master tools/utility - wget https://codeload.github.com/botonchou/libcumatrix/zip/master -O tools/libcumatrix.zip - unzip tools/libcumatrix.zip -d tools/ && mv tools/libcumatrix-master tools/libcumatrix + $CFG_WGET https://codeload.github.com/botonchou/libcumatrix/zip/master -O tools/libcumatrix.zip + $CFG_UNZIP tools/libcumatrix.zip -d tools/ && mv tools/libcumatrix-master tools/libcumatrix else printf "\33[34m[Info]\33[0m You can specify \33[33m--zip-only\33[0m if git clone is too slow\n" - git clone https://github.com/botonchou/utility.git tools/utility - git clone https://github.com/botonchou/libcumatrix.git tools/libcumatrix + $CFG_GIT clone https://github.com/botonchou/utility.git tools/utility + $CFG_GIT clone https://github.com/botonchou/libcumatrix.git tools/libcumatrix fi # Make dependencies first From 837bba29357c054b0a6070320267dc0391c203bb Mon Sep 17 00:00:00 2001 From: Paul Meng Date: Tue, 13 Jan 2015 22:38:21 +0800 Subject: [PATCH 02/19] Replace `make` with config variable --- install-sh | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/install-sh b/install-sh index 3e6ee30..5cba596 100755 --- a/install-sh +++ b/install-sh @@ -77,6 +77,7 @@ step_msg "looking for needed program" probe_need CFG_GIT git probe_need CFG_WGET wget probe_need CFG_UNZIP unzip +probe_need CFG_MAKE make mkdir -p tools bin/ obj/ @@ -97,8 +98,8 @@ else fi # Make dependencies first -cd tools/utility && make o3 && cd - -cd tools/libcumatrix && make o3 && cd - +cd tools/utility && $CFG_MAKE o3 && cd - +cd tools/libcumatrix && $CFG_MAKE o3 && cd - # Make !! -make o3 +$CFG_MAKE o3 From a74896081117e151816d4b07adcb67f8f5a823a3 Mon Sep 17 00:00:00 2001 From: Paul Meng Date: Tue, 13 Jan 2015 22:55:09 +0800 Subject: [PATCH 03/19] Testing the validaty of ctags --- install-sh | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/install-sh b/install-sh index 5cba596..073ab7f 100755 --- a/install-sh +++ b/install-sh @@ -1,5 +1,16 @@ #!/bin/bash +test_cmd() { + "$@" + local status=$? + + if [ $status -ne 0 ] + then err "are you using the gnu version?" + else msg "test $@ OK" + fi +} + + msg() { echo "install-sh: $1" } @@ -78,6 +89,10 @@ probe_need CFG_GIT git probe_need CFG_WGET wget probe_need CFG_UNZIP unzip probe_need CFG_MAKE make +probe_need CFG_CTAGS ctags + +msg "testing ctags is gnu" +test_cmd ctags -R mkdir -p tools bin/ obj/ From a89e0049d5f3048144304c5d3a9d31ca49da49c3 Mon Sep 17 00:00:00 2001 From: Paul Meng Date: Thu, 15 Jan 2015 22:41:47 +0800 Subject: [PATCH 04/19] Use make -C to recursively build --- Makefile | 2 ++ install-sh | 3 --- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index 62d5cf8..139b480 100755 --- a/Makefile +++ b/Makefile @@ -82,4 +82,6 @@ $(OBJDIR)/%.d: %.cpp | $(OBJDIR) ctags: @if command -v ctags >/dev/null 2>&1; then ctags -R --langmap=C:+.cu *; fi clean: + $(MAKE) clean -C tools/libcumatrix/ + $(MAKE) clean -C tools/utility/ rm -rf $(EXECUTABLES) $(OBJDIR)/* diff --git a/install-sh b/install-sh index 073ab7f..06fb0c3 100755 --- a/install-sh +++ b/install-sh @@ -112,9 +112,6 @@ else $CFG_GIT clone https://github.com/botonchou/libcumatrix.git tools/libcumatrix fi -# Make dependencies first -cd tools/utility && $CFG_MAKE o3 && cd - -cd tools/libcumatrix && $CFG_MAKE o3 && cd - # Make !! $CFG_MAKE o3 From 2ac79523c29215635d2a71a4e5dd880f9655d57b Mon Sep 17 00:00:00 2001 From: Paul Meng Date: Thu, 15 Jan 2015 22:42:18 +0800 Subject: [PATCH 05/19] Generate config.mk for configuration variable in Makefile --- Makefile | 16 ++++++++-------- install-sh | 48 ++++++++++++++++++++++++++++++++++++++++-------- 2 files changed, 48 insertions(+), 16 deletions(-) diff --git a/Makefile b/Makefile index 139b480..c8eba16 100755 --- a/Makefile +++ b/Makefile @@ -1,7 +1,7 @@ -CC=gcc -CXX=g++ +include config.mk + +CFG_NVCC+= -arch=sm_21 -w #-Xcompiler "-Wall" CFLAGS= -NVCC=nvcc -arch=sm_21 -w #-Xcompiler "-Wall" BOTON_UTIL_ROOT=tools/utility/ CUMATRIX_ROOT=tools/libcumatrix/ @@ -43,7 +43,7 @@ o3: CFLAGS+=-O3 o3: all debug: CFLAGS+=-g -DDEBUG debug: all -dump_nrv: NVCC+=-Xcompiler "-fdump-tree-nrv" all +dump_nrv: CFG_NVCC+=-Xcompiler "-fdump-tree-nrv" all dump_nrv: all vpath %.h include/ @@ -61,19 +61,19 @@ CUDA_LIBRARY=-lcuda -lcudart -lcublas LIBRARY_PATH=-L$(BOTON_UTIL_ROOT)/lib/ -L$(CUMATRIX_ROOT)/lib -L/usr/local/cuda/lib64 $(EXECUTABLES): bin/% : $(OBJ) $(OBJDIR)/%.o - $(CXX) -o $@ $(CFLAGS) -std=c++0x $(INCLUDE) $^ $(LIBRARY_PATH) $(LIBRARY) $(CUDA_LIBRARY) + $(CFG_CXX) -o $@ $(CFLAGS) -std=c++0x $(INCLUDE) $^ $(LIBRARY_PATH) $(LIBRARY) $(CUDA_LIBRARY) # +==============================+ # +===== Other Phony Target =====+ # +==============================+ $(OBJDIR)/%.o: %.cpp - $(CXX) $(CPPFLAGS) -std=c++0x -o $@ -c $< + $(CFG_CXX) $(CPPFLAGS) -std=c++0x -o $@ -c $< $(OBJDIR)/%.o: %.cu include/%.h - $(NVCC) $(CFLAGS) $(INCLUDE) -o $@ -c $< + $(CFG_NVCC) $(CFLAGS) $(INCLUDE) -o $@ -c $< $(OBJDIR)/%.d: %.cpp | $(OBJDIR) - @$(CXX) -MM $(CPPFLAGS) $< > $@.$$$$; \ + @$(CFG_CXX) -MM $(CPPFLAGS) $< > $@.$$$$; \ sed 's,\($*\)\.o[ :]*,$(OBJDIR)/\1.o $@ : ,g' < $@.$$$$ > $@;\ rm -f $@.$$$$ diff --git a/install-sh b/install-sh index 06fb0c3..a98c241 100755 --- a/install-sh +++ b/install-sh @@ -12,7 +12,7 @@ test_cmd() { msg() { - echo "install-sh: $1" + echo "configure: $1" } step_msg() { @@ -22,11 +22,11 @@ step_msg() { } warn() { - echo "install-sh: WARNING: $1" + echo "configure: WARNING: $1" } err() { - echo "install-sh: error: $1" + echo "configure: error: $1" exit 1 } @@ -65,6 +65,7 @@ probe() { done eval $V=\$T + putvar $V "$VER" } probe_need() { @@ -78,6 +79,30 @@ probe_need() { fi } +putvar() { + local T + eval T=\$$1 + eval TLEN=\${#$1} + if [ $TLEN -gt 35 ] + then + printf "configure: %-20s := %.35s ...\n" $1 "$T" + else + printf "configure: %-20s := %s %s\n" $1 "$T" "$2" + fi + printf "%-20s := %s\n" $1 "$T" >>config.tmp +} + +move_if_changed() { + if cmp -s $1 $2 + then + msg "leaving $2 unchanged" + else + msg "mv $1 $2" + mv -f $1 $2 + chmod u-w $2 # make moved artifact read-only + fi +} + msg "looking for required commands" need_cmd mkdir @@ -85,6 +110,9 @@ need_cmd printf step_msg "looking for needed program" +probe_need CFG_CC gcc +probe_need CFG_CXX g++ +probe_need CFG_NVCC nvcc probe_need CFG_GIT git probe_need CFG_WGET wget probe_need CFG_UNZIP unzip @@ -94,11 +122,10 @@ probe_need CFG_CTAGS ctags msg "testing ctags is gnu" test_cmd ctags -R -mkdir -p tools bin/ obj/ - +mkdir -p tools/ bin/ obj/ $CFG_WGET http://nchc.dl.sourceforge.net/project/rapidxml/rapidxml/rapidxml%201.13/rapidxml-1.13.zip -P tools/ -cd tools/ && unzip rapidxml-1.13.zip && cd - +$CFG_UNZIP -o tools/rapidxml-1.13.zip -d tools if [ "$1" == "--zip-only" ]; then $CFG_WGET https://codeload.github.com/botonchou/utility/zip/master -O tools/utility.zip @@ -113,5 +140,10 @@ else fi -# Make !! -$CFG_MAKE o3 +move_if_changed config.tmp config.mk +rm -f config.tmp + + +msg "libdnn configuration complete" +step_msg "please type 'make' to build the library" + From 5d62217571cedcacb1c9a2ab97b6b8ad9f5b4b11 Mon Sep 17 00:00:00 2001 From: Paul Meng Date: Thu, 15 Jan 2015 22:48:47 +0800 Subject: [PATCH 06/19] Rename install-sh to configure --- install-sh => configure | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename install-sh => configure (100%) diff --git a/install-sh b/configure similarity index 100% rename from install-sh rename to configure From 92d114481d2f492fef3ac4a221f1fd03f633dc92 Mon Sep 17 00:00:00 2001 From: Paul Meng Date: Thu, 15 Jan 2015 23:07:22 +0800 Subject: [PATCH 07/19] Move Makefile to be Makefile.in so that user wouldn't accidentally make before configuring --- Makefile.in | 87 +++++++++++++++++++++++++++++++++++++++++++++++++++++ configure | 12 +++++++- 2 files changed, 98 insertions(+), 1 deletion(-) create mode 100755 Makefile.in diff --git a/Makefile.in b/Makefile.in new file mode 100755 index 0000000..c8eba16 --- /dev/null +++ b/Makefile.in @@ -0,0 +1,87 @@ +include config.mk + +CFG_NVCC+= -arch=sm_21 -w #-Xcompiler "-Wall" +CFLAGS= + +BOTON_UTIL_ROOT=tools/utility/ +CUMATRIX_ROOT=tools/libcumatrix/ + +INCLUDE= -I ./ \ + -I include/ \ + -I $(BOTON_UTIL_ROOT)/include/ \ + -I $(CUMATRIX_ROOT)/include \ + -I /usr/local/cuda/samples/common/inc/ \ + -I /usr/local/cuda/include + +CPPFLAGS= -std=c++0x $(CFLAGS) $(INCLUDE) #-Werror -Wall + +SOURCES=cnn-utility.cu\ + nnet.cpp\ + dnn-utility.cu\ + utility.cpp\ + rbm.cu\ + feature-transform.cu\ + data-io.cpp\ + dataset.cpp\ + batch.cpp\ + config.cpp + +EXECUTABLES=nn-train\ + nn-predict\ + nn-init\ + nn-info\ + nn-print\ + data-statistics + +EXECUTABLES:=$(addprefix bin/, $(EXECUTABLES)) + +.PHONY: debug all o3 dump_nrv ctags clean + +all: $(EXECUTABLES) ctags + +o3: CFLAGS+=-O3 +o3: all +debug: CFLAGS+=-g -DDEBUG +debug: all +dump_nrv: CFG_NVCC+=-Xcompiler "-fdump-tree-nrv" all +dump_nrv: all + +vpath %.h include/ +vpath %.cpp src/ +vpath %.cu src/ + +OBJDIR:=obj/ +OBJ:=$(addprefix $(OBJDIR)/, $(addsuffix .o,$(basename $(SOURCES)))) + +$(OBJDIR): + @mkdir -p $(OBJDIR) + +LIBRARY=-lpbar -lcumatrix +CUDA_LIBRARY=-lcuda -lcudart -lcublas +LIBRARY_PATH=-L$(BOTON_UTIL_ROOT)/lib/ -L$(CUMATRIX_ROOT)/lib -L/usr/local/cuda/lib64 + +$(EXECUTABLES): bin/% : $(OBJ) $(OBJDIR)/%.o + $(CFG_CXX) -o $@ $(CFLAGS) -std=c++0x $(INCLUDE) $^ $(LIBRARY_PATH) $(LIBRARY) $(CUDA_LIBRARY) + +# +==============================+ +# +===== Other Phony Target =====+ +# +==============================+ +$(OBJDIR)/%.o: %.cpp + $(CFG_CXX) $(CPPFLAGS) -std=c++0x -o $@ -c $< + +$(OBJDIR)/%.o: %.cu include/%.h + $(CFG_NVCC) $(CFLAGS) $(INCLUDE) -o $@ -c $< + +$(OBJDIR)/%.d: %.cpp | $(OBJDIR) + @$(CFG_CXX) -MM $(CPPFLAGS) $< > $@.$$$$; \ + sed 's,\($*\)\.o[ :]*,$(OBJDIR)/\1.o $@ : ,g' < $@.$$$$ > $@;\ + rm -f $@.$$$$ + +-include $(addprefix $(OBJDIR)/,$(subst .cpp,.d,$(SOURCES))) + +ctags: + @if command -v ctags >/dev/null 2>&1; then ctags -R --langmap=C:+.cu *; fi +clean: + $(MAKE) clean -C tools/libcumatrix/ + $(MAKE) clean -C tools/utility/ + rm -rf $(EXECUTABLES) $(OBJDIR)/* diff --git a/configure b/configure index a98c241..94b130e 100755 --- a/configure +++ b/configure @@ -103,6 +103,16 @@ move_if_changed() { fi } +copy_if_changed() { + if cmp -s $1 $2 + then + msg "leaving $2 unchanged" + else + msg "cp $1 $2" + cp -f $1 $2 + chmod u-w $2 # make copied artifact read-only + fi +} msg "looking for required commands" need_cmd mkdir @@ -140,10 +150,10 @@ else fi +copy_if_changed Makefile.in ./Makefile move_if_changed config.tmp config.mk rm -f config.tmp msg "libdnn configuration complete" step_msg "please type 'make' to build the library" - From 6e3cc5d66c6def3b750d6e27fa43708c24fa4f92 Mon Sep 17 00:00:00 2001 From: Paul Meng Date: Thu, 15 Jan 2015 23:08:34 +0800 Subject: [PATCH 08/19] Add config.mk to .gitignore --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index 5dd1af0..cb44ceb 100644 --- a/.gitignore +++ b/.gitignore @@ -13,3 +13,4 @@ example/*.xml example/model/*.xml *.dat log +config.mk From e1142d67f318c834c32c9f8f1b46e1d940efb97b Mon Sep 17 00:00:00 2001 From: Paul Meng Date: Thu, 15 Jan 2015 23:09:48 +0800 Subject: [PATCH 09/19] Ignore Makefile --- .gitignore | 1 + Makefile | 87 ------------------------------------------------------ 2 files changed, 1 insertion(+), 87 deletions(-) delete mode 100755 Makefile diff --git a/.gitignore b/.gitignore index cb44ceb..9cb0a08 100644 --- a/.gitignore +++ b/.gitignore @@ -14,3 +14,4 @@ example/model/*.xml *.dat log config.mk +Makefile diff --git a/Makefile b/Makefile deleted file mode 100755 index c8eba16..0000000 --- a/Makefile +++ /dev/null @@ -1,87 +0,0 @@ -include config.mk - -CFG_NVCC+= -arch=sm_21 -w #-Xcompiler "-Wall" -CFLAGS= - -BOTON_UTIL_ROOT=tools/utility/ -CUMATRIX_ROOT=tools/libcumatrix/ - -INCLUDE= -I ./ \ - -I include/ \ - -I $(BOTON_UTIL_ROOT)/include/ \ - -I $(CUMATRIX_ROOT)/include \ - -I /usr/local/cuda/samples/common/inc/ \ - -I /usr/local/cuda/include - -CPPFLAGS= -std=c++0x $(CFLAGS) $(INCLUDE) #-Werror -Wall - -SOURCES=cnn-utility.cu\ - nnet.cpp\ - dnn-utility.cu\ - utility.cpp\ - rbm.cu\ - feature-transform.cu\ - data-io.cpp\ - dataset.cpp\ - batch.cpp\ - config.cpp - -EXECUTABLES=nn-train\ - nn-predict\ - nn-init\ - nn-info\ - nn-print\ - data-statistics - -EXECUTABLES:=$(addprefix bin/, $(EXECUTABLES)) - -.PHONY: debug all o3 dump_nrv ctags clean - -all: $(EXECUTABLES) ctags - -o3: CFLAGS+=-O3 -o3: all -debug: CFLAGS+=-g -DDEBUG -debug: all -dump_nrv: CFG_NVCC+=-Xcompiler "-fdump-tree-nrv" all -dump_nrv: all - -vpath %.h include/ -vpath %.cpp src/ -vpath %.cu src/ - -OBJDIR:=obj/ -OBJ:=$(addprefix $(OBJDIR)/, $(addsuffix .o,$(basename $(SOURCES)))) - -$(OBJDIR): - @mkdir -p $(OBJDIR) - -LIBRARY=-lpbar -lcumatrix -CUDA_LIBRARY=-lcuda -lcudart -lcublas -LIBRARY_PATH=-L$(BOTON_UTIL_ROOT)/lib/ -L$(CUMATRIX_ROOT)/lib -L/usr/local/cuda/lib64 - -$(EXECUTABLES): bin/% : $(OBJ) $(OBJDIR)/%.o - $(CFG_CXX) -o $@ $(CFLAGS) -std=c++0x $(INCLUDE) $^ $(LIBRARY_PATH) $(LIBRARY) $(CUDA_LIBRARY) - -# +==============================+ -# +===== Other Phony Target =====+ -# +==============================+ -$(OBJDIR)/%.o: %.cpp - $(CFG_CXX) $(CPPFLAGS) -std=c++0x -o $@ -c $< - -$(OBJDIR)/%.o: %.cu include/%.h - $(CFG_NVCC) $(CFLAGS) $(INCLUDE) -o $@ -c $< - -$(OBJDIR)/%.d: %.cpp | $(OBJDIR) - @$(CFG_CXX) -MM $(CPPFLAGS) $< > $@.$$$$; \ - sed 's,\($*\)\.o[ :]*,$(OBJDIR)/\1.o $@ : ,g' < $@.$$$$ > $@;\ - rm -f $@.$$$$ - --include $(addprefix $(OBJDIR)/,$(subst .cpp,.d,$(SOURCES))) - -ctags: - @if command -v ctags >/dev/null 2>&1; then ctags -R --langmap=C:+.cu *; fi -clean: - $(MAKE) clean -C tools/libcumatrix/ - $(MAKE) clean -C tools/utility/ - rm -rf $(EXECUTABLES) $(OBJDIR)/* From dfc687a8f76719f00c7e14ebf3065820cac76bef Mon Sep 17 00:00:00 2001 From: Paul Meng Date: Sat, 17 Jan 2015 17:01:02 +0800 Subject: [PATCH 10/19] Use gitsubmodule to manage dependencies and recursively make by passing required information - Note: I am aware of the downside of git submodule: https://codingkilledthecat.wordpress.com/2012/04/28/why-your-company-shouldnt-use-git-submodules/ . However, in this case it is only used for a RDONLY installation replica. Git submodule should be fine and light weight for this use case. --- .gitignore | 2 +- .gitmodules | 6 ++++ Makefile.in | 18 +++++++--- configure | 89 ++++++++++++++++++++++++++++++++++++++++------- tools/libcumatrix | 1 + tools/utility | 1 + 6 files changed, 99 insertions(+), 18 deletions(-) create mode 100644 .gitmodules create mode 160000 tools/libcumatrix create mode 160000 tools/utility diff --git a/.gitignore b/.gitignore index 9cb0a08..87cd122 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,5 @@ obj/* bin/* -tools/* data/*.model others/* latex/* @@ -15,3 +14,4 @@ example/model/*.xml log config.mk Makefile +tools/rapidxml* diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 0000000..87d5e7a --- /dev/null +++ b/.gitmodules @@ -0,0 +1,6 @@ +[submodule "tools/libcumatrix"] + path = tools/libcumatrix + url = https://github.com/MnO2/libcumatrix.git +[submodule "tools/utility"] + path = tools/utility + url = https://github.com/MnO2/utility.git diff --git a/Makefile.in b/Makefile.in index c8eba16..30d1b22 100755 --- a/Makefile.in +++ b/Makefile.in @@ -1,3 +1,5 @@ +BASEPROJ?=$(shell pwd) + include config.mk CFG_NVCC+= -arch=sm_21 -w #-Xcompiler "-Wall" @@ -35,9 +37,14 @@ EXECUTABLES=nn-train\ EXECUTABLES:=$(addprefix bin/, $(EXECUTABLES)) -.PHONY: debug all o3 dump_nrv ctags clean +.PHONY: debug all o3 dump_nrv ctags clean depndencies + +all: dependencies $(EXECUTABLES) ctags + +dependencies: + $(MAKE) -C tools/libcumatrix/ BASEPROJ=$(BASEPROJ) + $(MAKE) -C tools/utility/ BASEPROJ=$(BASEPROJ) -all: $(EXECUTABLES) ctags o3: CFLAGS+=-O3 o3: all @@ -58,7 +65,7 @@ $(OBJDIR): LIBRARY=-lpbar -lcumatrix CUDA_LIBRARY=-lcuda -lcudart -lcublas -LIBRARY_PATH=-L$(BOTON_UTIL_ROOT)/lib/ -L$(CUMATRIX_ROOT)/lib -L/usr/local/cuda/lib64 +LIBRARY_PATH=-L$(BOTON_UTIL_ROOT)/lib/ -L$(CUMATRIX_ROOT)/lib -L$(CFG_CUDA_LIBPATH) $(EXECUTABLES): bin/% : $(OBJ) $(OBJDIR)/%.o $(CFG_CXX) -o $@ $(CFLAGS) -std=c++0x $(INCLUDE) $^ $(LIBRARY_PATH) $(LIBRARY) $(CUDA_LIBRARY) @@ -81,7 +88,8 @@ $(OBJDIR)/%.d: %.cpp | $(OBJDIR) ctags: @if command -v ctags >/dev/null 2>&1; then ctags -R --langmap=C:+.cu *; fi + clean: - $(MAKE) clean -C tools/libcumatrix/ - $(MAKE) clean -C tools/utility/ + $(MAKE) clean -C tools/libcumatrix/ BASEPROJ=$(BASEPROJ) + $(MAKE) clean -C tools/utility/ BASEPROJ=$(BASEPROJ) rm -rf $(EXECUTABLES) $(OBJDIR)/* diff --git a/configure b/configure index 94b130e..7403e5b 100755 --- a/configure +++ b/configure @@ -114,14 +114,42 @@ copy_if_changed() { fi } + +CFG_OSTYPE=$(uname -s) +CFG_CPUTYPE=$(uname -m) + + +case $CFG_OSTYPE in + Linux) + CFG_OSTYPE=unknown-linux-gnu + ;; + Darwin) + CFG_OSTYPE=apple-darwin + ;; + MSYS*) + CFG_OSTYPE=pc-windows-gnu + ;; + *) + err "unknown OS type: $CFG_OSTYPE" + ;; +esac + + +if [ $CFG_OSTYPE = apple-darwin -a $CFG_CPUTYPE = i386 ] +then + if sysctl hw.optional.x86_64 | grep -q ': 1' + then + CFG_CPUTYPE=x86_64 + fi +fi + + msg "looking for required commands" need_cmd mkdir need_cmd printf step_msg "looking for needed program" -probe_need CFG_CC gcc -probe_need CFG_CXX g++ probe_need CFG_NVCC nvcc probe_need CFG_GIT git probe_need CFG_WGET wget @@ -129,6 +157,41 @@ probe_need CFG_UNZIP unzip probe_need CFG_MAKE make probe_need CFG_CTAGS ctags + +if [ $CFG_OSTYPE = apple-darwin ] +then + CFG_OSX_GCC_VERSION=$(g++ --version 2>&1 | grep "Apple LLVM version") + + if [ $? -eq 0 ] + then + step_msg "on OS X 10.9, g++ is an alias of clang. Which is not good since CUDA is only compatible with g++, trying to probe other path instead" + + #probe for homebrew installed g++-4.9 + probe_need CFG_CC gcc-4.9 + probe_need CFG_CXX g++-4.9 + + else + if [ $(g++ --version 2>&1 | grep -c ' 4\.[0-6]') -ne 0 ]; then + err "older g++ found, please install a newer version of gcc" + fi + + probe_need CFG_CC gcc + probe_need CFG_CXX g++ + fi + + CFG_CUDA_LIBPATH=/usr/local/cuda/lib + putvar CFG_CUDA_LIBPATH + +elif [ $CFG_OSTYPE = unknown-linux-gnu ] +then + probe_need CFG_CC gcc + probe_need CFG_CXX g++ + + CFG_CUDA_LIBPATH=/usr/local/cuda/lib64 + putvar CFG_CUDA_LIBPATH +fi + + msg "testing ctags is gnu" test_cmd ctags -R @@ -137,17 +200,19 @@ mkdir -p tools/ bin/ obj/ $CFG_WGET http://nchc.dl.sourceforge.net/project/rapidxml/rapidxml/rapidxml%201.13/rapidxml-1.13.zip -P tools/ $CFG_UNZIP -o tools/rapidxml-1.13.zip -d tools -if [ "$1" == "--zip-only" ]; then - $CFG_WGET https://codeload.github.com/botonchou/utility/zip/master -O tools/utility.zip - $CFG_UNZIP tools/utility.zip -d tools/ && mv tools/utility-master tools/utility +#$CFG_GIT submodule update --init --recursive - $CFG_WGET https://codeload.github.com/botonchou/libcumatrix/zip/master -O tools/libcumatrix.zip - $CFG_UNZIP tools/libcumatrix.zip -d tools/ && mv tools/libcumatrix-master tools/libcumatrix -else - printf "\33[34m[Info]\33[0m You can specify \33[33m--zip-only\33[0m if git clone is too slow\n" - $CFG_GIT clone https://github.com/botonchou/utility.git tools/utility - $CFG_GIT clone https://github.com/botonchou/libcumatrix.git tools/libcumatrix -fi +#if [ "$1" == "--zip-only" ]; then + #$CFG_WGET https://codeload.github.com/botonchou/utility/zip/master -O tools/utility.zip + #$CFG_UNZIP tools/utility.zip -d tools/ && mv tools/utility-master tools/utility + + #$CFG_WGET https://codeload.github.com/botonchou/libcumatrix/zip/master -O tools/libcumatrix.zip + #$CFG_UNZIP tools/libcumatrix.zip -d tools/ && mv tools/libcumatrix-master tools/libcumatrix +#else + #printf "\33[34m[Info]\33[0m You can specify \33[33m--zip-only\33[0m if git clone is too slow\n" + #$CFG_GIT clone https://github.com/botonchou/utility.git tools/utility + #$CFG_GIT clone https://github.com/botonchou/libcumatrix.git tools/libcumatrix +#fi copy_if_changed Makefile.in ./Makefile diff --git a/tools/libcumatrix b/tools/libcumatrix new file mode 160000 index 0000000..3214a58 --- /dev/null +++ b/tools/libcumatrix @@ -0,0 +1 @@ +Subproject commit 3214a58fe87f75c0b5ece1acca2b149a4d60a4ee diff --git a/tools/utility b/tools/utility new file mode 160000 index 0000000..18f9496 --- /dev/null +++ b/tools/utility @@ -0,0 +1 @@ +Subproject commit 18f9496d502d8034fb3ce9f975b413da8e931a33 From 991d353d34dc75d15203b566a5b57cf29d68827a Mon Sep 17 00:00:00 2001 From: Paul Meng Date: Sat, 17 Jan 2015 17:18:18 +0800 Subject: [PATCH 11/19] Adding back git submodule update --- configure | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configure b/configure index 7403e5b..9c2517e 100755 --- a/configure +++ b/configure @@ -200,7 +200,7 @@ mkdir -p tools/ bin/ obj/ $CFG_WGET http://nchc.dl.sourceforge.net/project/rapidxml/rapidxml/rapidxml%201.13/rapidxml-1.13.zip -P tools/ $CFG_UNZIP -o tools/rapidxml-1.13.zip -d tools -#$CFG_GIT submodule update --init --recursive +$CFG_GIT submodule update --init --recursive #if [ "$1" == "--zip-only" ]; then #$CFG_WGET https://codeload.github.com/botonchou/utility/zip/master -O tools/utility.zip From aba7f92a83725b54e1832fe0e10eecfea8fa9fd7 Mon Sep 17 00:00:00 2001 From: Paul Meng Date: Sat, 17 Jan 2015 20:20:42 +0800 Subject: [PATCH 12/19] Add scripts for travis-ci --- .travis.yml | 30 +++++++++++++++++++++++ scripts/travis/travis_build_and_test.sh | 9 +++++++ scripts/travis/travis_install.sh | 32 +++++++++++++++++++++++++ 3 files changed, 71 insertions(+) create mode 100644 .travis.yml create mode 100644 scripts/travis/travis_build_and_test.sh create mode 100644 scripts/travis/travis_install.sh diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000..b15220e --- /dev/null +++ b/.travis.yml @@ -0,0 +1,30 @@ +# Use a build matrix to do two builds in parallel: +# one using CMake, and one using make. +language: cpp + +# Cache Ubuntu apt packages. +cache: apt + +compiler: gcc + +before_install: + - export NUM_THREADS=4 + - export SCRIPTS=./scripts/travis + +install: + - sudo -E $SCRIPTS/travis_install.sh + +before_script: + - export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib + +script: $SCRIPTS/travis_build_and_test.sh + +notifications: +# Emails are sent to the committer's git-configured email address by default, +# but only if they have access to the repository. To enable Travis on your +# public fork of Caffe, just go to travis-ci.org and flip the switch on for +# your Caffe fork. To configure your git email address, use: +# git config --global user.email me@example.com + email: + on_success: always + on_failure: always diff --git a/scripts/travis/travis_build_and_test.sh b/scripts/travis/travis_build_and_test.sh new file mode 100644 index 0000000..4b9fca2 --- /dev/null +++ b/scripts/travis/travis_build_and_test.sh @@ -0,0 +1,9 @@ +#!/bin/bash +# Script called by Travis to do a CPU-only build of and test Caffe. + +set -e +MAKE="make --jobs=$NUM_THREADS --keep-going" + +./configure +$MAKE all +$MAKE test diff --git a/scripts/travis/travis_install.sh b/scripts/travis/travis_install.sh new file mode 100644 index 0000000..2ff6414 --- /dev/null +++ b/scripts/travis/travis_install.sh @@ -0,0 +1,32 @@ +#!/bin/bash +# This script must be run with sudo. + +set -e + +MAKE="make --jobs=$NUM_THREADS" + +# Install apt packages where the Ubuntu 12.04 default and ppa works for Caffe + +# This ppa is for gflags and glog +add-apt-repository -y ppa:tuleu/precise-backports +apt-get -y update +apt-get install \ + wget git curl unzip ctags \ + python-dev \ + libboost-dev libboost-system-dev libboost-python-dev libboost-thread-dev \ + libatlas-dev libatlas-base-dev + + +CUDA_URL=http://developer.download.nvidia.com/compute/cuda/repos/ubuntu1204/x86_64/cuda-repo-ubuntu1204_6.5-14_amd64.deb +CUDA_FILE=/tmp/cuda_install.deb +curl $CUDA_URL -o $CUDA_FILE +dpkg -i $CUDA_FILE +rm -f $CUDA_FILE +apt-get -y update +# Install the minimal CUDA subpackages required to test Caffe build. +# For a full CUDA installation, add 'cuda' to the list of packages. +apt-get -y install cuda-core-6-5 cuda-cublas-6-5 cuda-cublas-dev-6-5 cuda-cudart-6-5 cuda-cudart-dev-6-5 cuda-curand-6-5 cuda-curand-dev-6-5 +# Create CUDA symlink at /usr/local/cuda +# (This would normally be created by the CUDA installer, but we create it +# manually since we did a partial installation.) +ln -s /usr/local/cuda-6.5 /usr/local/cuda From 9fdb8c17a5dd7edaf3743e221527073cce63d424 Mon Sep 17 00:00:00 2001 From: Paul Meng Date: Sat, 17 Jan 2015 20:50:32 +0800 Subject: [PATCH 13/19] Change the scripts to be executable --- scripts/travis/travis_build_and_test.sh | 0 scripts/travis/travis_install.sh | 2 -- 2 files changed, 2 deletions(-) mode change 100644 => 100755 scripts/travis/travis_build_and_test.sh mode change 100644 => 100755 scripts/travis/travis_install.sh diff --git a/scripts/travis/travis_build_and_test.sh b/scripts/travis/travis_build_and_test.sh old mode 100644 new mode 100755 diff --git a/scripts/travis/travis_install.sh b/scripts/travis/travis_install.sh old mode 100644 new mode 100755 index 2ff6414..b9a7d0f --- a/scripts/travis/travis_install.sh +++ b/scripts/travis/travis_install.sh @@ -1,6 +1,4 @@ #!/bin/bash -# This script must be run with sudo. - set -e MAKE="make --jobs=$NUM_THREADS" From 5c9ba59c5e84a2f77c464e714e60bef10071e03a Mon Sep 17 00:00:00 2001 From: Paul Meng Date: Sat, 17 Jan 2015 21:02:22 +0800 Subject: [PATCH 14/19] Add /usr/local/cuda/bin to $PATH and add a dummy make test stub --- .travis.yml | 1 + Makefile.in | 7 ++++++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index b15220e..d7ca73a 100644 --- a/.travis.yml +++ b/.travis.yml @@ -16,6 +16,7 @@ install: before_script: - export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib + - export PATH=$PATH:/usr/local/cuda/bin script: $SCRIPTS/travis_build_and_test.sh diff --git a/Makefile.in b/Makefile.in index 30d1b22..7988f2c 100755 --- a/Makefile.in +++ b/Makefile.in @@ -37,7 +37,7 @@ EXECUTABLES=nn-train\ EXECUTABLES:=$(addprefix bin/, $(EXECUTABLES)) -.PHONY: debug all o3 dump_nrv ctags clean depndencies +.PHONY: debug all o3 dump_nrv ctags clean depndencies test all: dependencies $(EXECUTABLES) ctags @@ -93,3 +93,8 @@ clean: $(MAKE) clean -C tools/libcumatrix/ BASEPROJ=$(BASEPROJ) $(MAKE) clean -C tools/utility/ BASEPROJ=$(BASEPROJ) rm -rf $(EXECUTABLES) $(OBJDIR)/* + + +# Dummy make test for travis-ci +test: + $(shell pwd) From 390e138672d084ca7618c8899b388ca1398efce3 Mon Sep 17 00:00:00 2001 From: Paul Meng Date: Sat, 17 Jan 2015 21:20:24 +0800 Subject: [PATCH 15/19] Add cuda package into dependency list and add /usr/local/cuda/lib64 into LD_LIBRARY_PATH --- .travis.yml | 2 +- Makefile.in | 2 +- scripts/travis/travis_install.sh | 18 ++++-------------- 3 files changed, 6 insertions(+), 16 deletions(-) diff --git a/.travis.yml b/.travis.yml index d7ca73a..9388556 100644 --- a/.travis.yml +++ b/.travis.yml @@ -15,7 +15,7 @@ install: - sudo -E $SCRIPTS/travis_install.sh before_script: - - export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib + - export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib:/usr/local/cuda/lib64 - export PATH=$PATH:/usr/local/cuda/bin script: $SCRIPTS/travis_build_and_test.sh diff --git a/Makefile.in b/Makefile.in index 7988f2c..b4d54d0 100755 --- a/Makefile.in +++ b/Makefile.in @@ -97,4 +97,4 @@ clean: # Dummy make test for travis-ci test: - $(shell pwd) + $(shell exit 0) diff --git a/scripts/travis/travis_install.sh b/scripts/travis/travis_install.sh index b9a7d0f..58a3f78 100755 --- a/scripts/travis/travis_install.sh +++ b/scripts/travis/travis_install.sh @@ -3,16 +3,9 @@ set -e MAKE="make --jobs=$NUM_THREADS" -# Install apt packages where the Ubuntu 12.04 default and ppa works for Caffe - -# This ppa is for gflags and glog -add-apt-repository -y ppa:tuleu/precise-backports apt-get -y update apt-get install \ - wget git curl unzip ctags \ - python-dev \ - libboost-dev libboost-system-dev libboost-python-dev libboost-thread-dev \ - libatlas-dev libatlas-base-dev + wget git curl unzip ctags CUDA_URL=http://developer.download.nvidia.com/compute/cuda/repos/ubuntu1204/x86_64/cuda-repo-ubuntu1204_6.5-14_amd64.deb @@ -20,11 +13,8 @@ CUDA_FILE=/tmp/cuda_install.deb curl $CUDA_URL -o $CUDA_FILE dpkg -i $CUDA_FILE rm -f $CUDA_FILE + apt-get -y update -# Install the minimal CUDA subpackages required to test Caffe build. -# For a full CUDA installation, add 'cuda' to the list of packages. -apt-get -y install cuda-core-6-5 cuda-cublas-6-5 cuda-cublas-dev-6-5 cuda-cudart-6-5 cuda-cudart-dev-6-5 cuda-curand-6-5 cuda-curand-dev-6-5 -# Create CUDA symlink at /usr/local/cuda -# (This would normally be created by the CUDA installer, but we create it -# manually since we did a partial installation.) +apt-get -y install cuda-core-6-5 cuda-cublas-6-5 cuda-cublas-dev-6-5 cuda-cudart-6-5 cuda-cudart-dev-6-5 cuda-curand-6-5 cuda-curand-dev-6-5 cuda + ln -s /usr/local/cuda-6.5 /usr/local/cuda From 7826801e754c58ea10f0778843376a78c823215f Mon Sep 17 00:00:00 2001 From: Paul Meng Date: Sat, 17 Jan 2015 21:50:27 +0800 Subject: [PATCH 16/19] Remove the extra slash in obj/ --- Makefile.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile.in b/Makefile.in index b4d54d0..8439f74 100755 --- a/Makefile.in +++ b/Makefile.in @@ -57,7 +57,7 @@ vpath %.h include/ vpath %.cpp src/ vpath %.cu src/ -OBJDIR:=obj/ +OBJDIR:=obj OBJ:=$(addprefix $(OBJDIR)/, $(addsuffix .o,$(basename $(SOURCES)))) $(OBJDIR): From 57bd299a1ca6c2e4a87902f458d32a8c3c44358f Mon Sep 17 00:00:00 2001 From: Paul Meng Date: Sat, 17 Jan 2015 21:54:40 +0800 Subject: [PATCH 17/19] Add travis-ci build status badge in the README --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index 577b229..8a65f8e 100644 --- a/README.md +++ b/README.md @@ -2,6 +2,8 @@ libdnn 中文說明 ====== (See English version below) +[![Build Status](https://travis-ci.org/MnO2/libdnn.svg?branch=master)](https://travis-ci.org/MnO2/libdnn) + [libdnn](https://github.com/botonchou/libdnn) 是一個輕量、好讀、人性化的**深層學習**函式庫。由 C++ 和 CUDA 撰寫而成,目的是讓開發人員、研究人員、或任何有興趣的人都可以輕鬆體驗並駕馭深層學習所帶來的威力。 詳細的教學和使用說明,請參考[Wiki](https://github.com/botonchou/libdnn/wiki) From 852c0cbd85de9923f0660732c4f484fdb1c1469d Mon Sep 17 00:00:00 2001 From: Paul Meng Date: Sun, 18 Jan 2015 10:17:21 +0800 Subject: [PATCH 18/19] Adding --enable-ccache param to use ccache to speed up rebuild --- configure | 183 ++++++++++++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 172 insertions(+), 11 deletions(-) diff --git a/configure b/configure index 9c2517e..754485d 100755 --- a/configure +++ b/configure @@ -12,7 +12,7 @@ test_cmd() { msg() { - echo "configure: $1" + echo "$CFG_SELF: $1" } step_msg() { @@ -22,11 +22,11 @@ step_msg() { } warn() { - echo "configure: WARNING: $1" + echo "$CFG_SELF: WARNING: $1" } err() { - echo "configure: error: $1" + echo "$CFG_SELF: error: $1" exit 1 } @@ -85,9 +85,9 @@ putvar() { eval TLEN=\${#$1} if [ $TLEN -gt 35 ] then - printf "configure: %-20s := %.35s ...\n" $1 "$T" + printf "$CFG_SELF: %-20s := %.35s ...\n" $1 "$T" else - printf "configure: %-20s := %s %s\n" $1 "$T" "$2" + printf "$CFG_SELF: %-20s := %s %s\n" $1 "$T" "$2" fi printf "%-20s := %s\n" $1 "$T" >>config.tmp } @@ -115,6 +115,97 @@ copy_if_changed() { } +validate_opt () { + for arg in $CFG_CONFIGURE_ARGS + do + isArgValid=0 + for option in $BOOL_OPTIONS + do + if test --disable-$option = $arg + then + isArgValid=1 + fi + if test --enable-$option = $arg + then + isArgValid=1 + fi + done + for option in $VAL_OPTIONS + do + if echo "$arg" | grep -q -- "--$option=" + then + isArgValid=1 + fi + done + if [ "$arg" = "--help" ] + then + echo + echo "No more help available for Configure options," + echo "check the Wiki or join our IRC channel" + break + else + if test $isArgValid -eq 0 + then + err "Option '$arg' is not recognized" + fi + fi + done +} + + +opt_core() { + BOOL_OPTIONS="$BOOL_OPTIONS $2" + + local SAVE=$1 + local OP=$2 + local DEFAULT=$3 + shift + shift + shift + local DOC="$*" + local FLAG="" + + if [ $DEFAULT -eq 0 ] + then + FLAG="enable" + else + FLAG="disable" + DOC="don't $DOC" + fi + + if [ $HELP -eq 0 ] + then + for arg in $CFG_CONFIGURE_ARGS + do + if [ "$arg" = "--${FLAG}-${OP}" ] + then + OP=$(echo $OP | tr 'a-z-' 'A-Z_') + FLAG=$(echo $FLAG | tr 'a-z' 'A-Z') + local V="CFG_${FLAG}_${OP}" + eval $V=1 + if [ "$SAVE" = "save" ] + then + putvar $V + fi + fi + done + else + if [ ! -z "$META" ] + then + OP="$OP=<$META>" + fi + printf " --%-30s %s\n" "$FLAG-$OP" "$DOC" + fi +} + +opt_nosave() { + opt_core nosave "$@" +} + +opt() { + opt_core save "$@" +} + CFG_OSTYPE=$(uname -s) CFG_CPUTYPE=$(uname -m) @@ -144,6 +235,50 @@ then fi + +DEFAULT_BUILD="${CFG_CPUTYPE}-${CFG_OSTYPE}" + +CFG_SRC_DIR="$(cd $(dirname $0) && pwd)/" +CFG_BUILD_DIR="$(pwd)/" +CFG_SELF="$0" +CFG_CONFIGURE_ARGS="$@" + +OPTIONS="" +HELP=0 +if [ "$1" = "--help" ] +then + HELP=1 + shift + echo + echo "Usage: $CFG_SELF [options]" + echo + echo "Options:" + echo +else + msg "recreating config.tmp" + echo '' >config.tmp + + step_msg "processing $CFG_SELF args" +fi + +BOOL_OPTIONS="" +VAL_OPTIONS="" + +opt ccache 0 "invoke gcc/clang via ccache to reuse object files between builds" + + +if [ $HELP -eq 1 ] +then + echo + exit 0 +fi + +# Validate Options +step_msg "validating $CFG_SELF args" +validate_opt + + + msg "looking for required commands" need_cmd mkdir need_cmd printf @@ -157,6 +292,8 @@ probe_need CFG_UNZIP unzip probe_need CFG_MAKE make probe_need CFG_CTAGS ctags +probe CFG_CCACHE ccache + if [ $CFG_OSTYPE = apple-darwin ] then @@ -167,16 +304,16 @@ then step_msg "on OS X 10.9, g++ is an alias of clang. Which is not good since CUDA is only compatible with g++, trying to probe other path instead" #probe for homebrew installed g++-4.9 - probe_need CFG_CC gcc-4.9 - probe_need CFG_CXX g++-4.9 + probe_need CFG_GCC gcc-4.9 + probe_need CFG_GCXX g++-4.9 else if [ $(g++ --version 2>&1 | grep -c ' 4\.[0-6]') -ne 0 ]; then err "older g++ found, please install a newer version of gcc" fi - probe_need CFG_CC gcc - probe_need CFG_CXX g++ + probe_need CFG_GCC gcc + probe_need CFG_GCXX g++ fi CFG_CUDA_LIBPATH=/usr/local/cuda/lib @@ -184,8 +321,8 @@ then elif [ $CFG_OSTYPE = unknown-linux-gnu ] then - probe_need CFG_CC gcc - probe_need CFG_CXX g++ + probe_need CFG_GCC gcc + probe_need CFG_GCXX g++ CFG_CUDA_LIBPATH=/usr/local/cuda/lib64 putvar CFG_CUDA_LIBPATH @@ -195,6 +332,30 @@ fi msg "testing ctags is gnu" test_cmd ctags -R + +if [ ! -z "$CFG_ENABLE_CCACHE" ] +then + if [ -z "$CFG_CC" ] + then + if [ -z "$CFG_CCACHE" ] + then + err "ccache requested but not found" + fi + + CFG_CC="ccache $CFG_GCC" + CFG_CXX="ccache $CFG_GCXX" + else + CFG_CC=$CFG_GCC + CFG_CXX=$CFG_GCXX + fi +else + CFG_CC=$CFG_GCC + CFG_CXX=$CFG_GCXX +fi + +putvar CFG_CC +putvar CFG_CXX + mkdir -p tools/ bin/ obj/ $CFG_WGET http://nchc.dl.sourceforge.net/project/rapidxml/rapidxml/rapidxml%201.13/rapidxml-1.13.zip -P tools/ From f9211c4a3751ae975045c97dcdf0ad54b23e6fa3 Mon Sep 17 00:00:00 2001 From: Paul Meng Date: Sun, 18 Jan 2015 10:27:10 +0800 Subject: [PATCH 19/19] Remove extra slashes after libcumatrix/ and utility/ --- Makefile.in | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Makefile.in b/Makefile.in index 8439f74..d2f379d 100755 --- a/Makefile.in +++ b/Makefile.in @@ -5,8 +5,8 @@ include config.mk CFG_NVCC+= -arch=sm_21 -w #-Xcompiler "-Wall" CFLAGS= -BOTON_UTIL_ROOT=tools/utility/ -CUMATRIX_ROOT=tools/libcumatrix/ +BOTON_UTIL_ROOT=tools/utility +CUMATRIX_ROOT=tools/libcumatrix INCLUDE= -I ./ \ -I include/ \