[Cython] OpenMP problem

mark florisson markflorisson88 at gmail.com
Sun Jul 31 21:49:43 CEST 2011


2011/7/31 Vitja Makarov <vitja.makarov at gmail.com>:
> I've tried openmp support with simple example:
>
> from cython.parallel cimport prange
>
> def mul(values):
>    ret = 1
>    for i in prange(values):
>        ret *= i
>    return ret
>
> And cython crashes:
>
> ((b04e040...)) vitja at vitja-laptop:~/work/cython-vitek/zzz$ make mul.so
> /usr//bin/python  ../cython.py --gdb -v  mul.pyx -o mul.c
> Compiling /home/vitja/work/cython-vitek/zzz/mul.pyx
>
> Error compiling Cython file:
> ------------------------------------------------------------
> ...
> from cython.parallel cimport prange
>
> def mul(values):
>    ret = 1
>    for i in prange(values):
>                         ^
> ------------------------------------------------------------
>
> mul.pyx:5:26: stop argument must be numeric or a pointer (perhaps if a
> numeric literal is too big, use 1000LL)
>
> Error compiling Cython file:
> ------------------------------------------------------------
> ...
> from cython.parallel cimport prange
>
> def mul(values):
>    ret = 1
>    for i in prange(values):
>                  ^
> ------------------------------------------------------------
>
> mul.pyx:5:19: Compiler crash in AnalyseExpressionsTransform
>
> ModuleNode.body = StatListNode(mul.pyx:1:0)
> StatListNode.stats[0] = DefNode(mul.pyx:3:0,
>    modifiers = [...]/0,
>    name = u'mul',
>    num_required_args = 1,
>    reqd_kw_flags_cname = '0',
>    used = True)
> File 'Nodes.py', line 337, in analyse_expressions: StatListNode(mul.pyx:4:4,
>    is_terminator = True)
> File 'Nodes.py', line 6553, in analyse_expressions:
> ParallelRangeNode(mul.pyx:5:19,
>    assigned_nodes = [...]/1,
>    is_parallel = True,
>    is_prange = True,
>    valid_keyword_arguments = [...]/3)
>
> Compiler crash traceback from this point on:
>  File "/home/vitja/work/cython-vitek/Cython/Compiler/Nodes.py", line
> 6553, in analyse_expressions
>    self.index_type, node.type)
>  File "/home/vitja/work/cython-vitek/Cython/Compiler/PyrexTypes.py",
> line 2624, in widest_numeric_type
>    elif type1.rank < type2.rank:
> AttributeError: 'PyObjectType' object has no attribute 'rank'
> make: *** [mul.c] Ошибка 1
> rm mul.c
> ((b04e040...)) vitja at vitja-laptop:~/work/cython-vitek/zzz$
>
>
>
> --
> vitja.
> _______________________________________________
> cython-devel mailing list
> cython-devel at python.org
> http://mail.python.org/mailman/listinfo/cython-devel
>

Thanks for the report, I pushed a fix:
https://github.com/cython/cython/commit/e9f9fde70d5d96f418244a0640a63a966a2457c1
. Seems like I forgot an error test for that.


More information about the cython-devel mailing list