[petsc-users] MPI_Scan under Fortran

Wienand Drenth w.drenth at gmail.com
Wed Aug 24 09:33:21 CDT 2011


dear all,

For some parallellization project I am adapting example 10 of the SNES
tutorials ($PETSC_DIR/src/snes/examples/tutorials/ex10d/). Since the project
is writted in Fortran, and am trying to rewrite the example in Fortran.

So far little issues, but the MPI_Scan routine gives me some more problems.
In the said example, the call is like

ierr =
MPI_Scan(&user.Nvlocal,&rstart,1,MPIU_INT,MPI_SUM,PETSC_COMM_WORLD);CHKERRQ(ierr);

For Fortran I rewrote it a little to look like
call MPI_Scan(user%Nvlocal,rstart,1,MPIU_INT,MPI_SUM, PETSC_COMM_WORLD,
ierr)

The program compiles without troubles, but running it gives me an error. It
is, I think, related to the MPI_SUM operation:
[walrus:463] *** An error occurred in MPI_Scan: the reduction operation
MPI_SUM is not defined on the MPI_BYTE datatype
[walrus:463] *** on communicator MPI_COMM_WORLD
[walrus:463] *** MPI_ERR_OP: invalid reduce operation
[walrus:463] *** MPI_ERRORS_ARE_FATAL (your MPI job will now abort)

In addition, I needed to declare MPIU_INT explicitly as integer; this was
not required for the C program.

Am I missing a crucial header file with definitions? The solution will
probably be very simple and straightforward, but I seem to overlook it. Any
help will be greatly appreciated.

regards,
Wienand Drenth
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20110824/2ba14474/attachment.htm>


More information about the petsc-users mailing list