For those who are looking at doing data analysis with Rust in astrophysics, I have a crate fitsio ( https://crates.io/crates/fitsio ) which wraps cfitsio into rust, allowing the reading and writing of .fits files.
What can Rust do for astrophysics?
61–70 of 115 posts
Re: What can Rust do for astrophysics?
#62I don't know the astrophysics domain at all but shouldn't there be more arguments for Go? * Safer than C * Almost as fast as C * Good concurrency support * High productivity due to simple abstractions and good tooling Is the downside of a GC language really relevant? Does astrophysics suffer from "stop the world interrupts" or is it just because of the performance? The Go GC is already really fast.
> * Almost as fast as C That's the key point. Judging by the (wrong) benchmark above where both C and Go seem to do some work, Go is about half as fast as C. A grad student (if paid properly) costs maybe 60k €/year. In comparison, we regularly spend more than 250k on new and faster computers, not including maintenance, the electricity bill etc. If you can make software even 50% faster by increasing development time,…
It depends. If it takes 8 weeks for the program to run using a high-level language, but 1 week for it to run using a faster language, dropping down to C to cut the running time down to 6.5 days doesn't help if it take several weeks to do it, and you are not sure that you won't have to rerun the program due to hard-to-find bugs.
Re: What can Rust do for astrophysics?
#63Earlier quoted context omitted.
> Compile C version with better optimization flags or ask an expert to tweak it for faster performance. Part of the point they are trying to make is that you don't need to be an expert to reap performance benefits in certain languages. They explicitly state that they did not do things that C experts would know how to do. This is pretty reasonable in the context of astrophysics. The whole idea of the thing is that if…
You have a good criticism on my #1. I should drop "ask the expert" part but still maintain that when writing numerical computation software checking for compile flags is a reasonable request. Leave code as is, but still try -O3 / -Ofast. At this point it is not the language expertise, but knowing about your tools.
Re: What can Rust do for astrophysics?
#64Earlier quoted context omitted.
> * Almost as fast as C That's the key point. Judging by the (wrong) benchmark above where both C and Go seem to do some work, Go is about half as fast as C. A grad student (if paid properly) costs maybe 60k €/year. In comparison, we regularly spend more than 250k on new and faster computers, not including maintenance, the electricity bill etc. If you can make software even 50% faster by increasing development time,…
I think you misunderstand what "safety" refers to in the context of programming. It's not about flaws in your program being attacked, it's about writing correct programs.
It is easier to debug and improve a fast program when you can have some result in 1 day versus same algorithm implemented in a slower language that takes one week.
Re: What can Rust do for astrophysics?
#65Earlier quoted context omitted.
I looked at the Rust documentation's getting started page and it says: > If you’re using more than one word in your filename, use an underscore: hello_world.rs rather than helloworld.rs. Is the use of underscores a recommendation or a limitation?
Of course it's just a recommendation. Why would you think otherwise? To Rust, module name is just a bunch of characters, it doesn't recognize words anyhow.
Re: What can Rust do for astrophysics?
#66Earlier quoted context omitted.
One wouldn't, generally, at least in the astrophysics domain. The kinds of guarantees Rust makes don't add anything.
Not getting incorrect results due to UB with signed arithmetic or corrupted data sets? Then again, Fortran would cover these scenarios and is better established.
And your point about Fortran is great. I used that and C++ for my research and never once encountered an issue that Rust's guarantees would have helped with.
Re: What can Rust do for astrophysics?
#67Re: What can Rust do for astrophysics?
#68That said, while I'm really excited to see rust go more places, astrophysics seems like one of very few fields where practitioners learn a high performance language as a matter of course, and so rust may have a less empowering effect for them. I would wager that after paying the upfront cost to learn it, students and researchers may see improved iteration time from fewer bugs. But it seems like rust may have an incremental improvement to offer which is not as powerful as the transformative nature of its potential in other computationally intensive fields.
Re: What can Rust do for astrophysics?
#69Earlier quoted context omitted.
I'd agree but > Judging by the (wrong) benchmark above where both C and Go seem to do some work, Go is about half as fast as C. I think this is what is most flawed in the paper. For (some) concurrent problems Go is about as fast as C [1]. But then again, I don't know what kind of computing requirements they have. Is there a reason why GRP computing isn't mentioned? They are really efficient and CUDA isn't that hard t…
> I think this is what is most flawed in the paper. For (some) concurrent problems Go is about as fast as C [1]. Certainly, this was really only taken as a ballpark estimate of the performance difference. Looking at your link, it seems to have been slightly overestimating the difference, though the general point still stands: C is (in most cases) faster and there is (nearly) no case in which Go beats C. > Is there a…
That's an odd tradeoff. That time of debugging could be significantly longer than just writing the software in a safe language. Seems like a bad tradeoff, and in many scenarios, bugs can lead to very bad things that you can't recover from. I've experienced all of these, having to fix them over long periods of time (not all my code, but sadly some was): data loss, concurrency (tough to debug in gdb), major memory leaks (even from std libs), corrupted data because of misused non null terminated c strings, array out of bound issues. Each one of these took weeks to track down, maybe because I'm not smart, which is a valid criticism; with Rust I've never had issues with any of those (2 years and running), and given that I'm not smart, it helps me by telling me where I got something wrong.
Be safe out there people...
Re: What can Rust do for astrophysics?
#70I don't know the astrophysics domain at all but shouldn't there be more arguments for Go? * Safer than C * Almost as fast as C * Good concurrency support * High productivity due to simple abstractions and good tooling Is the downside of a GC language really relevant? Does astrophysics suffer from "stop the world interrupts" or is it just because of the performance? The Go GC is already really fast.
I looked at the Rust documentation's getting started page and it says: > If you’re using more than one word in your filename, use an underscore: hello_world.rs rather than helloworld.rs. Is the use of underscores a recommendation or a limitation?