diff --git a/cmfrec/cython_cblas.pxi b/cmfrec/cython_cblas.pxi index 7da0db2..e6d27bc 100644 --- a/cmfrec/cython_cblas.pxi +++ b/cmfrec/cython_cblas.pxi @@ -7,50 +7,50 @@ from scipy.linalg.cython_lapack cimport ( slacpy, sposv, spotrf, spotrs, sgelsd ) -ctypedef double (*ddot_)(const int*, const double*, const int*, const double*, const int*) nogil -ctypedef void (*dcopy_)(const int*, const double*, const int*, const double*, const int*) nogil -ctypedef void (*daxpy_)(const int*, const double*, const double*, const int*, double*, const int*) nogil -ctypedef void (*dscal_)(const int*, const double*, double*, const int*) nogil -ctypedef void (*dsyr_)(const char*, const int*, const double*, const double*, const int*, double*, const int*) nogil -ctypedef void (*dsyrk_)(const char*, const char*, const int*, const int*, const double*, const double*, const int*, const double*, double*, const int*) nogil -ctypedef double (*dnrm2_)(const int*, const double*, const int*) nogil -ctypedef void (*dgemm_)(const char*, const char*, const int*, const int*, const int*, const double*, const double*, const int*, const double*, const int*, const double*, double*, const int*) nogil -ctypedef void (*dgemv_)(const char*, const int*, const int*, const double*, const double*, const int*, const double*, const int*, const double*, double*, const int*) nogil -ctypedef void (*dsymv_)(const char*, const int*, const double*, const double*, const int*, const double*, const int*, const double*, double*, const int*) nogil -ctypedef void (*dger_)(const int*, const int*, const double*, const double*, const int*, const double*, const int*, double*, const int*) nogil - -ctypedef void (*dposv__)(const char*, const int*, const int*, double*, const int*, double*, const int*, int*) nogil -ctypedef void (*dlacpy__)(const char*, const int*, const int*, const double*, const int*, double*, const int*) nogil -ctypedef void (*dpotrf__)(const char*, const int*, double*, const int*, int*) nogil -ctypedef void (*dpotrs__)(const char*, const int*, const int*, const double*, const int*, double*, const int*, int*) nogil +ctypedef double (*ddot_)(const int*, const double*, const int*, const double*, const int*) noexcept nogil +ctypedef void (*dcopy_)(const int*, const double*, const int*, const double*, const int*) noexcept nogil +ctypedef void (*daxpy_)(const int*, const double*, const double*, const int*, double*, const int*) noexcept nogil +ctypedef void (*dscal_)(const int*, const double*, double*, const int*) noexcept nogil +ctypedef void (*dsyr_)(const char*, const int*, const double*, const double*, const int*, double*, const int*) noexcept nogil +ctypedef void (*dsyrk_)(const char*, const char*, const int*, const int*, const double*, const double*, const int*, const double*, double*, const int*) noexcept nogil +ctypedef double (*dnrm2_)(const int*, const double*, const int*) noexcept nogil +ctypedef void (*dgemm_)(const char*, const char*, const int*, const int*, const int*, const double*, const double*, const int*, const double*, const int*, const double*, double*, const int*) noexcept nogil +ctypedef void (*dgemv_)(const char*, const int*, const int*, const double*, const double*, const int*, const double*, const int*, const double*, double*, const int*) noexcept nogil +ctypedef void (*dsymv_)(const char*, const int*, const double*, const double*, const int*, const double*, const int*, const double*, double*, const int*) noexcept nogil +ctypedef void (*dger_)(const int*, const int*, const double*, const double*, const int*, const double*, const int*, double*, const int*) noexcept nogil + +ctypedef void (*dposv__)(const char*, const int*, const int*, double*, const int*, double*, const int*, int*) noexcept nogil +ctypedef void (*dlacpy__)(const char*, const int*, const int*, const double*, const int*, double*, const int*) noexcept nogil +ctypedef void (*dpotrf__)(const char*, const int*, double*, const int*, int*) noexcept nogil +ctypedef void (*dpotrs__)(const char*, const int*, const int*, const double*, const int*, double*, const int*, int*) noexcept nogil ctypedef void (*dgelsd__)(const int*, const int*, const int*, double*, const int*, double*, const int*, double*, const double*, int*, double*, - const int*, int*, int*) nogil - - -ctypedef float (*sdot_)(const int*, const float*, const int*, const float*, const int*) nogil -ctypedef void (*scopy_)(const int*, const float*, const int*, const float*, const int*) nogil -ctypedef void (*saxpy_)(const int*, const float*, const float*, const int*, float*, const int*) nogil -ctypedef void (*sscal_)(const int*, const float*, float*, const int*) nogil -ctypedef void (*ssyr_)(const char*, const int*, const float*, const float*, const int*, float*, const int*) nogil -ctypedef void (*ssyrk_)(const char*, const char*, const int*, const int*, const float*, const float*, const int*, const float*, float*, const int*) nogil -ctypedef float (*snrm2_)(const int*, const float*, const int*) nogil -ctypedef void (*sgemm_)(const char*, const char*, const int*, const int*, const int*, const float*, const float*, const int*, const float*, const int*, const float*, float*, const int*) nogil -ctypedef void (*sgemv_)(const char*, const int*, const int*, const float*, const float*, const int*, const float*, const int*, const float*, float*, const int*) nogil -ctypedef void (*ssymv_)(const char*, const int*, const float*, const float*, const int*, const float*, const int*, const float*, float*, const int*) nogil -ctypedef float (*sger_)(const int*, const int*, const float*, const float*, const int*, const float*, const int*, float*, const int*) nogil - -ctypedef void (*sposv__)(const char*, const int*, const int*, float*, const int*, float*, const int*, int*) nogil -ctypedef void (*slacpy__)(const char*, const int*, const int*, const float*, const int*, float*, const int*) nogil -ctypedef void (*spotrf__)(const char*, const int*, float*, const int*, int*) nogil -ctypedef void (*spotrs__)(const char*, const int*, const int*, const float*, const int*, float*, const int*, int*) nogil + const int*, int*, int*) noexcept nogil + + +ctypedef float (*sdot_)(const int*, const float*, const int*, const float*, const int*) noexcept nogil +ctypedef void (*scopy_)(const int*, const float*, const int*, const float*, const int*) noexcept nogil +ctypedef void (*saxpy_)(const int*, const float*, const float*, const int*, float*, const int*) noexcept nogil +ctypedef void (*sscal_)(const int*, const float*, float*, const int*) noexcept nogil +ctypedef void (*ssyr_)(const char*, const int*, const float*, const float*, const int*, float*, const int*) noexcept nogil +ctypedef void (*ssyrk_)(const char*, const char*, const int*, const int*, const float*, const float*, const int*, const float*, float*, const int*) noexcept nogil +ctypedef float (*snrm2_)(const int*, const float*, const int*) noexcept nogil +ctypedef void (*sgemm_)(const char*, const char*, const int*, const int*, const int*, const float*, const float*, const int*, const float*, const int*, const float*, float*, const int*) noexcept nogil +ctypedef void (*sgemv_)(const char*, const int*, const int*, const float*, const float*, const int*, const float*, const int*, const float*, float*, const int*) noexcept nogil +ctypedef void (*ssymv_)(const char*, const int*, const float*, const float*, const int*, const float*, const int*, const float*, float*, const int*) noexcept nogil +ctypedef float (*sger_)(const int*, const int*, const float*, const float*, const int*, const float*, const int*, float*, const int*) noexcept nogil + +ctypedef void (*sposv__)(const char*, const int*, const int*, float*, const int*, float*, const int*, int*) noexcept nogil +ctypedef void (*slacpy__)(const char*, const int*, const int*, const float*, const int*, float*, const int*) noexcept nogil +ctypedef void (*spotrf__)(const char*, const int*, float*, const int*, int*) noexcept nogil +ctypedef void (*spotrs__)(const char*, const int*, const int*, const float*, const int*, float*, const int*, int*) noexcept nogil ctypedef void (*sgelsd__)(const int*, const int*, const int*, float*, const int*, float*, const int*, float*, const float*, int*, float*, - const int*, int*, int*) nogil + const int*, int*, int*) noexcept nogil ctypedef enum CBLAS_ORDER: CblasRowMajor = 101 @@ -76,19 +76,19 @@ ctypedef enum CBLAS_SIDE: CblasLeft=141 CblasRight=142 -cdef public double cblas_ddot(const int n, const double *x, const int incx, const double *y, const int incy) nogil: +cdef public double cblas_ddot(const int n, const double *x, const int incx, const double *y, const int incy) noexcept nogil: return (ddot)(&n, x, &incx, y, &incy) -cdef public void cblas_dcopy(const int n, const double *x, const int incx, double *y, const int incy) nogil: +cdef public void cblas_dcopy(const int n, const double *x, const int incx, double *y, const int incy) noexcept nogil: (dcopy)(&n, x, &incx, y, &incy) -cdef public void cblas_daxpy(const int n, const double alpha, const double *x, const int incx, double *y, const int incy) nogil: +cdef public void cblas_daxpy(const int n, const double alpha, const double *x, const int incx, double *y, const int incy) noexcept nogil: (daxpy)(&n, &alpha, x, &incx, y, &incy) -cdef public void cblas_dscal(const int N, const double alpha, double *X, const int incX) nogil: +cdef public void cblas_dscal(const int N, const double alpha, double *X, const int incX) noexcept nogil: (dscal)(&N, &alpha, X, &incX) -cdef public void cblas_dsyr(const int order, const int Uplo, const int N, const double alpha, const double *X, const int incX, double *A, const int lda) nogil: +cdef public void cblas_dsyr(const int order, const int Uplo, const int N, const double alpha, const double *X, const int incX, double *A, const int lda) noexcept nogil: cdef char uplo = 0#'\0' if (order == CblasColMajor): if (Uplo == CblasLower): @@ -104,7 +104,7 @@ cdef public void cblas_dsyr(const int order, const int Uplo, const int N, const (dsyr)(&uplo, &N, &alpha, X, &incX, A, &lda) cdef public void cblas_dsyrk(const int Order, const int Uplo, const int Trans, - const int N, const int K, const double alpha, const double *A, const int lda, const double beta, double *C, const int ldc) nogil: + const int N, const int K, const double alpha, const double *A, const int lda, const double beta, double *C, const int ldc) noexcept nogil: cdef char uplo = 0#'\0' cdef char trans = 0#'\0' if (Order == CblasColMajor): @@ -135,11 +135,11 @@ cdef public void cblas_dsyrk(const int Order, const int Uplo, const int Trans, (dsyrk)(&uplo, &trans, &N, &K, &alpha, A, &lda, &beta, C, &ldc) -cdef public double cblas_dnrm2 (const int N, const double *X, const int incX) nogil: +cdef public double cblas_dnrm2 (const int N, const double *X, const int incX) noexcept nogil: return (dnrm2)(&N, X, &incX) cdef public void cblas_dgemm(const int Order, const int TransA, const int 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) nogil: + const double alpha, const double *A, const int lda, const double *B, const int ldb, const double beta, double *C, const int ldc) noexcept nogil: cdef char transA = 0#'\0' cdef char transB = 0#'\0' if (Order == CblasColMajor): @@ -177,7 +177,7 @@ cdef public void cblas_dgemm(const int Order, const int TransA, const int TransB (dgemm)(&transA, &transB, &N, &M, &K, &alpha, B, &ldb, A, &lda, &beta, C, &ldc) cdef public void cblas_dgemv(const int order, const int 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) nogil: + const double alpha, const double *a, const int lda, const double *x, const int incx, const double beta, double *y, const int incy) noexcept nogil: cdef char trans = 0#'\0' if (order == CblasColMajor): if (TransA == CblasNoTrans): @@ -200,7 +200,7 @@ cdef public void cblas_dgemv(const int order, const int TransA, const int m, c (dgemv)(&trans, &n, &m, &alpha, a, &lda, x, &incx, &beta, y, &incy); cdef public void cblas_dsymv(const int order, const int Uplo, 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) nogil: + const int lda, const double *X, const int incX, const double beta, double *Y, const int incY) noexcept nogil: cdef char uplo = 0#'\0'; if (order == CblasColMajor): if (Uplo == CblasUpper): @@ -217,47 +217,47 @@ cdef public void cblas_dsymv(const int order, const int Uplo, const int N, const (dsymv)(&uplo, &N, &alpha, A, &lda, X, &incX, &beta, Y, &incY) cdef public void cblas_dger(const int order, const int m, const int n, const double alpha, - const double *x, const int incx, const double *y, const int incy, double *a, const int lda) nogil: + const double *x, const int incx, const double *y, const int incy, double *a, const int lda) noexcept nogil: if (order == CblasColMajor): (dger)(&m, &n, &alpha, x, &incx, y, &incy, a, &lda); else: (dger)(&n, &m, &alpha, y, &incy, x, &incx, a, &lda); -cdef public void dposv_(const char* uplo, const int* m, const int* n, double* x, const int* ldx, double* y, const int* ldy, int* info) nogil: +cdef public void dposv_(const char* uplo, const int* m, const int* n, double* x, const int* ldx, double* y, const int* ldy, int* info) noexcept nogil: (dposv)(uplo, m, n, x, ldx, y, ldy, info) -cdef public void dlacpy_(const char* uplo, const int* m, const int* n, const double* x, const int* ldx, double* y, const int* ldy) nogil: +cdef public void dlacpy_(const char* uplo, const int* m, const int* n, const double* x, const int* ldx, double* y, const int* ldy) noexcept nogil: (dlacpy)(uplo, m, n, x, ldx, y, ldy) -cdef public void dpotrf_(const char* a1, const int* a2, double* a3, const int* a4, int* a5) nogil: +cdef public void dpotrf_(const char* a1, const int* a2, double* a3, const int* a4, int* a5) noexcept nogil: (dpotrf)(a1, a2, a3, a4, a5) -cdef public void dpotrs_(const char* a1, const int* a2, const int* a3, const double* a4, const int* a5, double* a6, const int* a7, int* a8) nogil: +cdef public void dpotrs_(const char* a1, const int* a2, const int* a3, const double* a4, const int* a5, double* a6, const int* a7, int* a8) noexcept nogil: (dpotrs)(a1, a2, a3, a4, a5, a6, a7, a8) cdef public void dgelsd_(const int* a1, const int* a2, const int* a3, double* a4, const int* a5, double* a6, const int* a7, double* a8, const double* a9, int* a10, double* a11, - const int* a12, int* a13, int* a14) nogil: + const int* a12, int* a13, int* a14) noexcept nogil: (dgelsd)(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14) ######################## -cdef public float cblas_sdot(const int n, const float *x, const int incx, const float *y, const int incy) nogil: +cdef public float cblas_sdot(const int n, const float *x, const int incx, const float *y, const int incy) noexcept nogil: return (sdot)(&n, x, &incx, y, &incy) -cdef public void cblas_scopy(const int n, const float *x, const int incx, float *y, const int incy) nogil: +cdef public void cblas_scopy(const int n, const float *x, const int incx, float *y, const int incy) noexcept nogil: (scopy)(&n, x, &incx, y, &incy) -cdef public void cblas_saxpy(const int n, const float alpha, const float *x, const int incx, float *y, const int incy) nogil: +cdef public void cblas_saxpy(const int n, const float alpha, const float *x, const int incx, float *y, const int incy) noexcept nogil: (saxpy)(&n, &alpha, x, &incx, y, &incy) -cdef public void cblas_sscal(const int N, const float alpha, float *X, const int incX) nogil: +cdef public void cblas_sscal(const int N, const float alpha, float *X, const int incX) noexcept nogil: (sscal)(&N, &alpha, X, &incX) -cdef public void cblas_ssyr(const int order, const int Uplo, const int N, const float alpha, const float *X, const int incX, float *A, const int lda) nogil: +cdef public void cblas_ssyr(const int order, const int Uplo, const int N, const float alpha, const float *X, const int incX, float *A, const int lda) noexcept nogil: cdef char uplo = 0#'\0' if (order == CblasColMajor): if (Uplo == CblasLower): @@ -273,7 +273,7 @@ cdef public void cblas_ssyr(const int order, const int Uplo, const int N, const (ssyr)(&uplo, &N, &alpha, X, &incX, A, &lda) cdef public void cblas_ssyrk(const int Order, const int Uplo, const int Trans, - const int N, const int K, const float alpha, const float *A, const int lda, const float beta, float *C, const int ldc) nogil: + const int N, const int K, const float alpha, const float *A, const int lda, const float beta, float *C, const int ldc) noexcept nogil: cdef char uplo = 0#'\0' cdef char trans = 0#'\0' if (Order == CblasColMajor): @@ -304,11 +304,11 @@ cdef public void cblas_ssyrk(const int Order, const int Uplo, const int Trans, (ssyrk)(&uplo, &trans, &N, &K, &alpha, A, &lda, &beta, C, &ldc) -cdef public float cblas_snrm2 (const int N, const float *X, const int incX) nogil: +cdef public float cblas_snrm2 (const int N, const float *X, const int incX) noexcept nogil: return (snrm2)(&N, X, &incX) cdef public void cblas_sgemm(const int Order, const int TransA, const int 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) nogil: + const float alpha, const float *A, const int lda, const float *B, const int ldb, const float beta, float *C, const int ldc) noexcept nogil: cdef char transA = 0#'\0' cdef char transB = 0#'\0' if (Order == CblasColMajor): @@ -346,7 +346,7 @@ cdef public void cblas_sgemm(const int Order, const int TransA, const int TransB (sgemm)(&transA, &transB, &N, &M, &K, &alpha, B, &ldb, A, &lda, &beta, C, &ldc) cdef public void cblas_sgemv(const int order, const int 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) nogil: + const float alpha, const float *a, const int lda, const float *x, const int incx, const float beta, float *y, const int incy) noexcept nogil: cdef char trans = 0#'\0' if (order == CblasColMajor): if (TransA == CblasNoTrans): @@ -369,7 +369,7 @@ cdef public void cblas_sgemv(const int order, const int TransA, const int m, c (sgemv)(&trans, &n, &m, &alpha, a, &lda, x, &incx, &beta, y, &incy); cdef public void cblas_ssymv(const int order, const int Uplo, 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) nogil: + const int lda, const float *X, const int incX, const float beta, float *Y, const int incY) noexcept nogil: cdef char uplo = 0#'\0'; if (order == CblasColMajor): if (Uplo == CblasUpper): @@ -386,29 +386,29 @@ cdef public void cblas_ssymv(const int order, const int Uplo, const int N, const (ssymv)(&uplo, &N, &alpha, A, &lda, X, &incX, &beta, Y, &incY) cdef public void cblas_sger(const int order, const int m, const int n, const float alpha, - const float *x, const int incx, const float *y, const int incy, float *a, const int lda) nogil: + const float *x, const int incx, const float *y, const int incy, float *a, const int lda) noexcept nogil: if (order == CblasColMajor): (sger)(&m, &n, &alpha, x, &incx, y, &incy, a, &lda); else: (sger)(&n, &m, &alpha, y, &incy, x, &incx, a, &lda); -cdef public void sposv_(const char* uplo, const int* m, const int* n, float* x, const int* ldx, float* y, const int* ldy, int* info) nogil: +cdef public void sposv_(const char* uplo, const int* m, const int* n, float* x, const int* ldx, float* y, const int* ldy, int* info) noexcept nogil: (sposv)(uplo, m, n, x, ldx, y, ldy, info) -cdef public void slacpy_(const char* uplo, const int* m, const int* n, const float* x, const int* ldx, float* y, const int* ldy) nogil: +cdef public void slacpy_(const char* uplo, const int* m, const int* n, const float* x, const int* ldx, float* y, const int* ldy) noexcept nogil: (slacpy)(uplo, m, n, x, ldx, y, ldy) -cdef public void spotrf_(const char* a1, const int* a2, float* a3, const int* a4, int* a5) nogil: +cdef public void spotrf_(const char* a1, const int* a2, float* a3, const int* a4, int* a5) noexcept nogil: (spotrf)(a1, a2, a3, a4, a5) -cdef public void spotrs_(const char* a1, const int* a2, const int* a3, const float* a4, const int* a5, float* a6, const int* a7, int* a8) nogil: +cdef public void spotrs_(const char* a1, const int* a2, const int* a3, const float* a4, const int* a5, float* a6, const int* a7, int* a8) noexcept nogil: (spotrs)(a1, a2, a3, a4, a5, a6, a7, a8) cdef public void sgelsd_(const int* a1, const int* a2, const int* a3, float* a4, const int* a5, float* a6, const int* a7, float* a8, const float* a9, int* a10, float* a11, - const int* a12, int* a13, int* a14) nogil: + const int* a12, int* a13, int* a14) noexcept nogil: (sgelsd)(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14) diff --git a/cmfrec/wrapper_untyped.pxi b/cmfrec/wrapper_untyped.pxi index 5334f49..5355819 100644 --- a/cmfrec/wrapper_untyped.pxi +++ b/cmfrec/wrapper_untyped.pxi @@ -40,7 +40,7 @@ cdef extern from "cmfrec.h": bint verbose, int_t print_every, bint handle_interrupt, int_t *niter, int_t *nfev, real_t *B_plus_bias - ) nogil + ) noexcept nogil int_t fit_offsets_explicit_lbfgs_internal( real_t *values, bint reset_values, @@ -64,7 +64,7 @@ cdef extern from "cmfrec.h": int_t *niter, int_t *nfev, real_t *Am, real_t *Bm, real_t *B_plus_bias - ) nogil + ) noexcept nogil int_t fit_collective_explicit_als( real_t *biasA, real_t *biasB, @@ -106,7 +106,7 @@ cdef extern from "cmfrec.h": real_t *precomputedTransCtCinvCt, real_t *precomputedCtCw, real_t *precomputedCtUbias - ) nogil + ) noexcept nogil int_t fit_collective_implicit_als( real_t *A, real_t *B, @@ -135,7 +135,7 @@ cdef extern from "cmfrec.h": real_t *precomputedBeTBe, real_t *precomputedBeTBeChol, real_t *precomputedCtUbias - ) nogil + ) noexcept nogil int_t fit_offsets_als( real_t *biasA, real_t *biasB, @@ -163,7 +163,7 @@ cdef extern from "cmfrec.h": real_t *Bm_plus_bias, real_t *precomputedBtB, real_t *precomputedTransBtBinvBt - ) nogil + ) noexcept nogil int_t precompute_collective_explicit( real_t *B, int_t n, int_t n_max, bint include_all_X, @@ -187,7 +187,7 @@ cdef extern from "cmfrec.h": real_t *TransCtCinvCt, real_t *CtCw, real_t *CtUbias - ) nogil + ) noexcept nogil int_t precompute_collective_implicit( real_t *B, int_t n, @@ -201,7 +201,7 @@ cdef extern from "cmfrec.h": real_t *BeTBe, real_t *BeTBeChol, real_t *CtUbias - ) nogil + ) noexcept nogil int_t offsets_factors_cold( real_t *a_vec, @@ -211,7 +211,7 @@ cdef extern from "cmfrec.h": real_t *C_bias, int_t k, int_t k_sec, int_t k_main, real_t w_user - ) nogil + ) noexcept nogil void predict_multiple( real_t *A, int_t k_user, @@ -223,7 +223,7 @@ cdef extern from "cmfrec.h": int_t predA[], int_t predB[], size_t nnz, real_t *outp, int nthreads - ) nogil + ) noexcept nogil int_t predict_X_old_collective_explicit( int_t row[], int_t col[], real_t *predicted, size_t n_predict, @@ -233,7 +233,7 @@ cdef extern from "cmfrec.h": int_t k, int_t k_user, int_t k_item, int_t k_main, int_t m, int_t n_max, int nthreads - ) nogil + ) noexcept nogil int_t topN( real_t *a_vec, int_t k_user, @@ -245,7 +245,7 @@ cdef extern from "cmfrec.h": int_t *exclude_ix, int_t n_exclude, int_t *outp_ix, real_t *outp_score, int_t n_top, int_t n, int nthreads - ) nogil + ) noexcept nogil int_t topN_new_content_based( int_t k, int_t n_new, @@ -259,7 +259,7 @@ cdef extern from "cmfrec.h": real_t glob_mean, int_t *outp_ix, real_t *outp_score, int_t n_top, int nthreads - ) nogil + ) noexcept nogil int_t fit_most_popular( real_t *biasA, real_t *biasB, @@ -275,7 +275,7 @@ cdef extern from "cmfrec.h": bint nonneg, bint NA_as_zero, real_t *w_main_multiplier, int nthreads - ) nogil + ) noexcept nogil int_t impute_X_collective_explicit( int_t m, bint user_bias, @@ -308,7 +308,7 @@ cdef extern from "cmfrec.h": real_t *CtUbias, real_t *B_plus_bias, int nthreads - ) nogil + ) noexcept nogil int_t predict_X_old_content_based( real_t *predicted, size_t n_predict, @@ -323,7 +323,7 @@ cdef extern from "cmfrec.h": real_t *Bm, real_t *biasB, real_t glob_mean, int nthreads - ) nogil + ) noexcept nogil int_t predict_X_new_content_based( real_t *predicted, size_t n_predict, @@ -339,14 +339,14 @@ cdef extern from "cmfrec.h": real_t *D, real_t *D_bias, real_t glob_mean, int nthreads - ) nogil + ) noexcept nogil int_t factors_content_based_single( real_t *a_vec, int_t k, real_t *u_vec, int_t p, real_t *u_vec_sp, int_t u_vec_ixB[], size_t nnz_u_vec, real_t *C, real_t *C_bias - ) nogil + ) noexcept nogil int_t fit_content_based_lbfgs( real_t *biasA, real_t *biasB, @@ -370,7 +370,7 @@ cdef extern from "cmfrec.h": bint verbose, int_t print_every, bint handle_interrupt, int_t *niter, int_t *nfev, real_t *Am, real_t *Bm - ) nogil + ) noexcept nogil int_t factors_collective_explicit_single( real_t *a_vec, real_t *a_bias, @@ -403,7 +403,7 @@ cdef extern from "cmfrec.h": real_t *TransCtCinvCt, real_t *CtUbias, real_t *B_plus_bias - ) nogil + ) noexcept nogil int_t factors_collective_implicit_single( real_t *a_vec, @@ -422,7 +422,7 @@ cdef extern from "cmfrec.h": real_t *BtB, real_t *BeTBeChol, real_t *CtUbias - ) nogil + ) noexcept nogil int_t factors_collective_explicit_multiple( real_t *A, real_t *biasA, int_t m, @@ -458,7 +458,7 @@ cdef extern from "cmfrec.h": real_t *CtUbias, real_t *B_plus_bias, int nthreads - ) nogil + ) noexcept nogil int_t factors_collective_implicit_multiple( real_t *A, int_t m, @@ -481,7 +481,7 @@ cdef extern from "cmfrec.h": real_t *BeTBeChol, real_t *CtUbias, int nthreads - ) nogil + ) noexcept nogil int_t factors_offsets_explicit_single( real_t *a_vec, real_t *a_bias, real_t *output_a, @@ -500,7 +500,7 @@ cdef extern from "cmfrec.h": real_t *precomputedTransBtBinvBt, real_t *precomputedBtB, real_t *Bm_plus_bias - ) nogil + ) noexcept nogil int_t factors_offsets_implicit_single( real_t *a_vec, @@ -514,7 +514,7 @@ cdef extern from "cmfrec.h": bint apply_log_transf, real_t *precomputedBtB, real_t *output_a - ) nogil + ) noexcept nogil int_t factors_offsets_explicit_multiple( real_t *Am, real_t *biasA, @@ -536,7 +536,7 @@ cdef extern from "cmfrec.h": real_t *precomputedBtB, real_t *Bm_plus_bias, int nthreads - ) nogil + ) noexcept nogil int_t factors_offsets_implicit_multiple( real_t *Am, int_t m, @@ -553,16 +553,16 @@ cdef extern from "cmfrec.h": bint apply_log_transf, real_t *precomputedBtB, int nthreads - ) nogil + ) noexcept nogil - # void py_set_threads(int) nogil - # int py_get_threads() nogil + # void py_set_threads(int) noexcept nogil + # int py_get_threads() noexcept nogil -cdef public void cy_printf(char *msg) nogil: +cdef public void cy_printf(char *msg) noexcept nogil: with gil: python_printmsg(msg) stdout.flush() -cdef public void cy_errprintf(char *msg) nogil: +cdef public void cy_errprintf(char *msg) noexcept nogil: with gil: python_printerrmsg(msg) stderr.flush() @@ -3841,14 +3841,14 @@ def call_impute_X_collective_explicit( return Xfull -cdef public void py_set_threads(int nthreads) nogil: +cdef public void py_set_threads(int nthreads) noexcept nogil: with gil: try: threadpoolctl.threadpool_limits(limits=nthreads, user_api="blas") except Exception: pass -cdef public int py_get_threads() nogil: +cdef public int py_get_threads() noexcept nogil: with gil: try: res = threadpoolctl.threadpool_info() diff --git a/pyproject.toml b/pyproject.toml index db35e2c..c12763a 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,2 +1,2 @@ [build-system] -requires = ["cython", "setuptools", "wheel", "oldest-supported-numpy", "scipy", "findblas"] +requires = ["cython>=3.0.0", "setuptools", "wheel", "numpy>=1.25", "scipy", "findblas"] diff --git a/setup.py b/setup.py index d618a55..9ecc254 100644 --- a/setup.py +++ b/setup.py @@ -348,7 +348,7 @@ def test_supports_clang_reassociate(self): setup( name = "cmfrec", packages = ["cmfrec"], - version = '3.5.1-4', + version = '3.5.1-5', description = 'Collective matrix factorization', author = 'David Cortes', url = 'https://github.com/david-cortes/cmfrec', @@ -372,6 +372,7 @@ def test_supports_clang_reassociate(self): define_macros = [("_FOR_PYTHON", None), ("USE_DOUBLE", None), ("NDEBUG", None), + ("NPY_NO_DEPRECATED_API", "NPY_1_7_API_VERSION"), ("USE_FINDBLAS" if use_findblas else "NO_FINDBLAS", None), ("USE_BLAS_SYR" if use_findblas else "AVOID_BLAS_SYR", None)] ), @@ -384,6 +385,7 @@ def test_supports_clang_reassociate(self): define_macros = [("_FOR_PYTHON", None), ("USE_FLOAT", None), ("NDEBUG", None), + ("NPY_NO_DEPRECATED_API", "NPY_1_7_API_VERSION"), ("USE_FINDBLAS" if use_findblas else "NO_FINDBLAS", None), ("USE_BLAS_SYR" if use_findblas else "AVOID_BLAS_SYR", None)] ),