sympy / sympy

A computer algebra system written in pure Python

Home Page:https://sympy.org/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

GPU Support for Boolean Expressions

YuriyTigiev opened this issue · comments

Hi SymPy Team,

Thanks for the awesome tool! Quick question: are you planning to add GPU support for Boolean expressions in future releases? It would really speed up computations. Would love to know your thoughts on this.

Thanks!

Hi @YuriyTigiev, you'll have to expand more on your request. You have not provided enough information to know exactly what you desire. Please provide some examples of what you may want to do with SymPy or examples of what SymPy fails to do.

Hello,

For example I want to run simplify_logic and simplified_expr functions on GPU for simple sample below. Real task has variables more than 1024. Do that on the cpu is unreal.
Also can I use https://docs.sympy.org/latest/modules/numeric-computation.html for this task ?

from sympy import symbols, Or, And

x1, y1 = symbols('x1 y1')
expr = Or(And(x1, y1), x1 ^ y1)
print(expr)
simplified_expr = simplify_logic(expr, deep=True)
print(simplified_expr)
solutions = satisfiable(simplified_expr, all_models=True)
for solution in solutions:
    print(solution)

The only thing that may connect you to GPU calculations (that I'm aware of) is that you could code print SymPy to numba code and then execute that on the GPU.

People also do custom code printing to support GPU oriented code, but I don't think we have anything in SymPy that directly does that for you.

I don't think that numba helps me, because it compiles the python code but sympy library already compiled.

Does sympy library internally use multithreading ?

If you are trying to run operations on SymPy objects in parallel or somehow on a GPU, then that is not something that SymPy supports. All internal calculations in SymPy are single threaded, i.e. there is no parallel code in SymPy. SymPy is a pure Python library, in general.

If you are trying to run operations on SymPy objects in parallel or somehow on a GPU, then that is not something that SymPy supports. All internal calculations in SymPy are single threaded, i.e. there is no parallel code in SymPy. SymPy is a pure Python library, in general.

Ok. I will try to use numba.