11 ms·
A new programming language for high-performance computers
- jimbob45 5y ago>speed and correctness do not have to compete ... they can go together, hand-in-hand Is Rust considered slow these days outside of compilation speed?
- brrrrrm 5y agofor the type of computation described in this article, Rust is considered slow. I recently stumbled across a site to track it's progress in changing that: https://www.arewelearningyet.com https://www.arewelearningyet.com
- amelius 5y agoHave we duplicated X yet? I wonder how this kind of thing will fare a 100 years in the future, where X is drawn from a set of functionalities that is much and much larger. We would essentially get stuck on a single language.
- whatshisface 5y agoNo, it's quite fast.
- ska 5y agoNot fast in this sense, but definitely not slow.
- stonewareslord 5y agoNot fast in which sense? HPC? Or single/multithredded processing on one machine?
- deleted 5y ago[deleted]
- xh-dude 5y agoIn the sense of - where Rust can do some amazing program transformations because it’s quite demanding about memory safety, ATL purports that if the math is all tensors, then there’s potential in program transformations based on automated reasoning about tensor formulae. Which no one needs for FizzBuzz but sounds like something worth exploring for HPC.
- wrnr 5y agoBack in the days the compile times where legendary for being slow and that fact has stuck around but this is no longer true today.
- capableweb 5y agoRust code is not slow to compile today? I'm currently learning myself some Rust, have a project with some dependencies + ~1500 lines of code in my directory and my debug build with cargo takes 20 seconds every time I change just a line. Specs: Intel i7-7600U (4) @ 2.800GHz, Samsung NVMe SSD SM961/PM961, 16GiB. Considering the small size of the project, I wouldn't consider that fast and in fact, makes me very turned off on the prospect of the project growing any bigger.
- Taywee 5y agoThat sounds quite bad to me. It can happen if you have a virus scanner going crazy on your build target during build (which is a common complaint on Windows, you might have to add your Rust projects to an exceptions list). It can also happen if you have really heavy proc macros or other compile-time magic going that needs to reprocess and reexecute often (serde famously can crank up compile times). I doubt your compile times would really ramp up that much from your project itself getting much bigger. If you are at 1.5k lines of code, the ridiculous compile time is probably due to other causes.
- capableweb 5y agoThese horrible compile times happen both on Windows and Linux. I am using Serde, but only on two out of 15 structs in total. I haven't really tried to investigate yet if these compile times is just because of my project, but I am using some "standard" crates (like tokio and serde) that the community seems to overall use for most user-facing software, so hopefully they won't "infect" the compile times too much. Thanks for the pointers though!
- xqcgrek2 5y ago
- dang 5y ago"Please don't post shallow dismissals, especially of other people's work. A good critical comment teaches us something." https://news.ycombinator.com/newsguidelines.html https://news.ycombinator.com/newsguidelines.html Edit: you've unfortunately been posting a lot of unsubstantive and/or flamebait comments. We ban accounts that do that. I don't want to ban you again, so you could you please review the site guidelines and fix this? We'd be grateful.
- xqcgrek2 5y agook, sorry, my bad
- jll29 5y agoShame that reporting for "normal" earthlings is unlikely to include a few sample lines of code of this new language. Draft paper: https://arxiv.org/pdf/2008.11256.pdf https://arxiv.org/pdf/2008.11256.pdf Sample code (looks like a DSL embedded in Python): https://github.com/gilbo/atl/blob/master/examples/catenary.py https://github.com/gilbo/atl/blob/master/examples/catenary.p...
- ogogmad 5y agoOne of the innovations in the paper is they find a method for implementing reverse-mode autodiff in a stateless manner, making optimisations easier to verify. I might be wrong but they take the principle of dual numbers: a + b epsilon, and change the b component into its linear dual. Therefore, b is a function, and not a number. If b is a function instead of a number, then there's more flexibility regarding flow of control, and that flexibility allows you to express reverse-mode autodiff.
- brrrrrm 5y agoa pure functional language is trivially differentiated, no? View a program as a data flow graph and then append the differentiation data flow graph. How this is executed (reverse-mode vs forward-mode vs some exotic mix) is just a leaked abstraction. Ideally, it wouldn't need to be exposed to the user.
- taeric 5y agoMy understanding is that all trivial versions of anything are wonderful for the pedagogy, but far short of what is needed in implementation. Just consider garbage collection. Trivial reference counting is easy to explain and implement. Not going to win too many points in use, though.
- balsam 5y agoIts unfortunate that ATL is such a generic name. The actual code to which you meant to link is here: https://github.com/ChezJrk/verified-scheduling https://github.com/ChezJrk/verified-scheduling OTOH, a Coq-like DSL written in python would be exciting!
- ogogmad 5y agoI think formal verification makes sense for programs like optimising compilers. You have a reasonable hypothesis to prove: That the optimisations don't change the behaviour of the program in any way, except for speed.
- astrange 5y agoIt's not "in any way" but "in any way we care about" - people love optimizations like -ffast-math that are not well founded.
- agambrahma 5y agoHmm, I would've expected them to double down on differentiation within Julia (via Zygote etc)
- eigenspace 5y agoMIT is a big place, there's lots of people there who don't use julia, and I don't think there's any structures in place to stop MIT people from making new languages (nor should there be).
- rbanffy 5y ago> I don't think there's any structures in place to stop MIT people from making new languages (nor should there be). And just reminding people this is one of the very few cases when it is ok to create a new language.
- UncleOxidant 5y agoYeah, based on the title and where it's from I half expected it to be some kind of DSL based on Julia. Instead it's based on Coq which gives them formal verification capability.
- simeonschaub 5y agoIt reads to me like ATL is actually more of a tensor compiler than a general-purpose language. In fact, I'd actually be curious if we could lower (subsets of) Julia to ATL, let it optimize the tensor expressions and transpile everything back into Julia/LLVM IR for further optimizations. In Julia, there is already Tullio.jl [1], which is basically a front end for tensor expressions, which can target both CPUs and GPUs with AD support and automatically parallelizes the computation. It doesn't really optimize the generated code much right now though, so something like this could be interesting. [1] https://github.com/mcabbott/Tullio.jl https://github.com/mcabbott/Tullio.jl
- tgflynn 5y agoBasing it on Julia would make sense for certain reasons, basing it on Coq would make sense for different reasons but basing it on Python, as appears to be the case from the only code sample I've seen, doesn't make a lot of sense to me.
- floren 5y agoMeanwhile, HPC software will continue to be written with C+MPI, or Fortran+MPI. Source: was involved in development of multiple HPC frameworks, attended multiple HPC conferences, despite wailing and gnashing of teeth all actual software continues to be written the same way it's always been.
- brrrrrm 5y agoIt'd be quite a boring world if observations of the past could reliably predict the future.
- deleted 5y ago[deleted]
- AnimalMuppet 5y agoI'm not an expert. But with current CPUs, doesn't HPC critically depend on memory alignment? (For two reasons: Avoiding cache misses, and enabling SIMD.) Sure, algorithms matter, probably more than memory alignment. But when you've got the algorithm perfect and you still need more speed, you're probably going to need to be able to tune memory alignment. C lets you control memory alignment, in a way that very few other languages do. Until the competitors in HPC catch up to that, C is going to continue to outrun those other languages. (Now, for doing the tweaking to get the most out of the algorithm, do I want to do that in C? No. I want to do it in something that makes me care about fewer details while I experiment.)
- brrrrrm 5y agoYou're correct that low level details very much matter in the HPC space. The types of optimizations described in this paper are exactly that! To elucidate, check out Halide's cool visualizations/documentation (which this paper compares itself to) https://halide-lang.org/tutorials/tutorial_lesson_05_scheduling_1.html https://halide-lang.org/tutorials/tutorial_lesson_05_schedul...
- mhh__ 5y agoNothing C does is even remotely special anymore. If anything it's total crap by modern standards because it makes performant abstractions harder. C code uses a lot of linked lists because linked lists are easy. C isn't the Lingua Franca of fast software anymore. The reason why C programs can sometimes be faster, today, however is not an intrinsic property of the language but rather its inability to allow incompetent programmers to hide their bad data structures. C also encourages programming styles that are harder to optimize so some loop optimizations are no longer possible.
- mindleyhilner 5y agoPaper: http://people.csail.mit.edu/lamanda/assets/documents/LiuPOPL2022.pdf http://people.csail.mit.edu/lamanda/assets/documents/LiuPOPL...
- UncleOxidant 5y agoThis sounds like Halide [1] which I think is also from the same group in MIT. However, Halide is an embedded DSL in C++. It sounds like ATL being based on Coq would be more likely to always produce correct code. [1] https://halide-lang.org/ https://halide-lang.org/
- downut 5y agoIndeed. Notice the last author. Halide has had transparent autodiff for some time now. I am guessing, this is follow-on work in the usual academic style. (Not trivializing at all.) I've been watching Halide for a while as I really like it, intuitively. Also it wasn't that hard to bring up on FreeBSD with a few patches, where it performs more or less exactly as on Linux when configured cpu only. That's solid generic programming, to say the least. However... I have no recent decades experience with HPC but I would be surprised if dense tensor operations were a significant component of current workloads. Could be though!
- going_ham 5y agoThere is also this: https://anydsl.github.io/ https://anydsl.github.io/ They have some framework that achieves high level compute!
- dan-robertson 5y agoIn mathematics, there are two ways to deal with tensors: 1. You come up with notation for tensor spaces, and tensor product operations, and a way to specify the indexes of pairs of dimensions you would like to contract, either using algebra or many-argument linear maps. 2. You write down a symbol for the tensors and one suffix for each of the indices. For an arbitrary rank tensor you write something like $T_{ij\cdots k}$. You write tensor operations using the summation convention: every index variable must appear exactly once in a term (indicating that it is free) or twice (indicating that it should be contracted – that is you should take the sum of the values for each possible value of the index). Special tensors are used to express special things. So for the product of two matrices C = AB, you could write: c_{ik} = a_{ij} b_{jk} Or a matrix times a vector: v_i = a_{ij} u_j Or the trace of A: t = a_{ij} \delta_{ij} (delta is the name of the identity matrix, aka the Kroenecker delta). For the determinant of a matrix you could write: d = a_{1i} a_{2j} \cdots a_{(n)k} \epsilon_{ij\cdots k} (Epsilon is the antisymmetric tensor, a rank n, n-dimensional tensor where the element at i, j, …, k is 1 if those indicted are an even permutation of 1, 2, …, n, -1 if they are an odd permutation, and 0 otherwise). The great advantage is that you don’t spend lots of time faffing around with bounds for the indices or their positions in the tensor product. But to some extent this is only possible because the dimension (ie the bounds) tends to have a physical or geometric meaning. This is also why when the notation is used in physics you also have subscripts and superscripts and you must contract one subscript index with a corresponding superscript index. I wonder if it is possible to achieve a similarly concise convenient notation for expressing these kinds of vector computations. You can imagine abusing the notation a bit but leaving most loops and ranges implicit, e.g. let buf[i] = f(x[i]); let buf' = buf or 0; let out[i] = buf'[i-1] + buf[i]; out (With this having a declarative meaning and not specifying how iteration should be done). A convolution with 5x5 kernel could be something like: /* in library */ indicator(p) = if p then 1 else 0 delta[[is]][[js]] = indicator(is == js) windows(radii)[[is]][[js]][[ks : (-radii..radii)]] = delta[[is]][[js + ks]] /* in user code */ out[i,j] = in[p,q] * windows([2, 2])[p,q,i,j,k,l] * weight[k,l] /* implicit sun over all k, l, p, q, but only loops over k, l as p, q values implied */ Where I’ve invented the syntax [[is]] to refer to multiple indices at once. I don’t know if it would be possible to sufficiently generalise it and avoid having to specify the size of everything everywhere, or whether a computer could recognise enough patterns to convert it to efficient computation.
- zitterbewegung 5y agoIs this in direct competition with JAX from google ?
- chillee 5y agoThis is not comparable with ML frameworks (Pytorch or Jax) - its closest analogue is Halide (which they mention in the paper).
- nestorD 5y agoI would say it is somewhat comparable with XLA which is the compiler backend for Jax (and was heavily inspired by Halide).
- brrrrrm 5y agoI'd be curious to read up on the parts of XLA design that were inspired by Halide if you have any links. I haven't familiarized myself with XLA/MLIR source code much, but I was under the impression it took a more conventional approach to optimizing compilers (pattern matching rather than generic separation of schedule and compute).
- ablekh 5y agoI would say that ATL is a domain-specific language (DSL). To be more accurate, I would refer to it as a horizontal DSL (as opposed to typical DSLs, which are usually focused on some vertical subject domain or industry). Another thought is that, if I were writing HPC-focused software today (and, especially, tomorrow), I would definitely much prefer Julia to ATL or similar niche solutions. Thanks to (likely) not much of, if any, loss of performance, but an incomparably wider spectrum of potential applications and covered domains. Plus, an additional benefit of lack of the two-language problem.
- sarusso 5y agoMeanwhile, loads of compute hours get wasted because of accidentally overwriting output data in structures like /data/final/new_conf9/last_try2/JOBID.txt or due to wrong dependency setup. IMHO the main issue of HPC today is not performance per se, but rather not embracing software best practices...
- klyrs 5y agoAshamed to admit this happened to me once. The job output files did have unique jobid-based names, but I didn't account for the poorly-documented fact that multiple clusters shared a filesystem (and I was running jobs on a few) so multiple jobs ended up with the same jobid. Thankfully, I had some sentinel start/stop output that allowed me to automatically detect when multiple processes had overlapping output, and I was able to re-run fractional jobs and only wasted about 5% of my compute time. On one hand, I hated that there wasn't some fancy framework (like, a database?) to hide the footguns behind... on the other hand, the learning curve was very low and I'm happier about that on the balance.
- sarusso 5y agoThis happened to any of us in the early days... :) As a side note, a good framework does not necessarily mean to increase the learning curve, but rather to protect the user from itself.
- KolenCh 5y agoI think you are referring to workflow managers? Yes, roll your own workflow manager is a bad practice but many do anyway.
- sarusso 5y agoNot only workflow managers... also: - Usually no testing on a small test case / data set before going to the big one; - Very old fashioned workload management systems with CLI-level job setup and automation prone to trivial errors as not handling escape sequences; - Poor environment setup, little to no use of containerisation and when in use, HPC-specific solutions (as Singularity or Slurm containerisation support) tend to be more palliatives than addressing the root issue; - A generic "not invented here" syndrome plus a strong belief that standard software best practices cannot be adopted in the HPC space (for no reason). This, more or less.
- jheriko 5y agoits nice to see this. the idea that speed, safety and usability are mutually exclusive has always been wrong. trivially so imo... but clearly not given how long the myth has persisted.
- x13pixels 5y agoIf you are interested in building programs with proofs of correctness, one of the authors of A Tensor Language (ATL), Adam Chlipala, has a book called "Certified Programming with Dependent Types" that can be read at http://adam.chlipala.net/cpdt/ http://adam.chlipala.net/cpdt/
- 7thaccount 5y agoIs "ATL" "A Tensor Language" a homage to "APL" "A Programming Language" from Iverson?
- igameu 5y agoOf course ATL is a homage to Ken Iverson's APL. His language treated multidimensional matrices up to 64 dimensions as single variables to be manipulated in single steps, thus creating a language that performed many steps in a short space and time. He was a farm-bred Canadian, first in his town to ever go to college, whose thinking was brilliant!
- jrk 5y agoYep!
- thriftwy 5y agoQBasic had tensor types support circa 1980s.
- rbanffy 5y agoIf this is a joke, I don’t get it.
- ksaj 5y agoRead the description for REDMAT.BAS. Apparently this started with Microsoft Professional Basic 7.0, which appeared in 1989. So technically, "the 1980s," but only the last one. https://www.cambridge.org/core/books/abs/crystal-field-handbook/qbasic-programs/A29283BBE4A1C877B9590E4A2094DF00 https://www.cambridge.org/core/books/abs/crystal-field-handb...
- thriftwy 5y agoIt had arrays of any n-arity. Come think of it, C++ also does
- EVa5I7bHFq9mnYK 5y agoSince when we started calling multidimensional arrays - tensors? I see it's shorter and sexier, but tensors, as I remember them from general relativity course, are something different.