Skip to content

Commit

Permalink
move to scipy blas
Browse files Browse the repository at this point in the history
  • Loading branch information
jdtuck committed Dec 25, 2023
1 parent 7f8fd9d commit 49584dd
Show file tree
Hide file tree
Showing 6 changed files with 66 additions and 5 deletions.
3 changes: 1 addition & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@ documentation = "https://fdasrsf-python.readthedocs.io/en/latest/"
# `tools/ci/cirrus_wheels.yml`.
skip = "cp36-* cp37-* cp38-* cp312-* pp* *-manylinux_i686 *_ppc64le *_s390x *-win32 *_i686"
build-verbosity = "3"
environment = {BLAS="/usr/local/lib",BLAS_SRC="/usr/local/include"}
before-build = "bash {project}/bin/cibw_before_build.sh {project}"

[tool.cibuildwheel.linux]
Expand All @@ -72,5 +71,5 @@ select = "*-win32"
environment = {PKG_CONFIG_PATH="/opt/32/lib/pkgconfig"}

[build-system]
requires = ["setuptools>=46.0", "wheel", "cffi>=1.0.0", "Cython", "findblas", "oldest-supported-numpy"] # PEP 518 - what is required to build
requires = ["setuptools>=46.0", "wheel", "cffi>=1.0.0", "Cython", "scipy", "oldest-supported-numpy"] # PEP 518 - what is required to build
build-backend = "setuptools.build_meta"
1 change: 0 additions & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ kiwisolver
matplotlib
numpy
patsy
findblas
pyparsing
python-dateutil
scipy
Expand Down
3 changes: 1 addition & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
import platform
from distutils.core import setup
from distutils.core import Command
from findblas.distutils import build_ext_with_blas
from distutils.extension import Extension
from Cython.Distutils import build_ext
from Cython.Build import cythonize
Expand Down Expand Up @@ -124,7 +123,7 @@ def run(self):


setup(
cmdclass={"build_ext": build_ext_with_blas, "build_docs": build_docs},
cmdclass={"build_ext": build_ext, "build_docs": build_docs},
ext_modules=extensions,
name="fdasrsf",
version="2.5.4",
Expand Down
55 changes: 55 additions & 0 deletions src/crbfgs.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
/* Generated by Cython 3.0.7 */

#ifndef __PYX_HAVE__crbfgs
#define __PYX_HAVE__crbfgs

#include "Python.h"

#ifndef __PYX_HAVE_API__crbfgs

#ifdef CYTHON_EXTERN_C
#undef __PYX_EXTERN_C
#define __PYX_EXTERN_C CYTHON_EXTERN_C
#elif defined(__PYX_EXTERN_C)
#ifdef _MSC_VER
#pragma message ("Please do not define the '__PYX_EXTERN_C' macro externally. Use 'CYTHON_EXTERN_C' instead.")
#else
#warning Please do not define the '__PYX_EXTERN_C' macro externally. Use 'CYTHON_EXTERN_C' instead.
#endif
#else
#define __PYX_EXTERN_C extern "C++"
#endif

#ifndef DL_IMPORT
#define DL_IMPORT(_T) _T
#endif

__PYX_EXTERN_C double cblas_dnrm2(int const , double const *, int const );

#endif /* !__PYX_HAVE_API__crbfgs */

/* WARNING: the interface of the module init function changed in CPython 3.5. */
/* It now returns a PyModuleDef instance instead of a PyModule instance. */

#if PY_MAJOR_VERSION < 3
PyMODINIT_FUNC initcrbfgs(void);
#else
/* WARNING: Use PyImport_AppendInittab("crbfgs", PyInit_crbfgs) instead of calling PyInit_crbfgs directly from Python 3.5 */
PyMODINIT_FUNC PyInit_crbfgs(void);

#if PY_VERSION_HEX >= 0x03050000 && (defined(__GNUC__) || defined(__clang__) || defined(_MSC_VER) || (defined(__cplusplus) && __cplusplus >= 201402L))
#if defined(__cplusplus) && __cplusplus >= 201402L
[[deprecated("Use PyImport_AppendInittab(\"crbfgs\", PyInit_crbfgs) instead of calling PyInit_crbfgs directly.")]] inline
#elif defined(__GNUC__) || defined(__clang__)
__attribute__ ((__deprecated__("Use PyImport_AppendInittab(\"crbfgs\", PyInit_crbfgs) instead of calling PyInit_crbfgs directly."), __unused__)) __inline__
#elif defined(_MSC_VER)
__declspec(deprecated("Use PyImport_AppendInittab(\"crbfgs\", PyInit_crbfgs) instead of calling PyInit_crbfgs directly.")) __inline
#endif
static PyObject* __PYX_WARN_IF_PyInit_crbfgs_INIT_CALLED(PyObject* res) {
return res;
}
#define PyInit_crbfgs() __PYX_WARN_IF_PyInit_crbfgs_INIT_CALLED(PyInit_crbfgs())
#endif
#endif

#endif /* !__PYX_HAVE__crbfgs */
1 change: 1 addition & 0 deletions src/crbfgs.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ cimport cyarma
cimport numpy as np

include "cyarma.pyx"
include "cython_cblas.pxi"

from libcpp cimport bool

Expand Down
8 changes: 8 additions & 0 deletions src/cython_cblas.pxi
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
from scipy.linalg.cython_blas cimport (
dnrm2
)

ctypedef double (*dnrm2_)(const int*, const double*, const int*) noexcept nogil

cdef public double cblas_dnrm2 (const int N, const double *X, const int incX) noexcept nogil:
return (<dnrm2_>dnrm2)(&N, X, &incX)

0 comments on commit 49584dd

Please sign in to comment.