Julia

Have some feature requests, feedback, cool stuff to share, or want to know where FreeCAD is going? This is the place.
Forum rules
Be nice to others! Read the FreeCAD code of conduct!
sprhawk
Posts: 4
Joined: Sat Sep 21, 2019 1:50 pm

Re: Julia

Post by sprhawk »

I am very supportive to add Julia integration into FreeCAD.

I'm aware of that Julia has some override area among Python and C++, In fact, I think Julia can do some same tasks covered both python and C++. But I agree with you that Julia can do better in doing computation tasks inside FreeCAD. Julia can be much more productive than C++ in writing code similar as python, but as fast as C++ ( about 1/2 speed I assume ).

For future I think, FreeCAD will contain more and more modules for computation, like FEM, Physics Simulation etc, Julia can be more productive and better in experiments than algorithm written in C++. And Julia is very good at interop among Python and C++ ( and other Languages )
saso wrote: Mon Jan 13, 2020 12:34 pm A short note to the topic...

So over the last two months, since I have first made a post on DifferentialEquations.jl and DiffEqFlux.jl (https://forum.freecadweb.org/viewtopic.php?f=8&t=40775) I have been slowly reviewing more and more in to Julia and related topics. In the beginning the idea was that they could maybe be helpful for us to just do some quick testing, researching, prototyping and benchmarking the different solvers and code implementations before doing the implementation in FreeCAD with Python and/or C++, but over time the idea of having Julia available directly in FreeCAD started to make more and more sense. It is not about replacing Python or C++ with it, actually it is able to work very well with both of them. And I would say it would probably be best to use it only (mostly) just for the computationally heavy stuff (not GUI or so) and as such it would probably also not be a big problem as a dependency for packaging/building.

Of course it is possible to use it already with FreeCAD if the user sets it up with Python or Jupiter etc but this is useful then only for some more specific needs of the individual user. It is of course just a proposal, to hear others opinion on it, but developing such things like the constraint solvers (https://forum.freecadweb.org/viewtopic.php?f=20&t=40525) or the fcFEM (https://forum.freecadweb.org/viewtopic.php?f=18&t=33974) with Julia would probably make sense. For ODE/PDE solvers for example, there are numerous tricks and optimization techniques to speed them up and packages such as DifferentialEquations.jl, SUNDIALS, CasADi, PETSc,... can easy be compared to geometrical kernels for brep modeling, saying that it is probably questionable if we should really be writing this on our own, Julia has some very strong support for this. And not just that it achieves near-C speeds, for a lot of its packages it also has support for running the code on GPU, could this make fcFEM execute in almost real time, like ansys discovery live (creo simulation live) ?! :roll:
User avatar
saso
Veteran
Posts: 1920
Joined: Fri May 16, 2014 1:14 pm
Contact:

Re: Julia

Post by saso »

sprhawk wrote: Thu Aug 13, 2020 1:23 pm I am very supportive to add Julia integration into FreeCAD.

I'm aware of that Julia has some override area among Python and C++, In fact, I think Julia can do some same tasks covered both python and C++. But I agree with you that Julia can do better in doing computation tasks inside FreeCAD. Julia can be much more productive than C++ in writing code similar as python, but as fast as C++ ( about 1/2 speed I assume ).

For future I think, FreeCAD will contain more and more modules for computation, like FEM, Physics Simulation etc, Julia can be more productive and better in experiments than algorithm written in C++. And Julia is very good at interop among Python and C++ ( and other Languages )
Exactly! Some users see FreeCAD just as a 3d CAD modeller and are interested more in the nice visual presentations of the models, nothing wrong with that, but we should be pushing FreeCAD more in to engineering (CAE), manufacturing (CAM) and scientific computing, this is where FreeCAD is coming from, this is where FreeCAD already has some good capabilities and this is where the primary focus should be also for the future. And here Julia becomes very interesting and is actually getting better by the day. In my first post of this topic I have tried to give some general introduction to Julia and some of the benefits of its architecture, now I am sort of trying to explore and introduce some of the existing Julia packages that are somewhat more specific to our different needs (as FEM, simulations, optimisations,...).
sprhawk
Posts: 4
Joined: Sat Sep 21, 2019 1:50 pm

Re: Julia

Post by sprhawk »

saso wrote: Sat Aug 15, 2020 7:27 am
sprhawk wrote: Thu Aug 13, 2020 1:23 pm I am very supportive to add Julia integration into FreeCAD.

I'm aware of that Julia has some override area among Python and C++, In fact, I think Julia can do some same tasks covered both python and C++. But I agree with you that Julia can do better in doing computation tasks inside FreeCAD. Julia can be much more productive than C++ in writing code similar as python, but as fast as C++ ( about 1/2 speed I assume ).

For future I think, FreeCAD will contain more and more modules for computation, like FEM, Physics Simulation etc, Julia can be more productive and better in experiments than algorithm written in C++. And Julia is very good at interop among Python and C++ ( and other Languages )
Exactly! Some users see FreeCAD just as a 3d CAD modeller and are interested more in the nice visual presentations of the models, nothing wrong with that, but we should be pushing FreeCAD more in to engineering (CAE), manufacturing (CAM) and scientific computing, this is where FreeCAD is coming from, this is where FreeCAD already has some good capabilities and this is where the primary focus should be also for the future. And here Julia becomes very interesting and is actually getting better by the day. In my first post of this topic I have tried to give some general introduction to Julia and some of the benefits of its architecture, now I am sort of trying to explore and introduce some of the existing Julia packages that are somewhat more specific to our different needs (as FEM, simulations, optimisations,...).
I thought on this these days, and I have new ideas.

Instead of building Julia inside FreeCAD, I think we can Build FreeCAD as a Python module and Setup/Run FreeCAD inside a Julia environment. Although embedding julia inside FreeCAD is exciting, but 1. I think in current stage Julia is not good at being embedded inside an Application like Python as, 2. Julia package is fair large 3. Julia in fact will not replace python insdie FreeCAD, and it will be more usable as calling python and c++, not as opposed 4. Julia programming needs a good REPL which will be better running outside of FreeCAD.

Another option I think it can be OK to setup a IPC Protocol between a FreeCAD process and an external Process which may or may not be in Julia, then the structure will be more flexible with much more implementation
sprhawk
Posts: 4
Joined: Sat Sep 21, 2019 1:50 pm

Re: Julia

Post by sprhawk »

I think it would be better to setup a project target, to do some real things, to make it happen to be real
User avatar
Kunda1
Veteran
Posts: 13434
Joined: Thu Jan 05, 2017 9:03 pm

Re: Julia

Post by Kunda1 »

sprhawk wrote: Fri Aug 21, 2020 6:38 am I think it would be better to setup a project target, to do some real things, to make it happen to be real
Yea, goals are good! Maybe following some of the lead of @kryptokomunist for Google Summer of Code 2020 - linking FreeCAD with iPython/Jupyter notebooks ?

https://forum.freecadweb.org/viewtopic.php?f=8&t=46039
Alone you go faster. Together we go farther
Please mark thread [Solved]
Want to contribute back to FC? Checkout:
'good first issues' | Open TODOs and FIXMEs | How to Help FreeCAD | How to report Bugs
sprhawk
Posts: 4
Joined: Sat Sep 21, 2019 1:50 pm

Re: Julia

Post by sprhawk »

Kunda1 wrote: Fri Aug 21, 2020 11:54 am Yea, goals are good! Maybe following some of the lead of @kryptokomunist for Google Summer of Code 2020 - linking FreeCAD with iPython/Jupyter notebooks ?

https://forum.freecadweb.org/viewtopic.php?f=8&t=46039
There are differences here, FreeCAD has python built along inside, but no julia runtime.
User avatar
saso
Veteran
Posts: 1920
Joined: Fri May 16, 2014 1:14 pm
Contact:

Re: Julia

Post by saso »

User avatar
saso
Veteran
Posts: 1920
Joined: Fri May 16, 2014 1:14 pm
Contact:

Re: Julia

Post by saso »

Few talks from JuliaCon 2021...

DataFrames.jl 1.0 tutorial
https://www.youtube.com/watch?v=tJf24gfcSto

Solving differential equations in parallel on GPUs
https://www.youtube.com/watch?v=DvlM0w6lYEY

Simulating Big Models in Julia with ModelingToolkit
https://www.youtube.com/watch?v=HEVOgSLBzWA

Package development: improving engineering quality & latency
https://www.youtube.com/watch?v=wXRMwJdEjX4

Package latency and what developers can do to reduce it
https://www.youtube.com/watch?v=rVBgrWYKLHY

TopOpt.jl: topology optimization software done right!
https://www.youtube.com/watch?v=sBqdkxPXluU

JuliaSPICE / Cedar: A Composable ML Accelerated Analog Circuit Simulator
https://www.youtube.com/watch?v=q8SzFTtgA60

New tools to solve PDEs in Julia with Gridap.jl
https://www.youtube.com/watch?v=hsQiFP4S5RY

WaterLily.jl: Real-time fluid simulation in pure Julia
https://www.youtube.com/watch?v=YsPkfZqbNSQ

Optical simulation with the OpticSim.jl package
https://www.youtube.com/watch?v=7-vN8oNAz6Y

Global Sensitivity Analysis for SciML models in Julia
https://www.youtube.com/watch?v=vvD4xGBmZc8

Modia – Modeling Multidomain Engineering Systems with Julia
https://www.youtube.com/watch?v=N94si3rOl1g

JuliaSim: Machine Learning Accelerated Modeling and Simulation
https://www.youtube.com/watch?v=lNbU5jNp67s

Many more at https://www.youtube.com/playlist?list=P ... 06VGLW4TLK
Last edited by saso on Fri Oct 07, 2022 10:33 am, edited 1 time in total.
User avatar
saso
Veteran
Posts: 1920
Joined: Fri May 16, 2014 1:14 pm
Contact:

Re: Julia

Post by saso »

Post Reply