Compilation fails at CRSMatrix.F90

Discussion about building and installing Elmer
Post Reply
flavien
Posts: 3
Joined: 14 Feb 2013, 05:07
Antispam: Yes

Compilation fails at CRSMatrix.F90

Post by flavien » 18 May 2018, 03:43

Hi,

I'm having trouble to install elmer on my computer as the compilation fails at CRSMatrix.F90.

Code: Select all

[ 66%] Building Fortran object fem/src/CMakeFiles/elmersolver.dir/Lists.F90.o
[ 66%] Building Fortran object fem/src/CMakeFiles/elmersolver.dir/ListMatrixArray.F90.o
[ 66%] Building Fortran object fem/src/CMakeFiles/elmersolver.dir/BandMatrix.F90.o
[ 66%] Building Fortran object fem/src/CMakeFiles/elmersolver.dir/SParIterComm.F90.o
[ 66%] Building Fortran object fem/src/CMakeFiles/elmersolver.dir/CRSMatrix.F90.o
[ 66%] Building Fortran object fem/src/CMakeFiles/elmersolver.dir/HashTable.F90.o
[ 66%] Building Fortran object fem/src/CMakeFiles/elmersolver.dir/ElementDescription.F90.o
[ 66%] Building Fortran object fem/src/CMakeFiles/elmersolver.dir/TimeIntegrate.F90.o
/Users/geomorph/Documents/Flavien/Projects/modelling/ice_quarrying/elmerice/fem/src/CRSMatrix.F90:4090:24:

       A % ILUCols    => ILUCols
                        1
Error: Assignment to contiguous pointer from non-contiguous target at (1)
/Users/geomorph/Documents/Flavien/Projects/modelling/ice_quarrying/elmerice/fem/src/CRSMatrix.F90:3881:23:

       A % ILUCols   => ILUCols
                       1
Error: Assignment to contiguous pointer from non-contiguous target at (1)
/Users/geomorph/Documents/Flavien/Projects/modelling/ice_quarrying/elmerice/fem/src/CRSMatrix.F90:3882:23:

       A % ILUValues => ILUValues
                       1
Error: Assignment to contiguous pointer from non-contiguous target at (1)
/Users/geomorph/Documents/Flavien/Projects/modelling/ice_quarrying/elmerice/fem/src/CRSMatrix.F90:2160:18:

     A % Values => Values
                  1
Error: Assignment to contiguous pointer from non-contiguous target at (1)
/Users/geomorph/Documents/Flavien/Projects/modelling/ice_quarrying/elmerice/fem/src/CRSMatrix.F90:2161:16:

     A % Cols => Cols
                1
Error: Assignment to contiguous pointer from non-contiguous target at (1)
make[2]: *** [fem/src/CMakeFiles/elmersolver.dir/CRSMatrix.F90.o] Error 1
make[2]: *** Waiting for unfinished jobs....
make[1]: *** [fem/src/CMakeFiles/elmersolver.dir/all] Error 2
make: *** [all] Error 2
The script I run for the install is:

Code: Select all

#!/bin/bash

CMAKE=cmake

# Installation directory (set these!)
TIMESTAMP=$(date +"%m-%d-%y")
ELMER_REV="Elmer_devel_${TIMESTAMP}"
ELMERSRC="/Users/geomorph/Documents/Flavien/Projects/modelling/ice_quarrying/elmerice"
BUILDDIR="$ELMERSRC/builddir"
IDIR="/usr/local/$ELMER_REV"
# next line is optional
#TOOLCHAIN="/path/to/your/own/toolchainfile/yourtoolchainfile.cmake"

echo "Building Elmer from within " ${BUILDDIR}
echo "using following toolchain file " ${TOOLCHAIN}
echo "installation into " ${IDIR}
cd ${BUILDDIR}
pwd
ls -ltr

echo $CMAKE $ELMERSRC 

