Re: [sympy] symjit

2025-07-20 Thread Shahriar Iravanian
The latest version of symjit (v2.3.0) is now available (with thanks to Jason). You can install it as `conda install -c conda-forge symjit`. In addition to being more stable, Symjit should be significantly faster, especially for certain workloads relevant to SymPy. The main improvements are: 1.

Re: [sympy] symjit

2025-04-13 Thread Oscar Benjamin
On Sun, 13 Apr 2025 at 15:04, Shahriar Iravanian wrote: > > Hi Oscar, > > I wrote a light wrapper around the symjit python backend. It can be installed > using `pip install funcbuilder`. The only dependency is numpy. The GitHub > repo is https://github.com/siravan/funcbuilder. Thanks Shahriar.

Re: [sympy] symjit

2025-04-13 Thread Shahriar Iravanian
Hi Isuru, The Rust backend has a C API for communication with Python. However, it expects the whole model as a JSON string, which may not be the most convenient form for SymEngine. I think we need to design a better API that is useful to SymEngine. Thanks, Shahriar On Saturday, April 12, 20

Re: [sympy] symjit

2025-04-13 Thread Shahriar Iravanian
Hi Oscar, I wrote a light wrapper around the symjit python backend. It can be installed using `pip install funcbuilder`. The only dependency is numpy. The GitHub repo is https://github.com/siravan/funcbuilder. It can compile your example: In [1]: from funcbuilder import FuncBuilder In [2]: B, [x

Re: [sympy] symjit

2025-04-12 Thread Oscar Benjamin
On Sat, 12 Apr 2025 at 18:01, Shahriar Iravanian wrote: > > Regarding the example, this is a tough test! It is and in some ways it is not realistic but actually in some ways it is. A common case will certainly be small expressions e.g. for simple ODEs as you show in the README. Another case thoug

Re: [sympy] symjit

2025-04-12 Thread Isuru Fernando
Hi Oscar, Yes, we can add symjit as another backend if it offers a C/C++ API. We also have a pure C/C++ backend, just replace `LLVMDouble` by `LambdaDouble`. Isuru On Sat, Apr 12, 2025 at 11:08 AM Oscar Benjamin wrote: > On Sat, 12 Apr 2025 at 16:32, Isuru Fernando wrote: > > > > SymEngine is

Re: [sympy] symjit

2025-04-12 Thread Shahriar Iravanian
Hi Oscar, Thank you very much for your response. I appreciate it. There is a lot to think about. Regarding the example, this is a tough test! It shows that there is a bug in the x64-86 rust backend. Interestingly, the Python backend and the rust one on ARM64 (MacOS) give the correct answer: e =

Re: [sympy] symjit

2025-04-12 Thread Oscar Benjamin
On Sat, 12 Apr 2025 at 16:32, Isuru Fernando wrote: > > SymEngine is a bit slower than protosym due to using memoryviews, but > we can add an interface to avoid those. I'm sure it can be made faster. To be clear to anyone reading this both SymEngine and protosym are using LLVM for this. I could h

Re: [sympy] symjit

2025-04-12 Thread Isuru Fernando
Hey Oscar, SymEngine's lambdify can be used too. It uses numpy arrays to support broadcasting and other features of sympy. from symengine import * x = symbols('x') e = x**2 + x for _ in range(10): e = e**2 + e ed = e.diff(x) f = lambdify([x], [ed]) print(f(.0001)) To avoid a bit of overhead

Re: [sympy] symjit

2025-04-12 Thread Peter Stahlecker
t >> faster? >> >> >> >> I found this on Anaconda’s website: >> >> So I could install like this and it will install the dependencies? I have >> windows. >> >> >> >> Thanks a lot! >> >> >> >> Peter >

Re: [sympy] symjit

2025-04-12 Thread Oscar Benjamin
On Fri, 11 Apr 2025 at 20:49, Shahriar Iravanian wrote: > > The latest version of symjit (1.5.0) has just been published. By now, the > Rust backend is stabilized and generates code on Linus/Darwin/Windows and > x86-64 and arm64 machines. Wow this is amazing. I have been thinking for a long tim

Re: [sympy] symjit

