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!
User avatar
saso
Veteran
Posts: 1920
Joined: Fri May 16, 2014 1:14 pm
Contact:

Julia

Post by saso »

The Julia Programming Language
https://julialang.org/
Julia was designed from the beginning for high performance. Julia programs compile to efficient native code for multiple platforms via LLVM.
Julia is provided under the MIT license, free for everyone to use. All source code is publicly viewable on GitHub.
Julia Documentation
https://docs.julialang.org/

Julia Noteworthy Differences from Other Languages
https://docs.julialang.org/en/v1/manual ... fferences/

Learning Julia
https://julialang.org/learning/

Getting Started with Julia (for Experienced Programmers)
https://www.youtube.com/watch?v=-lJK92bEKow

Intro to Julia tutorial (version 1.0)
https://www.youtube.com/watch?v=8h8rQyEpiZA

Julia Basics
https://www.youtube.com/playlist?list=P ... TUiwrZ719y

Julia Intermediate
https://www.youtube.com/playlist?list=P ... vr5hkNVrCw

Julia Advance
https://www.youtube.com/playlist?list=P ... uzzVfRd5xu

Julia Programming For Nervous Beginners
https://www.youtube.com/playlist?list=P ... qFlaIXYf1R
https://github.com/JuliaAcademy/JuliaPr ... sBeginners

Getting Started with Julia: Workflow
https://www.youtube.com/watch?v=Xn-Q_wuR5Uo

QuantEcon Cheatsheet
https://cheatsheets.quantecon.org/

Learn X in Y minutes, Where X=Julia
https://learnxinyminutes.com/docs/julia/

Think Julia: How to Think Like a Computer Scientist
https://benlauwens.github.io/ThinkJulia ... /book.html

Julia Wikibook
https://en.wikibooks.org/wiki/Introducing_Julia

Intro To Julia for Data Science and Scientific Computing (With Problems and Answers)
http://ucidatascienceinitiative.github.io/IntroToJulia/

Data Science in Julia for Hackers
https://datasciencejuliahackers.com/

Developing Julia Packages
https://www.youtube.com/watch?v=QVmU29rCjaA

Julia for Numerical Computation in MIT Courses
https://github.com/mitmath/julia-mit
High-level dynamic programming languages (as opposed to low-level languages like C or static languages like Java) are essential for interactive exploration of computational science. They allow you to play with matrices, computations on large datasets, plots, and so on without having to worry about managing memory, declaring types, or other minutiae—you can open up a window and start typing commands to immediately get results.

The traditional problem with high-level dynamic languages, however, is that they are slow: as soon as you run into a problem that cannot easily be expressed in terms of built-in library functions operating on large blocks of data ("vectorized" code), you find that your code is suddenly orders of magnitude slower that equivalent code in a low-level language. The typical solution has been to switch to another language (e.g. C or Fortran) to write key computational kernels, calling these from the high-level language (e.g. Matlab or Python) as needed, but this is vastly more difficult than writing code purely in a high-level language and imposes a steep barrier on anyone hoping to transition from casual experimentation to "serious" numerical computation. Julia mostly eliminates this issue, because it is carefully designed to exploit a "just-in-time compiler" called LLVM, making it possible to write high-level code in Julia that achieves near-C speed.
Using Julia's Type System For Hidden Performance Gains
https://www.stochasticlifestyle.com/usi ... snotation/

Intermediate Level Julia (Workshop)
https://www.youtube.com/watch?v=rAxzR7lMGDM

7 Julia Gotchas and How to Handle Them
https://www.stochasticlifestyle.com/7-j ... as-handle/

Type-Dispatch Design: Post Object-Oriented Programming for Julia
https://www.stochasticlifestyle.com/typ ... ing-julia/

A Comparison Between Differential Equation Solver Suites In MATLAB, R, Julia, Python, C, Mathematica, Maple, and Fortran
http://www.stochasticlifestyle.com/comp ... c-fortran/

I Like Julia Because It Scales and Is Productive: Some Insights From A Julia Developer
https://www.stochasticlifestyle.com/lik ... developer/

Algorithm efficiency comes from problem information
https://www.stochasticlifestyle.com/alg ... formation/

Automatic Differentiation in 10 minutes with Julia
https://www.youtube.com/watch?v=vAp6nUMrKYg