# you can add a -DCMAKE_TOOLCHAIN_FILE=$TOOLCHAIN,
# if you have a toolchain file declared
$CMAKE $ELMERSRC  \
    -DCMAKE_INSTALL_PREFIX=$IDIR \
    -DCMAKE_C_COMPILER=/usr/local/bin/gcc-8 \
    -DCMAKE_Fortran_COMPILER=/usr/local/bin/gfortran-8 \
    -DCMAKE_CXX_COMPILER=/usr/local/bin/c++-8 \
    -DWITH_MPI:BOOL=TRUE \
    -DWITH_Mumps:BOOL=TRUE \
    -DWITH_Hypre:BOOL=FALSE \
    -DWITH_Trilinos:BOOL=FALSE \
    -DWITH_ELMERGUI:BOOL=FALSE \
    -DWITH_ElmerIce:BOOL=TRUE

# change the -j4 to the number of available cores on your system                              
#make -j4 && sudo make install
sudo make -j4 install

# this automatically links /usr/local/Elmer-devel to your new built
sudo rm /usr/local/Elmer-devel
sudo ln -s $IDIR /usr/local/Elmer-devel

# Running the elmer tests
ctest -j4
I am having the same issue when I try installing with homebrew with the command:

brew install elmercsc/elmerfem/elmer --without-mumps

(There is also a problem with installing mumps with homebrew, so I trying to work around that.)

Code: Select all

==> Installing elmercsc/elmerfem/elmer --without-mumps
==> Downloading https://github.com/ElmerCSC/elmerfem/archive/release-8.2.tar.gz
==> Downloading from https://codeload.github.com/ElmerCSC/elmerfem/tar.gz/release-8.2
######################################################################## 100.0%
==> cmake ../ -DCMAKE_INSTALL_PREFIX=/usr/local/Cellar/elmer/8.2 -DWITH_Hypre:BOOL=TRUE -DWITH_MPI:BOOL=TRUE -DBLAS_LIBRARIES:STRING=/usr/local/opt/openblas/li
==> make
Last 15 lines from /Users/geomorph/Library/Logs/Homebrew/elmer/02.make:
Error: Assignment to contiguous pointer from non-contiguous target at (1)
/tmp/elmer-20180517-16181-h05ew8/elmerfem-release-8.2/fem/src/CRSMatrix.F90:1620:18:

     A % Values => Values
                  1
Error: Assignment to contiguous pointer from non-contiguous target at (1)
/tmp/elmer-20180517-16181-h05ew8/elmerfem-release-8.2/fem/src/CRSMatrix.F90:1621:16:

     A % Cols => Cols
                1
Error: Assignment to contiguous pointer from non-contiguous target at (1)
make[2]: *** [fem/src/CMakeFiles/elmersolver.dir/CRSMatrix.F90.o] Error 1
make[2]: *** Waiting for unfinished jobs....
make[1]: *** [fem/src/CMakeFiles/elmersolver.dir/all] Error 2
make: *** [all] Error 2
I'm using a mac mini with a quad core i7 processor and mac os high sierra (10.13.4) installed.

Any help would be greatly appreciated,
Thanks,

Flavien

Kitpaddel
Posts: 4
Joined: 26 May 2016, 01:10
Antispam: Yes

Re: Compilation fails at CRSMatrix.F90

Post by Kitpaddel » 10 Jun 2018, 18:42

Hi,

I get the same error when compiling under Archlinux using gcc 8.1.

