Ask Your Question

alexhutman's profile - activity

2023-10-05 17:21:31 +0200 received badge  Popular Question (source)
2022-11-21 02:29:47 +0200 edited question Cython compilation fail after separating code

Cython compilation fail after separating code Hello, I am on SageMath version 9.8.beta2, Release Date: 2022-10-16, Usin

2022-11-21 02:25:49 +0200 commented question Cython compilation fail after separating code

@vdelecroix I didn't want to be accused of not including enough information, so I included every step that I took along

2022-11-21 02:23:58 +0200 commented answer Cython compilation fail after separating code

Thank you Vincent, this solved my problem! I ended up going with the former option since after re-evaluating, zeroforcin

2022-11-21 02:22:27 +0200 received badge  Supporter (source)
2022-11-21 02:22:25 +0200 marked best answer Cython compilation fail after separating code

Hello,

I am on SageMath version 9.8.beta2, Release Date: 2022-10-16, Using Python 3.10.5.

I am using an Intel i9-12900K on WSL version 1.0.0.0, WSL Kernel version 5.15.74.2.


The code in my master branch is all in a big Cython file called OneGinormousFile.pyx. Running sage OneGinormousFile.pyx results in no compilation errors, and I'm able to call the functions defined in this file in a Jupyter notebook with no problems.

In the cleanup branch, I then tried separating the code into logical modules for easier readability/organization. When running sage setup.py build_ext --inplace, the fastqueue module compiles without any problems. The metagraph module, however, gives me a bunch of type coercion errors. Below is a brief snippet, but here is the full error log:

>sage --python3 setup.py build_ext --inplace

Compiling zeroforcing/metagraph/metagraph.pyx because it changed.
[1/1] Cythonizing zeroforcing/metagraph/metagraph.pyx

Error compiling Cython file:
------------------------------------------------------------
...

    cdef mp_bitcnt_t extra

    bits.size = size
    if fused_bitset_t is bitset_t:
        bits.limbs = (size - 1) / (8 * LIMB_SIZE) + 1
                                                 ^
------------------------------------------------------------

/mnt/e/projects/python/sage/src/sage/data_structures/bitset_base.pxd:177:50: Cannot assign type 'double' to 'mp_size_t'

Error compiling Cython file:
------------------------------------------------------------
...
    bits.size = size
    if fused_bitset_t is bitset_t:
        bits.limbs = (size - 1) / (8 * LIMB_SIZE) + 1
        bits.bits = <mp_limb_t*>check_calloc(bits.limbs, LIMB_SIZE)
    else:
        bits.limbs = ((size - 1) / (8*ALIGNMENT) + 1) * (ALIGNMENT/LIMB_SIZE)
                                                     ^
------------------------------------------------------------

/mnt/e/projects/python/sage/src/sage/data_structures/bitset_base.pxd:180:54: Cannot assign type 'double' to 'mp_size_t'

Error compiling Cython file:
------------------------------------------------------------
...
        bits.limbs = ((size - 1) / (8*ALIGNMENT) + 1) * (ALIGNMENT/LIMB_SIZE)
        extra = (ALIGNMENT + LIMB_SIZE - 2) // LIMB_SIZE
        bits.mem = check_calloc(bits.limbs + extra, LIMB_SIZE)
        bits.bits = <mp_limb_t*> align(bits.mem, ALIGNMENT)
        bits.non_zero_chunks_are_initialized = False
        bits.non_zero_chunks = <mp_bitcnt_t*> check_allocarray((bits.limbs*LIMB_SIZE) / ALIGNMENT, sizeof(mp_bitcnt_t))
                                                                                     ^
------------------------------------------------------------

/mnt/e/projects/python/sage/src/sage/data_structures/bitset_base.pxd:185:86: Cannot assign type 'double' to 'size_t'

Does anyone know why this is happening? There isn't a problem in the code since it's giving errors on Sage's bitset modules and it's only when the code is separated. I'm out of ideas 😅

2022-11-21 02:22:25 +0200 received badge  Scholar (source)
2022-11-17 05:07:45 +0200 edited question Cython compilation fail after separating code

Cython compilation fail after separating code Hello, I am on SageMath version 9.8.beta2, Release Date: 2022-10-16, Usin

2022-11-17 04:39:44 +0200 edited question Cython compilation fail after separating code

Cython compilation fail after separating code Hello, I am on SageMath version 9.8.beta2, Release Date: 2022-10-16, Usin

2022-11-05 14:08:25 +0200 received badge  Student (source)
2022-11-04 23:11:28 +0200 edited question Cython compilation fail after separating code

Cython compilation fail after separating code Hello, The code in my master branch is all in a big Cython file called On

2022-11-04 23:10:37 +0200 received badge  Editor (source)
2022-11-04 23:10:37 +0200 edited question Cython compilation fail after separating code

Cython compilation fail after separating code Hello, The code in my master branch is all in a big Cython file called On

2022-11-04 20:49:57 +0200 asked a question Cython compilation fail after separating code

Cython compilation fail after separating code Hello, My karma is not high enough to publish links, so I will have to gr