Why Numba and Cython are not substitutes for Julia
https://www.stochasticlifestyle.com/why ... for-julia/

Engineering Julia for Speed
https://www.youtube.com/watch?v=XWIZ_dCO6X8

Why Julia is the most suitable language for science
https://www.youtube.com/watch?v=7y-ahkUsIrY

Some State of the Art Packages in Julia v1.0
https://www.stochasticlifestyle.com/som ... ulia-v1-0/

The Unreasonable Effectiveness of Multiple Dispatch
https://www.youtube.com/watch?v=kc9HwsxE1OY

Julia and DifferentialEquations.jl
https://www.youtube.com/watch?v=zJ3R6vOhibA

A Deep Introduction to Julia for Data Science and Scientific Computing
http://ucidatascienceinitiative.github.io/IntroToJulia/

The Essential Tools of Scientific Machine Learning (Scientific ML)
http://www.stochasticlifestyle.com/the- ... ntific-ml/

How To Train Interpretable Neural Networks That Accurately Extrapolate From Small Data
https://www.stochasticlifestyle.com/how ... mall-data/

Universal Differential Equations for Scientific Machine Learning
https://www.youtube.com/watch?v=bBH8HVEr0-A

Parallel Computing and Scientific Machine Learning (MIT Course)
https://www.youtube.com/channel/UCDtsHj ... OPg/videos
https://github.com/mitmath/18337
https://book.sciml.ai/

Special Subject in Mathematics: Applications of Scientific Machine Learning (MIT Course)
https://github.com/mitmath/18S096SciML

SciML: An Open Source Software Organization for Scientific Machine Learning
https://sciml.ai/news/2020/03/29/SciML/

Almost Trivial: Parallelizing a Specialized Matrix Type in Julia
https://mdavezac.github.io/blog/

Julia Programming’s Dramatic Rise in HPC and Elsewhere
https://www.hpcwire.com/2020/01/14/juli ... elsewhere/

Large Scale WinD Farm Optimization Integrating Julia with OpenMDAO
https://www.youtube.com/watch?v=_V7xrvXiESc

The Ingredients for a Composable Programming Language
https://www.youtube.com/watch?v=W6MagCe2XZI
https://www.oxinabox.net/2020/02/09/why ... julia.html

Zero2Hero intensive Julia workshop
https://www.youtube.com/watch?v=Fi7Pf2NveH0
https://github.com/Datseris/Zero2Hero-JuliaWorkshop

GPU Programming in Julia
https://www.youtube.com/watch?v=9soe36Hqq3Y

Doing Scientific Machine Learning (SciML) With Julia
https://www.youtube.com/watch?v=QwVO0Xh2Hbg

Make your Julia Code Faster and Compatible with non-Julia Code
https://www.youtube.com/watch?v=S5R8zXJOsUQ
https://github.com/nassarhuda/juliacon2020files

Auto-Optimization and Parallelism in DifferentialEquations.jl
https://www.youtube.com/watch?v=UNkXNZZ3hSw

Julia, A language for AI and much more
https://www.youtube.com/watch?v=DG6-sMNTSdo

SciML: How Language is Changing Scientific Research
https://www.youtube.com/watch?v=3hM7wn7iJ70

Introduction to Computational Thinking (MIT Course)
https://www.youtube.com/playlist?list=P ... 0dz9OnsnIJ
https://computationalthinking.mit.edu/Fall20/
https://github.com/mitmath/18S191

Differential Equations in 2021
https://www.youtube.com/watch?v=XI-iHixmGgg

The impact of differentiable programming: how ∂P is enabling new science in Julia
https://www.youtube.com/watch?v=rF2QAJLM730

Stiffness in Scientific Machine Learning
https://www.youtube.com/watch?v=AIX8ardhAxA
https://diffeqflux.sciml.ai/dev/

Julia SciML Symposium, SIAM CSE 2021
https://www.youtube.com/playlist?list=P ... vQpGp3bwDn

Generalizing Automatic Differentiation to Automatic Sparsity, Uncertainty, Stability, and Parallelism
https://www.stochasticlifestyle.com/gen ... rallelism/

ModelingToolkit, Modelica, and Modia: The Composable Modeling Future in Julia
http://www.stochasticlifestyle.com/mode ... -in-julia/

Engineering Trade-Offs in Automatic Differentiation: from TensorFlow and PyTorch to Jax and Julia
https://www.stochasticlifestyle.com/eng ... and-julia/

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

Julia on A64FX
https://www.youtube.com/watch?v=kZNYFWGnixA

Causal vs Acausal Modeling By Example: Why Julia ModelingToolkit.jl Scales
https://www.youtube.com/watch?v=ZYkojUozeC4

Automate your Code Quality in Julia
https://forem.julialang.org/matthijscox ... julia-12hn

Link to a previous forum post on some of the Julia packages (and some other things)
https://forum.freecadweb.org/viewtopic.php?f=8&t=40775
Last edited by saso on Wed Oct 18, 2023 10:18 pm, edited 52 times in total.
User avatar
saso
Veteran
Posts: 1920
Joined: Fri May 16, 2014 1:14 pm
Contact:

Re: Julia

Post by saso »

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:
Last edited by saso on Thu Jan 16, 2020 1:16 pm, edited 4 times in total.
User avatar
looo
Veteran
Posts: 3941
Joined: Mon Nov 11, 2013 5:29 pm

Re: Julia

Post by looo »

I see Julia as an alternative to the python world. Julia allows faster computation but is still a very new language. Introducing Julia to freecad is a more difficult task than one might expect.

I guess pythons advantages is the clean syntax and the big user base. Accelerating python via jit is possible with numba which is in my eyes a good approach to speed up more time intensive functions.
With binding tools like pybind11 it's also quite simple to speed up things with c/c++.

In my eyes a lot of bubbeling is build around Julia via advertising. At least this is the impression after receiving some mails every month which tells me to switch to Julia.... I guess Julia is not only a community driven approach and therefore advertisement should be consumed carefully.

So from freecad perspective we should better concentrate on the python approach. There is a lot of things which can be optimized. In the long run bubbles will burst and only the working stuff will survive.
triplus
Veteran
Posts: 9471
Joined: Mon Dec 12, 2011 4:45 pm

Re: Julia

Post by triplus »

Unless some big revolution happens in a foreseeable future i feel that Python is the place to be.
User avatar
saso
Veteran
Posts: 1920
Joined: Fri May 16, 2014 1:14 pm
Contact:

Re: Julia

Post by saso »

Well, as I have said before, this is not about removing Python from FreeCAD but to add Julia as another "computational engine" to it and for the beginning it was also not meant as to start any development now, but just to share some links, collect some knowledge and do some research on it, so that users who are new to it can learn something and users who have already some knowledge and experience with it can give some opinions...
Last edited by saso on Mon Feb 10, 2020 10:07 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 »

