Using Spack to install ElmerFEM with GUI on Fedora 36

Discussion about building and installing Elmer
Post Reply
amit_elmer
Posts: 2
Joined: 20 May 2022, 14:42
Antispam: Yes

Using Spack to install ElmerFEM with GUI on Fedora 36

Post by amit_elmer »

Hi
I am trying to install ElmerFem with GUI on Fedora 36 with Spack. The elmerfem version in spack is 9.0. The command I ran was

Code: Select all

./spack install elmerfem+gui
First I got errors like "No such file or directory: #include <GL/glu.h>". I was able to fix it by modifying the `package.py` file for elmerfem and adding `mesa-glu` as a dependency when building with GUI.

But now I am getting errors in ElmerFem source code saying:

Code: Select all

12 errors found in build log:
     5439    
     5440      341 |                    'Bvector', Model % BCs(i) % Values,  n, NodeIndexes )
     5441          |                                                                        2
     5442    ......
     5443      505 |          DO i=1,MIN(3,SIZE(Hwrk,2))
     5444          |                                   1
  >> 5445    Error: Index variable 'i' redefined at (1) in procedure 'inputvector' called from within DO loop at (2)
     5446    /tmp/amit/spack-stage/spack-stage-elmerfem-9.0-hjoqs7a25dlmmclyldjkr3bcwda37gye/spack-src/fem/src/modules/DCRComplexSolve.F90:511:34:
     5447    
     5448      341 |                    'Bvector', Model % BCs(i) % Values,  n, NodeIndexes )
     5449          |                                                                        2
     5450    ......
     5451      511 |         DO i=1,MIN(3,SIZE(Hwrk,1))
     5452          |                                  1
  >> 5453    Error: Index variable 'i' redefined at (1) in procedure 'inputvector' called from within DO loop at (2)
     5454    /tmp/amit/spack-stage/spack-stage-elmerfem-9.0-hjoqs7a25dlmmclyldjkr3bcwda37gye/spack-src/fem/src/modules/DCRComplexSolve.F90:1394:35:
     5455    
     5456     1282 |                 'Amatrix', Model % Materials(k) % Values, Pn, Element % NodeIndexes )
     5457          |                                                                                     2
     5458    ......
     5459     1394 |          DO i=1,MIN(3,SIZE(Hwrk,2))
     5460          |                                   1
  >> 5461    Error: Index variable 'i' redefined at (1) in procedure 'inputtensor' called from within DO loop at (2)
     5462    /tmp/amit/spack-stage/spack-stage-elmerfem-9.0-hjoqs7a25dlmmclyldjkr3bcwda37gye/spack-src/fem/src/modules/DCRComplexSolve.F90:1400:35:
     5463    
     5464     1282 |                 'Amatrix', Model % Materials(k) % Values, Pn, Element % NodeIndexes )
     5465          |                                                                                     2
     5466    ......
     5467     1400 |          DO i=1,MIN(3,SIZE(Hwrk,1))
     5468          |                                   1
  >> 5469    Error: Index variable 'i' redefined at (1) in procedure 'inputtensor' called from within DO loop at (2)
     5470    /tmp/amit/spack-stage/spack-stage-elmerfem-9.0-hjoqs7a25dlmmclyldjkr3bcwda37gye/spack-src/fem/src/modules/DCRComplexSolve.F90:1406:34:
     5471    
     5472     1282 |                 'Amatrix', Model % Materials(k) % Values, Pn, Element % NodeIndexes )
     5473          |                                                                                     2
     5474    ......
     5475     1406 |         DO i=1,MIN(3,SIZE(Hwrk,1))
     5476          |                                  1
  >> 5477    Error: Index variable 'i' redefined at (1) in procedure 'inputtensor' called from within DO loop at (2)
     5478    /tmp/amit/spack-stage/spack-stage-elmerfem-9.0-hjoqs7a25dlmmclyldjkr3bcwda37gye/spack-src/fem/src/modules/DCRComplexSolve.F90:1446:35:
     5479    
     5480     1285 |                 'Avector 1', Model % Materials(k) % Values, Pn, Element % NodeIndexes )
     5481          |                                                                                       2
     5482    ......
     5483     1446 |          DO i=1,MIN(3,SIZE(Hwrk,2))
     5484          |                                   1
  >> 5485    Error: Index variable 'i' redefined at (1) in procedure 'inputvector' called from within DO loop at (2)
     5486    /tmp/amit/spack-stage/spack-stage-elmerfem-9.0-hjoqs7a25dlmmclyldjkr3bcwda37gye/spack-src/fem/src/modules/DCRComplexSolve.F90:1452:34:
     5487    
     5488     1285 |                 'Avector 1', Model % Materials(k) % Values, Pn, Element % NodeIndexes )
     5489          |                                                                                       2
     5490    ......
     5491     1452 |         DO i=1,MIN(3,SIZE(Hwrk,1))
     5492          |                                  1
  >> 5493    Error: Index variable 'i' redefined at (1) in procedure 'inputvector' called from within DO loop at (2)
     5494    /tmp/amit/spack-stage/spack-stage-elmerfem-9.0-hjoqs7a25dlmmclyldjkr3bcwda37gye/spack-src/fem/src/modules/DCRComplexSolve.F90:1446:35:
     5495    
     5496     1288 |                 'Avector 2', Model % Materials(k) % Values, Pn, Element % NodeIndexes )
     5497          |                                                                                       2
     5498    ......
     5499     1446 |          DO i=1,MIN(3,SIZE(Hwrk,2))
     5500          |                                   1
  >> 5501    Error: Index variable 'i' redefined at (1) in procedure 'inputvector' called from within DO loop at (2)
     5502    /tmp/amit/spack-stage/spack-stage-elmerfem-9.0-hjoqs7a25dlmmclyldjkr3bcwda37gye/spack-src/fem/src/modules/DCRComplexSolve.F90:1452:34:
     5503    
     5504     1288 |                 'Avector 2', Model % Materials(k) % Values, Pn, Element % NodeIndexes )
     5505          |                                                                                       2
     5506    ......
     5507     1452 |         DO i=1,MIN(3,SIZE(Hwrk,1))
     5508          |                                  1
  >> 5509    Error: Index variable 'i' redefined at (1) in procedure 'inputvector' called from within DO loop at (2)
