corepointer commented on a change in pull request #1101:
URL: https://github.com/apache/systemds/pull/1101#discussion_r523475240
##########
File path: src/main/cpp/libmatrixmult.cpp
##########
@@ -18,70 +18,42 @@
*/
#include "libmatrixmult.h"
-#include "omp.h"
-#include <cmath>
-#include <cstdlib>
-#ifdef USE_OPEN_BLAS
-#include <cblas.h>
-#else
-#include <mkl_service.h>
-#endif
+#include "common.h"
-static int SYSDS_CURRENT_NUM_THREADS = -1;
-void setNumThreadsForBLAS(int numThreads) {
- if (SYSDS_CURRENT_NUM_THREADS != numThreads) {
-#ifdef USE_OPEN_BLAS
- openblas_set_num_threads(numThreads);
-#else
- mkl_set_num_threads(numThreads);
-#endif
- SYSDS_CURRENT_NUM_THREADS = numThreads;
- }
-}
-
-void dmatmult(double *m1Ptr, double *m2Ptr, double *retPtr, int m, int k, int
n,
- int numThreads) {
+void dmatmult(double *m1Ptr, double *m2Ptr, double *retPtr, int m, int k, int
n, int numThreads) {
// BLAS routine dispatch according to input dimension sizes (we don't use
// cblas_dgemv with CblasColMajor for matrix-vector because it was generally
// slower than dgemm)
setNumThreadsForBLAS(numThreads);
if (m == 1 && n == 1) // VV
- retPtr[0] = cblas_ddot(k, m1Ptr, 1, m2Ptr, 1);
+ retPtr[0] = cblas_ddot(k, m1Ptr, 1, m2Ptr, 1);
Review comment:
Indentation in the native code is generally broken. I did a little
cleanup here and there but that's not the focus of this PR. I refrain from
further cleanup here to keep the PR somewhat readable :P
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]