diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 7cb89940..74fefe20 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -15,7 +15,7 @@ jobs: strategy: matrix: os: [ubuntu-latest, macos-latest, windows-latest] - python-version: [3.9] + python-version: [3.11] runs-on: ${{ matrix.os }} defaults: @@ -23,9 +23,9 @@ jobs: shell: bash -l {0} steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Set up Python ${{ matrix.python-version }} - uses: conda-incubator/setup-miniconda@v2 + uses: conda-incubator/setup-miniconda@v3 with: auto-update-conda: true python-version: ${{ matrix.python-version }} @@ -39,7 +39,8 @@ jobs: - name: Install dependencies run: | conda info - conda install -c conda-forge numpy cython h5py + conda install -c conda-forge numpy 'cython<3.0' h5py + python -m pip install --upgrade pip setuptools wheel python -m pip install https://github.com/pypr/cyarray/zipball/master python -m pip install https://github.com/pypr/compyle/zipball/master python -m pip install -r requirements.txt -r requirements-test.txt diff --git a/.github/workflows/zoltan-tests.yml b/.github/workflows/zoltan-tests.yml index 105a88db..c947706a 100644 --- a/.github/workflows/zoltan-tests.yml +++ b/.github/workflows/zoltan-tests.yml @@ -12,7 +12,7 @@ jobs: strategy: matrix: os: [ubuntu-latest] - python-version: [3.9] + python-version: [3.11] env: USE_TRILINOS: 1 @@ -26,13 +26,13 @@ jobs: shell: bash -l {0} steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Install Linux packages ZOLTAN support run: | sudo apt-get update sudo apt-get install -y openmpi-bin libopenmpi-dev libtrilinos-zoltan-dev - name: Set up Python ${{ matrix.python-version }} - uses: conda-incubator/setup-miniconda@v2 + uses: conda-incubator/setup-miniconda@v3 with: auto-update-conda: true python-version: ${{ matrix.python-version }} @@ -40,8 +40,10 @@ jobs: - name: Install dependencies run: | conda info - conda install -c conda-forge numpy cython - python -m pip install mpi4py cyarray + conda install -c conda-forge numpy 'cython<3.0' + python -m pip install --upgrade pip setuptools wheel + python -m pip install mpi4py + python -m pip install https://github.com/pypr/cyarray/zipball/master python -m pip install --no-build-isolation https://github.com/pypr/pyzoltan/zipball/master python -m pip install https://github.com/pypr/compyle/zipball/master python -m pip install -r requirements.txt diff --git a/pyproject.toml b/pyproject.toml index ece6eb95..5aa017ac 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,7 +1,7 @@ [build-system] requires = [ "Beaker", - "Cython>=0.20", + "Cython<3.0", "compyle>=0.8", "cyarray", "mako", diff --git a/pysph/base/linalg3.pyx b/pysph/base/linalg3.pyx index 1130654f..5c4391f3 100644 --- a/pysph/base/linalg3.pyx +++ b/pysph/base/linalg3.pyx @@ -11,7 +11,7 @@ from numpy.linalg import eigh cimport numpy import numpy -cdef extern: +cdef extern from "math.h": double fabs(double) nogil # this is cython substitute for const values diff --git a/pysph/base/nnps_base.pyx b/pysph/base/nnps_base.pyx index dfa35701..0e147e90 100644 --- a/pysph/base/nnps_base.pyx +++ b/pysph/base/nnps_base.pyx @@ -47,13 +47,6 @@ ELSE: cpdef set_number_of_threads(int n): print("OpenMP not available, cannot set number of threads.") - -IF UNAME_SYSNAME == "Windows": - cdef inline double fmin(double x, double y) nogil: - return x if x < y else y - cdef inline double fmax(double x, double y) nogil: - return x if x > y else y - # Particle Tag information from cyarray.carray cimport BaseArray, aligned_malloc, aligned_free from .utils import ParticleTAGS diff --git a/pysph/base/octree.pyx b/pysph/base/octree.pyx index 5f46bc2c..5960a49f 100644 --- a/pysph/base/octree.pyx +++ b/pysph/base/octree.pyx @@ -15,12 +15,6 @@ from cython.parallel import parallel, prange, threadid # EPS_MAX is maximum value of eps in tree building DEF EPS_MAX = 1e-3 -IF UNAME_SYSNAME == "Windows": - cdef inline double fmin(double x, double y) nogil: - return x if x < y else y - cdef inline double fmax(double x, double y) nogil: - return x if x > y else y - ctypedef cOctreeNode* node_ptr ctypedef double* dbl_ptr diff --git a/pysph/base/octree_nnps.pyx b/pysph/base/octree_nnps.pyx index 4bbba26a..14c98a99 100644 --- a/pysph/base/octree_nnps.pyx +++ b/pysph/base/octree_nnps.pyx @@ -9,13 +9,6 @@ from libc.stdlib cimport malloc, free cimport cython from cython.operator cimport dereference as deref, preincrement as inc -IF UNAME_SYSNAME == "Windows": - cdef inline double fmin(double x, double y) nogil: - return x if x < y else y - cdef inline double fmax(double x, double y) nogil: - return x if x > y else y - - ############################################################################# cdef class OctreeNNPS(NNPS): """Nearest neighbor search using Octree. diff --git a/pysph/base/spatial_hash_nnps.pyx b/pysph/base/spatial_hash_nnps.pyx index 65a0b4c6..9878dda3 100644 --- a/pysph/base/spatial_hash_nnps.pyx +++ b/pysph/base/spatial_hash_nnps.pyx @@ -8,13 +8,6 @@ from libcpp.vector cimport vector # Cython for compiler directives cimport cython -IF UNAME_SYSNAME == "Windows": - cdef inline double fmin(double x, double y) nogil: - return x if x < y else y - cdef inline double fmax(double x, double y) nogil: - return x if x > y else y - - ############################################################################# cdef class SpatialHashNNPS(NNPS): diff --git a/pysph/base/stratified_hash_nnps.pyx b/pysph/base/stratified_hash_nnps.pyx index 29ac4b3f..72bf6691 100644 --- a/pysph/base/stratified_hash_nnps.pyx +++ b/pysph/base/stratified_hash_nnps.pyx @@ -12,12 +12,6 @@ cimport cython DEF EPS = 1e-6 -IF UNAME_SYSNAME == "Windows": - cdef inline double fmin(double x, double y) nogil: - return x if x < y else y - cdef inline double fmax(double x, double y) nogil: - return x if x > y else y - ############################################################################# cdef class StratifiedHashNNPS(NNPS): diff --git a/pysph/base/stratified_sfc_gpu_nnps.pyx b/pysph/base/stratified_sfc_gpu_nnps.pyx index a6ee0349..413cf177 100644 --- a/pysph/base/stratified_sfc_gpu_nnps.pyx +++ b/pysph/base/stratified_sfc_gpu_nnps.pyx @@ -38,13 +38,6 @@ cdef extern from *: #endif """ -IF UNAME_SYSNAME == "Windows": - cdef inline double fmin(double x, double y) nogil: - return x if x < y else y - cdef inline double fmax(double x, double y) nogil: - return x if x > y else y - - cdef class StratifiedSFCGPUNNPS(GPUNNPS): def __init__(self, int dim, list particles, double radius_scale=2.0, int ghost_layers=1, domain=None, bint fixed_h=False, diff --git a/pysph/base/stratified_sfc_nnps.pyx b/pysph/base/stratified_sfc_nnps.pyx index 0f27e3c4..63b44f0d 100644 --- a/pysph/base/stratified_sfc_nnps.pyx +++ b/pysph/base/stratified_sfc_nnps.pyx @@ -33,13 +33,6 @@ cdef extern from *: #endif """ -IF UNAME_SYSNAME == "Windows": - cdef inline double fmin(double x, double y) nogil: - return x if x < y else y - cdef inline double fmax(double x, double y) nogil: - return x if x > y else y - - ############################################################################# cdef class StratifiedSFCNNPS(NNPS): diff --git a/pysph/base/z_order_gpu_nnps.pyx b/pysph/base/z_order_gpu_nnps.pyx index 3807d7e9..5a2ec5c8 100644 --- a/pysph/base/z_order_gpu_nnps.pyx +++ b/pysph/base/z_order_gpu_nnps.pyx @@ -44,13 +44,6 @@ cdef extern from *: #endif """ -IF UNAME_SYSNAME == "Windows": - cdef inline double fmin(double x, double y) nogil: - return x if x < y else y - cdef inline double fmax(double x, double y) nogil: - return x if x > y else y - - cdef class ZOrderGPUNNPS(GPUNNPS): def __init__(self, int dim, list particles, double radius_scale=2.0, int ghost_layers=1, domain=None, bint fixed_h=False, diff --git a/requirements.txt b/requirements.txt index ccb71adf..5426b1f9 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,6 +1,6 @@ numpy setuptools>=42.0.0 -Cython>=0.20 +Cython<3.0 cyarray compyle>=0.8 mako diff --git a/setup.py b/setup.py index 9c528fc4..ae13fc67 100644 --- a/setup.py +++ b/setup.py @@ -681,7 +681,7 @@ def setup_package(): # The requirements. install_requires = [ - 'numpy', 'mako', 'cyarray', 'compyle>=0.8', 'Cython>=0.20', + 'numpy', 'mako', 'cyarray', 'compyle>=0.8', 'Cython<3.0', 'setuptools>=42.0.0', 'pytools', 'Beaker' ] tests_require = ['pytest>=3.0', 'h5py', 'vtk']