7 ms·
Why scientists are turning to Rust (2020)
- phendrenad2 4y agoDiscussion from 2 years ago: https://news.ycombinator.com/item?id=25270762 https://news.ycombinator.com/item?id=25270762 It's a weird article. It seems more like a Rust sales pitch than anything.
- latenightcoding 4y agoFirst thing I did was to ctrl+f "10x genomics", because apart from them not too many people are using Rust for scientific computing.
- deleted 4y ago[deleted]
- codetrotter 4y agoOP or mods should probably add "(2020)" to the end of the title.
- BiteCode_dev 4y agoYeah no, "scientists", this wonderful general category that means nothing and everything, in general, are not turning to Rust. Programming is a niche. Rust is a, albeit amazing and gaining traction at a fast pace, niche in this niche. 99% of mathematicians, physicists and biologists I have worked with have not even tried programming yet. And if they do, they will start with the stuff their friends are already using: python, fortran, etc. Hell, 99% of the dev have not heard of rust yet. I go from companies to companies, every time I talk about rust, I have to explain what it is. It's not even living in a bubble if you think that, it's living in an bubble from another dimension. Having generalization from anecdotal evidence in nature.com is kinda ironic if you think about it.
- isofruit 4y agoFull agreement here. My past experience in the bioinformatics field taught me pretty much that "scientists" at large are just as afraid of the terminal as the average person. The science-folks more specialized on informatics typically are folks focusing on being able to use one language. Not use it well, mind you, just able to produce functional, untested code. Given that, I highly doubt any of them are even aware of languages beyond python and java and maybe they're aware that C and C++ exists but are scary.
- eggy 4y agoMust be scientists out of school in the past 15 years with the remark about C and C++ being scary, since engineering and science curriculums in the 80s taught Fortran, C, and C++. 'Numerical Recipes: The Art of Scientific Programming', and books like it, were books I turned to do science or engineering. But, I guess you're right, since I learned to program in 1978 on a Commodore PET 2001, computer science and web development have made pushed friendlier languages like Python, Ruby, JavaScript, and so C, C++, and now Rust (I prefer SPARK2014 or Zig), are considered 'scary' for scientists. BLAS (Fortran) and CBLAS (C) are under the hood of all the dressed up Python code up front (Numpy -> CBLAS). Real Scientists use assembler, C, and Frink! ;) Sad to say the engineering firm I worked at for 6 years was filled with 20-something and 30-something engineers with only one of 15 of them able to code. Excel use, sure. Coding, no. It wasn't that way 25 years ago.
- staticassertion 4y agoAgree that "Scientist" means nothing. I assume that they're basically saying "people who used Python already to solve some sort of problem, but are not programmers". Which is a very small part of the overall "scientist" world I think, who are probably not programming, or who may use matlab or python.
- tialaramex 4y agoI would expect that new graduates in more or less any numerate subject do some programming these days. I just looked, we (a major UK university) as well as having a Computer Science department to teach programming to obviously Computer Science and Electronics students as well as related disciplines such as Mathematics, other departments have their own staff teach programming for Physicists, Chemists, Psychologists, Geographers, and a bunch of social scientists who need Statistics. I just asked the API for courses about "programming" and then checked they didn't mean some other type of programming. So if say Law has a course named like "Coding in Javascript" for some reason I wouldn't have seen it. The most obvious numerate discipline I thought of which doesn't teach programming was Medicine, and I guess they just couldn't find time to add yet another entire discipline's knowledge into the timetable.
- Fomite 4y agoField specific, to be sure, but I know literally zero scientists turning to Rust.
- jrimbault 4y agoYeah. I have one physicist friend, and as I far I know from casual conversion with them, the whole team at his lab don't even know if they are writing C or C++. And explaining python to him, because he's required to teach a bit of it, was a rabbit hole of explaining fractal things. My impression is that at least a number of scientists don't know and don't care.
- Fomite 4y agoYeah, in my field its: R >>>>>>> Python >> Julia > Everything Else This of course ignores that a bunch of the underlying code for both the R and Python things people use is written in other languages, because they'll never really look at that code.
- okasaki 4y agoAre they? I worked with bioinformaticians and now physicists and rust has never come up. > Köster, now at the University of Duisburg-Essen in Germany, was looking for a language that offered the “expressiveness” of Python but the speed of languages such as C and C++. In other words, “a high-performance language that is still, let’s say, ergonomic to use”, he explains. What he found was Rust. He must not have looked very far. There are much better options if you're looking for the expressiveness of Python. Personally I'm very fond of Nim.
- WaxProlix 4y agoNim seems to have adopted a lot of the trappings of rust in the last few years. Sort of weird he didn't see Julia first, as it's explicitly aimed at this group.
- igorkraw 4y agoSpeaking as someone who has built things in python, rust and Julia,I have to say that while I love multiple dispatch and the possibilities the Julia ecosystem offers, I'm not surprised he went to Rust over Julia: it's not much slower to hack in (as in, change some code, try running things, see what breaks, fix) because cargo check will catch a lot of errors before actually running things and you can stub things with "todo!()", but it manages complexity much better (if you lean on the typesystem and your code compiles, it's usually almost done), integrates easier into other ecosystems (cbindgen, pyo3)and the finished product will start up faster
- ansgri 4y agoRust seems to get serious corporate support, which future-proofs it and guarantees ecosystem growth. Not sure about Nim. Edit: others mentioned Julia, and it indeed looks like a valid choice since they don’t seem to program embedded or safety-critical stuff.
- okasaki 4y agoWell, maybe, but IME expecting scientists to have high level thoughts like that about programming language ecosystems is expecting too much.
- pipeline_peak 4y agoWhy 5 scientists are turning to Rust (2020)
- lostmsu 4y agoI bet you they turned back by now.
- isaacg 4y agoThis article describes pretty much exactly why I turned to Rust for my scientific computing - high speed, far easier to use than C or C++, less bug prone.
- nivenkos 4y agoYou can't run it on GPUs and IPUs/TPUs like C++ though? I like Rust but all the scientists I know work with C++/Python (PyTorch) nowadays due to that.
- lostmsu 4y agoRust has tch-rs - quite descent PyTorch binding. But I still switched to Python due to poor debugging experience in Rust (expression evaluation especially with traits is impossible).
- rich_sasha 4y agoGood question then: how is the "occasianal's programmer" experience compare between Rust and C++? I used to write games in C++ as a teenager, and using it daily was fine. Now I find, every time I try to write something in it, it's a massive pain, as I forget the myriad of tiny rules, the very specific ways to write types etc. And that's before I even think about dependency management. Is Rust substantially better at this? When I read frustrations about Rust, it seems to be mostly about the Borrow Checker... does that affect "pedestrian" code, like "take this 4-dimensional array and munge it with an arcane for-loop"? Or, here's a basic immutable class with some fields and some methods, make it available in Python? I'm liking the look of Nim because it is concise, safe and fast-ish, so a good companion to Python. I dislike C++ as that companion because, even though once you've written your code, it integrates very well with Python, it's a lot of pain to get there. Where would Rust fit in this picture?
- rapsey 4y agoRust users are very enthusiastic about Rust, because it fixes so much annoying shit you have to deal with in C/C++. It really brings back a lot of joy to programming. The borrow checker is an issue when you are a beginner and have to unlearn all the bad practices you were doing in C/C++.
- rob74 4y agoI would say the borrow checker is an issue if you come from most other mainstream languages, because Rust's approach of trying to automate memory management without having a garbage collector is quite unique. Also, as a person interested in Rust, but who hasn't yet found the time (and strength of mind) to really commit to learning it: the main difference between C++ and Rust is the cruft that C++ has accumulated over the decades, which Rust doesn't have because it's much younger. But seeing the pace of new features introduced into Rust, I'm a bit worried that some of the older features will soon be declared "non-best practice" and turn into C++-style cruft.
- timeon 4y ago> But seeing the pace of new features introduced into Rust, I'm a bit worried that some of the older features will soon be declared "non-best practice" and turn into C++-style cruft. Is it just because you see additions of new features in general or there are some specific issues? For me new features do not make 'bad practice' from old ways. As example in older versions you had to be more explicit with lifetimes, but that is just convenience.
- eggy 4y ago>>“No other mainstream languages really have these concepts, and they’re really core to understanding a lot of how you have to write code in Rust,” Nichols says. I tried Rust, but I am using SPARK2014/Ada for my needs. Easier to learn and has the formal methods/software integrity checks and other niceties. I started learning SPARK2014 while reading the book, "Building High Integrity Applications with SPARK". It was used by the CubeSat lab in Vermont [1], which the book ties in nicely. I can see programmers flocking to Rust, but scientists are not typically computer scientists, and mainstream shouldn't be a highly-weighted metric. I find Rust a lot more heavy than SPARK/Ada. I've tried Julia too, but you can write systems level code in SPARK/Ada too. The adacore site has a lot of great projects and articles on embedded software, drone low-level code rewrite in SPARK, etc. The partnership between AdaCore and Ferrous Systems is very exciting [2]. I hope to be able to stay with SPARK and gradually learn Rust with this partnership when Rust has a bit more under its belt with real world embedded, high-integrity software like Ada's legacy. [1] http://cubesatlab.org/ http://cubesatlab.org/ [2] https://ferrous-systems.com/blog/ferrous-systems-adacore-joining-forces/ https://ferrous-systems.com/blog/ferrous-systems-adacore-joi...
- deleted 4y ago[deleted]
- batterylow 4y agoA couple of years ago when checking out Rust for scientific work I started looking for familiar ground, e.g. Jupyter notebook support. I was happy to find google/evcxr's Jupyter kernel [1] and started writing an early access book on Rust for data analysis [2]. I still check _Are we learning yet_ [3] to see their recommendation on the state of ML in Rust. It still lists "the ecosystem isn't very complete yet.", which is how I felt at the time! [1] https://github.com/google/evcxr/tree/main/evcxr_jupyter https://github.com/google/evcxr/tree/main/evcxr_jupyter [2] https://datacrayon.com/shop/product/data-analysis-with-rust-notebooks/ https://datacrayon.com/shop/product/data-analysis-with-rust-... [3] https://www.arewelearningyet.com https://www.arewelearningyet.com
- zgs 4y agoPython and R are the two go to modern programming languages for number crunching. Fortran still has a lot of sway. C has a little. Rust is totally irrelevent in this context.
- hobofan 4y agoFor everything high-performance in some scientific areas (like bioinformatics in the article), all the heavy number crunching isn't done by Python or R, but by underlying C/C++ libraries. And from having seen some of those libraries, my impression is that many are riddled with memory problems (even more so than other C/C++ code due to the FFI boundary to the wrapping language) and could benefit from being written in Rust.
- physicsguy 4y agoI worked as a Research Software Engineer, and while I saw the topic come up as a 'that's cool', I never met anyone using it. People writing HPC code are still overwhelmingly using C++ or Fortran, and everyone else is using Python or R. I didn't even come across more than about 2 people in my institution using Julia, despite the hype that it gets.
- Normille 4y ago>But for many Rustaceans, the human element is equally compelling. Hauck, a member of the LGBT+ community, says that Rust users have gone out of their way to make her feel welcome. Because, when interacting with a programming language community, it's so vitally important to know that they accept what you choose to do with your genitals, in your spare time.
- jamincan 4y agoI don't think most straight people are aware just how much of everyday life is peppered with aspects of their sexuality - holding hands, kissing their spouse or partner goodbye, even just referring to them in a gendered way. Growing up closeted, this is something I was acutely aware of every moment of every day. A welcoming environment for LGBTQ+ people has nothing to do with their genitals, and everything to do with them being able to be genuine and open about themselves without consequence.
- planetis 4y agoI remember many years ago people would start building a scientific ecosystem around Go, but where are all the scientists/engineers using Go now? Eventually people would also realize that Rust is just a bad language choice for building some things, like making games, scientific computing, etc. I expect all this effort to become abandoned. Not everyone wants to invest learning hard to explain memory management concepts and especially engineers are just not interested. For them programming is a tool, not something to be sucked in. I believe Nim on the other hand is a much more realistic choice, with a vibrant scientific community and many fast, high quality and easy to use libraries.
- lcall 4y agoI know someone working on a materials science PhD. He might have to learn python. I could more easily recommend Rust if there were, say, different flavors of Rust, that allow learning the "hard stuff" in stages, but starting with one that uses garbage collection by default. Then, instead of learning python and maybe having to re-learn Rust later--I realize this is less likely, but still--to save time overall, he could learn the "intro level" of Rust now, and expand his Rust skills as need arises, without ever having to restart from scratch to learn a new language, new libraries, etc. In other words, a step-by-step developer growth process from simple to hard, maybe 2-4 levels, governed by a Cargo.toml setting probably (comparable to a compiler switch), and you never have to throw away what you already learned. Like maybe "learn once, do anything". (Yes, compatibility with peer group is probably a larger factor. But as an option for some where it fits.)
- zozbot234 4y agoIs the lack of GC that much of a showstopper for novice learners? If all they're writing is toy programs, they might as well use Rc<...> and accept that cycles will leak.
- lcall 4y agoMy general impression is that it is, for many. Rust definitely has a reputation for being harder to learn than Python, for example, which is what I'm suggesting be fixed for one "step" of Rust. The ownership, borrowing, and lifetimes are a hurdle for someone who is almost certainly not going to be a full-time programmer, but needs to program sometimes, and more than toy programs. I think even Rc might be a barrier, because it looks like more complexity than Pythonistas expect.