5 ms·
ModelingToolkit.jl, an IR and Compiler for Scientific Models
- eigenspace 7y agoAwesome work, it’s really cool to see the progress being made in ModellingToolkit.jl. As someone who spends more time on symbolic mathematics than numerical mathematics, I’ve often wished that Julia’s symbolic libraries had the same sort of energy behind them that the numerical libraries had. But it’s great to see that a lot of the work put into the numerical libraries is relevant to the symbolic ones.
- lewis500 7y agoMe too. I think that because of the meta programming capabilities we’re going to see a lot more development in that direction. Recently I started using Turing.jl, which uses a sort of declarative syntax that was easy to write and understand.
- marmaduke 7y agoas a research engineer in data science/modeling, posts like this just look too good to be true. there's no free lunch. what is the catch with all this stuff? who is going to maintain all this when Chris Rackauckas gets plucked by MathWorks or Wolfram? (this is a compliment! it's great stuff)
- ChrisRackauckas 7y agoIf you're looking for a catch, I guess the issue is that the modeling domain is relatively simple, restricted to "mathematical models", i.e. no conditional-based control flow like while loops. Like systems like Jax, for loops are supported by simply unrolling the expression into something without control flow. This lets the resulting IR be relatively simple and then all of the math is easy to define, but of course means the domain for this is "math" and not "programs". That said, it's still large enough for things like Modelica models, which is a large enough domain for a lot of the algorithms I want to explore like automatic index reduction of DAEs.
- marmaduke 7y agoI have the obligatory does it work with GPUs question. I have lamented writing out jacobians for GPUs by hand for ages, and thought, SymPy should be able to do this.
- new4thaccount 7y agoAs someone whose entire industry runs off of a Jacobian matrix, I wonder how easy it is to run on the GPU? I assumed this was difficult as splitting up the matrix would impact the solution.
- b_tterc_p 7y agoWhat industry would that be and approximately how valuable do you think such a thing might be worth
- new4thaccount 7y agoHaha. Great question. Power Transmission. When you model the transmission grid, you can solve for the flows on the equipment (lines and transformers) where the inputs are certain equipment parameters as well as generation and load values. This is called powerflow or loadflow and the traditional Newton-Raphson method represents the equations in Jacobian form where the sensitivities represent how real and reactive power is impacted by the bus voltages and bus phase angles. This solution takes voltage into account (pretty important) and forms the basis of many computationally intensive operations such as contingency analysis (also known as N-1). You basically determine before the analysis which equipment you want to monitor and then you have a list of contingencies that you want to guard against. The grid itself is a pretty massive NxN matrix that is thankfully both sparse and symmetric. When you simulate a contingency, you take it out of service in the model and then re-solve the AC powerflow. For each of those solves, you check that the bus voltages are ok and that the equipment is within the rated limits. Violations are reported to the user. There are other calcs that are also important and that use the Jacobian. I think one reason this area hasn't received much GPU attention is that the problem is easy enough to parallelize and most vendors do so now, so a server with a decent amount of cores can whittle away at even large grids with thousands of contingencies in a reasonable amount of time. Less important studies that need to be quick and robust use the DC powerflow which is linearized and doesn't show voltage impact. There are many entities that monitor this in real-time, but transmission planners work with text file based models and will run millions of contingencies with computer clusters in a batch mode and dump the results in Excel or a SQL database. I'm not sure if a high end GPU would help there or if it is just a throw more CPU cores kind of problem. How much would it be worth? It is tough to say. I'd have to know how well GPUs perform here. I'm guessing it is not as good, but I'm not knowledgeable here. If you had a product that bundled GPU, GPU-based power systems analysis software and a client that would run on desktop with an API, AND it performed significantly faster than the competition, you might have some customers. That is a ton of upfront work though.