2015-06-24 03:56:45 +03:00
|
|
|
# Makefile for a Linux/GCC build of CNTK
|
|
|
|
#
|
|
|
|
# The Linux and Windows versions are not different branches, but rather build off the same
|
|
|
|
# source files, using different makefiles. This current makefile has the purpose of enabling
|
|
|
|
# work to make all sources compile with GCC, and also to check for GCC-compat regressions due to
|
|
|
|
# modifications which are currently done under Windows.
|
|
|
|
#
|
|
|
|
# This makefile will be extended/completed as we go.
|
|
|
|
#
|
2015-08-06 19:41:57 +03:00
|
|
|
# To use this Makefile, create a directory to build in and make a Config.make in the directory
|
|
|
|
# that provides
|
|
|
|
# ACML_PATH= path to ACML library installation
|
|
|
|
# only needed if MATHLIB=acml
|
|
|
|
# MKL_PATH= path to MKL library installation
|
|
|
|
# only needed if MATHLIB=mkl
|
|
|
|
# GDK_PATH= path to cuda gdk installation, so $(GDK_PATH)/include/nvidia/gdk/nvml.h exists
|
|
|
|
# defaults to /usr
|
|
|
|
# BUILDTYPE= One of release or debug
|
|
|
|
# defaults to release
|
|
|
|
# MATHLIB= One of acml or mkl
|
|
|
|
# defaults to acml
|
|
|
|
# CUDA_PATH= Path to CUDA
|
|
|
|
# If not specified, GPU will not be enabled
|
|
|
|
# KALDI_PATH= Path to Kaldi
|
|
|
|
# If not specified, Kaldi plugins will not be built
|
|
|
|
|
2015-08-07 20:03:27 +03:00
|
|
|
ifndef BUILD_TOP
|
|
|
|
BUILD_TOP=.
|
|
|
|
endif
|
|
|
|
|
|
|
|
ifneq ("$(wildcard $(BUILD_TOP)/Config.make)","")
|
|
|
|
include $(BUILD_TOP)/Config.make
|
2015-08-06 19:41:57 +03:00
|
|
|
else
|
2015-08-07 20:03:27 +03:00
|
|
|
$(error Cannot fine $(BUILD_TOP)/Config.make. Please see the README file for configuration instructions.)
|
2015-08-06 19:41:57 +03:00
|
|
|
endif
|
2015-06-24 03:56:45 +03:00
|
|
|
|
2015-08-06 19:41:57 +03:00
|
|
|
ifndef BUILDTYPE
|
|
|
|
$(info Defaulting BUILDTYPE=release)
|
|
|
|
BUILDTYPE=release
|
|
|
|
endif
|
2015-06-24 03:56:45 +03:00
|
|
|
|
2015-08-06 19:41:57 +03:00
|
|
|
ifndef MATHLIB
|
|
|
|
$(info DEFAULTING MATHLIB=acml)
|
|
|
|
MATHLIB=acml
|
|
|
|
endif
|
2015-06-24 03:56:45 +03:00
|
|
|
|
2015-08-06 01:46:31 +03:00
|
|
|
#### Configure based on options above
|
2015-06-24 03:56:45 +03:00
|
|
|
|
2015-08-06 19:41:57 +03:00
|
|
|
CXX = g++
|
2015-06-24 03:56:45 +03:00
|
|
|
|
2015-08-06 01:46:31 +03:00
|
|
|
INCLUDEPATH:= Common/Include Math/Math MachineLearning/CNTK
|
|
|
|
CPPFLAGS:= -D_POSIX_SOURCE -D_XOPEN_SOURCE=600 -D__USE_XOPEN2K
|
|
|
|
CXXFLAGS:= -msse3 -std=c++0x -std=c++11 -fopenmp -fpermissive -fPIC
|
|
|
|
LIBPATH:=
|
|
|
|
LIBS:=
|
|
|
|
LDFLAGS:=
|
2015-06-24 03:56:45 +03:00
|
|
|
|
2015-08-06 01:46:31 +03:00
|
|
|
SEPARATOR = "=-----------------------------------------------------------="
|
2015-08-06 19:41:57 +03:00
|
|
|
ALL:=
|
2015-08-06 01:46:31 +03:00
|
|
|
SRC:=
|
2015-06-24 03:56:45 +03:00
|
|
|
|
2015-08-06 19:41:57 +03:00
|
|
|
# Make sure all is the first (i.e. default) target, but we can't actually define it
|
|
|
|
# this early in the file, so let buildall do the work.
|
|
|
|
all : buildall
|
2015-06-24 03:56:45 +03:00
|
|
|
|
|
|
|
# Set up nvcc target architectures (will generate code to support them all, i.e. fat-binary)
|
|
|
|
GENCODE_SM20 := -gencode arch=compute_20,code=\"sm_20,compute_20\"
|
|
|
|
GENCODE_SM30 := -gencode arch=compute_30,code=\"sm_30,compute_30\"
|
|
|
|
GENCODE_SM35 := -gencode arch=compute_35,code=\"sm_35,compute_35\"
|
|
|
|
GENCODE_FLAGS := $(GENCODE_SM20) $(GENCODE_SM30) $(GENCODE_SM35)
|
|
|
|
|
2015-08-06 01:46:31 +03:00
|
|
|
# Set up basic nvcc options and add CUDA targets from above
|
|
|
|
CUFLAGS = -std=c++11 -D_POSIX_SOURCE -D_XOPEN_SOURCE=600 -D__USE_XOPEN2K -m 64 $(GENCODE_FLAGS)
|
2015-06-24 03:56:45 +03:00
|
|
|
|
2015-08-06 19:41:57 +03:00
|
|
|
ifdef CUDA_PATH
|
|
|
|
ifndef GDK_PATH
|
|
|
|
$(info defaulting GDK_PATH to /usr)
|
|
|
|
GDK_PATH=/usr
|
|
|
|
endif
|
|
|
|
|
2015-08-06 01:46:31 +03:00
|
|
|
DEVICE = gpu
|
2015-06-24 03:56:45 +03:00
|
|
|
|
2015-08-06 01:46:31 +03:00
|
|
|
NVCC = $(CUDA_PATH)/bin/nvcc
|
|
|
|
|
|
|
|
# This is a suggested/default location for NVML
|
|
|
|
INCLUDEPATH+=$(GDK_PATH)/include/nvidia/gdk
|
|
|
|
NVMLPATH=$(GDK_PATH)/src/gdk/nvml/lib
|
|
|
|
|
|
|
|
# Set up CUDA includes and libraries
|
|
|
|
INCLUDEPATH += $(CUDA_PATH)/include
|
|
|
|
LIBPATH += $(CUDA_PATH)/lib64
|
|
|
|
LIBS += -lcublas -lcudart -lcuda -lcurand -lcusparse -lnvidia-ml
|
2015-06-24 03:56:45 +03:00
|
|
|
|
|
|
|
else
|
2015-08-06 01:46:31 +03:00
|
|
|
DEVICE = cpu
|
|
|
|
|
|
|
|
CPPFLAGS +=-DCPUONLY
|
2015-06-24 03:56:45 +03:00
|
|
|
endif
|
|
|
|
|
2015-08-06 19:41:57 +03:00
|
|
|
ifeq ("$(MATHLIB)","acml")
|
2015-08-06 01:46:31 +03:00
|
|
|
INCLUDEPATH += $(ACML_PATH)/include
|
|
|
|
LIBPATH += $(ACML_PATH)/lib
|
|
|
|
LIBS += -lacml -lm -lpthread
|
|
|
|
CPPFLAGS += -DUSE_ACML
|
|
|
|
endif
|
2015-06-24 03:56:45 +03:00
|
|
|
|
2015-08-06 19:41:57 +03:00
|
|
|
ifeq ("$(MATHLIB)","mkl")
|
2015-08-06 01:46:31 +03:00
|
|
|
INCLUDEPATH += $(MKL_PATH)/mkl/include
|
|
|
|
LIBPATH += $(MKL_PATH)/compiler/lib/intel64 $(MKL_PATH)/mkl/lib/intel64 $(MKL_PATH)/compiler/lib/mic $(MKL_PATH)/mkl/lib/mic
|
|
|
|
LIBS += -lmkl_intel_lp64 -lmkl_intel_thread -lmkl_core -lm -liomp5 -lpthread
|
|
|
|
CPPFLAGS += -DUSE_MKL
|
|
|
|
endif
|
2015-06-24 03:56:45 +03:00
|
|
|
|
|
|
|
|
2015-08-06 19:41:57 +03:00
|
|
|
ifdef KALDI_PATH
|
2015-08-06 01:46:31 +03:00
|
|
|
########## Copy includes and defines from $(KALDI_PATH)/src/kaldi.mk ##########
|
|
|
|
FSTROOT = $(KALDI_PATH)/tools/openfst
|
|
|
|
ATLASINC = $(KALDI_PATH)/tools/ATLAS/include
|
2015-06-24 03:56:45 +03:00
|
|
|
|
2015-08-06 01:46:31 +03:00
|
|
|
INCLUDEPATH += $(KALDI_PATH)/src $(ATLASINC) $(FSTROOT)/include
|
|
|
|
CPPFLAGS+= -DKALDI_DOUBLEPRECISION=0 -DHAVE_POSIX_MEMALIGN -DHAVE_EXECINFO_H=1 -DHAVE_CXXABI_H -DHAVE_ATLAS -DHAVE_OPENFST_GE_10400
|
|
|
|
|
|
|
|
KALDI_LIBPATH += $(KALDI_PATH)/src/lib
|
|
|
|
KALDI_LIBS += -lkaldi-util -lkaldi-matrix -lkaldi-base -lkaldi-hmm -lkaldi-cudamatrix -lkaldi-nnet -lkaldi-lat
|
2015-06-24 03:56:45 +03:00
|
|
|
endif
|
|
|
|
|
2015-08-06 19:41:57 +03:00
|
|
|
ifeq ("$(BUILDTYPE)","debug")
|
2015-08-06 01:46:31 +03:00
|
|
|
CXXFLAGS += -g
|
|
|
|
CUFLAGS += -O0 -G -lineinfo
|
2015-08-06 19:41:57 +03:00
|
|
|
endif
|
|
|
|
|
|
|
|
ifeq ("$(BUILDTYPE)","release")
|
2015-08-06 01:46:31 +03:00
|
|
|
CXXFLAGS += -O4
|
|
|
|
CUFLAGS += -O3 -use_fast_math -lineinfo
|
2015-06-24 03:56:45 +03:00
|
|
|
endif
|
|
|
|
|
2015-08-06 01:46:31 +03:00
|
|
|
#######
|
|
|
|
|
2015-08-07 20:03:27 +03:00
|
|
|
OBJDIR:= $(BUILD_TOP)/.build
|
|
|
|
BINDIR:= $(BUILD_TOP)/bin
|
|
|
|
LIBDIR:= $(BUILD_TOP)/lib
|
2015-08-06 22:28:56 +03:00
|
|
|
|
2015-08-07 20:03:27 +03:00
|
|
|
ORIGINLIBDIR:='$$ORIGIN/../lib'
|
|
|
|
ORIGINDIR:='$$ORIGIN'
|
2015-08-06 01:46:31 +03:00
|
|
|
|
|
|
|
CNTKMATH:=cntkmath
|
|
|
|
|
2015-08-06 19:41:57 +03:00
|
|
|
########################################
|
|
|
|
# Math library
|
|
|
|
########################################
|
|
|
|
|
2015-08-06 01:46:31 +03:00
|
|
|
# Define all sources that need to be built
|
|
|
|
COMMON_SRC =\
|
|
|
|
Common/BestGpu.cpp \
|
|
|
|
Common/ConfigFile.cpp \
|
|
|
|
Common/DataReader.cpp \
|
|
|
|
Common/DataWriter.cpp \
|
|
|
|
Common/Eval.cpp \
|
|
|
|
Common/File.cpp \
|
|
|
|
Common/TimerUtility.cpp \
|
|
|
|
Common/fileutil.cpp \
|
|
|
|
|
|
|
|
MATH_SRC =\
|
|
|
|
Math/Math/CPUMatrix.cpp \
|
|
|
|
Math/Math/CPUSparseMatrix.cpp \
|
|
|
|
Math/Math/Matrix.cpp \
|
|
|
|
|
2015-08-06 19:41:57 +03:00
|
|
|
ifdef CUDA_PATH
|
2015-08-06 01:46:31 +03:00
|
|
|
MATH_SRC +=\
|
|
|
|
Math/Math/GPUMatrix.cu \
|
|
|
|
Math/Math/GPUMatrixCUDAKernels.cu \
|
|
|
|
Math/Math/GPUSparseMatrix.cu \
|
|
|
|
Math/Math/GPUWatcher.cu \
|
2015-07-01 23:15:29 +03:00
|
|
|
|
|
|
|
else
|
2015-08-06 01:46:31 +03:00
|
|
|
MATH_SRC +=\
|
|
|
|
Math/Math/NoGPU.cpp
|
|
|
|
|
2015-07-01 23:15:29 +03:00
|
|
|
endif
|
|
|
|
|
2015-08-06 01:46:31 +03:00
|
|
|
MATH_SRC+=$(COMMON_SRC)
|
|
|
|
|
|
|
|
MATH_OBJ := $(patsubst %.cu, $(OBJDIR)/%.o, $(patsubst %.cpp, $(OBJDIR)/%.o, $(MATH_SRC)))
|
|
|
|
|
|
|
|
CNTKMATH_LIB:= $(LIBDIR)/lib$(CNTKMATH).so
|
2015-08-06 19:41:57 +03:00
|
|
|
ALL += $(CNTKMATH_LIB)
|
2015-08-06 01:46:31 +03:00
|
|
|
SRC+=$(MATH_SRC)
|
|
|
|
|
|
|
|
RPATH=-Wl,-rpath,
|
|
|
|
|
|
|
|
$(CNTKMATH_LIB): $(MATH_OBJ)
|
|
|
|
@echo $(SEPARATOR)
|
|
|
|
@echo creating $@ for $(ARCH) with build type $(BUILDTYPE)
|
|
|
|
@mkdir -p $(dir $@)
|
2015-08-06 19:41:57 +03:00
|
|
|
$(CXX) $(LDFLAGS) -shared $(patsubst %,-L%, $(LIBPATH) $(NVMLPATH)) $(patsubst %,$(RPATH)%, $(ORIGINDIR) $(LIBPATH)) -o $@ $^ $(LIBS) -fopenmp
|
|
|
|
|
|
|
|
########################################
|
|
|
|
# BinaryReader plugin
|
|
|
|
########################################
|
2015-08-06 01:46:31 +03:00
|
|
|
|
|
|
|
|
|
|
|
BINARYREADER_SRC =\
|
|
|
|
DataReader/BinaryReader/BinaryFile.cpp \
|
|
|
|
DataReader/BinaryReader/BinaryReader.cpp \
|
|
|
|
DataReader/BinaryReader/BinaryWriter.cpp \
|
|
|
|
|
2015-06-24 03:56:45 +03:00
|
|
|
BINARYREADER_OBJ := $(patsubst %.cpp, $(OBJDIR)/%.o, $(BINARYREADER_SRC))
|
|
|
|
|
2015-08-06 01:46:31 +03:00
|
|
|
BINARY_READER:= $(LIBDIR)/BinaryReader.so
|
2015-06-24 03:56:45 +03:00
|
|
|
|
2015-08-06 19:41:57 +03:00
|
|
|
#ALL += $(BINARY_READER)
|
2015-08-06 01:46:31 +03:00
|
|
|
#SRC+=$(BINARYREADER_SRC)
|
2015-06-24 03:56:45 +03:00
|
|
|
|
2015-08-06 01:46:31 +03:00
|
|
|
$(BINARY_READER): $(BINARYREADER_OBJ) | $(CNTKMATH_LIB)
|
2015-06-24 03:56:45 +03:00
|
|
|
@echo $(SEPARATOR)
|
2015-08-06 19:41:57 +03:00
|
|
|
$(CXX) $(LDFLAGS) -shared $(patsubst %,-L%, $(LIBDIR) $(LIBPATH)) $(patsubst %,$(RPATH)%, $(ORIGINDIR) $(LIBPATH)) -o $@ $^ -l$(CNTKMATH)
|
|
|
|
|
|
|
|
########################################
|
|
|
|
# HTKMLFReader plugin
|
|
|
|
########################################
|
|
|
|
|
2015-08-06 01:46:31 +03:00
|
|
|
|
|
|
|
HTKMLFREADER_SRC =\
|
|
|
|
DataReader/HTKMLFReader_linux/DataReader.cpp \
|
|
|
|
DataReader/HTKMLFReader_linux/DataWriter.cpp \
|
|
|
|
DataReader/HTKMLFReader_linux/HTKMLFReader.cpp \
|
|
|
|
DataReader/HTKMLFReader_linux/HTKMLFWriter.cpp \
|
|
|
|
|
|
|
|
HTKMLREADER_OBJ := $(patsubst %.cpp, $(OBJDIR)/%.o, $(HTKMLFREADER_SRC))
|
2015-06-24 03:56:45 +03:00
|
|
|
|
2015-08-06 01:46:31 +03:00
|
|
|
HTKMLREADER:=$(LIBDIR)/HTKMLFReader.so
|
2015-08-06 19:41:57 +03:00
|
|
|
ALL+=$(HTKMLREADER)
|
2015-08-06 01:46:31 +03:00
|
|
|
SRC+=$(HTKMLREADER_SRC)
|
|
|
|
|
|
|
|
$(LIBDIR)/HTKMLFReader.so: $(HTKMLREADER_OBJ) | $(CNTKMATH_LIB)
|
2015-06-24 03:56:45 +03:00
|
|
|
@echo $(SEPARATOR)
|
2015-08-06 19:41:57 +03:00
|
|
|
$(CXX) $(LDFLAGS) -shared $(patsubst %,-L%, $(LIBDIR) $(LIBPATH)) $(patsubst %,$(RPATH)%, $(ORIGINDIR) $(LIBPATH)) -o $@ $^ -l$(CNTKMATH)
|
|
|
|
|
|
|
|
########################################
|
|
|
|
# LMSequenceReader plugin
|
|
|
|
########################################
|
2015-08-06 01:46:31 +03:00
|
|
|
|
|
|
|
LMSEQUENCEREADER_SRC =\
|
|
|
|
DataReader/LMSequenceReader/Exports.cpp \
|
|
|
|
DataReader/LMSequenceReader/SequenceParser.cpp \
|
|
|
|
DataReader/LMSequenceReader/SequenceReader.cpp \
|
|
|
|
|
|
|
|
LMSEQUENCEREADER_OBJ := $(patsubst %.cpp, $(OBJDIR)/%.o, $(LMSEQUENCEREADER_SRC))
|
2015-06-24 03:56:45 +03:00
|
|
|
|
2015-08-06 01:46:31 +03:00
|
|
|
LMSEQUENCEREADER:= $(LIBDIR)/LMSequenceReader.so
|
2015-08-06 19:41:57 +03:00
|
|
|
ALL+=$(LMSEQUENCEREADER)
|
2015-08-06 01:46:31 +03:00
|
|
|
SRC+=$(LMSEQUENCEREADER_SRC)
|
|
|
|
|
|
|
|
$(LMSEQUENCEREADER): $(LMSEQUENCEREADER_OBJ) | $(CNTKMATH_LIB)
|
2015-06-24 03:56:45 +03:00
|
|
|
@echo $(SEPARATOR)
|
2015-08-06 19:41:57 +03:00
|
|
|
$(CXX) $(LDFLAGS) -shared $(patsubst %,-L%, $(LIBDIR) $(LIBPATH)) $(patsubst %,$(RPATH)%, $(ORIGINDIR) $(LIBPATH)) -o $@ $^ -l$(CNTKMATH)
|
2015-08-06 01:46:31 +03:00
|
|
|
|
2015-08-06 19:41:57 +03:00
|
|
|
########################################
|
|
|
|
# LUSequenceReader plugin
|
|
|
|
########################################
|
2015-08-06 01:46:31 +03:00
|
|
|
|
|
|
|
LUSEQUENCEREADER_SRC =\
|
|
|
|
DataReader/LUSequenceReader/Exports.cpp \
|
|
|
|
DataReader/LUSequenceReader/LUSequenceParser.cpp \
|
|
|
|
DataReader/LUSequenceReader/LUSequenceReader.cpp \
|
|
|
|
|
|
|
|
LUSEQUENCEREADER_OBJ := $(patsubst %.cpp, $(OBJDIR)/%.o, $(LUSEQUENCEREADER_SRC))
|
2015-06-24 03:56:45 +03:00
|
|
|
|
2015-08-06 01:46:31 +03:00
|
|
|
LUSEQUENCEREADER:=$(LIBDIR)/LUSequenceReader.so
|
2015-08-06 19:41:57 +03:00
|
|
|
ALL+=$(LUSEQUENCEREADER)
|
2015-08-06 01:46:31 +03:00
|
|
|
SRC+=$(LUSEQUENCEREADER_SRC)
|
|
|
|
|
|
|
|
$(LUSEQUENCEREADER): $(LUSEQUENCEREADER_OBJ) | $(CNTKMATH_LIB)
|
2015-06-24 03:56:45 +03:00
|
|
|
@echo $(SEPARATOR)
|
2015-08-06 19:41:57 +03:00
|
|
|
$(CXX) $(LDFLAGS) -shared $(patsubst %,-L%, $(LIBDIR) $(LIBPATH)) $(patsubst %,$(RPATH)%, $(ORIGINDIR) $(LIBPATH)) -o $@ $^ -l$(CNTKMATH)
|
2015-08-06 01:46:31 +03:00
|
|
|
|
2015-08-06 19:41:57 +03:00
|
|
|
########################################
|
|
|
|
# UCIFastReader plugin
|
|
|
|
########################################
|
2015-08-06 01:46:31 +03:00
|
|
|
|
|
|
|
UCIFASTREADER_SRC =\
|
|
|
|
DataReader/UCIFastReader/Exports.cpp \
|
|
|
|
DataReader/UCIFastReader/UCIFastReader.cpp \
|
|
|
|
DataReader/UCIFastReader/UCIParser.cpp \
|
|
|
|
|
|
|
|
UCIFASTREADER_OBJ := $(patsubst %.cpp, $(OBJDIR)/%.o, $(UCIFASTREADER_SRC))
|
2015-06-24 03:56:45 +03:00
|
|
|
|
2015-08-06 01:46:31 +03:00
|
|
|
UCIFASTREADER:=$(LIBDIR)/UCIFastReader.so
|
2015-08-06 19:41:57 +03:00
|
|
|
ALL += $(UCIFASTREADER)
|
2015-08-06 01:46:31 +03:00
|
|
|
SRC+=$(UCIFASTREADER_SRC)
|
|
|
|
|
|
|
|
$(UCIFASTREADER): $(UCIFASTREADER_OBJ) | $(CNTKMATH_LIB)
|
2015-06-24 03:56:45 +03:00
|
|
|
@echo $(SEPARATOR)
|
2015-08-06 19:41:57 +03:00
|
|
|
$(CXX) $(LDFLAGS) -shared $(patsubst %,-L%, $(LIBDIR) $(LIBPATH)) $(patsubst %,$(RPATH)%, $(ORIGINDIR) $(LIBPATH)) -o $@ $^ -l$(CNTKMATH)
|
2015-08-06 01:46:31 +03:00
|
|
|
|
2015-08-06 19:41:57 +03:00
|
|
|
########################################
|
|
|
|
# Kaldi plugins
|
|
|
|
########################################
|
|
|
|
|
|
|
|
ifdef KALDI_PATH
|
2015-08-06 01:46:31 +03:00
|
|
|
KALDIREADER_SRC = \
|
|
|
|
DataReader/KaldiReader/DataReader.cpp \
|
|
|
|
DataReader/KaldiReader/DataWriter.cpp \
|
|
|
|
DataReader/KaldiReader/HTKMLFReader.cpp \
|
|
|
|
DataReader/KaldiReader/HTKMLFWriter.cpp \
|
|
|
|
|
|
|
|
KALDIREADER_OBJ := $(patsubst %.cpp, $(OBJDIR)/%.o, $(KALDIREADER_SRC))
|
2015-06-24 03:56:45 +03:00
|
|
|
|
2015-08-06 01:46:31 +03:00
|
|
|
KALDIREADER:=$(LIBDIR)/KaldiReader.so
|
2015-08-06 19:41:57 +03:00
|
|
|
ALL+=$(KALDIREADER)
|
2015-08-06 01:46:31 +03:00
|
|
|
SRC+=$(KALDIREADER_SRC)
|
|
|
|
|
|
|
|
$(KALDIREADER): $(KALDIREADER_OBJ)
|
2015-06-24 03:56:45 +03:00
|
|
|
@echo $(SEPARATOR)
|
2015-08-06 19:41:57 +03:00
|
|
|
$(CXX) $(LDFLAGS) -shared $(patsubst %,-L%, $(LIBDIR) $(KALDI_LIBPATH) $(LIBPATH)) $(patsubst %,$(RPATH)%, $(ORIGINDIR) $(KALDI_LIBPATH) $(LIBPATH)) -o $@ $^ -l$(CNTKMATH) $(KALDI_LIBS)
|
2015-08-06 01:46:31 +03:00
|
|
|
|
|
|
|
KALDIWRITER:=$(LIBDIR)/KaldiWriter.so
|
2015-08-06 19:41:57 +03:00
|
|
|
ALL+=$(KALDIWRITER)
|
2015-06-24 03:56:45 +03:00
|
|
|
|
2015-08-06 01:46:31 +03:00
|
|
|
$(KALDIWRITER): $(KALDIREADER_OBJ)
|
2015-06-24 03:56:45 +03:00
|
|
|
@echo $(SEPARATOR)
|
2015-08-06 19:41:57 +03:00
|
|
|
$(CXX) $(LDFLAGS) -shared $(patsubst %,-L%, $(LIBDIR) $(LIBPATH)) $(patsubst %,$(RPATH)%, $(ORIGINDIR) $(LIBPATH)) -o $@ $^ -l$(CNTKMATH)
|
2015-08-06 01:46:31 +03:00
|
|
|
|
|
|
|
|
|
|
|
KALDI2READER_SRC = \
|
|
|
|
DataReader/Kaldi2Reader/DataReader.cpp \
|
|
|
|
DataReader/Kaldi2Reader/DataWriter.cpp \
|
|
|
|
DataReader/Kaldi2Reader/HTKMLFReader.cpp \
|
|
|
|
DataReader/Kaldi2Reader/HTKMLFWriter.cpp \
|
|
|
|
DataReader/Kaldi2Reader/KaldiSequenceTrainingDerivative.cpp \
|
|
|
|
DataReader/Kaldi2Reader/UtteranceDerivativeBuffer.cpp \
|
|
|
|
|
|
|
|
KALDI2READER_OBJ := $(patsubst %.cpp, $(OBJDIR)/%.o, $(KALDI2READER_SRC))
|
2015-07-01 23:15:29 +03:00
|
|
|
|
2015-08-06 01:46:31 +03:00
|
|
|
KALDI2READER:=$(LIBDIR)/Kaldi2Reader.so
|
2015-08-06 19:41:57 +03:00
|
|
|
ALL+=$(KALDI2READER)
|
2015-08-06 01:46:31 +03:00
|
|
|
SRC+=$(KALDI2READER_SRC)
|
|
|
|
|
|
|
|
$(KALDI2READER): $(KALDI2READER_OBJ)
|
|
|
|
@echo $(SEPARATOR)
|
2015-08-06 19:41:57 +03:00
|
|
|
$(CXX) $(LDFLAGS) -shared $(patsubst %,-L%, $(LIBDIR) $(KALDI_LIBPATH) $(LIBPATH)) $(patsubst %,$(RPATH)%, $(ORIGINDIR) $(KALDI_LIBPATH) $(LIBPATH)) -o $@ $^ -l$(CNTKMATH) $(KALDI_LIBS)
|
2015-08-06 01:46:31 +03:00
|
|
|
|
|
|
|
endif
|
|
|
|
|
2015-08-06 19:41:57 +03:00
|
|
|
########################################
|
|
|
|
# cntk
|
|
|
|
########################################
|
|
|
|
|
|
|
|
CNTK_SRC =\
|
2015-08-06 01:46:31 +03:00
|
|
|
MachineLearning/CNTK/CNTK.cpp \
|
|
|
|
MachineLearning/CNTK/ComputationNode.cpp \
|
|
|
|
MachineLearning/CNTK/ModelEditLanguage.cpp \
|
|
|
|
MachineLearning/CNTK/NetworkDescriptionLanguage.cpp \
|
|
|
|
MachineLearning/CNTK/Profiler.cpp \
|
|
|
|
MachineLearning/CNTK/SimpleNetworkBuilder.cpp \
|
|
|
|
MachineLearning/CNTK/tests.cpp \
|
|
|
|
MachineLearning/CNTKEval/CNTKEval.cpp \
|
|
|
|
|
2015-08-06 19:41:57 +03:00
|
|
|
CNTK_OBJ := $(patsubst %.cpp, $(OBJDIR)/%.o, $(CNTK_SRC))
|
2015-08-06 01:46:31 +03:00
|
|
|
|
|
|
|
CNTK:=$(BINDIR)/cntk
|
2015-08-06 19:41:57 +03:00
|
|
|
ALL+=$(CNTK)
|
2015-08-06 01:46:31 +03:00
|
|
|
|
2015-08-06 19:41:57 +03:00
|
|
|
$(CNTK): $(CNTK_OBJ) | $(CNTKMATH_LIB)
|
2015-07-01 23:15:29 +03:00
|
|
|
@echo $(SEPARATOR)
|
|
|
|
@mkdir -p $(dir $@)
|
2015-08-06 01:46:31 +03:00
|
|
|
@echo building output for $(ARCH) with build type $(BUILDTYPE)
|
2015-08-06 19:41:57 +03:00
|
|
|
$(CXX) $(LDFLAGS) $(patsubst %,-L%, $(LIBDIR) $(LIBPATH)) $(patsubst %,$(RPATH)%, $(ORIGINLIBDIR) $(LIBPATH)) -o $@ $^ $(LIBS) -l$(CNTKMATH) -fopenmp
|
|
|
|
|
|
|
|
########################################
|
|
|
|
# General compile and dependency rules
|
|
|
|
########################################
|
2015-08-06 01:46:31 +03:00
|
|
|
|
|
|
|
VPATH := $(sort $(dir $(SRC)))
|
|
|
|
|
|
|
|
# Define object files
|
|
|
|
OBJ := $(patsubst %.cu, $(OBJDIR)/%.o, $(patsubst %.cpp, $(OBJDIR)/%.o, $(SRC)))
|
|
|
|
|
|
|
|
# C++ include dependencies generated by -MF compiler option
|
|
|
|
DEP := $(patsubst %.o, %.d, $(OBJ))
|
2015-06-24 03:56:45 +03:00
|
|
|
|
|
|
|
# Include all C++ dependencies, like header files, to ensure that a change in those
|
|
|
|
# will result in the rebuild.
|
|
|
|
-include ${DEP}
|
|
|
|
|
|
|
|
$(OBJDIR)/%.o : %.cu Makefile
|
|
|
|
@echo $(SEPARATOR)
|
|
|
|
@echo creating $@ for $(ARCH) with build type $(BUILDTYPE)
|
|
|
|
@mkdir -p $(dir $@)
|
2015-08-06 01:46:31 +03:00
|
|
|
$(NVCC) -c $< -o $@ $(CUFLAGS) $(INCLUDEPATH:%=-I%) -Xcompiler -fPIC
|
2015-06-24 03:56:45 +03:00
|
|
|
|
|
|
|
$(OBJDIR)/%.o : %.cpp Makefile
|
|
|
|
@echo $(SEPARATOR)
|
|
|
|
@echo creating $@ for $(ARCH) with build type $(BUILDTYPE)
|
|
|
|
@mkdir -p $(dir $@)
|
2015-08-06 19:41:57 +03:00
|
|
|
$(CXX) -c $< -o $@ $(CPPFLAGS) $(CXXFLAGS) $(INCLUDEPATH:%=-I%) -MD -MP -MF ${@:.o=.d}
|
2015-06-24 03:56:45 +03:00
|
|
|
|
2015-08-06 19:41:57 +03:00
|
|
|
.PHONY: clean buildall all
|
2015-06-24 03:56:45 +03:00
|
|
|
|
|
|
|
clean:
|
|
|
|
@echo $(SEPARATOR)
|
|
|
|
@rm -rf $(OBJDIR)
|
2015-08-06 19:41:57 +03:00
|
|
|
@rm -rf $(ALL)
|
2015-06-24 03:56:45 +03:00
|
|
|
@echo finished cleaning up the project
|
2015-08-06 01:46:31 +03:00
|
|
|
|
2015-08-06 19:41:57 +03:00
|
|
|
buildall : $(ALL)
|
2015-08-06 01:46:31 +03:00
|
|
|
@echo $(SEPARATOR)
|
|
|
|
@echo finished building for $(ARCH) with build type $(BUILDTYPE)
|