Earlier quoted context omitted.
Nim would be a nice option if the ecosystem were even half as developed as the Rust package ecosystem.
Kind of a chicken and egg scenario there really. A few early adopters will need to branch out and start using it to get that momentum building, which is probably a great opportunity for scientists who are looking for an alternative
Why scientists are turning to Rust
81–90 of 105 posts
Re: Why scientists are turning to Rust
#82Does anyone know why scientists aren’t just using Excel? Nothing against Python/Julia but Excel seems like it would be my first choice (paired with some CSV files).
In my PhD I was analyzing petabytes of structured data from particle detectors that required relatively complex algorithms just to reconstruct, before any physics analysis is ever started, and the analyses were just as complex. My experiment’s total code base was at least 100kloc of C++ and Fortran if not more, and used a farm with over 20k cores for massive distributed processing, single jobs regularly taking hundreds or thousands of cores and terabytes of memory.
I’m currently working on distributed GPU accelerated hydrodynamic simulations where a single input is in the ~1-10Gb range of structured mesh data and the calculation requires ~200+ Gb of GPU memory.
I really don’t see how excel would be a viable option for basically anything I have worked on in my scientific career, beyond my undergraduate toy analyses.
Re: Why scientists are turning to Rust
#83This seems like a stretch, or it seems very limited to the specific people mentioned in the article. I find it hard to believe that scientists who have specialised very narrowly in their domain will also want to be full-time software engineers too and choose one of the most complex languages on top of that. This just doesn't scale beyond the few people who are really into it. > Köster, now at the University of Duisbu…
Most of Rust's difficulty comes from the borrow-checker. And if you're mostly doing linear work, if you're doing a lot of math, if you have a lot of pretty flat data structures, if you mostly keep things on the stack, then you may not run up against the borrow-checker that often. I would assume (I don't know for sure) that scientific computing tends to do more of this kind of stuff, and not as much heap-juggling/hete…
Re: Why scientists are turning to Rust
#84Earlier quoted context omitted.
Compared to Python? Just about everything starting from simple things like how to create a simple data structure, how to convert a variable to a different type, how to understand any error message that you get, how to open a file or modify a visualisation and extending all the way up to overarching concepts like the typing system, importing foreign code and managing dependencies.
A simple data structure: struct ASimpleDataStructure a b end Convert a variable to a different type: x = 1 x = Float64(x) Open a file: open(“a_file.txt”) Import foreign code: using PyCall so = pyimport(“scipy.optimize”) so.newton(x -> cos(x) - x, 1)
- I had none of those examples in mind (for example by foreign code I was referring to code written in a different project, not to using a different language). No, I don't need you to give me code snippets on how to do my actual list.
- Obviously Julia can do everything that Python can. And most of it will look ergonomic, short and simple. The difficult part isn't whether the language can do it once you know how, it's how quickly you can get to figuring it out when you don't know it.
- So what makes the small things difficult is really the mix of unhelpful error messages and the limited resources online.
This is my overall point - if you take someone who hasn't written code in either Python or Julia, give them access to online search and ask them to complete almost any task, they'll do it faster and with less effort in Python.
Re: Why scientists are turning to Rust
#85I work in hci research and have never played with/ heard of Rust being used. Was quickly checking for visualisation libraries and found https://lib.rs/visualization Loved the Color scheme and font ... lol. Anyways, will be using Rust for a small side project (short paper for augmented Humans ( https://augmented-humans.org/ deadline in 2 weeks :) let’s see how quickly I can learn it). Any tutorial recommendations go u…
> deadline in 2 weeks That's.. ambitious. Rust is a nice language, but the borrow checker, for all its awesomeness, has a fairly steep learning curve. Unless you're a C++ programmer, in which case this level of thinking won't be totally alien to you at least.
For my first program (task scheduling, regexes, redis, rest), everything was simple and obvious, it was made in about 3 days.
My second program was dealing with several kinds of graphs, optimal sub string addressing, and then I hit the painful points and it took me several weeks of this side project to get my head around the complex concepts of Rust, and several months to really feel at ease.
There's a subset of problems for which Rust is "easy" and it's probably possible, with some guidance and occasional help, to organize one's work around those.
Re: Why scientists are turning to Rust
#86I don't think scientists should worry themselves with the cognitive burden of Rust. It's hard enough to figure out how to do things in any language as a full-time software developer, never mind someone that just needs a program for their research, etc.
So yes you can easily start hacking something in fortran or c++, and the cognitive load is probably much smaller, but then you have the risk of being eaten by your bugs, or of not working on some problems just because the tool you make is so badly designed you give up doing the necessary changes.
Re: Why scientists are turning to Rust
#87Has someone attempted to write something like Numerical Recipes Textbook or the GSL Scientific Library using Rust a lot of people in my org use those two resources - especially the NR textbook all the time. I've found a lot of people bash NR online as outdated but it has really clear explanation of how certain algorithms are written as well as clean to read code examples. Very helpful to follow along with an explanat…
Nowadays, a similar effort would have to be community driven, and open-source, and include the deep discussions for domain specializations.
Re: Why scientists are turning to Rust
#88I've started learning Julia lately, and it also has an appeal, especially for fortran-ish computations. (Yup, I said fortran ... it is still used in lots of scientific computations e.g. fluid-mechanical models.)
"used" as in "using existing libraries" or do you mean there are folks still writing fortran in 2020?
Fortran is a great language for legacy products, with code written 50 years ago still working fine. But it has also gained new features over the years, keeping it ahead of competitors in terms of its ability to harvest all a machine can deliver.
This is all for technical work like numerical modelling. Scientists are a very practical lot, switching from Fortran to C (usually C++) when that makes sense, then to python, R, etc when that makes sense, and so forth.
The original article was about scientists switching to rust. I don't know anyone who has done that. I do know many who are exploring Julia, though.
Bear in mind that scientists tend to be quite good at technical work. Learning a new language is not a significant problem for them. But scientific programming is about much, much more than programming. The essence of scientific programming is in the underlying mathematics and science, and Fortran just happens to be pretty good at those things.
Re: Why scientists are turning to Rust
#89Earlier quoted context omitted.
Rust is easier than C++ for this kind of work because of its packages. In some ways Rust is closer to Python for prototyping an idea to see if it works. Rust gets challenging when you have to deal with large systems, which is not a problem for research. Researchers / scientists will sometimes not even write functions. It's that small of a scope.
> Researchers / scientists will rarely even write functions. It's that small of a scope Scientific computing can mean so many different things that if feels like some of us are talking past each other in this thread. The person in the article talks about needing to get out every ounce of performance and writing an application that identifies genome variants at scale. You're talking code so small that it doesn't need…
One usually needs Fortran or C++ or Matlab or Python with Numpy for numerical computing that is doing matrix or sparse matrix work (a lot of numerical computing is like this). I don't know of any uses that are so small as to not need functions outside of some extremely small/simplified models for explanatory purposes.
There is also symbolic mathematics that Mathematica really excels at although it's pretty good at a lot of things these days.
If someone just needs fast code to loop through some data, they should be able to use whatever compiled or JIT language they see fit. Heck, it sounds like bash/ask might even fit this use case if the code is so small as to not need functions.
Re: Why scientists are turning to Rust
#90Earlier quoted context omitted.
The code I'm talking about needs to run fast (or be type safe) or you wouldn't consider using Rust. But internally in a library or a function that gets ran over and over again and needs to run super fast often isn't a lot of lines of code. So what I mean by a researcher may not even write a function is, they write the meat of the algorithm, it gets handed off to software engineers, and they turn it into a library or…
I'm a little jealous you work somewhere where there are data engineers to hand off to!
Technically they're infrastructure software engineers without the title, but most people don't know what that is, so it can be easier to call them data engineers. The company doesn't give titles like that, they're just "the cloud people" with a vanilla software engineer title.
Unless you're a BI / business analyst, there are probably software engineers that work with AWS / gCloud at your company, who setup the database(s) and do the backend. What you want to do is called an IT request, where you request they help out when you need to productionize. It's bad form for a data scientist or any other kind of researcher to have the keys to the live production servers. While it can be fun to learn that stuff, there is a barrier of entry, specially monitoring software and unit tests.
This is more on the PM (or DPM (data project manager)) side but: https://www.datascience-pm.com/domino-data-science-lifecycle... can give a good map of the process. Many who do research are on their own, not apart of larger teams and are disconnected, so they don't know what options they have. Maybe that roadmap can help, depending on your situation.
When it comes to productionization, I've had too many years of software engineers rewriting my models and adding bugs left and right. The second they want to rewrite it from a notebook into a py file (or equivalent language, usually Java), I get cautious. I find the best process skips these issues and the software engineers will thank you for it: Automate most of the productionization process. Using notebooks as an example, python has libraries that can import notebooks, so you don't have to copy paste code into a py file. Instead an OOP wrapper (which they love) can be written with the interface they like. They can do the IO like streaming data or batching or whatever. They can do the unit tests and monitoring part. What you can do is write the function calls inside of the interface. Usually you want a .predict() method, similar to how ML algos work, but .run() is popular too. Inside of that, put all of the functions from the notebook you want called and in what order. In metaphor it's like writing a header file in C or C++. This py file will then import the notebook and call those functions.
The beauty of this is at least four fold: 1) no new bugs 2) no explaining how the model works, because you're doing that part and 3) If you want to update the model, you can update the notebook and then no work needs to be done in the py file. It's importing the notebook, so it will import the changes. It's fully automated. 4) You can have EDA, plots, documentation, all that stuff that usually takes up 40-60% of the notebook, not be required to remove it, because it will not get called.
The only downside is that every cell in the notebook that the py file will call needs to be wrapped in a function. However, this is a good idea by default, because you'll get global variable type bugs when you run the cells out of order if your cells are not wrapped in a function, so to avoid that you're probably already writing functions in your notebooks.
*Sometimes code has to go fast, and notebooks tend to use dataframes, which is fine for 99% of the work out there. In that case, instead of having the software engineers rewriting my model, because of the problems mentioned above, I will instead 1) Write libraries in C/C++ that accelerate parts of the notebook. And if that can't be done I will 2) write the model directly while prototyping in a language like Rust, C, C++, or Java. I'd rather write it than have someone port it. Most will not do this, because it's beyond the average researcher's skill, but it alleviates so many problems, and I'm not afraid of statically typed languages.