Skip to content

Commit

Permalink
Disentangle cuda libraries from where they aren't needed
Browse files Browse the repository at this point in the history
Allow nvidia gdk to be installed in /usr/local/gdk
  • Loading branch information
diyessi committed Sep 29, 2015
1 parent 9b44e1f commit 04af449
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
13 changes: 9 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,10 @@ INCLUDEPATH:= Common/Include Math/Math MachineLearning/CNTK MachineLearning/CNTK
CPPFLAGS:= -D_POSIX_SOURCE -D_XOPEN_SOURCE=600 -D__USE_XOPEN2K
CXXFLAGS:= -msse3 -std=c++0x -std=c++11 -fopenmp -fpermissive -fPIC -Werror -Wno-error=literal-suffix
LIBPATH:=
# For everyone
LIBS:=
# Just the math library
CNTKMATH_LIBS:=
LDFLAGS:=

SEPARATOR = "=-----------------------------------------------------------="
Expand Down Expand Up @@ -85,7 +88,9 @@ endif
# Set up CUDA includes and libraries
INCLUDEPATH += $(CUDA_PATH)/include
LIBPATH += $(CUDA_PATH)/lib64
LIBS += -lcublas -lcudart -lcuda -lcurand -lcusparse -lnvidia-ml
# Profiling is currently enabled directly from cntk, rather than via the math library
LIBS += -lcudart
CNTKMATH_LIBS += -lcublas -lcudart -lcuda -lcurand -lcusparse -lnvidia-ml

else
DEVICE = cpu
Expand All @@ -96,14 +101,14 @@ endif
ifeq ("$(MATHLIB)","acml")
INCLUDEPATH += $(ACML_PATH)/include
LIBPATH += $(ACML_PATH)/lib
LIBS += -lacml -lm -lpthread
CNTKMATH_LIBS += -lacml -lm -lpthread
CPPFLAGS += -DUSE_ACML
endif

ifeq ("$(MATHLIB)","mkl")
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
CNTKMATH_LIBS += -lmkl_intel_lp64 -lmkl_intel_thread -lmkl_core -lm -liomp5 -lpthread
CPPFLAGS += -DUSE_MKL
endif

Expand Down Expand Up @@ -212,7 +217,7 @@ $(CNTKMATH_LIB): $(MATH_OBJ)
@echo $(SEPARATOR)
@echo creating $@ for $(ARCH) with build type $(BUILDTYPE)
@mkdir -p $(dir $@)
$(CXX) $(LDFLAGS) -shared $(patsubst %,-L%, $(LIBPATH) $(NVMLPATH)) $(patsubst %,$(RPATH)%, $(ORIGINDIR) $(LIBPATH)) -o $@ $^ $(LIBS) -fopenmp
$(CXX) $(LDFLAGS) -shared $(patsubst %,-L%, $(LIBPATH) $(NVMLPATH)) $(patsubst %,$(RPATH)%, $(ORIGINDIR) $(LIBPATH)) -o $@ $^ $(CNTKMATH_LIBS) $(LIBS) -fopenmp

########################################
# BinaryReader plugin
Expand Down
2 changes: 1 addition & 1 deletion configure
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ default_mkls=""
# NOTE: Will get compilation errors with cuda-6.0
default_cudas="cuda-7.5 cuda-7.0 cuda-6.5"
default_kaldis="kaldi-trunk"
default_gdks="."
default_gdks=". gdk/usr"

function default_paths ()
{
Expand Down

0 comments on commit 04af449

Please sign in to comment.