Skip to content

Use LLVMDoubleVisitor #110

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Nov 2, 2016
Merged

Use LLVMDoubleVisitor #110

merged 5 commits into from
Nov 2, 2016

Conversation

isuruf
Copy link
Member

@isuruf isuruf commented Nov 1, 2016

cc @bjodah

Copy link
Contributor

@certik certik left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Otherwise I think that looks good.

def Lambdify(args, exprs, bool real=True, bool llvm=False):
IF HAVE_SYMENGINE_LLVM:
if llvm:
return LLVMDouble(args, exprs, real)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this raise an exception if llvm==True but HAVE_SYMENGINE_LLVM is False?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree, at least a warning?

We could also leave it None and allow the user to choose default by setting an environment variable, e.g. SYMENGINE_LAMBDIFY_BACKEND or something along those lines? (we could then run the tests suite with
that variable set to llvm and lambda respectively)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's good idea, but llvm backend doesn't have all the features of lambda including complex support. Let's add that when llvm backend is on par with the lambda backend.

@@ -50,6 +50,15 @@ def test_Lambdify():
assert allclose(l(range(n, n+len(args))),
[3*n+3, n**2, -1/(n+2), n*(n+1)*(n+2)])

def test_Lambdify_LLVM():
if not se.have_llvm:
return
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And here we can test that exception.

Copy link
Contributor

@bjodah bjodah left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great, is it a good time for me to start working on a version supporting outputs with heterogeneous shapes once this is in?

else:
self.lambda_double_complex[0].call(&out[0], &inp[0])
cdef void _eval_complex(self, double complex[::1] inp, double complex[::1] out):
raise ValueError("Not supported")

# the two cpdef:ed methods below may use void return type
# once Cython 0.23 (from 2015) is acceptable as requirement.
cpdef unsafe_real(self, double[::1] inp, double[::1] out):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since you now do size checking maybe the unsafe_ prefix doesn't really apply any more?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This checking was already there in _eval which was called previously by unsafe_real. We can rename this to eval_real and this would call _eval_real (which should changed into a cpdef method)

def Lambdify(args, exprs, bool real=True, bool llvm=False):
IF HAVE_SYMENGINE_LLVM:
if llvm:
return LLVMDouble(args, exprs, real)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree, at least a warning?

We could also leave it None and allow the user to choose default by setting an environment variable, e.g. SYMENGINE_LAMBDIFY_BACKEND or something along those lines? (we could then run the tests suite with
that variable set to llvm and lambda respectively)

@isuruf isuruf force-pushed the llvm branch 4 times, most recently from 5a1a347 to b492f0b Compare November 2, 2016 04:54
@isuruf
Copy link
Member Author

isuruf commented Nov 2, 2016

Made changes. Ready for review again

@isuruf
Copy link
Member Author

isuruf commented Nov 2, 2016

is it a good time for me to start working on a version supporting outputs with heterogeneous shapes once this is in?

Thanks. Once this is merged, you can start on it.

Copy link
Contributor

@bjodah bjodah left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Look great! 👍

@isuruf isuruf merged commit eb13330 into symengine:master Nov 2, 2016
@isuruf
Copy link
Member Author

isuruf commented Nov 2, 2016

Thanks for the reviews

@certik
Copy link
Contributor

certik commented Nov 2, 2016

+1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants