Earlier quoted context omitted.
I've never seen recursive looping over a thing get turned into efficient SIMD code in any language. Starting with loops has no good reason to be better able to achieve that but for practical compilers it makes a huge difference. Julia code might also uses a lot of in place operations which would be hard for a compiler to infer as safe.
This is why I find it so annoying that CS programs seem to worship functional programming (at least MY program did!). No, I AM going to write procedural code, and it WILL be faster than your "high IQ" 1 line recursive solution. Also funny to see how little recursion gets used in CUDA/Pytorch/GPU programming - which is what we are seeing to be more and more important over time.
PyTorch: Where we are headed and why it looks a lot like Julia (but not exactly)
121–130 of 291 posts
Re: PyTorch: Where we are headed and why it looks a lot like Julia (but not exactly)
#122Earlier quoted context omitted.
Julia is much, much faster than Python. For numeric code it's almost as fast as C++. They've used lots of cool tricks to become crazy fast on numeric workloads. It's also definitely got support for multithreading, clusters, etc...
For numeric code, comparing to pure python makes no sense, since people use numpy+numba to do that. Is julia much much faster than numba? I don't think so :)
Re: PyTorch: Where we are headed and why it looks a lot like Julia (but not exactly)
#123Earlier quoted context omitted.
I like what Julia is doing but I just dislike the syntax. It seems to resemble ruby, whose syntax I also think is ugly, which to me resembles a modern form of basic.
I know what you mean. I especially dislike the use of an "end" keyword everywhere without a corresponding "begin" keyword.
Re: PyTorch: Where we are headed and why it looks a lot like Julia (but not exactly)
#124Neither language have proper tail call elimination, which, is absolutely insane to me. Yall really just write procedural code for everything?
Tail calls and while loops are essentially equivalent, so why care whether a language prefers one or the other?
Re: PyTorch: Where we are headed and why it looks a lot like Julia (but not exactly)
#125Java has a massive ecosystem yet we continue to see rapid replacement of backends in JavaScript (Node now Deno) and Golang. Each of those language ecosystems rapidly became both large (arguably too large) and robust. Rust has been eating C++ lunch. Same rapid rise of ecosystem story. Instead of forcing Python to be a language it isn't it might be more efficient and ultimately the "right choice" to invest the time in…
I think Python is great for exploration and method development, while I would prefer something more efficient like Julia for production systems. On the other hand, Julia requires compilation while Python allows open-heart surgery on the production system (for the masochists among us). I personally don't like Python that much because every library does things differently and sometimes it feels like learning a complete…
Re: PyTorch: Where we are headed and why it looks a lot like Julia (but not exactly)
#126Earlier quoted context omitted.
Julia is much, much faster than Python. For numeric code it's almost as fast as C++. They've used lots of cool tricks to become crazy fast on numeric workloads. It's also definitely got support for multithreading, clusters, etc...
For numeric code, comparing to pure python makes no sense, since people use numpy+numba to do that. Is julia much much faster than numba? I don't think so :)
Re: PyTorch: Where we are headed and why it looks a lot like Julia (but not exactly)
#127> Julia says: > A language must compile to efficient code, and we will add restrictions to the language (type stability) to make sure this is possible. > A language must allow post facto extensibility (multiple dispatch), and we will organize the ecosystem around JIT compilation to make this possible. > The combination of these two features gives you a system that has dynamic language level flexibility (because you h…
There’s also some unfortunate choices Java made like standardizing one specific semantics for reproducible floating point code. That’s unfortunate because adjusting for native SIMD widths sacrifices reproducibility but improves both accuracy and speed. The only choice if you want perfect reproducibility on all hardware that Java supports is the worst performance model with the worst accuracy.
There’s also the fact that Java integers are 32-bit and Java arrays are limited to 2GB, which was reasonable when Java was designed, but is pretty limiting for modern numerical computing.
I also think that the JVM object model is quite limiting for numerical computing. They still don’t support value types, but value types are precisely what you want to represent efficient numerical values like complex numbers, or quaternions or rationals, and so on. Java forces all user-defined types to be heap-allocated reference types. Julia solves this by defaulting to immutable structures, which is exactly what you want for numerical values: the semantics are still referential (if you can’t mutate you can’t distinguish value semantics from reference semantics), you just can’t change values, which is exactly how you want numbers to behave (you don’t want to be able to change the value of 2).
Lack of value types in Java also makes memory management unnecessarily challenging. You can’t make a user-defined type with an efficient C-compatible array layout in Java. Because the objects are references, so the array is an array of pointers to individual heap-allocated objects. The ability to subtype classes forces that, but even with final classes, the ability to mutate objects also forces it, since pulling an object reference out of an array and modifying it is required to modify the object in the array (reference semantics), and that’s incompatible with the inline array layout.
And finally, this same lack of value types puts a LOT of pressure on the garbage collector.
Re: PyTorch: Where we are headed and why it looks a lot like Julia (but not exactly)
#128This seems so silly to me. It’s PyTorch-if they said “the next version of PyTorch will be in Julia, the ecosystem would shift accordingly. They’re practically saying “this language has every feature we need and want, most of them already existing, but we’re going to continue re-inventing them in this objectively less suitable language because we clearly wish to make life harder for ourselves”
Or I read it as "We want to make life as easy for our userbase as possible, so we will put more work on ourselves to make our users lives easier" which is an attitude I very much appreciate.
I have used MATLAB, R, Python and Julia extensively for doing all sorts of data related things during the last 20 years. Julia is incredibly easy to work with, very elegant and really efficient.
R and Python have always felt clumsy in some ways, and hard to write really performant code, even if you are more proficient in Python! As a seasoned Lisper and MLer, even after having a lot of Python experience in my belt, Julia felt much easier to work with from the very beginning.
Furthermore, most Julia libraries are written in pure Julia which simplifies things a lot and enhances composability. While there are great libraries around, the DL landscape is a bit lacking. Flux is great, but I would not use it to build e.g. transformers as it changes too often and has too few maintainers behind it. Hence a potential migration of Torch to Julia would be fantastic.
Re: PyTorch: Where we are headed and why it looks a lot like Julia (but not exactly)
#129Neither language have proper tail call elimination, which, is absolutely insane to me. Yall really just write procedural code for everything?
Lack of TCO is a JVM problem. All JVM languages are incapable for this reason. It's a very hard problem to fix apparently, I remember even asking one of the Sun JVM developers at a talk at my university and he said one of the issues was the Java security model and stack ownership IIRC. This was a long time ago though so I may be incorrect. The problem remains hard though.
Re: PyTorch: Where we are headed and why it looks a lot like Julia (but not exactly)
#130Earlier quoted context omitted.
As has been pointed out, Julia is not limited to a single thread. It's actually got a pretty good support for parallelism both at the thread and process level. And no, Julia is not too similar to Python. Julia has multiple dispatch, Python does not.
Another point that is often lost is how mathematical Julia code can look, especially for matrix functions. Yeh this is superficial, but so are 200 dollar sneakers and they do just fine. Honestly there is a real pleasure writing code that looks like it could be on the blackboard. The numpy / numba world in Python just feels... not great.