Skip to content
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

Change lambdify's default for backend to llvm when available #431

Merged
merged 3 commits into from
Mar 20, 2023

Conversation

bjodah
Copy link
Contributor

@bjodah bjodah commented Feb 12, 2023

Background: I actually thought 'llvm' was our default, so I was surprised when I realized it actually isn't:
sympy/sympy#24673 (comment)

People coming to symengine.py is probably doing so for the performance advantage over SymPy, so I think changing the default is helpful here.

This could perhaps be considered mildly backwards incompatible, but I think the pros outweigh the cons. What do you think?

@rikardn
Copy link
Contributor

rikardn commented Feb 13, 2023

I agree. Would it still be possible to use the current default via some option at runtime or can it only be set at compile time?

@bjodah
Copy link
Contributor Author

bjodah commented Feb 13, 2023

launching e.g. python3 using:

$ env SYMENGINE_LAMBDIFY_BACKEND=lambda python3

would set the default to lambda, no matter if libsymengine was compiled with LLVM support or not. And I think you can modify environment variables of an already running python interpreter (useful in jupyter notebooks) by assigning to os.environ["SYMENGINE_LAMBDIFY_BACKEND"] = "lambda", but I need to confirm that it works.

There are some test failures for this PR that I intend to debug, but my current local debug build of symengine uses some unfortunate combination of SYMENGINE_INTEGER=boostmp and a boost versions which essentially hangs during the collection phase of pytest... (integer nthroot probably uses some algorithm of poor time complexity in boost).

Co-authored-by: Isuru Fernando <isuruf@gmail.com>
@isuruf
Copy link
Member

isuruf commented Feb 14, 2023

Would it still be possible to use the current default via some option at runtime or can it only be set at compile time?

You can do sym.Lambdify(expr, args, backend="lambda") to get the previous default.

@isuruf isuruf merged commit 0ca50eb into symengine:master Mar 20, 2023
@bjodah bjodah deleted the lambdify-llvm-by-default branch March 21, 2023 05:58
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