ctypedef struct ReturnRows:
double[50000] v1
double[50000] v2
double[50000] v3
double[50000] v4
works, but
ctypedef struct ReturnRows:
double[100000] v1
double[100000] v2
double[100000] v3
double[100000] v4
fails with Process finished with exit code 139 (interrupted by signal 11: SIGSEGV)
It does not make sense to me, because the upper limit should be close to the available limit of the system dedicated to that processing task. Is there an upper limit set in some way?
Here is my builder:
from distutils.core import setup
import numpy as np
from distutils.core import setup, Extension
from Cython.Build import cythonize
file_names = ['example_cy.pyx', 'enricher_cy.pyx']
for fn in file_names:
print("cythonize %s" % fn)
setup(ext_modules = cythonize(fn),
author='CGi',
author_email='hi@so.com',
description='Utils for faster data enrichment.',
packages=['distutils', 'distutils.command'],
include_dirs=[np.get_include()])
From Question: How i use the struct? I iterate over it, coming from a pandas dataframe:
cpdef ReturnRows cython_atrs(list v1, list v2, list v3, list v4):
cdef ReturnRows s_ReturnRows # Allocate memory for the struct
s_ReturnRows.v1 = [0] * 50000
s_ReturnRows.v2 = [0] * 50000
s_ReturnRows.v3 = [0] * 50000
s_ReturnRows.v4 = [0] * 50000
# tmp counters to keep track of the latest data averages and so on.
cdef int lines_over_v1 = 0
cdef double all_ranges = 0
cdef int some_index = 0
for i in range(len(v3)-1):
# trs
s_ReturnRows.v1[i] = (round(v2[i] - v3[i],2))
# A lot more calculations, why I really need this loop.