http://git-wip-us.apache.org/repos/asf/incubator-singa/blob/dd1e4afa/Makefile.am ---------------------------------------------------------------------- diff --git a/Makefile.am b/Makefile.am deleted file mode 100644 index a30b9d1..0000000 --- a/Makefile.am +++ /dev/null @@ -1,381 +0,0 @@ -ACLOCAL_AMFLAGS = -I config -AUTOMAKE_OPTIONS = foreign subdir-objects - -#AM_CPPFLAGS = -I$(top_srcdir)/src -#AM_LDFLAGS = $(LD_FLAGS) - -MSHADOW_FLAGS = -DMSHADOW_USE_CUDA=0 -DMSHADOW_USE_CBLAS=1 -DMSHADOW_USE_MKL=0 -DEFAULT_FLAGS = -Wall -pthread -fPIC -std=c++11 -Wno-unknown-pragmas \ - $(MSHADOW_FLAGS) -funroll-loops -DTHREADED - -CFLAGS = $(DEBUG) -CXXFLAGS = $(DEBUG) -#AC_CXXFLAGS = $(DEBUG) - -INCLUDES = -I$(top_srcdir)/include - -PROTOS := $(top_srcdir)/src/proto/singa.proto \ - $(top_srcdir)/src/proto/job.proto \ - $(top_srcdir)/src/proto/common.proto -PROTO_SRCS := src/proto/singa.pb.cc \ - src/proto/job.pb.cc \ - src/proto/common.pb.cc -PROTO_HDRS := include/proto/singa.pb.h \ - include/proto/job.pb.h \ - include/proto/common.pb.h -PROTO_PYS := tool/python/pb2/singa_pb2.py \ - tool/python/pb2/job_pb2.py \ - tool/python/pb2/common_pb2.py - -CUDA_SRCS := src/utils/math_kernel.cu -CUDA_OBJS := src/utils/math_kernel.o -CUDA_HDRS := include/singa/utils/math_kernel.h - -CUDNN_SRCS := src/neuralnet/loss_layer/cudnn_softmaxloss.cc \ - src/neuralnet/neuron_layer/cudnn_softmax.cc \ - src/neuralnet/neuron_layer/cudnn_pooling.cc \ - src/neuralnet/neuron_layer/cudnn_activation.cc \ - src/neuralnet/neuron_layer/cudnn_lrn.cc \ - src/neuralnet/neuron_layer/cudnn_convolution.cc \ - src/neuralnet/neuron_layer/cudnn_bm.cc - -PY_SRCS := tool/python/singa/driver_wrap.cxx \ - src/driver.cc - -ZOOKEEPER_SRCS := src/utils/zk_service.cc -ZOOKEEPER_HDRS := include/singa/utils/zk_service.h - -HDFS_SRCS := src/io/hdfsfile.cc \ - src/io/hdfsfile_store.cc -HDFS_HDRS := include/singa/io/hdfsfile.h \ - include/singa/io/hdfsfile_store.h - -SINGA_SRCS := src/driver.cc \ - src/server.cc \ - src/worker.cc \ - src/stub.cc \ - src/neuralnet/layer.cc \ - src/neuralnet/connection_layer/bridge.cc \ - src/neuralnet/connection_layer/concate.cc \ - src/neuralnet/connection_layer/slice.cc \ - src/neuralnet/connection_layer/split.cc \ - src/neuralnet/connection_layer/rnn_dummy.cc \ - src/neuralnet/input_layer/char_rnn.cc \ - src/neuralnet/input_layer/onehot.cc \ - src/neuralnet/input_layer/csv.cc \ - src/neuralnet/input_layer/image_preprocess.cc \ - src/neuralnet/input_layer/record.cc \ - src/neuralnet/input_layer/deprecated.cc \ - src/neuralnet/input_layer/store.cc \ - src/neuralnet/input_layer/rnn_label.cc \ - src/neuralnet/output_layer/accuracy.cc \ - src/neuralnet/output_layer/argsort.cc \ - src/neuralnet/output_layer/csv.cc \ - src/neuralnet/output_layer/record.cc \ - src/neuralnet/output_layer/char_rnn.cc \ - src/neuralnet/loss_layer/euclidean.cc \ - src/neuralnet/loss_layer/softmax.cc \ - src/neuralnet/neuron_layer/activation.cc \ - src/neuralnet/neuron_layer/bm.cc \ - src/neuralnet/neuron_layer/convolution.cc \ - src/neuralnet/neuron_layer/dropout.cc \ - src/neuralnet/neuron_layer/dummy.cc \ - src/neuralnet/neuron_layer/embedding.cc \ - src/neuralnet/neuron_layer/inner_product.cc \ - src/neuralnet/neuron_layer/lrn.cc \ - src/neuralnet/neuron_layer/pooling.cc \ - src/neuralnet/neuron_layer/rbm.cc \ - src/neuralnet/neuron_layer/gru.cc \ - src/neuralnet/neuron_layer/relu.cc \ - src/neuralnet/neuron_layer/sigmoid.cc \ - src/neuralnet/neuron_layer/softmax.cc \ - src/neuralnet/neuron_layer/stanh.cc \ - src/neuralnet/neuralnet.cc \ - src/comm/socket.cc \ - src/comm/msg.cc \ - src/io/kvfile.cc \ - src/io/kvfile_store.cc \ - src/io/textfile_store.cc \ - src/io/store.cc \ - src/utils/cluster.cc \ - src/utils/cluster_rt.cc \ - src/utils/graph.cc \ - src/utils/common.cc \ - src/utils/param.cc \ - src/utils/updater.cc \ - src/utils/blob.cc \ - src/utils/image_transform.cc \ - src/utils/job_manager.cc - - -SINGA_HDRS := include/singa.h \ - include/singa/utils/math_blob.h \ - include/singa/utils/math_addr.h \ - include/singa/utils/cluster.h \ - include/utils/cluster_rt.h \ - include/utils/param.h \ - include/utils/common.h \ - include/utils/factory.h \ - include/utils/data_shard.h \ - include/utils/singleton.h \ - include/utils/graph.h \ - include/utils/blob.h \ - include/utils/updater.h \ - include/utils/tinydir.h \ - include/utils/tokenizer.h \ - include/utils/image_transform.h \ - include/utils/job_manager.h \ - include/server.h \ - include/worker.h \ - include/stub.h \ - include/neuralnet/layer.h \ - include/neuralnet/output_layer.h \ - include/neuralnet/input_layer.h \ - include/neuralnet/loss_layer.h \ - include/neuralnet/neuron_layer.h \ - include/neuralnet/connection_layer.h \ - include/neuralnet/neuralnet.h \ - include/singa/comm/msg.h \ - include/singa/comm/socket.h \ - include/singa/io/store.h \ - include/singa/io/kvfile.h \ - include/singa/io/kvfile_store.h \ - include/singa/io/textfile_store.h \ - include/mshadow/cxxnet_op.h \ - include/mshadow/tensor_expr.h \ - include/mshadow/tensor_container.h \ - include/mshadow/tensor_expr_ext.h \ - include/mshadow/tensor.h \ - include/mshadow/tensor_io.h \ - include/mshadow/tensor_base.h \ - include/mshadow/tensor_random.h - -GTEST_SRCS := include/gtest/gtest-all.cc -GTEST_HRDS := include/gtest/gtest.h -TEST_SRCS := include/gtest/gtest_main.cc \ - src/test/test_cluster.cc \ - src/test/test_common.cc \ - src/test/test_msg.cc \ - src/test/test_math.cc \ - src/test/test_neuralnet.cc \ - src/test/test_paramslicer.cc \ - src/test/test_kvfile.cc \ - src/test/test_store.cc \ - src/test/test_connection_layers.cc \ - src/test/test_record_input_layer.cc \ - src/test/test_csv_input_layer.cc \ - src/test/test_gru_layer.cc \ - src/test/test_unrolling.cc - -#EXTRA_PROGRAMS = $(PROGS) -EXTRA_PROGRAMS = singatest test -#EXTRA_LTLIBRARIES = $(LTLIBS) -EXTRA_LTLIBRARIES = libgtest.la _driver.la - -lib_LTLIBRARIES = libsinga.la $(LTLIBS) -bin_PROGRAMS = singa singatool $(PROGS) -pydir = $(CURDIR)/tool/python/singa/ -py_LTLIBRARIES = $(PY_PROGS) -#gpudir = $(CURDIR)/.libs -#gpu_LTLIBRARIES = libsingagpu.so - -#lib_LTLIBRARIES = libsinga.la -libsinga_la_SOURCES = $(PROTO_SRCS) $(SINGA_SRCS) -libsinga_la_CXXFLAGS = $(DEFAULT_FLAGS) -msse3 -fpermissive -I$(top_srcdir)/include -libsinga_la_LDFLAGS = -if LMDB -libsinga_la_CXXFLAGS += -DUSE_LMDB -endif - -if DCUDNN -libsinga_la_SOURCES += $(CUDNN_SRCS) -libsinga_la_CXXFLAGS += $(CUDNN_CFLAGS) -libsinga_la_LDFLAGS += $(CUDNN_LDFLAGS) $(CUDNN_LIBS) -endif - -if DCUDA -libsinga_la_SOURCES += $(CUDA_SRCS) $(CUDA_HDRS) -libsinga_la_CXXFLAGS += $(CUDA_CFLAGS) -libsinga_la_LDFLAGS += $(CUDA_LDFLAGS) $(CUDA_LIBS) -L./ -lsingagpu -Wl,-rpath=. -libsinga_la_LIBADD = libsingagpu.so -endif - -if DDIST -libsinga_la_SOURCES += $(ZOOKEEPER_SRCS) -libsinga_la_CXXFLAGS += $(DIST_CFLAGS) -libsinga_la_LDFLAGS += $(DIST_LDFLAGS) $(DIST_LIBS) -endif - -if DHDFS -libsinga_la_SOURCES += $(HDFS_SRCS) -libsinga_la_CXXFLAGS += $(HDFS_CFLAGS) -libsinga_la_LDFLAGS += $(HDFS_LDFLAGS) $(HDFS_LIBS) -endif - -#bin_PROGRAMS = singa -singa_SOURCES = src/main.cc -singa_CXXFLAGS = $(DEFAULT_FLAGS) -MMD -I$(top_srcdir)/include -singa_LDFLAGS = -lsinga \ - -lglog \ - -lprotobuf \ - -lopenblas \ - -lczmq -if LMDB -singa_LDFLAGS += -llmdb -endif - -if DCUDNN -singa_SOURCES += $(CUDNN_SRCS) -singa_CXXFLAGS += $(CUDNN_CFLAGS) -singa_LDFLAGS += $(CUDNN_LDFLAGS) $(CUDNN_LIBS) -endif - -if DCUDA -singa_SOURCES += $(CUDA_SRCS) $(CUDA_HDRS) -singa_CXXFLAGS += $(CUDA_CFLAGS) -singa_LDFLAGS += $(CUDA_LDFLAGS) $(CUDA_LIBS) -endif - -if DDIST -singa_SOURCES += $(ZOOKEEPER_SRCS) -singa_CXXFLAGS += $(DIST_CFLAGS) -singa_LDFLAGS += $(DIST_LDFLAGS) $(DIST_LIBS) -endif - -if DHDFS -singa_SOURCES += $(HDFS_SRCS) -singa_CXXFLAGS += $(HDFS_CFLAGS) -singa_LDFLAGS += $(HDFS_LDFLAGS) $(HDFS_LIBS) -endif -#bin_PROGRAMS += singatool -singatool_SOURCES = src/utils/tool.cc #$(CUDA_SRCS) $(CUDA_HDRS) $(CUDNN_SRCS) -singatool_CXXFLAGS = -Wall -pthread -fPIC -std=c++11 -MMD -Wno-unknown-pragmas \ - -funroll-loops -DTHREADED -I$(top_srcdir)/include $(DEFAULT_FLAGS) -singatool_LDFLAGS = -lsinga \ - -lglog \ - -lprotobuf - -if DDIST -singatool_SOURCES += $(ZOOKEEPER_SRCS) -singatool_CXXFLAGS += $(DIST_CFLAGS) -singatool_LDFLAGS += $(DIST_LDFLAGS) $(DIST_LIBS) -endif - -#lib_LTLIBRARIES += libgtest.la -libgtest_la_SOURCES = $(GTEST_HDRS) $(GTEST_SRCS) -libgtest_la_CXXFLAGS = $(DEFAULT_FLAGS) -msse3 -fpermissive -I$(top_srcdir)/include -if LMDB -libgtest_la_CXXFLAGS += -DUSE_LMDB -endif -#libgtest_la_LDFLAGS = -I$(top_srcdir)/include - -#bin_PROGRAMS += test - -singatest_SOURCES = $(GTEST_HDRS) $(TEST_SRCS) -singatest_CXXFLAGS = $(DEFAULT_FLAGS) -I$(top_srcdir)/include -singatest_LDADD = ./libgtest.la -singatest_LDFLAGS = -lsinga \ - -lglog \ - -lprotobuf \ - -lopenblas \ - -lczmq \ - -lgtest -if LMDB -singatest_LDFLAGS += -llmdb -endif - -if DCUDNN -singatest_SOURCES += $(CUDNN_SRCS) -singatest_CXXFLAGS += $(CUDNN_CFLAGS) -singatest_LDFLAGS += $(CUDNN_LDFLAGS) $(CUDNN_LIBS) -endif - -if DCUDA -singatest_SOURCES += $(CUDA_SRCS) $(CUDA_HDRS) -singatest_CXXFLAGS += $(CUDA_CFLAGS) -singatest_LDFLAGS += $(CUDA_LDFLAGS) $(CUDA_LIBS) -endif - -if DDIST -singatest_SOURCES += $(ZOOKEEPER_SRCS) -singatest_CXXFLAGS += $(DIST_CFLAGS) -singatest_LDFLAGS += $(DIST_LDFLAGS) $(DIST_LIBS) -endif - -_driver_la_SOURCES = $(PY_SRCS) -_driver_la_CXXFLAGS = $(DEFAULT_FLAGS) $(MSHADOW_FLAGS) -I$(top_srcdir)/include $(PYFLAGS) -_driver_la_LDFLAGS = -lsinga -module -shared $(PYLIBS) -avoid-version -rpath $(pydir) - -if DCUDNN -_driver_la_CXXFLAGS += $(CUDNN_CFLAGS) -_driver_la_LDFLAGS += $(CUDNN_LDFLAGS) $(CUDNN_LIBS) -endif - -if DCUDA -_driver_la_CXXFLAGS += $(CUDA_CFLAGS) -_driver_la_LDFLAGS += $(CUDA_LDFLAGS) $(CUDA_LIBS) -endif - -clean-local: - rm -rf $(PROTO_SRCS) $(PROTO_HDRS) - rm -rf $(PROTO_PYS) - rm -rf neuralnet/neuron_layer/*.o - rm -rf src/utils/math_kernel.o - rm -rf rat_check - rm -rf tool/python/pb2 - rm -rf libsingagpu.so - -# Add scrips for py driver installation -all-local: - @if [ -f ".libs/_driver.so" ]; then \ - echo "Copy libs for python wrapper"; \ - cp -f .libs/_driver.so tool/python/singa/; \ - touch tool/python/singa/__init__.py; \ - fi - @if [ -f "libsingagpu.so" ]; then \ - cp libsingagpu.so .libs/; \ - fi - -# For rat check -rat: - @if test ! -z '$(shell command -v java 2>/dev/null)'; then \ - if test ! -z '$(shell echo $$RAT_PATH)'; then \ - make distclean;\ - java -jar $(RAT_PATH) -E rat-excludes -d . > rat_check; \ - else \ - echo "RAT_PATH is not set to correct jar file. Apache RAT can be downloaded at http://creadur.apache.org/rat/download_rat.cgi"; \ - fi \ - else \ - echo "java is not found"; \ - fi - -.cu.o: .cu - $(NVCC) $(MSHADOW_FLAGS) --shared -Xcompiler -fPIC $(CUDA_CFLAGS) $(CUDA_LDFLAGS) $(CUDA_LIBS) -I$(top_srcdir)/include -std=c++11 -G -c -o $@ $< - -# Generate gpu libs for singa -libsingagpu.so: $(CUDA_OBJS) - $(NVCC) -o libsingagpu.so -shared -Xcompiler -fPIC $(CUDA_OBJS) $(CUDA_CFLAGS) $(CUDA_LDFLAGS) $(CUDA_LIBS) -I$(top_srcdir)/include -std=c++11 -G - -# Create python class files -install-pyLTLIBRARIES: $(py_LTLIBRARIES) - touch tool/python/singa/__init__.py - @if [ -f ".libs/_driver.so" ]; then \ - cp -f .libs/_driver.so tool/python/singa/;\ - fi - -uninstall-pyLTLIBRARIES: - rm -f tool/python/singa/__init__.py - rm -f tool/python/singa/_driver.so - -# For autorun singatest -test: singatest - @./singatest - -$(PROTO_HDRS) $(PROTO_SRCS): $(PROTOS) - protoc --proto_path=$(top_srcdir)/src/proto --cpp_out=$(top_srcdir)/src/proto $(PROTOS) - mkdir -p $(top_srcdir)/tool/python/pb2/ - touch $(top_srcdir)/tool/python/pb2/__init__.py - protoc --proto_path=$(top_srcdir)/src/proto --python_out=$(top_srcdir)/tool/python/pb2 $(PROTOS) - mkdir -p $(top_srcdir)/include/singa/proto/ - cp $(top_srcdir)/src/proto/*.pb.h $(top_srcdir)/include/singa/proto/ - @echo
http://git-wip-us.apache.org/repos/asf/incubator-singa/blob/dd1e4afa/Makefile.example ---------------------------------------------------------------------- diff --git a/Makefile.example b/Makefile.example deleted file mode 100644 index 4fb0c66..0000000 --- a/Makefile.example +++ /dev/null @@ -1,116 +0,0 @@ -#/** -# * Licensed to the Apache Software Foundation (ASF) under one -# * or more contributor license agreements. See the NOTICE file -# * distributed with this work for additional information -# * regarding copyright ownership. The ASF licenses this file -# * to you under the Apache License, Version 2.0 (the -# * "License"); you may not use this file except in compliance -# * with the License. You may obtain a copy of the License at -# * -# * http://www.apache.org/licenses/LICENSE-2.0 -# * -# * Unless required by applicable law or agreed to in writing, software -# * distributed under the License is distributed on an "AS IS" BASIS, -# * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# * See the License for the specific language governing permissions and -# * limitations under the License. -# */ - -###################User Config Varaibles ############################# -# third-party library installation folder -HOME_DIR := /usr -# Lib folder for system and external libs. You may need to change it. -LIBRARY_DIRS := $(HOME_DIR)/lib64 $(HOME_DIR)/lib $(HOME_DIR)/local/lib -# Header folder for system and external libs. You may need to change it. -INCLUDE_DIRS := $(HOME_DIR)/include ./include $(HOME_DIR)/local/include/zookeeper -# g++ location, should support c++11, tested with 4.8.1 -CXX := g++ - -######################Setting Varialbes####################################### -LIBRARIES := glog protobuf openblas zmq czmq zookeeper_mt - -LDFLAGS := $(foreach librarydir, $(LIBRARY_DIRS), -L$(librarydir))\ - $(foreach library, $(LIBRARIES), -l$(library)) -# Folder to store compiled files -BUILD_DIR := .libs -MSHADOW_FLAGS :=-DMSHADOW_USE_CUDA=0 -DMSHADOW_USE_CBLAS=1 -DMSHADOW_USE_MKL=0 -ZK_FLAGS :=-DTHREADED -fpermissive -CXXFLAGS := -O2 -msse3 -Wall -pthread -fPIC -std=c++11 -Wno-unknown-pragmas \ - $(MSHADOW_FLAGS) -DCPU_ONLY=1 $(ZK_FLAGS)\ - -funroll-loops $(foreach includedir, $(INCLUDE_DIRS), -I$(includedir)) - -# find user defined .proto file, and then compute the corresponding .h, .cc -# files, which cannot be found by shell find, because they haven't been -# generated currently -PROTOS := $(shell find src/proto/ -name "*.proto") -PROTO_SRCS :=$(PROTOS:.proto=.pb.cc) -PROTO_HDRS :=$(patsubst src%, include%, $(PROTOS:.proto=.pb.h)) -PROTO_OBJS :=$(addprefix $(BUILD_DIR)/, $(PROTO_SRCS:.cc=.o)) - -# each singa src file will generate a .o file -SINGA_SRCS := $(shell find src/ \( -path "src/test" -o -path "src/main.cc" -o -path "src/utils/tool.cc" \) \ - -prune -o \( -name "*.cc" -type f \) -print ) -SINGA_OBJS := $(sort $(addprefix $(BUILD_DIR)/, $(SINGA_SRCS:.cc=.o)) \ - $(PROTO_OBJS) ) --include $(SINGA_OBJS:%.o=%.P) - -TEST_SRCS :=$(shell find src/test/ -maxdepth 1 -name "*.cc") -TEST_OBJS := $(sort $(addprefix $(BUILD_DIR)/, $(TEST_SRCS:.cc=.o))) --include $(TEST_OBJS:%.o=%.P) - -GTEST_SRC := include/gtest/gtest-all.cc -GTEST_HDR := include/gtest/gtest.h -GTEST_LIB := $(BUILD_DIR)/libgtest.a - -OBJS := $(sort $(SINGA_OBJS) $(TEST_OBJS) ) - -########################Compilation Section################################### -.PHONY: singa test - -singa: $(PROTO_OBJS) $(SINGA_OBJS) - $(CXX) -shared -o $(BUILD_DIR)/libsinga.so $(SINGA_OBJS) - $(CXX) $(SINGA_OBJS) src/main.cc -o singa $(CXXFLAGS) $(LDFLAGS) - @echo - $(CXX) $(SINGA_OBJS) src/utils/tool.cc -o singatool $(CXXFLAGS) $(LDFLAGS) - @echo - -loader: proto $(LOADER_OBJS) - $(CXX) $(LOADER_OBJS) -o $(BUILD_DIR)/loader $(CXXFLAGS) $(LDFLAGS) - @echo - -test: proto $(GTEST_LIB) $(TEST_OBJS) $(SINGA_OBJS) - $(CXX) $(TEST_OBJS) include/gtest/gtest_main.cc $(GTEST_LIB) \ - $(SINGA_OBJS) -o $(BUILD_DIR)/test $(CXXFLAGS) $(LDFLAGS) - @echo - -$(GTEST_LIB): $(GTEST_HDR) $(GTEST_SRC) - $(CXX) $(GTEST_SRC) -c -o $(BUILD_DIR)/gtest-all.o $(CXXFLAGS) - ar -rv $(GTEST_LIB) $(BUILD_DIR)/gtest-all.o - -# compile all files -$(OBJS):$(BUILD_DIR)/%.o : %.cc - @mkdir -p $(dir $@) - $(CXX) $< $(CXXFLAGS) -MMD -c -o $@ - cp $(BUILD_DIR)/$*.d $(BUILD_DIR)/$*.P; \ - sed -e 's/#.*//' -e 's/^[^:]*: *//' -e 's/ *\\$$//' \ - -e '/^$$/ d' -e 's/$$/ :/' < $(BUILD_DIR)/$*.d >> $(BUILD_DIR)/$*.P; \ - rm -f $*.d - -proto: $(PROTO_OBJS) - -$(PROTO_SRCS): $(PROTOS) - protoc --proto_path=src/proto --cpp_out=src/proto $(PROTOS) - mkdir -p include/proto/ - cp src/proto/*.pb.h include/proto/ - mkdir -p tool/pb2/ - touch tool/pb2/__init__.py - protoc --proto_path=src/proto --python_out=tool/pb2/ $(PROTOS) - @echo - -clean: - rm -rf *.a *.so - rm -rf include/proto/* - rm -rf src/proto/*.pb.h src/proto/*.pb.cc - rm -rf tool/pb2/* - rm -rf $(BUILD_DIR) - @echo http://git-wip-us.apache.org/repos/asf/incubator-singa/blob/dd1e4afa/Makefile.gpu ---------------------------------------------------------------------- diff --git a/Makefile.gpu b/Makefile.gpu deleted file mode 100644 index 0615f6b..0000000 --- a/Makefile.gpu +++ /dev/null @@ -1,154 +0,0 @@ -#/** -# * Licensed to the Apache Software Foundation (ASF) under one -# * or more contributor license agreements. See the NOTICE file -# * distributed with this work for additional information -# * regarding copyright ownership. The ASF licenses this file -# * to you under the Apache License, Version 2.0 (the -# * "License"); you may not use this file except in compliance -# * with the License. You may obtain a copy of the License at -# * -# * http://www.apache.org/licenses/LICENSE-2.0 -# * -# * Unless required by applicable law or agreed to in writing, software -# * distributed under the License is distributed on an "AS IS" BASIS, -# * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# * See the License for the specific language governing permissions and -# * limitations under the License. -# */ - -###################User Config Varaibles ############################# -# third-party library installation folder -HOME_DIR := /home/wangwei/local - -# must config the cudnn folder if using cudnn -CUDNN_DIR := $(HOME_DIR)/cudnn - -CUDA_DIR := /usr/local/cuda - -# Lib folder for system and external libs. You may need to change it. -LIBRARY_DIRS := $(HOME_DIR)/lib64 $(HOME_DIR)/lib $(CUDNN_DIR)/lib64 $(CUDA_DIR)/lib64 $(CUDA_DIR)/lib -# Header folder for system and external libs. You may need to change it. -INCLUDE_DIRS := ./include $(HOME_DIR)/include $(CUDNN_DIR)/include $(CUDA_DIR)/include -# g++ location, should support c++11, tested with 4.8.1 -CXX := g++ -CUCXX := nvcc - -######################Setting Varialbes####################################### -LIBRARIES := glog protobuf openblas zmq czmq zookeeper_mt - -ifneq ($(CUDA_DIR),) - LIBRARIES := $(LIBRARIES) cublas cudart curand cudnn -endif - -LDFLAGS := $(foreach librarydir, $(LIBRARY_DIRS), -L$(librarydir))\ - $(foreach library, $(LIBRARIES), -l$(library)) -# Folder to store compiled files -BUILD_DIR := .libs -MSHADOW_FLAGS :=-DMSHADOW_USE_CUDA=0 -DMSHADOW_USE_CBLAS=1 -DMSHADOW_USE_MKL=0 -ZK_FLAGS :=-DTHREADED -fpermissive -CXXFLAGS := -O2 -msse3 -Wall -pthread -fPIC -std=c++11 -Wno-unknown-pragmas \ - $(MSHADOW_FLAGS) -DUSE_CUDNN $(ZK_FLAGS)\ - -funroll-loops $(foreach includedir, $(INCLUDE_DIRS), -I$(includedir)) -CUCXXFLAGS := -DUSE_CUDNN $(MSHADOW_FLAGS) -std=c++11 $(CUDA_ARCH) \ - $(foreach includedir, $(INCLUDE_DIRS), -I$(includedir)) - -#Add device compile option -ifeq ($(CUDA_DIR),) - MSHADOW_FLAGS := $(MSHADOW_FLAGS) -DCPU_ONLY - CXXFLAGS := $(CXXFLAGS) -DCPU_ONLY -else - CXXFLAGS := $(CXXFLAGS) -DUSE_GPU -endif - -# find user defined .proto file, and then compute the corresponding .h, .cc -# files, which cannot be found by shell find, because they haven't been -# generated currently -PROTOS := $(shell find src/proto/ -name "*.proto") -PROTO_SRCS :=$(PROTOS:.proto=.pb.cc) -PROTO_HDRS :=$(patsubst src%, include%, $(PROTOS:.proto=.pb.h)) -PROTO_OBJS :=$(addprefix $(BUILD_DIR)/, $(PROTO_SRCS:.cc=.o)) - -# each singa src file will generate a .o file -SINGA_SRCS := $(shell find src/ \( -path "src/test" -o -path "src/main.cc" -o -path "src/utils/tool.cc" \) \ - -prune -o \( -name "*.cc" -type f \) -print ) -SINGA_OBJS := $(sort $(addprefix $(BUILD_DIR)/, $(SINGA_SRCS:.cc=.o)) \ - $(PROTO_OBJS) ) --include $(SINGA_OBJS:%.o=%.P) - -TEST_SRCS :=$(shell find src/test/ -maxdepth 1 -name "*.cc") -TEST_OBJS := $(sort $(addprefix $(BUILD_DIR)/, $(TEST_SRCS:.cc=.o))) --include $(TEST_OBJS:%.o=%.P) - -TEST_CUDA_SRCS :=$(shell find src/test/ -maxdepth 1 -name "*.cu") -TEST_CUDA_OBJS := $(sort $(addprefix $(BUILD_DIR)/, $(TEST_CUDA_SRCS:.cu=.o))) --include $(TEST_CUDA_OBJS:%.o=%.P) - -SINGA_CUDA_SRCS := $(shell find src/ \( -path "src/test" \) -prune -o \( -name "*.cu" -type f \) -print ) -SINGA_CUDA_OBJS := $(sort $(addprefix $(BUILD_DIR)/, $(SINGA_CUDA_SRCS:.cu=.o))) --include $(SINGA_CUDA_OBJS:%.o=%.P) - -GTEST_SRC := include/gtest/gtest-all.cc -GTEST_HDR := include/gtest/gtest.h -GTEST_LIB := $(BUILD_DIR)/libgtest.a - -OBJS := $(sort $(SINGA_OBJS) $(TEST_OBJS) ) -CUOBJS := $(sort $(SINGA_CUDA_OBJS) $(TEST_CUDA_OBJS) ) - -########################Compilation Section################################### -.PHONY: singa test - -singa: $(PROTO_OBJS) $(SINGA_OBJS) $(SINGA_CUDA_OBJS) - $(CXX) -shared -o $(BUILD_DIR)/libsinga.so $(SINGA_OBJS) - $(CXX) $(SINGA_OBJS) $(SINGA_CUDA_OBJS) src/main.cc -o singa $(CXXFLAGS) $(LDFLAGS) - @echo - $(CXX) $(BUILD_DIR)/libsinga.so src/utils/tool.cc -o singatool $(CXXFLAGS) $(LDFLAGS) -Wl,-unresolved-symbols=ignore-in-shared-libs - @echo - -loader: proto $(LOADER_OBJS) - $(CXX) $(LOADER_OBJS) -o $(BUILD_DIR)/loader $(CXXFLAGS) $(LDFLAGS) - @echo - -test: proto $(GTEST_LIB) $(TEST_OBJS) $(TEST_CUDA_OBJS) $(SINGA_OBJS) $(SINGA_CUDA_OBJS) - $(CXX) $(TEST_OBJS) $(TEST_CUDA_OBJS) include/gtest/gtest_main.cc $(GTEST_LIB) \ - $(SINGA_OBJS) $(SINGA_CUDA_OBJS) -o $(BUILD_DIR)/test $(CXXFLAGS) $(LDFLAGS) - @echo - -$(GTEST_LIB): $(GTEST_HDR) $(GTEST_SRC) - $(CXX) $(GTEST_SRC) -c -o $(BUILD_DIR)/gtest-all.o $(CXXFLAGS) - ar -rv $(GTEST_LIB) $(BUILD_DIR)/gtest-all.o - -# compile all files -$(OBJS):$(BUILD_DIR)/%.o : %.cc - @mkdir -p $(dir $@) - $(CXX) $< $(CXXFLAGS) -MMD -c -o $@ - cp $(BUILD_DIR)/$*.d $(BUILD_DIR)/$*.P; \ - sed -e 's/#.*//' -e 's/^[^:]*: *//' -e 's/ *\\$$//' \ - -e '/^$$/ d' -e 's/$$/ :/' < $(BUILD_DIR)/$*.d >> $(BUILD_DIR)/$*.P; \ - rm -f $*.d - -$(CUOBJS):$(BUILD_DIR)/%.o : %.cu - @mkdir -p $(dir $@) - $(CUCXX) $< -c -o $@ $(CUCXXFLAGS) - cp $(BUILD_DIR)/$*.d $(BUILD_DIR)/$*.P; \ - sed -e 's/#.*//' -e 's/^[^:]*: *//' -e 's/ *\\$$//' \ - -e '/^$$/ d' -e 's/$$/ :/' < $(BUILD_DIR)/$*.d >> $(BUILD_DIR)/$*.P; \ - rm -f $*.d - -proto: $(PROTO_OBJS) - -$(PROTO_SRCS): $(PROTOS) - protoc --proto_path=src/proto --cpp_out=src/proto $(PROTOS) - mkdir -p include/proto/ - cp src/proto/*.pb.h include/singa/proto/ - mkdir -p tool/pb2/ - touch tool/pb2/__init__.py - protoc --proto_path=src/proto --python_out=tool/pb2/ $(PROTOS) - @echo - -clean: - rm -rf *.a *.so - rm -rf include/proto/* - rm -rf src/proto/*.pb.h src/proto/*.pb.cc - rm -rf tool/pb2/* - rm -rf $(BUILD_DIR) - @echo http://git-wip-us.apache.org/repos/asf/incubator-singa/blob/dd1e4afa/README.md ---------------------------------------------------------------------- diff --git a/README.md b/README.md index 4d124aa..8cbc603 100644 --- a/README.md +++ b/README.md @@ -2,6 +2,8 @@ Distributed deep learning system +This is the dev branch for V1.0, please refer to the master branch and the following links for V0.3. + ##Project Website All the details can be found in [Project Website](http://singa.incubator.apache.org), including the following instructions. @@ -11,218 +13,4 @@ All the details can be found in [Project Website](http://singa.incubator.apache. * [Development Mailing List](mailto:[email protected]) ([Archive](http://mail-archives.apache.org/mod_mbox/singa-dev/)) * [Commits Mailing List](mailto:[email protected]) ([Archive](http://mail-archives.apache.org/mod_mbox/singa-commits/)) -<a name="Dependencies"</a> -##Dependencies -The current code depends on the following external libraries: - - * `glog` (New BSD) - * `google-protobuf` (New BSD) - * `openblas` (New BSD) - -###Optional dependencies -For advanced features, the following libraries are needed: - - * `zeromq` (LGPLv3 + static link exception),`czmq` (Mozilla Public License Version 2.0) and `zookeeper` (Apache 2.0), for distributed training with multiple processes. Compile SINGA with `--enable-dist` - * `cuda` (NVIDIA CUDA Toolkit EUL) for training using NVIDIA GPUs. - * `cudnn` (NVIDIA CuDNN EULA) for training using NVIDIA's CuDNN library. - * `Apache Mesos` (Apache 2.0) - * `Apache Hadoop` (Apache 2.0) - * `libhdfs3` (Apache 2.0) - * `swig` (GPL) for using Python Binding. - -We have tested SINGA on Ubuntu 12.04, Ubuntu 14.01 and CentOS 6. -You can install all dependencies (including optional dependencies) into `$PREFIX` folder by - - ./thirdparty/install.sh all $PREFIX - -If `$PREFIX` is not a system path (e.g., `/usr/local/`), please export the following -variables to continue the building instructions, - - $ export LD_LIBRARY_PATH=$PREFIX/lib:$LD_LIBRARY_PATH - $ export CPLUS_INCLUDE_PATH=$PREFIX/include:$CPLUS_INCLUDE_PATH - $ export LIBRARY_PATH=$PREFIX/lib:$LIBRARY_PATH - $ export PATH=$PREFIX/bin:$PATH - - -##Documentation - -Full documentation is available online at [Official Documentation](https://singa.incubator.apache.org/docs/overview.html). - -##Building SINGA - -Please make sure you have `g++ >= 4.8.1` before building SINGA. - - $ ./autogen.sh - # refer to the FAQs below for errors during configure, including blas_segmm() error - $ ./configure - # refer to the FAQs below for error during make - $ make - -To compile with GPU support, you should run: - - $ ./configure --enable-cuda --with-cuda=/CUDA/PATH --enable-cudnn --with-cudnn=/CUDNN/PATH - ---with-cuda and --with-cudnn are optional as by default the script will search system paths. We have tested with CUDA V7.0 and V7.5, CUDNN V3 and V4. -Please kindly set proper environment parameters (LD_LIBRARY_PATH, LIBRARY_PATH, etc.) when you run the code. - -To compile with HDFS support, you should run: - - $ ./configure --enable-hdfs --with-libhdfs=/PATH/TO/HDFS3 - ---with-libhdfs is optional as by default the path is /usr/local/. - -To compile with python wrappers, you should run: - - $ ./tool/python/singa/generatepy.sh - $ ./configure --enable-python --with-python=/PATH/TO/Python.h - ---with-python is optional as by default the path is /usr/local/include. - -You can also run the following command for further configuration. - - $ ./configure --help - -##Running Examples - -Let us train the [CNN model](http://papers.nips.cc/paper/4824-imagenet-classification-with-deep-convolutional-neural-networks) over the -[CIFAR-10](http://www.cs.toronto.edu/~kriz/cifar.html) dataset without parallelism as an example. The hyper-parameters -are set following [cuda-convnet](https://code.google.com/p/cuda-convnet/). More details about this example are available -at [CNN example](http://singa.incubator.apache.org/docs/cnn). - -First, download the dataset and create data shards: - - $ cd examples/cifar10/ - $ cp Makefile.example Makefile - $ make download - $ make create - -If it reports errors due to library missing, e.g., `libopenblas` or `libprotobuf`, -please export the environment variables shown in the [Dependencies](#Dependencies) section and -continue with the following instructions, - - # delete the newly created folders - $ rm -rf cifar10_t* - $ make create - -Next, start the training: - - $ cd ../../ - $ ./singa -conf examples/cifar10/job.conf - -For GPU training or distributed training, please refer to the [online guide](http://singa.apache.org/docs). - -##LICENSE - -Apache SINGA is licensed under the [Apache License, Version 2.0](http://www.apache.org/licenses/LICENSE-2.0). - -For additional information, see the `LICENSE` and `NOTICE` files. - -## FAQ - -* Q1:I get error `./configure --> cannot find blas_segmm() function` even I -have installed `OpenBLAS`. - - A1: This means the compiler cannot find the `OpenBLAS` library. If you have installed `OpenBLAS` via `apt-get install`, then export the path to `$LD_LIBRARY_PATH` (e.g. `/usr/lib/openblas-base`). If you installed it with - `./thirdparty/install.sh`, then export the correct path based on `$PREFIX` (e.g. `/opt/OpenBLAS/lib`): - - # using apt-get install for openblas - $ export LIBRARY_PATH=$PATH_TO_OPENBLAS_LIB:$LIBRARY_PATH - - # using ./thirdparty/install.sh for openblas: - $ export LIBRARY_PATH=/opt/OpenBLAS/lib:$LIBRARY_PATH - - -* Q2: I get error `cblas.h no such file or directory exists`. - - A2: You need to include the folder containing `cblas.h` into `$CPLUS_INCLUDE_PATH`, - e.g., - - $ export CPLUS_INCLUDE_PATH=$PREFIX/include:$CPLUS_INCLUDE_PATH - # e.g., - $ export CPLUS_INCLUDE_PATH=/opt/OpenBLAS/include:$CPLUS_INCLUDE_PATH - # then reconfigure and make SINGA - $ ./configure - $ make - - -* Q3: When compiling, I get error `SSE2 instruction set not enabled` - - A3: You can try following command: - - $ make CFLAGS='-msse2' CXXFLAGS='-msse2' - - -* Q4: I get `ImportError: cannot import name enum_type_wrapper` from -`google.protobuf.internal` when I try to import `.py` files. - - A4: After installing `protobuf` by `make install`, we should install `python` - runtime libraries. Go to `protobuf` source directory, run: - - $ cd /PROTOBUF/SOURCE/FOLDER - $ cd python - $ python setup.py build - $ python setup.py install - - You may need `sudo` when you try to install `python` runtime libraries in - the system folder. - - -* Q5: I get a linking error caused by `gflags`. - - A5: SINGA does not depend on `gflags`. But you may have installed the `glog` with - `gflags`. In that case you can reinstall `glog` using `thirdparty/install.sh` into - a another folder and export the `$LDFLAGS` and `$CPPFLAGS` to include that folder. - - -* Q6: While compiling SINGA and installing `glog` on mac OS X, I get fatal error -`'ext/slist' file not found` - - A6: We have not done thorough test on Mac OS. If you want to install `glog`, please goto glog folder and try: - - $ make CFLAGS='-stdlib=libstdc++' CXXFLAGS='stdlib=libstdc++' - -* Q7: When I start a training job, it reports error related to `ZOO_ERROR...zk retcode=-4...`. - - A7: This is because `zookeeper` is not started. Please start the service - - $ ./bin/zk-service.sh start - - If the error still exists, probably that you do not have `java`. You can simply - check it by - - $ java --version - -* Q8: When I build `OpenBLAS` from source, I am told that I need a fortran compiler. - - A8: You can compile `OpenBLAS` by - - $ make ONLY_CBLAS=1 - - or install it using - - $ sudo apt-get install openblas-dev - - or - - $ sudo yum install openblas-devel - - It is worth noting that you need root access to run the last two commands. - Remember to set the environment variables to include the header and library - paths of `OpenBLAS` after installation (please refer to the [Dependencies](#Dependencies) section). - -* Q9: When I build protocol buffer, it reports that `GLIBC++_3.4.20 not found in /usr/lib64/libstdc++.so.6`. - - A9: This means the linker found `libstdc++.so.6` but that library - belongs to an older version of `GCC` than was used to compile and link the - program. The program depends on code defined in - the newer `libstdc++` that belongs to the newer version of GCC, so the linker - must be told how to find the newer `libstdc++` shared library. - The simplest way to fix this is to find the correct `libstdc++` and export it to - `$LD_LIBRARY_PATH`. For example, if `GLIBC++_3.4.20` is listed in the output of the - following command, - - $ strings /usr/local/lib64/libstdc++.so.6|grep GLIBC++ - - then just set your environment variable as - $ export LD_LIBRARY_PATH=/usr/local/lib64:$LD_LIBRARY_PATH http://git-wip-us.apache.org/repos/asf/incubator-singa/blob/dd1e4afa/autogen.sh ---------------------------------------------------------------------- diff --git a/autogen.sh b/autogen.sh deleted file mode 100755 index ff8eacb..0000000 --- a/autogen.sh +++ /dev/null @@ -1,23 +0,0 @@ -#!/bin/sh -#/** -# * Licensed to the Apache Software Foundation (ASF) under one -# * or more contributor license agreements. See the NOTICE file -# * distributed with this work for additional information -# * regarding copyright ownership. The ASF licenses this file -# * to you under the Apache License, Version 2.0 (the -# * "License"); you may not use this file except in compliance -# * with the License. You may obtain a copy of the License at -# * -# * http://www.apache.org/licenses/LICENSE-2.0 -# * -# * Unless required by applicable law or agreed to in writing, software -# * distributed under the License is distributed on an "AS IS" BASIS, -# * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# * See the License for the specific language governing permissions and -# * limitations under the License. -# */ - -mkdir -p ./config; -aclocal; -autoreconf -f -i; -automake; http://git-wip-us.apache.org/repos/asf/incubator-singa/blob/dd1e4afa/configure.ac ---------------------------------------------------------------------- diff --git a/configure.ac b/configure.ac deleted file mode 100644 index 21f699c..0000000 --- a/configure.ac +++ /dev/null @@ -1,311 +0,0 @@ -#/** -# * Licensed to the Apache Software Foundation (ASF) under one -# * or more contributor license agreements. See the NOTICE file -# * distributed with this work for additional information -# * regarding copyright ownership. The ASF licenses this file -# * to you under the Apache License, Version 2.0 (the -# * "License"); you may not use this file except in compliance -# * with the License. You may obtain a copy of the License at -# * -# * http://www.apache.org/licenses/LICENSE-2.0 -# * -# * Unless required by applicable law or agreed to in writing, software -# * distributed under the License is distributed on an "AS IS" BASIS, -# * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# * See the License for the specific language governing permissions and -# * limitations under the License. -# */ -# -*- Autoconf -*- -# Process this file with autoconf to produce a configure script. - -AC_PREREQ(2.59) -AC_INIT(singa, 0.1.0, [email protected]) -AC_CONFIG_AUX_DIR(config) -AC_CONFIG_MACRO_DIR(config) -AC_CONFIG_SRCDIR([src/utils/common.cc]) -AC_CONFIG_HEADER([config.h]) -AM_INIT_AUTOMAKE([subdir-objects foreign]) -m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])]) -ACLOCAL_AMFLAGS = -I m4 --install - -# Checks for programs. -AC_PROG_CXX([g++]) -AC_PROG_CC -AC_DISABLE_STATIC -AC_PROG_LIBTOOL - -# Checks for libraries. -AC_SEARCH_LIBS([cblas_sgemm], [openblas], [], [ - AC_MSG_ERROR([unable to find cblas_sgemm() function]) - ]) -AC_SEARCH_LIBS([zmsg_new], [czmq], [], [ - AC_MSG_ERROR([unable to find zmsg_new() function]) - ]) -AC_CHECK_LIB([glog], [main], [], [ - AC_MSG_ERROR([unable to find glog library]) - ]) -AC_CHECK_LIB([protobuf], [main], [], [ - AC_MSG_ERROR([unable to find protobuf library]) - ]) - -PROGS='' -LTLIBS='' - -# Setup custom CUDNN paths -AC_ARG_ENABLE([cudnn], - [AS_HELP_STRING(--enable-cudnn,enable CUDNN support)], - [enable_cudnn="yes"], [enable_cudnn="no"]) -AM_CONDITIONAL(DCUDNN, [test "$enable_cudnn" = "yes"]) -AC_ARG_WITH([cudnn], - [AS_HELP_STRING([--with-cudnn=PATH], [prefix where CUDNN is installed])], - [cudnn_prefix=$withval], [cudnn_prefix="/usr/local/cudnn"]) -if test "$cudnn_prefix" == "yes"; then - if test "$withval" == "yes"; then - cudnn_prefix="/usr/local/cudnn" - fi -fi -if test x"$enable_cudnn" == x"yes"; then - CUDNN_CFLAGS="-I$cudnn_prefix/include" - CUDNN_LDFLAGS="-L$cudnn_prefix/lib64 -L$cudnn_prefix/lib" - CUDNN_LIBS="-lcudnn" - LIBS="$LIBS $CUDNN_LIBS" - LDFLAGS="$LDFLAGS $CUDNN_LDFLAGS" - DEBUG="-DUSE_CUDNN" - AC_DEFINE(DCUDNN,[1],[Defined if CUDNN should be used]) - AC_CHECK_LIB([cudnn], [main], [], [ - AC_MSG_ERROR([unable to find cudnn library]) - ]) -else - CUDNN_CFLAGS="" - CUDNN_LDFLAGS="" - CUDNN_LIBS="" -fi -AC_SUBST(CUDNN_CFLAGS) -AC_SUBST(CUDNN_LDFLAGS) -AC_SUBST(CUDNN_LIBS) - -# Setup custom CUDA paths -AC_ARG_ENABLE(cuda, - [AS_HELP_STRING(--enable-cuda,enable CUDA support)], - cudaval="yes", - cudaval="no") -AM_CONDITIONAL(DCUDA, [test "$cudaval" = "yes"]) -AC_ARG_WITH([cuda], - [AS_HELP_STRING( - [--with-cuda=PATH], - [prefix where CUDA is installed])], - [cuda_prefix=$withval], - [cuda_prefix="/usr/local/cuda"]) -if test "$cuda_prefix" == "yes"; then - if test "$withval" == "yes"; then - cuda_prefix="/usr/local/cuda" - fi -fi -if test x"$cudaval" = x"yes"; then - AC_MSG_CHECKING([nvcc in $cuda_prefix/bin]) - if test -x "$cuda_prefix/bin/nvcc"; then - AC_MSG_RESULT([found]) - AC_DEFINE_UNQUOTED([NVCC_PATH], ["$cuda_prefix/bin/nvcc"], [Path to nvcc binary]) - else - AC_MSG_RESULT([not found!]) - AC_MSG_FAILURE([nvcc was not found in $cuda_prefix/bin]) - fi - CUDA_CFLAGS="-I$cuda_prefix/include" - CUDA_LDFLAGS="-L$cuda_prefix/lib64 -L$cuda_prefix/lib" - CUDA_LIBS="-lcublas -lcudart -lcurand" - LIBS="$LIBS $CUDA_LIBS" - LDFLAGS="$LDFLAGS $CUDA_LDFLAGS -L./" - LIBTOOL='LD_LIBRARY_PATH=$(PWD) $(SHELL) $(top_builddir)/libtool' - NVCC="nvcc" - DEBUG+=" -DUSE_GPU" - AC_DEFINE(DCUDA,[1],[Defined if CUDA should be used]) - AC_CHECK_LIB([cublas], [main], [], [ - AC_MSG_ERROR([unable to find cuda library]) - ]) - AC_CHECK_LIB([cudart], [main], [], [ - AC_MSG_ERROR([unable to find cudart library]) - ]) - AC_CHECK_LIB([curand], [main], [], [ - AC_MSG_ERROR([unable to find curand library]) - ]) -else - CUDA_CFLAGS="" - CUDA_LDFLAGS="" - CUDA_LIBS="" - NVCC="" - DEBUG="-DCPU_ONLY" -fi -AC_SUBST(LIBTOOL) -AC_SUBST(NVCC) -AC_SUBST(CUDA_LDFLAGS) -AC_SUBST(CUDA_LIBS) -AC_SUBST(CUDA_CFLAGS) - -# Setup custom zookeeper and zmq paths -AC_ARG_ENABLE(dist, - AS_HELP_STRING([--enable-dist],[enable dist support]), - [enable_dist="yes"],[enable_dist="no"]) -AM_CONDITIONAL(DDIST, test "$enable_dist" = "yes") -AC_ARG_WITH([dist], - [AS_HELP_STRING([--with-dist=PATH], [prefix where dist libraries,i.e. - zookeeper/zmq is installed])], - [dist_prefix=$withval], [dist_prefix="/usr/local"]) -if test "$dist_prefix" == "yes"; then - if test "$withval" == "yes"; then - dist_prefix="/usr/local" - fi -fi -if test x"$enable_dist" == x"yes"; then - AC_CHECK_LIB([zookeeper_mt], [main], [], [ - AC_MSG_ERROR([unable to find zookeeper library]) - ]) - AC_SEARCH_LIBS([zmq_ctx_new], [zmq], [], [ - AC_MSG_ERROR([unable to find zmq_ctx_new() function]) - ]) - DIST_CFLAGS="-I$dist_prefix/include" - DIST_LDFLAGS="-L$dist_prefix/lib" - DIST_LIBS="-lzookeeper_mt -lzmq" - LIBS="$LIBS $DIST_LIBS" - LDFLAGS="$LDFLAGS $DIST_LDFLAGS" - DEBUG+=" -DUSE_ZOOKEEPER -DUSE_ZMQ" - AC_DEFINE(DDIST,[1],[Defined if dist should be used]) -else - DIST_CFLAGS="" - DIST_LDFLAGS="" - DIST_LIBS="" -fi -AC_SUBST(DIST_CFLAGS) -AC_SUBST(DIST_LDFLAGS) -AC_SUBST(DIST_LIBS) - -# Setup custom lmdb paths -AC_ARG_ENABLE(lmdb, - AS_HELP_STRING([--enable-lmdb],[enable debug option]), - [enable_lmdb=yes],[enable_lmdb=no]) -AM_CONDITIONAL(LMDB, test "$enable_lmdb" = yes) -if test x"$enable_lmdb" = x"yes"; then - AC_SEARCH_LIBS([mdb_env_create], [lmdb], [], [ - AC_MSG_ERROR([unable to find mdb_env_create() function]) - ]) - AC_DEFINE(LMDB, 1, [Enable Option layer]) -fi - -# Setup custom libhdfs paths -AC_ARG_ENABLE(hdfs, - AS_HELP_STRING([--enable-hdfs],[enable hdfs support]), - [enable_hdfs=yes],[enable_hdfs=no]) -AM_CONDITIONAL(DHDFS, test "$enable_hdfs" = yes) -AC_ARG_WITH([libhdfs], - [AS_HELP_STRING([--with-libhdfs=PATH], [prefix where libhdfs is installed])], - [hdfs_prefix=$withval], [hdfs_prefix="/usr/local"]) -if test "$hdfs_prefix" == "yes"; then - if test "$withval" == "yes"; then - cudnn_prefix="/usr/local" - fi -fi -if test x"$enable_hdfs" != x"no"; then - HDFS_CFLAGS="-I$hdfs_prefix/include" - HDFS_LDFLAGS="-L$hdfs_prefix/lib" - HDFS_LIBS="-lhdfs3" - LIBS="$LIBS $HDFS_LIBS" - LDFLAGS="$LDFLAGS $HDFS_LDFLAGS" - DEBUG+=" -DUSE_HDFS" - AC_DEFINE(DHDFS,[1],[Defined if HDFS should be used]) - AC_CHECK_LIB([hdfs3], [main], [], [ - AC_MSG_ERROR([unable to find hdfs3 library]) - ]) -else - HDFS_CFLAGS="" - HDFS_LDFLAGS="" - HDFS_LIBS="" -fi -AC_SUBST(HDFS_CFLAGS) -AC_SUBST(HDFS_LDFLAGS) -AC_SUBST(HDFS_LIBS) - -# Setup for test args -AC_ARG_ENABLE(test, - AS_HELP_STRING([--enable-test],[enable singa test]), - [enable_test=yes],[enable_test=no]) -AM_CONDITIONAL(SINGATEST, test "$enable_test" = yes) -if test x"$enable_test" != x"no"; then - PROGS+='singatest test ' - LTLIBS+='libgtest.la ' -else - PROGS+='' - LTLIBS+='' -fi - -# Setup for debug args -AC_ARG_ENABLE(debug, - AS_HELP_STRING([--enable-debug],[enable debug mode]), - [enable_debug=yes],[enable_debug=no]) -AM_CONDITIONAL(SINGADEBUG, [test "$enable_debug" = yes]) -if test x"$enable_debug" == x"yes"; then - DEBUG+=' -g' -else - DEBUG+=' -O2' -fi - -# Setup for python args -AC_ARG_ENABLE(python, - [AS_HELP_STRING([--enable-python],[enable python binding])], - [enable_python=yes],[enable_python=no]) -AM_CONDITIONAL([PY], [test "enable_python" = "yes"]) -if test x"$enable_python" != x"no"; then - AC_CHECK_PROG(PY_CHECK,python,yes) - if test x"$PY_CHECK" != x"yes"; then - AC_MSG_ERROR([Cannot find command "python". Please intall before make.]) - else - PYLIBS="-lpython`python -V 2>&1 | awk '{print substr($2,1,3)}'`" - fi -fi -AC_SUBST(PYLIBS) - -# Setup for python paths -AC_ARG_WITH([python], - [AS_HELP_STRING([--with-python=PATH],[prefix where python is installed])], - [python_prefix=$withval],[python_prefix="/usr/include/python`python -V 2>&1 | awk '{print substr($2,1,3)}'`"]) -if test "$python_prefix" == "yes"; then - if test "$withval" == "yes"; then - python_prefix="/usr/include/python`python -V 2>&1 | awk '{print substr($2,1,3)}'`" - fi -fi -if test x"$enable_python" != x"no"; then - AC_MSG_CHECKING([Python.h in $python_prefix]) - if test -f "$python_prefix/Python.h"; then - AC_MSG_RESULT([Python.h found]) - AC_DEFINE_UNQUOTED([PYTHON_PATH], ["$python_prefix"], [Path to python binary]) - else - AC_MSG_RESULT([Python.h not found!]) - AC_MSG_FAILURE([Python.h was not found in $python_prefix]) - fi - #AC_DEFINE(PY,[1],[Defined if PY should be used]) - PY_PROGS='_driver.la ' - PYFLAGS="-I$python_prefix " -else - PY_PROGS='' - PYFLAGS='' -fi -AC_SUBST([PROGS]) -AC_SUBST([LTLIBS]) -AC_SUBST([DEBUG]) -AC_SUBST([PYFLAGS]) -AC_SUBST([PY_PROGS]) - -# Checks for header files. -AC_HEADER_STDC -AC_CHECK_HEADERS([fcntl.h malloc.h stdlib.h]) - -# Checks for typedefs, structures, and compiler characteristics. -AC_HEADER_STDBOOL -AC_C_CONST -AC_C_INLINE -AC_TYPE_SIZE_T -AC_C_VOLATILE - -# Checks for library functions. -AC_FUNC_MALLOC -AC_FUNC_STAT -AC_CHECK_FUNCS([gethostname memset mkdir pow sqrt]) -AC_OUTPUT(Makefile)
