0

I am compiling the package BLACS on Linux. I compiled the package, the contents of the INSTALL directory. When I try to build the contents of the directory TESTING, I get errors

blacstest.f:(.text+0xb9): undefined reference to `blacs_gridinit_'

etc.

When I tried looking for the function in the library, the message I get is,

~/sources/BLACS/LIB$ nm blacs_MPI-LINUX-0.a | less | grep blacs_gridinit_
blacs_gridinit_.o:
0000000000000000 T blacs_gridinit__
Cblacs_gridinit_.oo:

So the function exists, but with a double underscore. How to make it have just one?

I have tried a few things in Bmake.inc.

#   INTFACE = -Df77IsF2C
#   INTFACE = -fno-underscoring
    INTFACE = -DAdd_

But none of it seems to work. Anyone has some experience with this?

Thanks, Elan.

EDIT: BLACS comes with a .inc file where everything is configured. I have:

   F77            = mpif77
   F77NO_OPTFLAGS = 
   F77FLAGS       = $(F77NO_OPTFLAGS) -O -fPIC 
   F77LOADER      = $(F77)
   F77LOADFLAGS   = 
   CC             = mpicc
   CCFLAGS        = -O4 -fPIC
   CCLOADER       = $(CC)
   CCLOADFLAGS    =

-assume 2underscore was not accepted in either of the compile flags. In addition, the template .inc file says:

#  ---------------------------------------------------------------------------
#  The Fortran 77 to C interface to be used.  If you are unsure of the correct
#  setting for your platform, compile and run BLACS/INSTALL/xintface.
#  Choices are: Add_, NoChange, UpCase, or f77IsF2C.
#  ---------------------------------------------------------------------------
#   INTFACE = -Df77IsF2C
Elan
  • 443
  • 5
  • 14
  • Did you try with `-DNoChange`? – Hristo Iliev Jun 18 '12 at 11:44
  • What compiler and linker are you using ? Have you tried a flag such as `-assume 2underscores` ? – High Performance Mark Jun 18 '12 at 12:05
  • 1
    @Elan: nope, that doesn't tell us what compiler and linker you are using. `mpif77` and `mpicc` are compiler wrappers usually distributed as part of an MPI installation, and often in the form of shell scripts. – High Performance Mark Jun 18 '12 at 13:53
  • How about following the advice to compiler and run `BLACS/INSTALL/xintface`. I've never installed BLACS so it's hard for me to guess what this program will do but probably it will probe how your Fortran mangles external symbol names. GCC's Fortran compiler (g77 or gfortran) by default make external symbols lowercase and append one underscore, e.g. `FUNC` becomes `func_`. – Hristo Iliev Jun 18 '12 at 13:57
  • Ok, the expansion of the wrapped compilers, (with --showme of openmpi) is "gcc -I/usr/lib/openmpi/include -I/usr/lib/openmpi/include/openmpi -pthread -L/usr/lib/openmpi/lib -lmpi -lopen-rte -lopen-pal -ldl -Wl,--export-dynamic -lnsl -lutil -lm -ldl" and "gfortran -I/usr/lib/openmpi/include -pthread -L/usr/lib/openmpi/lib -lmpi_f77 -lmpi -lopen-rte -lopen-pal -ldl -Wl,--export-dynamic -lnsl -lutil -lm -ldl" – Elan Jun 18 '12 at 14:06
  • Tried running BLACS/INSTALL/xintface as well. It produces two .o files which are surprisingly without executable flag. Looks like they are intermediate libraries without _main. There are two executables in the TESTING directory, but they just don't start, quoting problems with 'orte' – Elan Jun 18 '12 at 14:09

1 Answers1

2

EasyBuild (partially) solves this issue for you, see https://github.com/hpcugent/easybuild-easyblocks/blob/master/easybuild/easyblocks/b/blacs.py for the Python code that implements the build procedure for BLACS.

It doesn't build the tests (yet), but it does build BLACS in the correct way.

As you already saw in the template.inc file, you should build the xintface tool and run it, which will help you figure out what the correct setting for INTFACE is. You also need to make sure the TRANSCOMM setting is correct, you can use the xtc_CsameF77 and xtc_UseMpich tools for that.

Once you've figured the values for INTFACE and TRANSCOMM out, rebuild BLACS and set these on the make command line. Then try building the tests again (using the same options).

Jens Timmerman
  • 9,316
  • 1
  • 42
  • 48
Kenneth Hoste
  • 2,816
  • 20
  • 14