Skip to content

Commit

Permalink
Slight changes.
Browse files Browse the repository at this point in the history
  • Loading branch information
devinamatthews committed Jul 20, 2017
1 parent 6fbab63 commit e92aabe
Show file tree
Hide file tree
Showing 12 changed files with 24 additions and 29 deletions.
1 change: 0 additions & 1 deletion optimizing_gemm/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ SHELL=/bin/bash
CXX=g++
CXXFLAGS=-O3 -march=native -fopenmp
LDFLAGS=-fopenmp -lopenblas
CXXFLAGS+=-I/Users/dmatthews/src

all: run

Expand Down
10 changes: 2 additions & 8 deletions optimizing_gemm/blas_dgemm.cxx
Original file line number Diff line number Diff line change
@@ -1,15 +1,9 @@
#include "common.hpp"

#include "lawrap/blas.h"
using namespace LAWrap;

/*
* Compute C = A*B
* Compute C += A*B
*/
void my_dgemm(int m, int n, int k, const matrix& A, const matrix& B, matrix& C)
{
gemm('N', 'N', n, m, k,
1.0, B.data(), n,
A.data(), k,
1.0, C.data(), n);
C += A*B;
}
2 changes: 2 additions & 0 deletions optimizing_gemm/common.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

#include <omp.h>

#define EIGEN_USE_BLAS
#define EIGEN_NO_DEBUG
#include <Eigen/Dense>

Expand All @@ -17,3 +18,4 @@ using matrix = Eigen::Matrix<double, Eigen::Dynamic, Eigen::Dynamic, Eigen::RowM
void my_dgemm(int m, int n, int k, const matrix& A, const matrix& B, matrix& C);

#endif

2 changes: 1 addition & 1 deletion optimizing_gemm/my_dgemm_0.cxx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#include "common.hpp"

