Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 34 additions & 0 deletions src/include/ablas.h
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,40 @@ ablas_gemm(
// const cl_event *eventWaitList,
// cl_event *events);


/**@{*/
/*! \brief
* \defgroup BLAS Level 3 BLAS
* @param[in] precision single/double, real/complex.
* @param[in] order Row/column order.
* @param[in] trans How matrix is to be transposed. NULL if does not apply.
* @param[in] uplo The triangle in matrix being referenced. NULL if does not apply.
* @param[in] diag Specify whether matrix is unit triangular. NULL if does not apply.
* @param[in] M character for matrix A, C. NULL if does not apply.
* @param[in] N character for matrix B, C. NULL if does not apply.
* @param[in] K character for matrix A, B. NULL if does not apply.
* @param[in] offset Offset of the first element of the matrix.
* @param[in] ldX Leading dimension of matrix
* @param[in] X pointer to device memory
* @param[out] ablas_X pointer to a matrix struct.
*/
ABLAS_EXPORT ablas_status
clblas_2_ablas_init_matrix(
const ablas_precision *precision,
const ablas_order *order,
const ablas_transpose *trans,
const ablas_uplo *uplo,
const ablas_diag *diag,
const size_t *M,
const size_t *N,
const size_t *K,
size_t offset,
size_t ldX,
void *X,
ablas_matrix *ablas_X
);
/**@}*/

#ifdef __cplusplus
} // extern C
#endif
Expand Down
13 changes: 13 additions & 0 deletions src/include/ablas_types.h
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,19 @@ typedef enum ablas_side_ {
} ablas_side;


/*! \brief Indicate the data order of a matrix. This is only used by the help function clblas_2_ablas_gemm */
typedef enum ablas_order_{
ablas_row_major,
ablas_column_major
} ablas_order;

/*! \brief Indicate the transpose form of a matrix. This is only used by the help function clblas_2_ablas_gemm */
typedef enum ablas_transpose_{
ablas_no_trans,
ablas_trans,
ablas_conjugate_trans
}ablas_transpose;

/*! \brief Structure to encapsulate dense matrix/vector/scalar data to aBLAS API.
* \details Able to store multiple matrices (or vectors, scalars)
* to facilitate high-performance batched oprations;
Expand Down
87 changes: 87 additions & 0 deletions src/library/clblas_2_ablas_intit.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
#include "ablas.h"

ablas_status
clblas_2_ablas_init_matrix(
const ablas_precision *precision,
const ablas_order *order,
const ablas_transpose *trans,
const ablas_uplo *uplo,
const ablas_diag *diag,
const size_t *M,
const size_t *N,
const size_t *K,
size_t offset,
size_t ldX,
void *X,
ablas_matrix *ablas_X)
{
//unfinished
if (ablas_X == NULL)
return -1;//throw some kind of error

ablas_X->data = X;
ablas_X->precision = *precision;
ablas_X->offset = offset;

if ((uplo == NULL) && (diag == NULL))
{
//not a symmetric matrix

if (*order == ablas_column_major)
{
if (N == NULL)
{
if (trans == NULL)
{
//matrix C does not have trans
ablas_X->num_cols = *M;
ablas_X->num_rows = *K;
ablas_X->num_matrices = 1;
ablas_X->col_stride = ldX;
ablas_X->row_stride = 1;
ablas_X->matrix_stride = ldX*(*K);
return 0;
}
else if (*trans == ablas_no_trans)
{
ablas_X->num_cols = *M;
ablas_X->num_rows = *K;
ablas_X->num_matrices = 1;
ablas_X->col_stride = ldX;
ablas_X->row_stride = 1;
ablas_X->matrix_stride = ldX*(*K);
return 0;
}
else if (*trans == ablas_trans)
{
ablas_X->num_cols = *K;
ablas_X->num_rows = *M;
ablas_X->num_matrices = 1;
ablas_X->col_stride = ldX;
ablas_X->row_stride = 1;
ablas_X->matrix_stride = ldX*(*M);
return 0;
}
else if (*trans == ablas_conjugate_trans)
{
}
}
else if (M == NULL)
{
}
else if (K == NULL)
{
}
else
{
//it would be confusing to have values for all M, N and K
return -1;
}

}



return -1;
}
}