Looking forward to differentiable programming in Fortran.
LFortran: Modern interactive LLVM-based Fortran compiler
31–40 of 73 posts
Re: LFortran: Modern interactive LLVM-based Fortran compiler
#32Not much of a Fortran yet without arrays, complex numbers, or strings.
Re: LFortran: Modern interactive LLVM-based Fortran compiler
#33I 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've never used Eigen, could you explain specifically what lazy evaluation implies for this expression? Is it to do with the diagonal() call constraining the amount of work to be done?
Re: LFortran: Modern interactive LLVM-based Fortran compiler
#34I 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…
Re: LFortran: Modern interactive LLVM-based Fortran compiler
#35I 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…
You can do this with Julia. Julia has an insanely good interop with essentially any language you can name, including cpp and Fortran. You will go through julia but hey, for linear algebra it's the shit.
Re: LFortran: Modern interactive LLVM-based Fortran compiler
#36Earlier quoted context omitted.
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…
Thanks for the benchmarks. Do you see some intrinsic reason why a Fortran compiler couldn't do these optimizations? I would think it would know all the information so it would be the ideal place to optimize it.
Re: LFortran: Modern interactive LLVM-based Fortran compiler
#37Not much of a Fortran yet without arrays, complex numbers, or strings.
fortran - one of only a handful of languages that natively supports multidimensional arrays, maybe the only low level one?
Re: LFortran: Modern interactive LLVM-based Fortran compiler
#38Not much of a Fortran yet without arrays, complex numbers, or strings.
fortran - one of only a handful of languages that natively supports multidimensional arrays, maybe the only low level one?
Re: LFortran: Modern interactive LLVM-based Fortran compiler
#39Earlier quoted context omitted.
fortran - one of only a handful of languages that natively supports multidimensional arrays, maybe the only low level one?
That's ridiculous, you can make a C++ class and overload operator() like Eigen to easily make a multi-dimensional array.
Re: LFortran: Modern interactive LLVM-based Fortran compiler
#40I 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…