Skip to content

Commit

Permalink
Remove all usages of Intel MKL
Browse files Browse the repository at this point in the history
This library was clumsily integrated with the rest of the code and is
not publicly available. Removing make the codebase easier to work with.
  • Loading branch information
aristos-d committed Apr 13, 2024
1 parent 5e15309 commit 42ef22f
Show file tree
Hide file tree
Showing 6 changed files with 3 additions and 229 deletions.
21 changes: 0 additions & 21 deletions include/generic/coo.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,27 +29,6 @@ inline void spmv_coo(
spmv_coo(v, ri, ci, nnz, x, y);
}

#ifdef MKL_SPARSE
#include <mkl.h>
#include <stdio.h>

#include "params.h"

template <>
inline void spmv_coo(
float const * const v, int const * const ri, int const * const ci,
int const rows, int const columns, int const nnz,
float const * const __restrict x,
float * const __restrict y)
{
DEBUG_USE_MKL( fprintf(stderr, "MKL COO in use\n") );
const float alpha = 1.0f;
const float beta = 1.0f;
mkl_scoomv ("N", &rows, &columns, &alpha, "G__C", v, ri, ci, &nnz, x, &beta, y);
}

#endif

/*
* Heavily overloaded constructors for COO matrices
*/
Expand Down
31 changes: 1 addition & 30 deletions include/matrix/dense.h
Original file line number Diff line number Diff line change
@@ -1,15 +1,14 @@
#ifndef _DENSE_H_
#define _DENSE_H_

#include <assert.h>
#include <cassert>

#include "typedefs.h"
#include "matrix/coo.2.h"
#include "matrix/coo.3.h"
#include "spmv/dense.h"
#include "spmv/omp/dense.h"


/*
* Structure representing a dense matrix, stored in classic C way.
*/
Expand Down Expand Up @@ -75,34 +74,6 @@ inline void spmv_serial(DENSE<T,IT> const * const A,
spmv_dense_serial(A->val, A->rows, A->columns, x, y);
}

/*
* Template specializations which use Intel's MKL library
*/
#ifdef MKL_DENSE
#include <mkl.h>

template <>
inline void spmv_dense(float const * const val, int const M, int const N,
float const * const __restrict x, float * const __restrict y)
{
DEBUG_USE_MKL( fprintf(stderr, "MKL Dense in use\n") );
cblas_sgemv(CblasRowMajor, CblasNoTrans, M, N,
1.0f, val, N,
x, 1, 1.0f,
y, 1);
}

template <>
inline void spmv_dense_serial(float const * const val, int const M, int const N,
float const * const __restrict x, float * const __restrict y)
{
// No point in having serial/parallel version. That is determined at link-time.
spmv_dense(val, M, N, x, y);
}

#endif


/* ------------------ Constructors begin ------------------ */

/*
Expand Down
10 changes: 0 additions & 10 deletions include/params.h
Original file line number Diff line number Diff line change
Expand Up @@ -61,20 +61,10 @@
#define SLACKNESS 8
#endif

// Uncomment for debugging messages
// #define DEBUG_MODE
// #define DEBUG_MODE_MKL

#ifdef DEBUG_MODE
#define DEBUG(expression) expression
#else
#define DEBUG(expression)
#endif

#ifdef DEBUG_MODE_MKL
#define DEBUG_USE_MKL(expression) expression
#else
#define DEBUG_USE_MKL(expression)
#endif

#endif
2 changes: 1 addition & 1 deletion src/drivers/bench.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ int main (int argc, char * argv[])
INDEXTYPE beta;

Coo3<VALTYPE,INDEXTYPE> coo;
Csr<VALTYPE,INDEXTYPE> csr; // Don't use MKL for this one!
Csr<VALTYPE,INDEXTYPE> csr;
Cgbr2<VALTYPE,INDEXTYPE,SINDEXTYPE> cgbr;

if (argc != 2){
Expand Down
2 changes: 1 addition & 1 deletion src/drivers/pbench.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ int main(int argc, char * argv[])
INDEXTYPE beta;

Coo3<VALTYPE,INDEXTYPE> coo;
Csr<VALTYPE,INDEXTYPE> csr; // Don't use MKL for this one!
Csr<VALTYPE,INDEXTYPE> csr;
Cgbr2<VALTYPE,INDEXTYPE,SINDEXTYPE> cgbr;

if (argc != 3){
Expand Down
166 changes: 0 additions & 166 deletions src/test/mkl.cpp

This file was deleted.

0 comments on commit 42ef22f

Please sign in to comment.