News for hackers. Stuff that matters.
Re:Fortran Compiled to WebAssembly by ink_13 on Tuesday September 29, 2020 @10:48PM (#24635238)
The blog post linked is worth reading. This part in particular:

> While you were reading this article, the test scripts have already run. So open up the developer console and check it out!

That was really slick.

Re:Fortran Compiled to WebAssembly by mshockwave on Tuesday September 29, 2020 @08:31PM (#24634643)
I think while flang (https://github.com/llvm/llvm-project/tree/master/flang) is getting more stable. It would be a lot easier to compile Fortran into WASM with LLVM's WASM backend
Re:Fortran Compiled to WebAssembly by azakai on Tuesday September 29, 2020 @09:53PM (#24635033)
That would save a few steps (gfortran, dragonegg, llvm-as), so it's definitely worth trying.

But note that technically speaking the current approach also uses the LLVM wasm backend (after doing all the above, it uses the LLVM wasm backend to compile LLVM IR to wasm).

Re:Fortran Compiled to WebAssembly by skunkworker on Wednesday September 30, 2020 @02:12AM (#24636133)
It's awesome that BLAS for the most part will compile (except for the "Complex and quad-precision numeric support is still unavailable, but the rest works just fine." according to the article)
Re:Fortran Compiled to WebAssembly by juangburgos on Wednesday September 30, 2020 @06:05AM (#24637105)
CBLAS (and CLAPACK) can already be compiled. It is used for example in https://pidtuner.com
Re:Fortran Compiled to WebAssembly by ineedasername on Tuesday September 29, 2020 @11:44PM (#24635509)
Is there something about Fortran that makes is a more attractive language for WebAssembly than, say, C?

Or is this project more of a "I did it because it was there and I can" (which is certainly a good reason as well)

Re:Fortran Compiled to WebAssembly by ptsneves on Wednesday September 30, 2020 @02:22AM (#24636176)
A lot of fluid dynamics code is in Fortran and has been validated in wind tunnel. Scientists do not care about what language it is in nor they want to port and risk breaking the pre validated code. They want to run the code and be able to provide a citation as the ground for their work. Scientifically they would need to produce academic literature validating the port and only then come back to the matter at hand.
Re:Fortran Compiled to WebAssembly by ForOldHack on Wednesday September 30, 2020 @04:39PM (#24643542)
All of the stuff at Ames that ran on the Cray, was written in HPE Fortran, because the compiler has the ability to vectorize it, and yes, a lot of those fluid simulations that are in their final form for airfoil design do get validated in wind tunnels.

I would love to see some fluid dynamic work run in a web browser, but ... You need the WebAssembly to be able to vectorize and optimize it: See Airvisual.com

or

https://paveldogreat.github.io/WebGL-Fluid-Simulation/

Re:Fortran Compiled to WebAssembly by danmg on Wednesday September 30, 2020 @09:26AM (#24638479)
Fortran doesn't have pointer arithmetic, and pointers that decay like C. The compiler can be much more aggressive about optimization.

Passing around variable length arrays and arrays with a variable number of dimensions is much easier than C. You don't need to worry about making your own interface around blocks of memory or macros to do this sort of routine thing.

Bounds checking is standard in every Fortran compiler.

Fortran does what its name implies: FORMula TRANslation of math code without a lot of noise.

Yes, 50 year old Fortran code can be hard to read. But, there are tools that can statically 'modernize' it if you really need to do maintenance on it.

Re:Fortran Compiled to WebAssembly by LanceH on Wednesday September 30, 2020 @12:22AM (#24635672)
I suppose the #1 reason to pick Fortran over C is knowing Fortran and not C. Then doing it because you can.

Maybe you have a math library in there worth putting into wasm.

Re:Fortran Compiled to WebAssembly by pjmlp on Wednesday September 30, 2020 @04:34AM (#24636713)
Second one is performance for numerical computing, followed by modules, generics, OOP and almost forgot that one, better type safety.
Re:Fortran Compiled to WebAssembly by MayeulC on Wednesday September 30, 2020 @11:42AM (#24639945)
While reading the blog article, I kept wondering what the performance was like compared to bare metal?

I guess the performance hit is similar to the one C and Rust take? In the order of 10x slower IIRC? How does a Fortran-written (better optimized) library compare to a C-written one? Is the WASM overhead enough to nullify the performance difference? Are the original optimizations well translated to WASM?

Re:Fortran Compiled to WebAssembly by Koshkin on Wednesday September 30, 2020 @12:48PM (#24640765)
#2: Due to the differences in language design, Fortran admits better generated machine code optimization than C does.
Re:Fortran Compiled to WebAssembly by C1sc0cat on Wednesday September 30, 2020 @04:56AM (#24636802)
Fortran is probably easier to learn than C and it also has some cool cuda and parallel extensions.
Re:Fortran Compiled to WebAssembly by TheRealKing on Wednesday September 30, 2020 @01:23PM (#24641173)
Fortran is much easier to learn (compared to C/C++), much, MUCH easier, including its Coarray one-sided communication parallel programming paradigm.
Re:Fortran Compiled to WebAssembly by ineedasername on Thursday October 01, 2020 @08:23AM (#24650065)
*>math library

Ah, that's right. There's a ton of scientific software in FORTRAN.

Re:Fortran Compiled to WebAssembly by TheRealKing on Friday October 02, 2020 @12:54AM (#24659011)
Your supposition is likely inaccurate.
Re:Fortran Compiled to WebAssembly by watersb on Wednesday September 30, 2020 @12:44AM (#24635758)
Some of our core assets are still in Fortran.
Re:Fortran Compiled to WebAssembly by loa_in_ on Wednesday September 30, 2020 @04:08AM (#24636603)
What do you mean by our? I guess you mean collective scientific community?
Re:Fortran Compiled to WebAssembly by corty on Wednesday September 30, 2020 @07:07AM (#24637463)
That, and lots of companies. Everything thats old and not COBOL is FORTRAN.
Re:Fortran Compiled to WebAssembly by ineedasername on Wednesday September 30, 2020 @08:01AM (#24637827)
Yes, this is certainly true. I work with a "modern" ERP that just had it's newest release. Lots of low level pieces are stíll in COBOL.
Re:Fortran Compiled to WebAssembly by pjmlp on Wednesday September 30, 2020 @09:05AM (#24638323)
Alongside UNIX and C, which happen to be just 10 years younger, but people keep forgetting it.
Re:Fortran Compiled to WebAssembly by TheRealKing on Wednesday September 30, 2020 @01:25PM (#24641196)
In fact, Fortran is one of the oldest and newest programming languages in the world right now, with the Fortran 2018 standard released just recently.
Re:Fortran Compiled to WebAssembly by acabin on Wednesday September 30, 2020 @04:50AM (#24636773)
Does anyone know whether VBA will be compiled to WebAssembly?
Re:Fortran Compiled to WebAssembly by jmt_ on Wednesday September 30, 2020 @08:01AM (#24637829)
I'm not sure it can. I've worked with VBA professionally and it always needs to run within an Office application like Access of Excel. A transpiler is probably doable, but I don't think it would be easy or even possible to port things using VBA to webasm.
Re:Fortran Compiled to WebAssembly by e12e on Wednesday September 30, 2020 @11:56AM (#24640109)
Hm. So did anyone adapt MPI on web assembly to work over web sockets yet, for a dyi folding@home etc ?
Re:Fortran Compiled to WebAssembly by doonesbury on Wednesday September 30, 2020 @12:29AM (#24635711)
Call me when you can compile Cobol to English.
Re:Fortran Compiled to WebAssembly by e12e on Wednesday September 30, 2020 @11:52AM (#24640052)
Re:Fortran Compiled to WebAssembly by doonesbury on Friday October 02, 2020 @01:55AM (#24659361)
Strong point!!
Re:Fortran Compiled to WebAssembly by pjmlp on Wednesday September 30, 2020 @04:35AM (#24636719)
Not there, but JVM, .NET and WebAssembly backends are already there.
Re:Fortran Compiled to WebAssembly by hardlianotion on Wednesday September 30, 2020 @04:50AM (#24636770)
Sacrilege