Skip to content

Commit

Permalink
Revert "use mkl sparse matrix to improve performance (apache#14492)" (a…
Browse files Browse the repository at this point in the history
…pache#14806)

This reverts commit c437d5b.
  • Loading branch information
pengzhao-intel authored and Rohit Kumar Srivastava committed May 14, 2019
1 parent d400a61 commit a315551
Show file tree
Hide file tree
Showing 6 changed files with 3 additions and 175 deletions.
21 changes: 0 additions & 21 deletions 3rdparty/sparse-matrix/Makefile

This file was deleted.

45 changes: 0 additions & 45 deletions 3rdparty/sparse-matrix/sparse_matrix.cc

This file was deleted.

48 changes: 0 additions & 48 deletions 3rdparty/sparse-matrix/sparse_matrix.h

This file was deleted.

34 changes: 0 additions & 34 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,6 @@ ifeq ($(USE_MKLDNN), 1)
LDFLAGS += -L$(MKLDNNROOT)/lib -lmkldnn -Wl,-rpath,'$${ORIGIN}'
endif


# setup opencv
ifeq ($(USE_OPENCV), 1)
CFLAGS += -DMXNET_USE_OPENCV=1
Expand Down Expand Up @@ -416,14 +415,6 @@ ifeq ($(USE_DIST_KVSTORE), 1)
LDFLAGS += $(PS_LDFLAGS_A)
endif

#sparse-matrix
ifeq ($(USE_BLAS), mkl)
SPARSE_MATRIX_DIR = $(ROOTDIR)/3rdparty/sparse-matrix
LIB_DEP += $(SPARSE_MATRIX_DIR)/libsparse_matrix.so
CFLAGS += -I$(SPARSE_MATRIX_DIR)
LDFLAGS += -L$(SPARSE_MATRIX_DIR) -lsparse_matrix -Wl,-rpath,'$${ORIGIN}'
endif

.PHONY: clean all extra-packages test lint docs clean_all rcpplint rcppexport roxygen\
cython2 cython3 cython cyclean

Expand Down Expand Up @@ -561,30 +552,11 @@ ifeq ($(UNAME_S), Darwin)
endif
endif

ifeq ($(USE_BLAS), mkl)
ifeq ($(UNAME_S), Darwin)
install_name_tool -change '@rpath/libsparse_matrix.dylib' '@loader_path/libsparse_matrix.dylib' $@
endif
endif

$(PS_PATH)/build/libps.a: PSLITE

PSLITE:
$(MAKE) CXX="$(CXX)" DEPS_PATH="$(DEPS_PATH)" -C $(PS_PATH) ps

ifeq ($(USE_BLAS), mkl)
$(SPARSE_MATRIX_DIR)/libsparse_matrix.so: SPARSE_MATRIX

SPARSE_MATRIX:
ifeq ($(USE_INTEL_PATH), NONE)
$(MAKE) -C $(SPARSE_MATRIX_DIR)
else
$(MAKE) -C $(SPARSE_MATRIX_DIR) USE_INTEL_PATH=$(USE_INTEL_PATH)
endif
mkdir -p $(ROOTDIR)/lib
cp $(SPARSE_MATRIX_DIR)/libsparse_matrix.so $(ROOTDIR)/lib/
endif

$(DMLC_CORE)/libdmlc.a: DMLCCORE

DMLCCORE:
Expand Down Expand Up @@ -661,10 +633,6 @@ rpkg:
cp -rf lib/libmklml_intel.so R-package/inst/libs; \
fi

if [ -e "lib/libsparse_matrix.so" ]; then \
cp -rf lib/libsparse_matrix.so R-package/inst/libs; \
fi

mkdir -p R-package/inst/include
cp -rl include/* R-package/inst/include
Rscript -e "if(!require(devtools)){install.packages('devtools', repo = 'https://cloud.r-project.org/')}"
Expand Down Expand Up @@ -710,7 +678,6 @@ clean: rclean cyclean $(EXTRA_PACKAGES_CLEAN)
(cd scala-package && mvn clean) || true
cd $(DMLC_CORE); $(MAKE) clean; cd -
cd $(PS_PATH); $(MAKE) clean; cd -
cd $(SPARSE_MATRIX_DIR); $(MAKE) clean; cd -
cd $(NNVM_PATH); $(MAKE) clean; cd -
cd $(AMALGAMATION_PATH); $(MAKE) clean; cd -
$(RM) -r $(patsubst %, %/*.d, $(EXTRA_OPERATORS)) $(patsubst %, %/*/*.d, $(EXTRA_OPERATORS))
Expand All @@ -721,7 +688,6 @@ clean: rclean mkldnn_clean cyclean testclean $(EXTRA_PACKAGES_CLEAN)
(cd scala-package && mvn clean) || true
cd $(DMLC_CORE); $(MAKE) clean; cd -
cd $(PS_PATH); $(MAKE) clean; cd -
cd $(SPARSE_MATRIX_DIR); $(MAKE) clean; cd -
cd $(NNVM_PATH); $(MAKE) clean; cd -
cd $(AMALGAMATION_PATH); $(MAKE) clean; cd -
endif
Expand Down
2 changes: 1 addition & 1 deletion ci/jenkins/Jenkins_steps.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ mx_cmake_lib = 'build/libmxnet.so, build/libmxnet.a, build/3rdparty/dmlc-core/li
// mxnet cmake libraries, in cmake builds we do not produce a libnvvm static library by default.
mx_cmake_lib_debug = 'build/libmxnet.so, build/libmxnet.a, build/3rdparty/dmlc-core/libdmlc.a, build/tests/mxnet_unit_tests'
mx_cmake_mkldnn_lib = 'build/libmxnet.so, build/libmxnet.a, build/3rdparty/dmlc-core/libdmlc.a, build/tests/mxnet_unit_tests, build/3rdparty/openmp/runtime/src/libomp.so, build/3rdparty/mkldnn/src/libmkldnn.so.0'
mx_mkldnn_lib = 'lib/libmxnet.so, lib/libmxnet.a, lib/libiomp5.so, lib/libmkldnn.so.0, lib/libmklml_intel.so, lib/libsparse_matrix.so, 3rdparty/dmlc-core/libdmlc.a, 3rdparty/tvm/nnvm/lib/libnnvm.a'
mx_mkldnn_lib = 'lib/libmxnet.so, lib/libmxnet.a, lib/libiomp5.so, lib/libmkldnn.so.0, lib/libmklml_intel.so, 3rdparty/dmlc-core/libdmlc.a, 3rdparty/tvm/nnvm/lib/libnnvm.a'
mx_tensorrt_lib = 'build/libmxnet.so, lib/libnvonnxparser_runtime.so.0, lib/libnvonnxparser.so.0, lib/libonnx_proto.so, lib/libonnx.so'
mx_lib_cpp_examples = 'lib/libmxnet.so, lib/libmxnet.a, 3rdparty/dmlc-core/libdmlc.a, 3rdparty/tvm/nnvm/lib/libnnvm.a, 3rdparty/ps-lite/build/libps.a, deps/lib/libprotobuf-lite.a, deps/lib/libzmq.a, build/cpp-package/example/*'
mx_lib_cpp_examples_cpu = 'build/libmxnet.so, build/cpp-package/example/*'
Expand Down
28 changes: 2 additions & 26 deletions src/operator/tensor/dot-inl.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,7 @@
#ifdef __CUDACC__
#include "./dot-inl.cuh"
#endif // __CUDACC__
#if (MSHADOW_USE_MKL == 1)
#include "sparse_matrix.h"
#endif

