I wonder if this code in Julia would be quicker and clearer.
This would be a DSL in Julia, too. According to the abstract, the DSL is a high-level declarative specification of a CFD problem, which then gets automatically transformed into the low-level, parallel numerical code. So, it’s similar in spirit to the DSL that ModelingToolkit.jl provides.
The overall approach to creating a CFD DSL like this is the same regardless of the language used.
The syntax is very verbose, but I think this has more to do with wanting to make the translation between Saiph and Scala very simple, and the DAG of computations explicit. You could design a more Julia-like syntax that gets executed in parallel, the disadvantage of this is that the translation becomes less obvious and debugging is harder.
My job actually does something similar. We add a bunch of expressions to a DAG, and then evaluate the DAG all at once, deduplicating and executing in parallel. We do this using Julia exprs
and macros. For example, we might have something like:
dag = DAG()
d = .001u"m"^2 / u"s"
d2 = d^2
add_expr!(dag, d^2)
Where macros behind the scenes ensure that d
is recorded as a dependency of d^2
. In our case, all our expressions are large arrays, so this sort of overhead makes sense.