Skip to content

Commit

Permalink
WIP: do not link with blas, use process one
Browse files Browse the repository at this point in the history
  • Loading branch information
serge-sans-paille committed Oct 13, 2023
1 parent e642a98 commit 00dd1c6
Show file tree
Hide file tree
Showing 2 changed files with 59 additions and 8 deletions.
4 changes: 1 addition & 3 deletions pythran/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -223,9 +223,7 @@ def parse_define(define):
extension['define_macros'].append('PYTHRAN_BLAS_NONE')

if user_blas not in reserved_blas_entries:
# required to cope with atlas missing extern "C"
extension['define_macros'].append('PYTHRAN_BLAS_{}'
.format(user_blas.upper()))
pass

# final macro normalization
extension["define_macros"] = [
Expand Down
63 changes: 58 additions & 5 deletions pythran/pythonic/numpy/dot.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,66 @@
#error pythran configured without BLAS but BLAS seem needed
#endif

#if defined(PYTHRAN_BLAS_ATLAS) || defined(PYTHRAN_BLAS_SATLAS)
extern "C" {
#endif
#include <cblas.h>
#if defined(PYTHRAN_BLAS_ATLAS) || defined(PYTHRAN_BLAS_SATLAS)

typedef enum { CblasRowMajor = 101, CblasColMajor = 102 } CBLAS_LAYOUT;
typedef enum {
CblasNoTrans = 111,
CblasTrans = 112,
CblasConjTrans = 113
} CBLAS_TRANSPOSE;

float cblas_sdot(const int N, const float *X, const int incX, const float *Y,
const int incY);

double cblas_ddot(const int N, const double *X, const int incX, const double *Y,
const int incY);

void cblas_cdotu_sub(const int N, const void *X, const int incX, const void *Y,
const int incY, void *dotu);

void cblas_zdotu_sub(const int N, const void *X, const int incX, const void *Y,
const int incY, void *dotu);

void cblas_sgemv(CBLAS_LAYOUT layout, CBLAS_TRANSPOSE TransA, const int M,
const int N, const float alpha, const float *A, const int lda,
const float *X, const int incX, const float beta, float *Y,
const int incY);
void cblas_dgemv(CBLAS_LAYOUT layout, CBLAS_TRANSPOSE TransA, const int M,
const int N, const double alpha, const double *A,
const int lda, const double *X, const int incX,
const double beta, double *Y, const int incY);

void cblas_cgemv(CBLAS_LAYOUT layout, CBLAS_TRANSPOSE TransA, const int M,
const int N, const void *alpha, const void *A, const int lda,
const void *X, const int incX, const void *beta, void *Y,
const int incY);

void cblas_zgemv(CBLAS_LAYOUT layout, CBLAS_TRANSPOSE TransA, const int M,
const int N, const void *alpha, const void *A, const int lda,
const void *X, const int incX, const void *beta, void *Y,
const int incY);

void cblas_sgemm(CBLAS_LAYOUT layout, CBLAS_TRANSPOSE TransA,
CBLAS_TRANSPOSE TransB, const int M, const int N, const int K,
const float alpha, const float *A, const int lda,
const float *B, const int ldb, const float beta, float *C,
const int ldc);
void cblas_dgemm(CBLAS_LAYOUT layout, CBLAS_TRANSPOSE TransA,
CBLAS_TRANSPOSE TransB, const int M, const int N, const int K,
const double alpha, const double *A, const int lda,
const double *B, const int ldb, const double beta, double *C,
const int ldc);

void cblas_cgemm(CBLAS_LAYOUT layout, CBLAS_TRANSPOSE TransA,
CBLAS_TRANSPOSE TransB, const int M, const int N, const int K,
const void *alpha, const void *A, const int lda, const void *B,
const int ldb, const void *beta, void *C, const int ldc);
void cblas_zgemm(CBLAS_LAYOUT layout, CBLAS_TRANSPOSE TransA,
CBLAS_TRANSPOSE TransB, const int M, const int N, const int K,
const void *alpha, const void *A, const int lda, const void *B,
const int ldb, const void *beta, void *C, const int ldc);
}
#endif

PYTHONIC_NS_BEGIN

Expand Down

0 comments on commit 00dd1c6

Please sign in to comment.