Continued from https://forum.freecadweb.org/viewtopic. ... 30#p367810
ChrisRackauckas wrote: Sun Feb 09, 2020 10:31 pm Hey,
This is Chris Rackauckas, developer of DifferentialEquations.jl and author of StochasticLifestyle.com. Wordpress stats led me over to this community and I found there's some fun discussion. Let me know what your community would need out of differential equation solvers and modeling tools to best support your activities. We'll soon be releasing a bunch of blog posts on PDE-constrained optimization and automated learning of partial differential equations with universal differential equations (showing more of the sparsity techniques to go beyond https://arxiv.org/abs/2001.04385). I'm not much of a CAD guy but if you let me know what you guys need we can work it into our development roadmap and research! Indeed, a lot of our DAE work started because Hilding Elmqvist (inventor of Modelica) transitioned fully to Julia (Modia.jl) and he had a lot of questions to support tooling for his next gen Modelica. If you let us know what FreeCAD needs, we can work it into the Julia Lab's research and our next round of GSoCs :D .
I guess the first thing where some help would be very appreciated would be with the development of our 2D/3D constraints solvers (recent topic on this https://forum.freecadweb.org/viewtopic.php?f=20&t=40525), it represents a very basic and core functionality for our program and as such it is really needed. I guess if we decide to continue develop this in C++ there is not so much interest from you (or the bigger Julia community) to do much of an collaboration in the sense of code development but even at least some advice on the solvers choice and implementations could be very helpful.

Moving a bit further from the basic constraints there is the need for kinematics, also where things related to Modelica start to come in to question (I guess roughly we could define it as the domain of ODE's) and then even further in to FEM/CFD (PDE's). And additional to this "user defined" simulations there is then also the need for optimization/surrogate modeling and design space discovery with the more "classical" methods and as the new possibilities with NDE/UDE's... Maybe this topic https://forum.freecadweb.org/viewtopic.php?f=24&t=41605 of the airfoils workbench and its targets gives a nice example of one such possibility (but in the general computer aided engineering there are endless such examples). My post in that topic https://forum.freecadweb.org/viewtopic. ... 30#p356752 and the videos of a recent OpenMDAO Workshop https://www.youtube.com/user/OpenMDAO/videos can give some more ideas around that. And I am guessing that if we would do this in Julia then there would also be quite some interest on it from your side (and possible the bigger Julia community)?

Realizing at least a small part of this big dream, with a bit of collaboration and help of a few GSoCs, would be huge :)
Last edited by saso on Thu Mar 12, 2020 11:03 am, edited 1 time in total.
User avatar
adrianinsaval
Veteran
Posts: 5541
Joined: Thu Apr 05, 2018 5:15 pm

Re: Julia

Post by adrianinsaval »

maybe they can give an alternative to solvespace? It is my understanding that solvespace's license (among other things) is impeding the inclussion of assembly3 in the FreeCAD source code
User avatar
saso
Veteran
Posts: 1920
Joined: Fri May 16, 2014 1:14 pm
Contact:

Re: Julia

Post by saso »

Last edited by saso on Thu Sep 03, 2020 9:23 pm, edited 2 times in total.
User avatar
saso
Veteran
Posts: 1920
Joined: Fri May 16, 2014 1:14 pm
Contact:

Re: Julia

Post by saso »

Minisymposium on Partial Differential Equations
https://www.youtube.com/watch?v=pYZzbu_oGaw
https://github.com/JuliaPDE/SurveyofPDEPackages
https://github.com/PetrKryslUCSD/FinEtools.jl
https://github.com/PetrKryslUCSD/MeshTutor.jl
https://github.com/PetrKryslUCSD/Elfel.jl
https://github.com/j-fu/VoronoiFVM.jl
https://github.com/krcools/BEAST.jl
https://github.com/SciML/NeuralPDE.jl
https://github.com/chakravala/Grassmann.jl

Solving partial differential equations in Julia with Gridap.jl
https://www.youtube.com/watch?v=txcb3ROQBS4
New tools to solve PDEs in Julia with Gridap.jl
https://www.youtube.com/watch?v=hsQiFP4S5RY
https://joss.theoj.org/papers/10.21105/joss.02520
https://github.com/gridap/Gridap.jl
https://github.com/gridap/Tutorials
https://gitter.im/Gridap-jl/community
https://discourse.julialang.org/t/ann-g ... ents/51971

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

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

Modia – Modeling Multidomain Engineering Systems with Julia
https://www.youtube.com/watch?v=N94si3rOl1g
https://github.com/ModiaSim/Modia.jl
https://modiasim.github.io/docs/

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

PointSpreadFunctions.jl - optical point spread functions
https://www.youtube.com/watch?v=HwhrCIGzYAk
https://github.com/RainerHeintzmann/Poi ... nctions.jl
https://en.wikipedia.org/wiki/Point_spread_function
https://www.youtube.com/watch?v=Tkc_GOCjx7E The Point Spread Function
https://www.youtube.com/watch?v=JQy94K94nL0 Microscopy: Point Spread Function

Automatic Differentiation for Solid Mechanics in Julia
https://www.youtube.com/watch?v=EeC2pu9i_F0
https://github.com/avigliotti/AD4SM.jl
https://link.springer.com/epdf/10.1007/ ... vp-Q%3D%3D

Ferrite.jl - Finite element toolbox for Julia
https://www.youtube.com/playlist?list=P ... Vh291rwo2l
https://github.com/Ferrite-FEM/Ferrite.jl
https://ferrite-fem.github.io/Ferrite.jl/

Trixi.jl - Adaptive high-order numerical simulations of hyperbolic PDEs in Julia
https://github.com/trixi-framework/Trixi.jl
https://trixi-framework.github.io/Trixi.jl/stable/
Last edited by saso on Tue Oct 31, 2023 8:12 pm, edited 17 times in total.
Post Reply