YingyiLiu / HAMS

An open-source computer program for the analysis of wave diffraction and radiation of three-dimensional floating or submerged structures
Apache License 2.0
100 stars 50 forks source link

Compiling errors in Centos #4

Closed ramisetti closed 2 years ago

ramisetti commented 3 years ago

I am unable to compile HAMS source code using gfortran (v7.1.0) in Centos OS. I get following two errors:

**Warning: Unused variable ‘md’ declared at (1) [-Wunused-variable] gfortran -g -m64 -c -O3 -fno-align-commons -fPIC -fdec-math -fbacktrace -fcheck=all -Wall -o AssbMatx_irr.o AssbMatx_irr.f90 AssbMatx_irr.f90:260:132:

      DIST=SQRT((iXYZ_P(IEL-NELEM,1)-XYZ_P(JEL,1))**2+(iXYZ_P(IEL-NELEM,2)-XYZ_P(JEL,2))**2+(iXYZ_P(IEL-NELEM,3)-XYZ_P(JEL,3))**2)
                                                                                                                                1

Error: Line truncated at (1) [-Werror=line-truncation] AssbMatx_irr.f90:260:132:

      DIST=SQRT((iXYZ_P(IEL-NELEM,1)-XYZ_P(JEL,1))**2+(iXYZ_P(IEL-NELEM,2)-XYZ_P(JEL,2))**2+(iXYZ_P(IEL-NELEM,3)-XYZ_P(JEL,3))**2)
                                                                                                                                1

Error: Syntax error in argument list at (1) AssbMatx_irr.f90:586:32:**

ramisetti commented 3 years ago

Yes, I was able to fix it. But raised the issue so it can be fixed.

ramisetti commented 3 years ago

With the latest code, I am getting an error (see below) while compiling. Error: Function ‘atan2d’ at (1) has no IMPLICIT type.

gbarter commented 3 years ago

Make sure you use the -fdec-math compiler option. This is activated in the makefile in the source directory. If you are using an old version of gfortran, that might also be an issue.

ramisetti commented 3 years ago

For some reason, I deactivated it as I was using an older version of gfortran but now I switched to gfortran 7.1.0 and I am using the fdec-math option. However, now I have few linker errors. I am using Lapack version 3.9.1

/soft/opensoft/math/lapack-3.9.1/liblapack.a(zgetrf.o): In function zgetrf_': zgetrf.f:(.text+0x37e): undefined reference toztrsm' zgetrf.f:(.text+0x437): undefined reference to `zgemm' /soft/opensoft/math/lapack-3.9.1/liblapack.a(zgetrs.o): In function `zgetrs_':

On 17 May 2021, at 21:22, Garrett Barter @.***> wrote:

Make sure you use the -fdec-math compiler option https://gcc.gnu.org/onlinedocs/gcc-9.2.0/gfortran/ATAN2D.html. This is activated in the makefile in the source directory. If you are using an old version of gfortran, that might also be an issue.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/YingyiLiu/HAMS/issues/4#issuecomment-842437072, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACFBMHVVUDL5C4VSA7O2SU3TOE3UZANCNFSM44V3HFPQ.

gbarter commented 3 years ago

Sorry you are still having issues. That one is tough for me to help with remotely as you are using custom installs of Lapack. Maybe double cross check with the makefile flags that are working.

When I get around to setting up a CI workflow, maybe some of these issues will get ironed out.

ramisetti commented 3 years ago

Finally, I managed to compile HAMS without any errors by using another compiled version of Lapack from PETSC-3.12.0 module. I also able to run the Cylinder test case.

YingyiLiu commented 3 years ago

Congratulations, @ramisetti , could you share the link of that Lapack package, so that others can follow? Thanks.

ramisetti commented 3 years ago

I compiled the PETSC-3.12.0 library which also has Lapack package. The link for Petsc is https://www.mcs.anl.gov/petsc/download/index.html. However, I will not suggest this procedure to all users because in my case I was trying to use Lapack library (https://www.netlib.org/lapack/lug/node11.html) that I compiled from its source code. For some reason, HAMS is not working with this version. So I used the libraries from PETSC that I compiled for other codes.

In general, one can install the Lapack library files on their personal Linux machine if not already available. Then, I think they will be able to compile HAMS without any problem. For instance, on Ubuntu OS the following command in the terminal will install Lapack library.

sudo apt-get install liblapack-dev

gbarter commented 3 years ago

It's been a while since I ran a RedHat/Centos machine, but Lapack should be available via your package manager too . .

ramisetti commented 3 years ago

Yes, it is indeed available in Centos machines as well. In my case, I prefer not to install it in the system location so as to avoid any conflicts with other codes that depend on it.

On 18 May 2021, at 15:56, Garrett Barter @.***> wrote:

It's been a while since I ran a RedHat/Centos machine, but Lapack should be available via your package manager too . .

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/YingyiLiu/HAMS/issues/4#issuecomment-843051961, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACFBMHUHVMPT37OPWCRX6H3TOI6GTANCNFSM44V3HFPQ.