/*
* Compute C = A*B
* Compute C += A*B
*/
void my_dgemm(int m, int n, int k, const matrix& A, const matrix& B, matrix& C)
{
Expand Down
2 changes: 1 addition & 1 deletion optimizing_gemm/my_dgemm_1.cxx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#include "common.hpp"

/*
* Compute C = A*B
* Compute C += A*B
*/
void my_dgemm(int m, int n, int k, const matrix& A, const matrix& B, matrix& C)
{
Expand Down
4 changes: 2 additions & 2 deletions optimizing_gemm/my_dgemm_2.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
#define N_UNROLL 8

/*
* Compute C = A*B for some subblocks of A, B, and C
* Compute C += A*B for some subblocks of A, B, and C
*/
template <typename MatrixA, typename MatrixB, typename MatrixC>
void my_dgemm_kernel(int k, const MatrixA& A, const MatrixB& B, MatrixC& C)
Expand Down Expand Up @@ -44,7 +44,7 @@ void my_dgemm_kernel(int k, const MatrixA& A, const MatrixB& B, MatrixC& C)
}

/*
* Compute C = A*B
* Compute C += A*B
*/
void my_dgemm(int m, int n, int k, const matrix& A, const matrix& B, matrix& C)
{
Expand Down
4 changes: 2 additions & 2 deletions optimizing_gemm/my_dgemm_3.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
#define N_UNROLL 8

/*
* Compute C = A*B for some subblocks of A, B, and C
* Compute C += A*B for some subblocks of A, B, and C
*/
template <typename MatrixA, typename MatrixB, typename MatrixC>
void my_dgemm_kernel(int k, const MatrixA& A, const MatrixB& B, MatrixC& C)
Expand Down Expand Up @@ -129,7 +129,7 @@ void my_dgemm_kernel(int k, const MatrixA& A, const MatrixB& B, MatrixC& C)
}

/*
* Compute C = A*B
* Compute C += A*B
*/
void my_dgemm(int m, int n, int k, const matrix& A, const matrix& B, matrix& C)
{
Expand Down
4 changes: 2 additions & 2 deletions optimizing_gemm/my_dgemm_4.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
#define N_UNROLL 8

/*
* Compute C = A*B for some subblocks of A, B, and C
* Compute C += A*B for some subblocks of A, B, and C
*/
template <typename MatrixA, typename MatrixB, typename MatrixC>
void my_dgemm_kernel(int k, const MatrixA& A, const MatrixB& B, MatrixC& C)
Expand Down Expand Up @@ -121,7 +121,7 @@ void my_dgemm_kernel(int k, const MatrixA& A, const MatrixB& B, MatrixC& C)
}

/*
* Compute C = A*B
* Compute C += A*B
*/
void my_dgemm(int m, int n, int k, const matrix& A, const matrix& B, matrix& C)
{
Expand Down
6 changes: 3 additions & 3 deletions optimizing_gemm/my_dgemm_5.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
#define N_UNROLL 8

/*
* Compute C = A*B for some really tiny subblocks of A, B, and C
* Compute C += A*B for some really tiny subblocks of A, B, and C
*/
template <typename MatrixA, typename MatrixB, typename MatrixC>
void my_dgemm_micro_kernel(int k, const MatrixA& A, const MatrixB& B, MatrixC& C)
Expand Down Expand Up @@ -92,7 +92,7 @@ void my_dgemm_micro_kernel(int k, const MatrixA& A, const MatrixB& B, MatrixC& C
}

/*
* Compute C = A*B for some subblocks of A, B, and C
* Compute C += A*B for some subblocks of A, B, and C
*/
template <typename MatrixA, typename MatrixB, typename MatrixC>
void my_dgemm_inner_kernel(int m, int n, int k,
Expand All @@ -112,7 +112,7 @@ void my_dgemm_inner_kernel(int m, int n, int k,
}

/*
* Compute C = A*B
* Compute C += A*B
*/
void my_dgemm(int m, int n, int k, const matrix& A, const matrix& B, matrix& C)
{
Expand Down
6 changes: 3 additions & 3 deletions optimizing_gemm/my_dgemm_6.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
#define N_UNROLL 8

/*
* Compute C = A*B for some really tiny subblocks of A, B, and C
* Compute C += A*B for some really tiny subblocks of A, B, and C
*/
template <typename MatrixC>
void my_dgemm_micro_kernel(int k, const double* A, const double* B, MatrixC& C)
Expand Down Expand Up @@ -86,7 +86,7 @@ void my_dgemm_micro_kernel(int k, const double* A, const double* B, MatrixC& C)
}

/*
* Compute C = A*B for some subblocks of A, B, and C
* Compute C += A*B for some subblocks of A, B, and C
*/
template <typename MatrixC>
void my_dgemm_inner_kernel(int m, int n, int k,
Expand Down Expand Up @@ -199,7 +199,7 @@ static double A_pack[M_BLOCK*K_BLOCK];
static double B_pack[N_BLOCK*K_BLOCK];

/*
* Compute C = A*B
* Compute C += A*B
*/
void my_dgemm(int m, int n, int k, const matrix& A, const matrix& B, matrix& C)
{
Expand Down
6 changes: 3 additions & 3 deletions optimizing_gemm/my_dgemm_7.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
#define K_UNROLL 4

/*
* Compute C = A*B for some really tiny subblocks of A, B, and C
* Compute C += A*B for some really tiny subblocks of A, B, and C
*/
template <typename MatrixC>
void my_dgemm_micro_kernel(int k, const double* A, const double* B, MatrixC& C)
Expand Down Expand Up @@ -131,7 +131,7 @@ void my_dgemm_micro_kernel(int k, const double* A, const double* B, MatrixC& C)
}

/*
* Compute C = A*B for some subblocks of A, B, and C
* Compute C += A*B for some subblocks of A, B, and C
*/
template <typename MatrixC>
void my_dgemm_inner_kernel(int m, int n, int k,
Expand Down Expand Up @@ -217,7 +217,7 @@ static double A_pack[M_BLOCK*K_BLOCK];
static double B_pack[N_BLOCK*K_BLOCK];

/*
* Compute C = A*B
* Compute C += A*B
*/
void my_dgemm(int m, int n, int k, const matrix& A, const matrix& B, matrix& C)
{
Expand Down
6 changes: 3 additions & 3 deletions optimizing_gemm/my_dgemm_8.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
#define K_UNROLL 4

/*
* Compute C = A*B for some really tiny subblocks of A, B, and C
* Compute C += A*B for some really tiny subblocks of A, B, and C
*/
template <typename MatrixC>
void my_dgemm_micro_kernel(int64_t k, const double* A, const double* B, MatrixC& C)
Expand Down Expand Up @@ -246,7 +246,7 @@ void my_dgemm_micro_kernel(int64_t k, const double* A, const double* B, MatrixC&
}

/*
* Compute C = A*B for some subblocks of A, B, and C
* Compute C += A*B for some subblocks of A, B, and C
*/
template <typename MatrixC>
void my_dgemm_inner_kernel(int m, int n, int k,
Expand Down Expand Up @@ -332,7 +332,7 @@ static double A_pack[M_BLOCK*K_BLOCK];
static double B_pack[N_BLOCK*K_BLOCK];

/*
* Compute C = A*B
* Compute C += A*B
*/
void my_dgemm(int m, int n, int k, const matrix& A, const matrix& B, matrix& C)
{
Expand Down

0 comments on commit e92aabe

Please sign in to comment.