Checking for this (non)-contiguous assignments seems to be a new feature of gcc 8.1 (https://github.com/gcc-mirror/gcc/commi ... 260445a395)

with the gcc author stating, that he (https://gcc.gnu.org/ml/fortran/2017-10/msg00017.html):
... opted for an error because, well, the use cases rejected by this are really errors, and will very likely lead to wrong code in user applications.
So the question might be, is this true an something need to be changed in the CRSMatrix.F90 file, or is it time for a gfortran bug report?

Best regards

kataja
Posts: 73
Joined: 09 May 2014, 16:06
Antispam: Yes

Re: Compilation fails at CRSMatrix.F90

Post by kataja » 11 Jun 2018, 16:37

Hi,

I did a tentative fix on this at https://github.com/ElmerCSC/elmerfem/tr ... scontigfix. However, I seem to face a possible compiler bug with ElementDescription.F90:

Code: Select all

[ 60%] Building Fortran object fem/src/CMakeFiles/elmersolver.dir/ElementDescription.F90.o

(null):0: confused by earlier errors, bailing out
fem/src/CMakeFiles/elmersolver.dir/build.make:302: recipe for target 'fem/src/CMakeFiles/elmersolver.dir/ElementDescription.F90.o' failed
make[3]: *** [fem/src/CMakeFiles/elmersolver.dir/ElementDescription.F90.o] Error 1
fem/src/CMakeFiles/elmersolver.dir/build.make:318: recipe for target 'fem/src/CMakeFiles/elmersolver.dir/ElementDescription.F90.o.provides' failed
make[2]: *** [fem/src/CMakeFiles/elmersolver.dir/ElementDescription.F90.o.provides] Error 2
CMakeFiles/Makefile2:647: recipe for target 'fem/src/CMakeFiles/elmersolver.dir/all' failed
make[1]: *** [fem/src/CMakeFiles/elmersolver.dir/all] Error 2
Makefile:160: recipe for target 'all' failed
make: *** [all] Error 2
make failed
gfortran version

Code: Select all

GNU Fortran (Ubuntu 8.1.0-5ubuntu1~16.04) 8.1.0
Copyright (C) 2018 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

kataja
Posts: 73
Joined: 09 May 2014, 16:06
Antispam: Yes

Re: Compilation fails at CRSMatrix.F90

Post by kataja » 11 Jun 2018, 17:24

So as for now, I suggest reverting to older gfortran version using the fine Homebrew "Versions" feature https://docs.brew.sh/Versions.html. So something like

Code: Select all

$ brew install gcc@7
might work.

Cheers,
Juhani

Kitpaddel
Posts: 4
Joined: 26 May 2016, 01:10
Antispam: Yes

Re: Compilation fails at CRSMatrix.F90

Post by Kitpaddel » 11 Jun 2018, 22:08

kataja wrote:
11 Jun 2018, 16:37
Hi,

I did a tentative fix on this at https://github.com/ElmerCSC/elmerfem/tr ... scontigfix. However, I seem to face a possible compiler bug with ElementDescription.F90:
Jup, I get the same error with gcc8.1 under Archlinux as well. CRSMatrix.F90 seems to compile with your fix.

Kitpaddel
Posts: 4
Joined: 26 May 2016, 01:10
Antispam: Yes

Re: Compilation fails at CRSMatrix.F90

Post by Kitpaddel » 24 Jun 2018, 17:10

I wasn't able to figure out why ElementDescription.F90 does not compile, but a temporary workaround was to compile with:

Code: Select all

-DWITH_OpenMP:BOOL=FALSE
Still, a lot of other files fail with the contiguous pointer error. I was able to compile by extensive usage of the CONTIG keyword. Find a patch in the attachment. Please review before using, as the fortran fu is not strong with me.
Attachments
contig.patch
(31.94 KiB) Downloaded 39 times

kataja
Posts: 73
Joined: 09 May 2014, 16:06
Antispam: Yes

Re: Compilation fails at CRSMatrix.F90

Post by kataja » 26 Jun 2018, 16:35

Hi,

you might want to try to compile with cmake flag

Code: Select all

 -DCMAKE_Fortran_COMPILER_SUPPORTS_CONTIGUOUS=FALSE 
This will disable all CONTIGUOUS attributes from variables throughout the code...

-Juhani

kataja
Posts: 73
Joined: 09 May 2014, 16:06
Antispam: Yes

Re: Compilation fails at CRSMatrix.F90

Post by kataja » 02 Jul 2018, 16:28

Hi!

In the latest devel version, this -DCMAKE_Fortran_COMPILER_SUPPORTS_CONTIGUOUS=FALSE should no longer be necessary. This error, however, might reappear because almost no other compiler views such a pointer assignment as an error currently.

flavien
Posts: 3
Joined: 14 Feb 2013, 05:07
Antispam: Yes

Re: Compilation fails at CRSMatrix.F90

Post by flavien » 28 Jul 2018, 00:09

Hi Juhani,

Thank you for the fix. It seems to all be working just fine now with the homebrew install.
I had a couple of other issues including the installation of mumps, but that also seems to be sorted out.

Thank you for you time!
Cheers,
Flavien

Post Reply