2025-04-12 Thread Shahriar Iravanian
Of > *Shahriar > Iravanian > *Sent:* Friday, April 11, 2025 9:49 PM > *To:* sympy@googlegroups.com > *Subject:* Re: [sympy] symjit > > > > The latest version of symjit (1.5.0) has just been published. By now, the > Rust backend is stabilized and generates code on Linus/

RE: [sympy] symjit

2025-04-11 Thread peter.stahlecker
Shahriar Iravanian Sent: Friday, April 11, 2025 9:49 PM To: sympy@googlegroups.com Subject: Re: [sympy] symjit The latest version of symjit (1.5.0) has just been published. By now, the Rust backend is stabilized and generates code on Linus/Darwin/Windows and x86-64 and arm64 machines

Re: [sympy] symjit

2025-04-11 Thread Shahriar Iravanian
The latest version of symjit (1.5.0) has just been published. By now, the Rust backend is stabilized and generates code on Linus/Darwin/Windows and x86-64 and arm64 machines. Symjit also has a new plain Python-based backend, which depends only on the Python standard library and numpy (the numpy de

Re: [sympy] symjit

2025-02-20 Thread Jason Moore
Dear Shahrari, We have already debugged everything and merged the PR to conda forge: https://github.com/conda-forge/staged-recipes/pull/29211 You can install symjit with: conda install -c conda-forge symjit Enjoy! Jason moorepants.info +01 530-601-9791 On Fri, Feb 21, 2025 at 1:24 AM Shahri

Re: [sympy] symjit

2025-02-20 Thread Shahriar Iravanian
Hi Jason, Thanks for your help. I got conda-forge working. You can install symjit on Windows and Linux (Mac will be coming soon). Here is the meta.yaml that works: ``` {% set name = "symjit" %} {% set version = "1.2.1" %} package: name: {{ name|lower }} version: {{ version }} source: url

Re: [sympy] symjit

2025-02-20 Thread Jason Moore
Hi, The way conda forge works is that it starts from a source distribution and compiles the code using their toolchain (they have a rust toolchain). This generates conda binaries, not wheels. So, to get it to build there on conda forge we have to debug any Rust compilation or Rust->Setuptools/pyt

Re: [sympy] symjit

2025-02-20 Thread Shahriar Iravanian
Hi, I’m using setuptools. I should try conda next. Currently, it comes with binaries for Windows, linux x86-64 (built on ubuntu), and raspbian linux (aarch64). No Mac yet. I will try to compile it on a Mac. In the long run, it might be easier to rewrite it in pure python with hardware dependenci

Re: [sympy] symjit

2025-02-20 Thread Jason Moore
Dear Shahriar, I opened a PR to package symjit for conda here: https://github.com/conda-forge/staged-recipes/pull/29211 I've never tried building any rust packages. There are a couple issues, but maybe it has to do with conda-forge. I'm not sure. If you have any tips you can comment there. I muc

Re: [sympy] symjit

2025-02-20 Thread Shahriar Iravanian
Thanks a lot. Yes, I meant https://www.sympy.org/en/index.html. I will send a PR. Regarding the name, I was thinking about a variation of lambdify but couldn't come up with one, so I went with compile_func. -- Shahriar On Wed, Feb 19, 2025 at 11:05 PM Jason Moore wrote: > Yes, this looks inter

Re: [sympy] symjit

2025-02-19 Thread Jason Moore
Yes, this looks interesting, especially that you choose a sane function name "compile_func". We should have named lambdify that. Jason moorepants.info +01 530-601-9791 On Wed, Feb 19, 2025 at 11:41 PM Oscar Benjamin wrote: > Hi Shahriar, > > The symjit package sounds very interesting. I will h

Re: [sympy] symjit

2025-02-19 Thread Oscar Benjamin
Hi Shahriar, The symjit package sounds very interesting. I will have to take a look at it. I'm not sure what the list of packages you are referring to is. Presumably a PR to the website can add this? https://github.com/sympy/sympy.github.com Oscar On Wed, 19 Feb 2025 at 22:14, Shahriar Iravani

[sympy] symjit

2025-02-19 Thread Shahriar Iravanian
Could you please add symjit (https://github.com/siravan/symjit) to the list of SymPy projects? Symjit is a lightweight just-in-time (JIT) compiler that directly translates basic sympy expressions into x86-64 and aarch64 machine codes (and, optionally, to WebAssembly). Currently, its main utili