namespace mxnet {
namespace op {

Expand Down Expand Up @@ -777,35 +775,13 @@ inline void DotCsrDnsDnsImpl(const OpContext& ctx,
}

using nnvm::dim_t;
#if (MSHADOW_USE_MKL == 1)
TShape lhs_shape = lhs.shape();
TShape rhs_shape = rhs.shape_;
#endif

const TBlob data_l = lhs.data();
const TBlob indptr_l = lhs.aux_data(csr::kIndPtr);
const TBlob col_idx_l = lhs.aux_data(csr::kIdx);
const TBlob& data_r = rhs;
const TBlob data_out = *ret;

#if (MSHADOW_USE_MKL == 1)
if (data_l.type_flag_ == mshadow::kFloat32
&& indptr_l.type_flag_ == mshadow::kInt64
&& col_idx_l.type_flag_ == mshadow::kInt64
&& !trans_lhs) {
bool ret = mkl_DotCsrDnsDns(static_cast<SP_INT64*>(indptr_l.dptr_),
static_cast<SP_INT64*>(col_idx_l.dptr_),
data_l.dptr<float>(),
data_r.dptr<float>(),
data_out.dptr<float>(),
lhs_shape[0],
lhs_shape[1],
rhs_shape[1]);
if (ret) {
return;
}
}
#endif

MSHADOW_SGL_DBL_TYPE_SWITCH(data_l.type_flag_, DType, { // data type
MSHADOW_IDX_TYPE_SWITCH(indptr_l.type_flag_, IType, { // indptr type
MSHADOW_IDX_TYPE_SWITCH(col_idx_l.type_flag_, CType, { // col idx type
Expand Down

0 comments on commit a315551

Please sign in to comment.