# Multiple questions about Fortran, Fortran packages, compilers, etc

**URL:** <https://fortran-lang.discourse.group/t/multiple-questions-about-fortran-fortran-packages-compilers-etc/2938>\
**Category:** Help\
**Created:** [March 10, 2022, 11:33am UTC](https://fortran-lang.discourse.group/t/multiple-questions-about-fortran-fortran-packages-compilers-etc/2938 "2022-03-10T11:33:32Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![Aurelius\_Nero](https://avatars.discourse-cdn.com/v4/letter/a/a87d85/32.png) [@Aurelius\_Nero](https://fortran-lang.discourse.group/u/Aurelius_Nero)\
**Post date:** [March 10, 2022, 11:33am UTC](https://fortran-lang.discourse.group/t/multiple-questions-about-fortran-fortran-packages-compilers-etc/2938/1 "2022-03-10T11:33:32Z")

</div>

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,

```auto
use stdlib

```

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

Thanks in advance  
Thanks all

---

<div class="post-metadata">

**Author:** ![Beliavsky](https://avatars.discourse-cdn.com/v4/letter/b/ba8739/32.png) [@Beliavsky](https://fortran-lang.discourse.group/u/Beliavsky)\
**Post date:** [March 10, 2022, 1:26pm UTC](https://fortran-lang.discourse.group/t/multiple-questions-about-fortran-fortran-packages-compilers-etc/2938/2 "2022-03-10T13:26:08Z")

</div>

Some of your questions are answered at the sites of [LFortran](https://lfortran.org/), [fpm](https://fpm.fortran-lang.org/en/index.html), and [stdlib](https://github.com/fortran-lang/stdlib). One site discussing Lapack installation is by [Yutaka Masuda](https://masuday.github.io/fortran_tutorial/external.html).

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

---

<div class="post-metadata">

**Author:** ![Aurelius\_Nero](https://avatars.discourse-cdn.com/v4/letter/a/a87d85/32.png) [@Aurelius\_Nero](https://fortran-lang.discourse.group/u/Aurelius_Nero)\
**Post date:** [March 10, 2022, 2:51pm UTC](https://fortran-lang.discourse.group/t/multiple-questions-about-fortran-fortran-packages-compilers-etc/2938/4 "2022-03-10T14:51:15Z")

</div>

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

```auto
[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 :

```auto
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
	A(1,1)=3.1
	A(1,2)=1.3
	A(1,3)=-5.7
	A(2,1)=1.0
	A(2,2)=-6.9
	A(2,3)=5.8
	A(3,1)=3.4
	A(3,2)=7.2
	A(3,3)=-8.8
! define vector b, make b a matrix and you can solve multiple
! equations with the same A but different b
	b(1)=-1.3
	b(2)=-0.1
	b(3)=1.8
! 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

```

---

<div class="post-metadata">

**Author:** ![Aurelius\_Nero](https://avatars.discourse-cdn.com/v4/letter/a/a87d85/32.png) [@Aurelius\_Nero](https://fortran-lang.discourse.group/u/Aurelius_Nero)\
**Post date:** [March 10, 2022, 4:01pm UTC](https://fortran-lang.discourse.group/t/multiple-questions-about-fortran-fortran-packages-compilers-etc/2938/5 "2022-03-10T16:01:43Z")

</div>

I got my code to work the links provided by @Beliavsky helped especially [external library tutorial](https://masuday.github.io/fortran_tutorial/external.html) by Yutaka Masuda

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

```auto
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 ?

---

<div class="post-metadata">

**Author:** ![certik](https://yyz2.discourse-cdn.com/free1/user_avatar/fortran-lang.discourse.group/certik/32/4_2.png) [@certik](https://fortran-lang.discourse.group/u/certik)\
**Post date:** [March 10, 2022, 6:50pm UTC](https://fortran-lang.discourse.group/t/multiple-questions-about-fortran-fortran-packages-compilers-etc/2938/6 "2022-03-10T18:50:11Z")

</div>

I’ll answer these:

> [@Aurelius\_Nero](#):
>
> 1. What is the Lfortran compiler ?
> 
> - How is it different from Gfortran ?

I think that’s answered at the front page of LFortran: [https://lfortran.org/](https://lfortran.org/), if you have more specific questions, I am happy to answer.

> [@Aurelius\_Nero](#):
>
> - Will it support coarrays out of the box ? As in will we have to install something like OpenCoarrays separately for paralleliszation ?

Yes, it will support coarrays, although we haven’t implemented them yet. Yes, we’ll probably use OpenCoarrays or [Caffeine](https://github.com/BerkeleyLab/caffeine).

---

<div class="post-metadata">

**Author:** ![Aurelius\_Nero](https://avatars.discourse-cdn.com/v4/letter/a/a87d85/32.png) [@Aurelius\_Nero](https://fortran-lang.discourse.group/u/Aurelius_Nero)\
**Post date:** [March 10, 2022, 8:46pm UTC](https://fortran-lang.discourse.group/t/multiple-questions-about-fortran-fortran-packages-compilers-etc/2938/7 "2022-03-10T20:46:00Z")

</div>

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 ?

---

<div class="post-metadata">

**Author:** ![msz59](https://avatars.discourse-cdn.com/v4/letter/m/3d9bf3/32.png) [@msz59](https://fortran-lang.discourse.group/u/msz59)\
**Post date:** [March 10, 2022, 10:20pm UTC](https://fortran-lang.discourse.group/t/multiple-questions-about-fortran-fortran-packages-compilers-etc/2938/8 "2022-03-10T22:20:32Z")

</div>

> [@Aurelius\_Nero](#):
>
> 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`

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`

---

<div class="post-metadata">

**Author:** ![certik](https://yyz2.discourse-cdn.com/free1/user_avatar/fortran-lang.discourse.group/certik/32/4_2.png) [@certik](https://fortran-lang.discourse.group/u/certik)\
**Post date:** [March 11, 2022, 4:39am UTC](https://fortran-lang.discourse.group/t/multiple-questions-about-fortran-fortran-packages-compilers-etc/2938/9 "2022-03-11T04:39:01Z")

</div>

> [@Aurelius\_Nero](#):
>
> Would it be possible to one day be able to perform symbolic calculus and the like using `lfortran` ?

Yes, we have an issue open for it:

> **[SymPy integration (#71) · Issues · lfortran / lfortran · GitLab](https://gitlab.com/lfortran/lfortran/-/issues/71)**
>
> There are two fundamental projects: Use LFortran for SymPy's code generation. SymPy will target the LFortran's ASR, and LFortran can both generate...

> [@Aurelius\_Nero](#):
>
> Would the stdlib from Fortran-lang be also included ?

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.

---

<div class="post-metadata">

**Author:** ![Aurelius\_Nero](https://avatars.discourse-cdn.com/v4/letter/a/a87d85/32.png) [@Aurelius\_Nero](https://fortran-lang.discourse.group/u/Aurelius_Nero)\
**Post date:** [March 11, 2022, 11:05am UTC](https://fortran-lang.discourse.group/t/multiple-questions-about-fortran-fortran-packages-compilers-etc/2938/10 "2022-03-11T11:05:57Z")

</div>

Omg I didn’t realize you were one of the devs for SymPy 😛  
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

> **[Maxima (software)](https://en.wikipedia.org/wiki/Maxima_(software))**
>
> Maxima (/ˈmæksɪmə/) is a computer algebra system (CAS) based on a 1982 version of Macsyma. It is written in Common Lisp and runs on all POSIX platforms such as macOS, Unix, BSD, and Linux, as well as under Microsoft Windows and Android. It is free software released under the terms of the GNU General Public License (GPL).
> Maxima is based on a 1982 version of Macsyma, which was developed at MIT with funding from the United States Department of Energy and other government agencies. A version of Mac...

Anyways thanks for answering my questions.

---

<div class="post-metadata">

**Author:** ![certik](https://yyz2.discourse-cdn.com/free1/user_avatar/fortran-lang.discourse.group/certik/32/4_2.png) [@certik](https://fortran-lang.discourse.group/u/certik)\
**Post date:** [March 12, 2022, 3:19pm UTC](https://fortran-lang.discourse.group/t/multiple-questions-about-fortran-fortran-packages-compilers-etc/2938/11 "2022-03-12T15:19:02Z")

</div>

> [@Aurelius\_Nero](#):
>
> Have you seen or heard about maxima though ?

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.
