array expressions #144

Closed
wants to merge 56 commits into
from

Conversation

Projects
None yet
3 participants
@markflorisson
Contributor

markflorisson commented Aug 24, 2012

Element-wise array expressions for Cython

markflorisson added some commits May 21, 2012

Support overlapping memory and broadcasting assignment
    (Avoid recomputation along broadcasting axes)
    (Need some tests)

@scoder scoder referenced this pull request Oct 12, 2012

Closed

refactor indexnode2 #137

+write_graphviz = False
+
+# Macro that should be defined to enable explicit vectorization
+cython_vector_size = "CYTHON_VECTOR_SIZE"

This comment has been minimized.

@robertwb

robertwb Oct 16, 2012

Contributor

Meaning of this value?

@robertwb

robertwb Oct 16, 2012

Contributor

Meaning of this value?

This comment has been minimized.

@markflorisson

markflorisson Oct 16, 2012

Contributor

Compiling with -DCYTHON_VECTOR_SIZE=X enables vectorization, with 4 meaning SSE2 (4 floats), and 8 meaning AVX (8 floats).

The new branch is called _array_expressions_rebased, but the py3k build segfaults with a refcount error. I still need to investigate that.

@markflorisson

markflorisson Oct 16, 2012

Contributor

Compiling with -DCYTHON_VECTOR_SIZE=X enables vectorization, with 4 meaning SSE2 (4 floats), and 8 meaning AVX (8 floats).

The new branch is called _array_expressions_rebased, but the py3k build segfaults with a refcount error. I still need to investigate that.

+ return minitypes.ArrayType(dtype, len(type.axes),
+ is_c_contig=type.is_c_contig,
+ is_f_contig=type.is_f_contig)
+ elif type.is_float:

This comment has been minimized.

@robertwb

robertwb Oct 16, 2012

Contributor

Would these be better expressed as a dictionary?

@robertwb

robertwb Oct 16, 2012

Contributor

Would these be better expressed as a dictionary?

This comment has been minimized.

@markflorisson

markflorisson Oct 16, 2012

Contributor

Yes I think that would be nicer.

@markflorisson

markflorisson Oct 16, 2012

Contributor

Yes I think that would be nicer.

This comment has been minimized.

@markflorisson

markflorisson Oct 28, 2012

Contributor

Oh I remember why I didn't do that now. It's because you can create new types, and for instance c_sint_type and c_int_type are the same, but don't compare equal (I'm not sure why?).

@markflorisson

markflorisson Oct 28, 2012

Contributor

Oh I remember why I didn't do that now. It's because you can create new types, and for instance c_sint_type and c_int_type are the same, but don't compare equal (I'm not sure why?).

This comment has been minimized.

@robertwb

robertwb Oct 30, 2012

Contributor

Like typedefs I guess. Does this then assume you know the exact size at compile time? Hmm...

@robertwb

robertwb Oct 30, 2012

Contributor

Like typedefs I guess. Does this then assume you know the exact size at compile time? Hmm...

This comment has been minimized.

@markflorisson

markflorisson Oct 30, 2012

Contributor

No, it needs that only for the LLVM backend (which isn't used by Cython). It uses the external typedef name if the typedef is external, otherwise it uses the actual types to allow code reuse of expressions of equivalent types. I got everything working, except for one pyximport test, but I think that might be my test setup. I'll try a new PR next weekend.

@markflorisson

markflorisson Oct 30, 2012

Contributor

No, it needs that only for the LLVM backend (which isn't used by Cython). It uses the external typedef name if the typedef is external, otherwise it uses the actual types to allow code reuse of expressions of equivalent types. I got everything working, except for one pyximport test, but I think that might be my test setup. I'll try a new PR next weekend.

+
+ self.context.original_cython_code = code
+
+ if_clause = "if"

This comment has been minimized.

@robertwb

robertwb Oct 16, 2012

Contributor

unused code

@robertwb

robertwb Oct 16, 2012

Contributor

unused code

@robertwb

This comment has been minimized.

Show comment
Hide comment
@robertwb

robertwb Oct 16, 2012

Contributor

In my (albeit somewhat cursory) perusal of the code, I think it looks good. Is there any way to test that your code is being used (i.e. unnecessary intermediates are not being created) as well as getting the correct output? (Perhaps an object type that prints out arithmetic operations could verify the expected sequence of operations, though this might be too much subject to change). Also, it'd be good to have a link somewhere to your thesis or other high-level overview.

Contributor

robertwb commented Oct 16, 2012

In my (albeit somewhat cursory) perusal of the code, I think it looks good. Is there any way to test that your code is being used (i.e. unnecessary intermediates are not being created) as well as getting the correct output? (Perhaps an object type that prints out arithmetic operations could verify the expected sequence of operations, though this might be too much subject to change). Also, it'd be good to have a link somewhere to your thesis or other high-level overview.

@scoder

This comment has been minimized.

Show comment
Hide comment
@scoder

scoder Sep 1, 2017

Contributor

Since no-one has stepped up to continue and maintain this in 5 years, I'll close it. I think the feature itself should still be integrated, but it should be based on external backend such as NumExpr or Pythran.

Contributor

scoder commented Sep 1, 2017

Since no-one has stepped up to continue and maintain this in 5 years, I'll close it. I think the feature itself should still be integrated, but it should be based on external backend such as NumExpr or Pythran.

@scoder scoder closed this Sep 1, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment