Multiple questions about Fortran, Fortran packages, compilers, etc

Hi all,
I have multiple questions regarding Fortran, its packages, and other compilers mentioned in this discourse forum.

  1. What is the Lfortran compiler ?
  • How is it different from Gfortran ?

  • Will it support coarrays out of the box ? As in will we have to install something like OpenCoarrays separately for paralleliszation ?

  1. What is the fpm (Fortran package manager) ?
  • How does one install it ? (on Linux)
  1. How does one use the stdlib ?
  • Again how does one install it ?

  • How do I use it in my fortran programs ?
    is it just,

use stdlib
  1. How do I use the LAPACK library in my Fortran code ?

Thanks in advance
Thanks all

Some of your questions are answered at the sites of LFortran, fpm, and stdlib. One site discussing Lapack installation is by Yutaka Masuda.

Could you follow the installation instructions of the projects and post about specific problems?


I tried to compile a test program using the -llapack and the -libblas flags but got this error message:

[agnelo@fedora fortran experiment]$ gfortran linear_al.f90 -o linear_al -llapack -libblas
/usr/bin/ld: cannot find -llapack
/usr/bin/ld: cannot find -libblas
collect2: error: ld returned 1 exit status
[agnelo@fedora fortran experiment]$ 

This is the program :

Program LinearEquations
! solving the matrix equation A*x=b using LAPACK
  implicit none
! declarations, notice single precision
	Real*4 A(3,3), b(3)
	integer i, j, pivot(3), ok
! define matrix A
! define vector b, make b a matrix and you can solve multiple
! equations with the same A but different b
! find the solution using the LAPACK routine SGESV
	call SGESV(3, 1, A, 3, pivot, b, 3, ok)
! parameters in the order as they appear in the function call
!    order of matrix A, number of right hand sides (b), matrix A,
!    leading dimension of A, array that records pivoting, 
!    result vector b on entry, x on exit, leading dimension of b
!   return value 	
 !  print the vector x
	do i=1, 3
	   write(*,*) b(i)
 end do
end Program LinearEquations

I got my code to work the links provided by @Beliavsky helped especially external library tutorial by Yutaka Masuda

I have another question however:
is it possible to link to a folder instead of two seperate files when compiling using:

gfortran test_lapack.f90 liblapack.a librefblas.a -o test_lapack

for example ? or does one need to create n number of copies for all their projects ?

I’ll answer these:

I think that’s answered at the front page of LFortran:, if you have more specific questions, I am happy to answer.

Yes, it will support coarrays, although we haven’t implemented them yet. Yes, we’ll probably use OpenCoarrays or Caffeine.

1 Like

Would it be possible to one day be able to perform symbolic calculus and the like using lfortran ?
Would the stdlib from Fortran-lang be also included ?

1 Like

Sure it is. If the libraries are not installed in the system (where they would be found by the compiler automatically), but in a folder, use

gfortran test_lapack.f90 -L path-to-that-folder -llapack -lrefblas -o test_lapack

1 Like

Yes, we have an issue open for it:

Yes that would be the idea. fpm actually makes it very easy to use, so possibly we can just ensure things work out of the box with fpm.

1 Like

Omg I didn’t realize you were one of the devs for SymPy :stuck_out_tongue:
SymPy is one solution for symbolic calculus, and a great one at that.
Have you seen or heard about maxima though ? SageMath uses it along with SymPy and it still does a pretty good job

Anyways thanks for answering my questions.

1 Like

Yes. I used to use Maxima, but I wanted to have a solution in Python, and designed in a way that can be easily extended from Python, so I started SymPy. One of the first packages were limits. In Maxima you have to fix them from within Lisp, it was really hard for me to understand the code and fix it. It was also easier to find contributors to a Python package than a Lisp package.

1 Like