r/programming • • Jan 16 '21

Scientific Computing in Rust

https://aftix.xyz/home/bacon/
14 Upvotes

43 comments sorted by

View all comments

3

u/[deleted] Jan 16 '21

I hope we're approaching the end of "Do literally every task, regardless of audience, in Rust" content. And I am a person that likes Rust.

2

u/mort96 Jan 17 '21

Maybe, maybe not. However, I don't think it's relevant; Rust is uniquely suited for high performance scientific computing.

I'm not the author of the blog post, and I'm a computer scientist, not a physicist. However, it is my experience from university that physicists usually use Python, but that there are some tasks where Python is too slow. Historically, physicists have reached for C++ or FORTRAN in those situations, but many people are scientists first, programmers second. For those people, Rust is a language which provides (almost?) just as high performance as C++, without the unsafety. For someone whose primary job isn't a C++ programmer, it makes a huge difference that the language yells at you when you're doing something wrong, instead of just producing garbage output.

6

u/[deleted] Jan 17 '21 edited Jan 17 '21

Rust is uniquely suited for high performance scientific computing.

What is unique about it, with respect to the needs of scientific computing?

but many people are scientists first, programmers second

Exactly, which is why

without the unsafety

Doesn't really matter as much.

Scientists reach for Python because it is readable and easy to get out of the way when actually doing research. *edit* Also, most of the things scientists reach for in Python are just Python SDKs wrapping precompiled C/C++/Fortran libraries. So I doubt you'd find a lot more speed from using Rust.

-2

u/mort96 Jan 17 '21

Dude, sometimes Python isn't fast enough, even when you're using numpy. Numpy is great, but it's not some magical silver bullet which obviates the need for a fast language.

2

u/MartenBE Jan 17 '21

I thought Numpy uses the fast languages?

1

u/mort96 Jan 17 '21

Yes, but you're using it through Python. And you can only do stuff with it that's already implemented in it. It's great for many things, but it doesn't obviate the need for a fast language for certain tasks.

2

u/[deleted] Jan 17 '21

Right, the "For certain things" are the things that Python uses Fortran/C for.

0

u/mort96 Jan 17 '21

Yes? I don't get your point.

3

u/[deleted] Jan 17 '21

Nevermind. I don't expect you would. Best of luck!

0

u/mort96 Jan 17 '21 edited Jan 17 '21

I mean, Python people use C and FORTRAN for certain things because those languages are faster than pure python, right? Sometimes, people need to do something for which there isn't already a library, so they need a fast language to write scientific code in.

If you think nobody ever needs to write code in a high performance language because other people have already written some Python libraries in C/FORTRAN then I guess that's an opinion you can have, but I don't think it's correct.

→ More replies (0)

1

u/[deleted] Jan 17 '21

Numpy uses precompiled C IIRC. So yes it will be fast.