Intel® oneAPI Math Kernel Library
Ask questions and share information with other developers who use Intel® Math Kernel Library.

BLACS broadcast 64-bit integer



I'm trying to broadcast a 64-bit integer with BLACS routines IGEBS2D() and IGEBR2D() --- Centos 6.5 Linux, ifort, composer_xe_2013_sp1.2.144, intel64, Intel MPI, ilp64 libs.  Despite declaring all integers as integer*8, compiling with -i8 and linking exclusively with ilp64 libs, only 32-bits of the 64-bit integer seem to be broadcast.  My compile line is:

  mpiifort -i8 -o demo1 demo1.f -warn all -L${MKLROOT}/lib/intel64 -lmkl_intel_ilp64 -lmkl_core -lmkl_sequential -lmkl_blacs_intelmpi_ilp64 -lpthread -lm

Sample program:

      program demo1
      implicit none
      integer*8 ictxt, iam, nprocs, nprow, npcol, myprow, mypcol, bignum

!     Determine my process number and the number of processes
      call blacs_pinfo (iam, nprocs)
      if (nprocs .lt. 2) stop 'Please use mpirun with more than 1 proc'

!     Get the blacs default system context
      call blacs_get (-1, 0, ictxt)

!     Set up a (1 x nprocs) processor grid
      nprow = 1
      npcol = nprocs
      call blacs_gridinit (ictxt, 'Row-major', nprow, npcol)

!     find out where I am in the processor grid, in (myprow, mypcol)
      call blacs_gridinfo (ictxt, nprow, npcol, myprow, mypcol)

!     skip everything unless I'm in the processor grid
      if (myprow .lt. nprow .and. mypcol .lt. npcol) then

!        broadcast bignum from the master proc to all other procs
         if (myprow .eq. 0 .and. mypcol .eq. 0) then

            bignum = 3000000000
            write (6,'(''initially bignum ='',i19)'), bignum
            call igebs2d (ictxt, 'All', ' ', 1, 1, bignum, 1)


            call igebr2d (ictxt, 'All', ' ', 1, 1, bignum, 1, 0, 0)

         end if

         write (6,'(''iam,nprocs,bignum='',2i4,i19)')iam, nprocs, bignum

      end if

!     tidy up and exit
      call blacs_gridexit (ictxt)
      call blacs_exit (0)


Expected output from  mpirun -np 2 demo1  is:

initially bignum =         3000000000
iam,nprocs,bignum=   0   2        3000000000
iam,nprocs,bignum=   1   2        3000000000

but instead I see:

initially bignum =         3000000000
iam,nprocs,bignum=   0   2        -1294967296
iam,nprocs,bignum=   1   2        -1294967296

suggesting that integer*8 bignum was truncated to 32-bits when it was broadcast.

What am I doing wrong please?

Thanks, Peter McGavin.

0 Kudos
1 Reply

Three things I thought of later, but they didn't work:

1: Adding the -ilp64 option to the mpiifort command;

2: Adding the -ilp64 option to the mpirun command;

3: Moving the blacs_gridexit() call to where it's supposed to be --- inside the preceding 'if I'm in the processor grid' clause.

Problem is still unsolved - any help appreciated.

Thanks, Peter McGavin.

0 Kudos