Building OpenCoarrays as part of building gfortran

Toon Moene toon@moene.org
Fri Apr 24 16:09:00 GMT 2015


On 04/20/2015 11:07 PM, Toon Moene wrote:

> On 04/20/2015 07:24 PM, Damian Rouson wrote:
>
>> Hi Toon,
>>
>> Thanks for looking into this.  The installation instructions are at
>> https://github.com/afanfa/opencoarrays/blob/master/INSTALL (we just
>> moved the OpenCoarrays repository to GitHub a few days ago).  In case
>> it helps, the overall process is to first install GCC 5, then build
>> MPI with GCC 5 (assuming the default libcaf_mpi.a is desired), and
>> then build OpenCoarrays with GCC 5.  Based on these steps, GCC 5 is
>> actually a prerequisite for OpenCoarrays rather than the reverse so
>> possibly my original request was misguided.  However, it would be
>> great to see that OpenCoarrays gets built (along with some chosen MPI
>> distribution — preferably MPICH) automatically whenever gfortran is
>> built.  If others agree, then I’m open to suggestions about how best
>> to proceed.
>
> OK, I am going to try this this weekend (I have done all steps -
> separately - before, so it should work [famous last words]).
>
> I will report back to you.

This is what I did so far:

Downloaded gcc-5.1.0.tar.gz from mirror ftp.nluug.nl
Downloaded openmpi-1.8.4.tar.gz from www.open-mpi.org
Downloaded opencoarrays-master.zip from opencoarrays.org

Made a directory 'coarrays' in my home directory to group this stuff and 
changed directory to it (so everything below is in this subdirectory).

Build gcc-5 as follows (note, I rely on the various prerequisites as 
installed on my Debian Testing system):

tar zxvf ~/Downloads/gcc-5.1.0.tar.gz
mkdir build-gcc  # Create a separate build directory
cd build-gcc/    # for building gcc and go there.
../gcc-5.1.0/configure --prefix=$HOME/coarrays/install --with-gnu-as 
--with-gnu-ld --enable-languages=fortran --disable-multilib --disable-nls
make -j16
make install     # gcc(++)/gfortran now reside in $HOME/coarrays/install/bin

$ ls -l install/bin
...
-rwxr-xr-x 4 toon toon 3545608 Apr 24 14:33 c++
-rwxr-xr-x 1 toon toon 3540832 Apr 24 14:33 cpp
-rwxr-xr-x 4 toon toon 3545608 Apr 24 14:33 g++
-rwxr-xr-x 3 toon toon 3536368 Apr 24 14:33 gcc
-rwxr-xr-x 2 toon toon  142312 Apr 24 14:33 gcc-ar
-rwxr-xr-x 2 toon toon  142216 Apr 24 14:33 gcc-nm
-rwxr-xr-x 2 toon toon  142232 Apr 24 14:33 gcc-ranlib
-rwxr-xr-x 1 toon toon 2449808 Apr 24 14:33 gcov
-rwxr-xr-x 1 toon toon 2327648 Apr 24 14:33 gcov-tool
-rwxr-xr-x 2 toon toon 3546616 Apr 24 14:33 gfortran

Build open-mpi in directory 'coarrays':

tar zxvf ~/Downloads/openmpi-1.8.4.tar.gz
cd openmpi-1.8.4/
(export PATH=$HOME/coarrays/install/bin:$PATH; export 
LD_LIBRARY_PATH=$HOME/coarrays/install/lib:$LD_LIBRARY_PATH; ./configure 
--prefix=$HOME/coarrays/install)
(export PATH=$HOME/coarrays/install/bin:$PATH; export 
LD_LIBRARY_PATH=$HOME/coarrays/install/lib:$LD_LIBRARY_PATH; make)
(export PATH=$HOME/coarrays/install/bin:$PATH; export 
LD_LIBRARY_PATH=$HOME/coarrays/install/lib:$LD_LIBRARY_PATH; make install)

Now the openmpi libraries, built with gcc-5, reside in 
$HOME/coarrays/install/lib:

$ ls -l install/lib
...
lrwxrwxrwx 1 toon toon      22 Apr 24 14:48 libmpi_usempi.so -> 
libmpi_usempi.so.1.4.0
lrwxrwxrwx 1 toon toon      22 Apr 24 14:48 libmpi_usempi.so.1 -> 
libmpi_usempi.so.1.4.0
-rwxr-xr-x 1 toon toon    6416 Apr 24 14:48 libmpi_usempi.so.1.4.0

Then, making the opencoarrays library:

unzip ~/Downloads/opencoarrays-master.zip
cd opencoarrays-master/
(export PATH=$HOME/coarrays/install/bin:$PATH; export 
LD_LIBRARY_PATH=$HOME/coarrays/install/lib:$LD_LIBRARY_PATH; make)
cp mpi/libcaf_mpi.a /home/toon/coarrays/install/lib/
ranlib /home/toon/coarrays/install/lib/libcaf_mpi.a

[ Note that the coarray build doesn't have a configure, nor an install
   phase; perhaps that should be changed. ]

$ ls -l install/lib
...
-rw-r--r-- 1 toon toon  121226 Apr 24 14:52 libcaf_mpi.a

Then I tried some of the tests.

I restricted myself to testcases for which there was a makefile.