I am not experienced in Fortran. All I could find online is that in Fortran all the variables are passed by reference and this error message indicates that the loop variable is being passed to some procedure that is modifying it and it is not allowed in Fortran. But I wonder if there is a bug in the source code and how it is getting compiled on other platforms. So I suspect it has got to do with the `gfortran` compiler version being used by spack.

Please give me some pointers.

Regards,
amit_elmer
raback
Site Admin
Posts: 4812
Joined: 22 Aug 2009, 11:57
Antispam: Yes
Location: Espoo, Finland
Contact:

Re: Using Spack to install ElmerFEM with GUI on Fedora 36

Post by raback »

Hi

This module causing the problems is really old and has been edited recently (in 2021) only for some other compilation issues. Sometimes new compilers become pickier in some respects.

I don't really see what could be wrong here. However, I changes the SIZE(Hwrk,..) appearing in the loop bounds for "i". This does not make much sense though... Just committed this to the devel branch.

Previously "i" was added to local scope. So in case you're running rather old version it could be the same bug that was already fixed. The official version (latest is 9.0) come rather seldom and we consider the "devel" brach to be stable. Hundreds of tests are run before committing anything into it.

-Peter
kevinarden
Posts: 2237
Joined: 25 Jan 2019, 01:28
Antispam: Yes

Re: Using Spack to install ElmerFEM with GUI on Fedora 36

Post by kevinarden »

Most elmer users are using a debian based linux system and binaries are readily available to install. There are no binaries for a redhat based system. I have seen very few succesful installations of elmer and ElmerGUI on a redhat based system. This topic claims success on a redhat based system

viewtopic.php?f=2&t=3818&sid=97b9f3c8b9 ... 1ad3f312b3
amit_elmer
Posts: 2
Joined: 20 May 2022, 14:42
Antispam: Yes

Re: Using Spack to install ElmerFEM with GUI on Fedora 36

Post by amit_elmer »

Thank you very much for your reply Peter. I checked the Git repository. Indeed on the devel branch, you have made the changes that you have mentioned. I am installing using https://spack.io which has the preferred version of Elmer set at release 9.0.

You were right, using the latest compiler (GCC 12) was causing the issue. I was successfully able to build Elmer with GUI on an RHEL 7-based cluster using GCC 10.3.0 and also on my laptop running Fedora 36 by using GCC 7.5.0.

Thank you for the link @kevinarden. I was trying to use spack instead of Cmake directly because I was doing a practice run to install on the cluster.
Post Reply