Repository: systemml Updated Branches: refs/heads/master 6c468f98b -> 525381d51
[SYSTEMML-2105] Support single-precision conv2d with MKL Closes #723. Project: http://git-wip-us.apache.org/repos/asf/systemml/repo Commit: http://git-wip-us.apache.org/repos/asf/systemml/commit/525381d5 Tree: http://git-wip-us.apache.org/repos/asf/systemml/tree/525381d5 Diff: http://git-wip-us.apache.org/repos/asf/systemml/diff/525381d5 Branch: refs/heads/master Commit: 525381d51a9df8a2613f699cad2538d2ddf1f759 Parents: 6c468f9 Author: Niketan Pansare <npan...@us.ibm.com> Authored: Fri Feb 2 18:30:41 2018 -0800 Committer: Matthias Boehm <mboe...@gmail.com> Committed: Fri Feb 2 18:30:41 2018 -0800 ---------------------------------------------------------------------- src/main/cpp/CMakeLists.txt | 2 +- .../cpp/lib/libsystemml_mkl-Linux-x86_64.so | Bin 27504 -> 32048 bytes .../lib/libsystemml_openblas-Linux-x86_64.so | Bin 36136 -> 31288 bytes src/main/cpp/libmatrixdnn.cpp | 3 ++- src/main/cpp/libmatrixmult.cpp | 5 ++++- src/main/cpp/libmatrixmult.h | 12 ++++++------ 6 files changed, 13 insertions(+), 9 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/systemml/blob/525381d5/src/main/cpp/CMakeLists.txt ---------------------------------------------------------------------- diff --git a/src/main/cpp/CMakeLists.txt b/src/main/cpp/CMakeLists.txt index 04e12b4..5dd2720 100644 --- a/src/main/cpp/CMakeLists.txt +++ b/src/main/cpp/CMakeLists.txt @@ -25,7 +25,7 @@ set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake/") # Options to Use OpenBLAS or Intel MKL option(USE_OPEN_BLAS "Whether to use OpenBLAS (Defaults to compiling with Intel MKL, if both set, MKL has priority)" OFF) -option(USE_INTEL_MKL "Whether to use Intel MKL (Defaults to compiling with Intel MKL)" ON) +option(USE_INTEL_MKL "Whether to use Intel MKL (Defaults to compiling with Intel MKL)" OFF) # Build a shared libraray add_library(systemml SHARED libmatrixdnn.cpp libmatrixmult.cpp systemml.cpp) http://git-wip-us.apache.org/repos/asf/systemml/blob/525381d5/src/main/cpp/lib/libsystemml_mkl-Linux-x86_64.so ---------------------------------------------------------------------- diff --git a/src/main/cpp/lib/libsystemml_mkl-Linux-x86_64.so b/src/main/cpp/lib/libsystemml_mkl-Linux-x86_64.so index 9793b33..9f08870 100755 Binary files a/src/main/cpp/lib/libsystemml_mkl-Linux-x86_64.so and b/src/main/cpp/lib/libsystemml_mkl-Linux-x86_64.so differ http://git-wip-us.apache.org/repos/asf/systemml/blob/525381d5/src/main/cpp/lib/libsystemml_openblas-Linux-x86_64.so ---------------------------------------------------------------------- diff --git a/src/main/cpp/lib/libsystemml_openblas-Linux-x86_64.so b/src/main/cpp/lib/libsystemml_openblas-Linux-x86_64.so index c04e735..d6c9477 100755 Binary files a/src/main/cpp/lib/libsystemml_openblas-Linux-x86_64.so and b/src/main/cpp/lib/libsystemml_openblas-Linux-x86_64.so differ http://git-wip-us.apache.org/repos/asf/systemml/blob/525381d5/src/main/cpp/libmatrixdnn.cpp ---------------------------------------------------------------------- diff --git a/src/main/cpp/libmatrixdnn.cpp b/src/main/cpp/libmatrixdnn.cpp index f90857c..85efdfc 100644 --- a/src/main/cpp/libmatrixdnn.cpp +++ b/src/main/cpp/libmatrixdnn.cpp @@ -480,6 +480,7 @@ int sconv2dBiasAddDense(float* inputPtr, float* biasPtr, float* filterPtr, float // Step 3: Destroy the description of the operation dnnDelete_F32(pConvolution); + return computeNNZ<float>(retPtr, N*KPQ); #else // First step: Avoids oversubscription and other openmp/internal blas threading issues setNumThreadsForBLAS(1); @@ -515,7 +516,7 @@ int sconv2dBiasAddDense(float* inputPtr, float* biasPtr, float* filterPtr, float nnz += computeNNZ<float>(retPtr + n*KPQ, KPQ); } delete [] loweredMatArrays; + return nnz; #endif - return nnz; } http://git-wip-us.apache.org/repos/asf/systemml/blob/525381d5/src/main/cpp/libmatrixmult.cpp ---------------------------------------------------------------------- diff --git a/src/main/cpp/libmatrixmult.cpp b/src/main/cpp/libmatrixmult.cpp index 0fce70d..6edbc67 100644 --- a/src/main/cpp/libmatrixmult.cpp +++ b/src/main/cpp/libmatrixmult.cpp @@ -22,7 +22,10 @@ #include <cstdlib> #include "omp.h" #include <cmath> -#include <cblas.h> + +#ifdef USE_OPEN_BLAS + #include <cblas.h> +#endif int SYSML_CURRENT_NUM_THREADS = -1; void setNumThreadsForBLAS(int numThreads) { http://git-wip-us.apache.org/repos/asf/systemml/blob/525381d5/src/main/cpp/libmatrixmult.h ---------------------------------------------------------------------- diff --git a/src/main/cpp/libmatrixmult.h b/src/main/cpp/libmatrixmult.h index ee231d4..ca357c9 100644 --- a/src/main/cpp/libmatrixmult.h +++ b/src/main/cpp/libmatrixmult.h @@ -42,12 +42,12 @@ // we call "extension" APIs for setting number of threads of the given API. // For example: for OpenBLAS we use openblas_set_num_threads and // for MKL we use mkl_set_num_threads. This avoids performance degradation due to overprovisioning. -#ifdef USE_OPEN_BLAS -#include <cblas.h> -extern "C" void openblas_set_num_threads(int numThreads); -#elif defined USE_INTEL_MKL -#include <mkl.h> -#include <mkl_service.h> +#ifdef USE_INTEL_MKL + #include <mkl.h> + #include <mkl_service.h> +#else + #include <cblas.h> + extern "C" void openblas_set_num_threads(int numThreads); #endif void setNumThreadsForBLAS(int numThreads);