toon@moene:~/coarrays/opencoarrays-master/tests/src/coarrayHelloWorld$ 
(export PATH=$HOME/coarrays/install/bin:$PATH; export 
LD_LIBRARY_PATH=$HOME/coarrays/install/lib:$LD_LIBRARY_PATH; make)
mpif90 -fcoarray=lib  -c hello_multiverse.F90
mpif90 -fcoarray=lib  -L /opt/opencoarrays/lib hello_multiverse.o -o 
hello_multiverse -lcaf_mpi
toon@moene:~/coarrays/opencoarrays-master/tests/src/coarrayHelloWorld$ 
(export PATH=$HOME/coarrays/install/bin:$PATH; export 
LD_LIBRARY_PATH=$HOME/coarrays/install/lib:$LD_LIBRARY_PATH; mpirun -np 
8 ./hello_multiverse)
  Greetings from image  1 of  8
  Greetings from image  2 of  8
  Greetings from image  3 of  8
  Greetings from image  4 of  8
  Greetings from image  5 of  8
  Greetings from image  6 of  8
  Greetings from image  7 of  8
  Greetings from image  8 of  8
  Test passed.

[Well, that was easy ]

toon@moene:~/coarrays/opencoarrays-master/tests/src/pde_solvers/BurgersMPI$ 
(export PATH=$HOME/coarrays/install/bin:$PATH; export 
LD_LIBRARY_PATH=$HOME/coarrays/install/lib:$LD_LIBRARY_PATH; make)
cp ../include-files/intel_capabilities.txt compiler_capabilities.txt
cp ../include-files/intel_capabilities.txt 
../library/compiler_capabilities.txt
mpiifort -Bdynamic -standard-semantics -O3 -L/usr/lib64   -c 
../library/object_interface.F90
make: mpiifort: Command not found
Makefile:66: recipe for target 'object_interface.o' failed
make: *** [object_interface.o] Error 127

[OK, that didn't work due to mpiifort (the Fortran compiler wrapper) not 
being found]

toon@moene:~/coarrays/opencoarrays-master/tests/src/pde_solvers/coarrayHeatSimplified$ 
(export PATH=$HOME/coarrays/install/bin:$PATH; export 
LD_LIBRARY_PATH=$HOME/coarrays/install/lib:$LD_LIBRARY_PATH; make)
mpif90 -fcoarray=lib  -c local_field.f90
local_field.f90:58:34:

    pure subroutine assign_array(lhs,rhs)
                                   1
Error: INTENT(OUT) argument 'lhs' of pure procedure 'assign_array' at 
(1) may not be polymorphic
Makefile:32: recipe for target 'local_field.o' failed
make: *** [local_field.o] Error 1

[This looks like a Fortran error - not coarray related]

toon@moene:~/coarrays/opencoarrays-master/tests/src/pde_solvers/coarrayBurgers$ 
(export PATH=$HOME/coarrays/install/bin:$PATH; export 
LD_LIBRARY_PATH=$HOME/coarrays/install/lib:$LD_LIBRARY_PATH; make)
cp ./include-files/gfortran_capabilities.txt 
./library/compiler_capabilities.txt
mpif90 -fcoarray=lib  -c ./library/object_interface.F90
mpif90 -fcoarray=lib  -c ./library/ForTrilinos_assertion_utility.F90
mpif90 -fcoarray=lib  -c ./library/ForTrilinos_error.F90
mpif90 -fcoarray=lib  -c local_field.F90
mpif90 -fcoarray=lib  -c ./library/co_object_interface.F90
mpif90 -fcoarray=lib  -c global_field.F90
mpif90 -fcoarray=lib  -c main.F90
mpif90 -fcoarray=lib -L ../../../../mpi  main.o local_field.o 
global_field.o co_object_interface.o object_interface.o 
ForTrilinos_assertion_utility.o ForTrilinos_error.o  -o burgers  -lcaf_mpi
toon@moene:~/coarrays/opencoarrays-master/tests/src/pde_solvers/coarrayBurgers$ 
(export PATH=$HOME/coarrays/install/bin:$PATH; export 
LD_LIBRARY_PATH=$HOME/coarrays/install/lib:$LD_LIBRARY_PATH; mpirun -np 
8 ./burgers)
-------------------------------------------------------
Primary job  terminated normally, but 1 process returned
a non-zero exit code.. Per user-direction, the job has been aborted.
-------------------------------------------------------
./burgers: /usr/lib/x86_64-linux-gnu/libgfortran.so.3: version 
`GFORTRAN_1.6' not found (required by ./burgers)
./burgers: /usr/lib/x86_64-linux-gnu/libgfortran.so.3: version 
`GFORTRAN_1.6' not found (required by ./burgers)
./burgers: /usr/lib/x86_64-linux-gnu/libgfortran.so.3: version 
`GFORTRAN_1.6' not found (required by ./burgers)
./burgers: /usr/lib/x86_64-linux-gnu/libgfortran.so.3: version 
`GFORTRAN_1.6' not found (required by ./burgers)
./burgers: /usr/lib/x86_64-linux-gnu/libgfortran.so.3: version 
`GFORTRAN_1.6' not found (required by ./burgers)
./burgers: /usr/lib/x86_64-linux-gnu/libgfortran.so.3: version 
`GFORTRAN_1.6' not found (required by ./burgers)
./burgers: /usr/lib/x86_64-linux-gnu/libgfortran.so.3: version 
`GFORTRAN_1.6' not found (required by ./burgers)

[Primary job termiated normally ... almost correct]

Thanks for your, Alessandro's and Tobias' work on coarrays !

-- 
Toon Moene - e-mail: toon@moene.org - phone: +31 346 214290
Saturnushof 14, 3738 XG  Maartensdijk, The Netherlands
At home: http://moene.org/~toon/; weather: http://moene.org/~hirlam/
Progress of GNU Fortran: http://gcc.gnu.org/wiki/GFortran#news



More information about the Fortran mailing list