Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
obj/*
bin/*
tools/*
data/*.model
others/*
latex/*
Expand All @@ -13,3 +12,6 @@ example/*.xml
example/model/*.xml
*.dat
log
config.mk
Makefile
tools/rapidxml*
6 changes: 6 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -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
31 changes: 31 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# 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:/usr/local/cuda/lib64
- export PATH=$PATH:/usr/local/cuda/bin

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
43 changes: 29 additions & 14 deletions Makefile → Makefile.in
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
CC=gcc
CXX=g++
BASEPROJ?=$(shell pwd)

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/
BOTON_UTIL_ROOT=tools/utility
CUMATRIX_ROOT=tools/libcumatrix

INCLUDE= -I ./ \
-I include/ \
Expand Down Expand Up @@ -35,51 +37,64 @@ EXECUTABLES=nn-train\

EXECUTABLES:=$(addprefix bin/, $(EXECUTABLES))

.PHONY: debug all o3 dump_nrv ctags clean
.PHONY: debug all o3 dump_nrv ctags clean depndencies test

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
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/
vpath %.cpp src/
vpath %.cu src/

OBJDIR:=obj/
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
LIBRARY_PATH=-L$(BOTON_UTIL_ROOT)/lib/ -L$(CUMATRIX_ROOT)/lib -L$(CFG_CUDA_LIBPATH)

$(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 $@.$$$$

-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/ BASEPROJ=$(BASEPROJ)
$(MAKE) clean -C tools/utility/ BASEPROJ=$(BASEPROJ)
rm -rf $(EXECUTABLES) $(OBJDIR)/*


# Dummy make test for travis-ci
test:
$(shell exit 0)
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
Loading