I use C++ Eigen extensively. I wonder if it feasible to write a C++ programs that hands off blocks of linear algebra code to Fortran subroutines. Eigen does a wonderful job of late binding and lazy evaluation so that something like the following is fairly efficient: (L.transpose() * P).diagonal().array().square().mean(); which computes the squared average of column by column dot products between matrices L and P. I a…
LFortran: Modern interactive LLVM-based Fortran compiler
11–20 of 73 posts
Re: LFortran: Modern interactive LLVM-based Fortran compiler
#12If curious see also 2019 https://news.ycombinator.com/item?id=19795262 https://news.ycombinator.com/item?id=19788526
Re: LFortran: Modern interactive LLVM-based Fortran compiler
#13I use C++ Eigen extensively. I wonder if it feasible to write a C++ programs that hands off blocks of linear algebra code to Fortran subroutines. Eigen does a wonderful job of late binding and lazy evaluation so that something like the following is fairly efficient: (L.transpose() * P).diagonal().array().square().mean(); which computes the squared average of column by column dot products between matrices L and P. I a…
If you want to try external BLAS/LAPACK with Eigen, I'd look at: https://eigen.tuxfamily.org/dox/TopicUsingBlasLapack.html
I have `A * B`, `A * B'`, `A' * B` and `A' * B'` small-single-threaded-matmul benchmarks here: https://chriselrod.github.io/LoopVectorization.jl/latest/exa... I compared triple nested loops with Clang, icc, ifort, gfortran, Julia, and LoopVectorization.jl with matmul routines from ifort, gfortran, OpenBLAS, MKL, and Eigen.
While gfortran's builtin hit over 40 GFLOPS with `A * B` and `A' * B'`, it failed to get half that if only one argument was transposed. I'm supposed awkward fusing at the start of this post because if it had done one after the other, it should have still hit >40 GFLOPS when only 1 matrix was transposed.
Re: LFortran: Modern interactive LLVM-based Fortran compiler
#14And my first computer lecture many decades ago is really about how he hated fortran and why FORTRAN is still not dead (Mainly negative view due to haveGOTO that time). And it is still not dead.
Re: LFortran: Modern interactive LLVM-based Fortran compiler
#15If curious see also 2019 https://news.ycombinator.com/item?id=19795262 https://news.ycombinator.com/item?id=19788526
These are very interesting discussions. I don’t know how I managed to miss them when I submitted...
Re: LFortran: Modern interactive LLVM-based Fortran compiler
#16I use C++ Eigen extensively. I wonder if it feasible to write a C++ programs that hands off blocks of linear algebra code to Fortran subroutines. Eigen does a wonderful job of late binding and lazy evaluation so that something like the following is fairly efficient: (L.transpose() * P).diagonal().array().square().mean(); which computes the squared average of column by column dot products between matrices L and P. I a…
I think Eigen's template strategy is probably hard to beat from the perspective of combining operations. How well Fortran does is probably mostly up to the compiler implementation. In some of my benchmarks, gfortran sometimes seems to fuse the operations and end up much slower than if it has performed them separately in succession, but I wouldn't be surprised if compiling with `-fexternal-blas` (and linking MKL) woul…
Certainly, gfortran’s default implementation works well as a quick and easy solution for small vectors and matrices outside of hot paths. Also, I remember discussions about improving matmul(transpose(A),B) somewhat recently. I don’t remember for which version it was, but it’s the sort of things that is improved regularly.
I would love an option to align arrays in gfortran. It’s very important to take advantage of automatic vectorisation but I haven’t found a reliable way to do it.
Re: LFortran: Modern interactive LLVM-based Fortran compiler
#17Wish lisp have these like jupyter integration. And my first computer lecture many decades ago is really about how he hated fortran and why FORTRAN is still not dead (Mainly negative view due to haveGOTO that time). And it is still not dead.
Re: LFortran: Modern interactive LLVM-based Fortran compiler
#18Looking forward to differentiable programming in Fortran.
Re: LFortran: Modern interactive LLVM-based Fortran compiler
#19I use C++ Eigen extensively. I wonder if it feasible to write a C++ programs that hands off blocks of linear algebra code to Fortran subroutines. Eigen does a wonderful job of late binding and lazy evaluation so that something like the following is fairly efficient: (L.transpose() * P).diagonal().array().square().mean(); which computes the squared average of column by column dot products between matrices L and P. I a…
Re: LFortran: Modern interactive LLVM-based Fortran compiler
#20Wish lisp have these like jupyter integration. And my first computer lecture many decades ago is really about how he hated fortran and why FORTRAN is still not dead (Mainly negative view due to haveGOTO that time). And it is still not dead.
First cl-jupyter (https://github.com/fredokun/cl-jupyter) which is now in maintance mode and now common-lisp-jupyter (https://github.com/yitzchak/common-lisp-jupyter).
Here is a notebook I did awhile back with cl-jupyter: https://github.com/mmaul/clml.tutorials/blob/master/CLML-Win...