Hi,

I've installed openmpi-3.1.0 on my "SUSE Linux Enterprise Server
12.3 (x86_64)" with gcc-6.4.0. Why do I get "extent: 0" instead of
"extent: 1" for my small program. In my opinion the extent of the
old data type and the resized extent of the new data type should
be the same. Am I wrong, is something wrong with my program, or
results the unexpected value from an error of the MPI Java method
getExtent() for a derived data type? I get the value 1, if I use
MPI.DOUBLE.getSize() or MPI.DOUBLE.getExtent().

loki java 130 which \mpijavac
/usr/local/openmpi-3.1.0_64_gcc/bin/mpijavac
loki java 131 \mpijavac SizeExtentMain.java
loki java 132 mpiexec -np 1 java SizeExtentMain
strided vector:
  size of old data type: 1
  count:                 2
  blocklength:           2
  stride:                4
  size:                  4
  lower bound:           0
  extent:                0
  true lower bound:      0
  true extent:           6
loki java 133

I would be grateful, if somebody can fix the problem, if it is a
problem of the MPI Java method or if somebody knows, what I'm doing
wrong in my program. Thank you very much for any help in advance.


Kind regards

Siegmar
/* A  small MPI Java program that creates a vector and prints
 * its size and extent.
 *
 * "mpijavac" and Java-bindings are available in "Open MPI
 * version 1.7.4" or newer.
 *
 *
 * Class file generation:
 *   mpijavac SizeExtentMain.java
 *
 * Usage:
 *   mpiexec [parameters] java [parameters] SizeExtentMain
 *
 * Examples:
 *   mpiexec java SizeExtentMain
 *   mpiexec java -cp $HOME/mpi_classfiles SizeExtentMain
 *
 *
 * File: SizeExtentMain.java            Author: S. Gross
 * Date: 19.07.2018
 *
 */

import mpi.*;

public class SizeExtentMain
{
  static final int COUNT = 2;
  static final int BLOCKLENGTH = 2;
  static final int STRIDE = 4;

  public static void main (String args[]) throws MPIException
  {
    int  mytid,                         /* my task id                   */
         size,                          /* size of vector               */
         sizeMpiDouble;                 /* size of MPI.DOUBLE           */
    long extent, trueExtent,            /* extent of (resized) vector   */
         lb, trueLb;                    /* lower bound of (resized) vect*/
    Datatype vector_t,                  /* strided vector               */
             tmp_vector_t;

    MPI.Init (args);
    mytid  = MPI.COMM_WORLD.getRank ();
    sizeMpiDouble = MPI.DOUBLE.getSize ();

    /* Build the new type for a strided vector and resize the extent
     * of the new datatype in such a way that the extent of the whole
     * vector looks like just one element.
     */
    tmp_vector_t = Datatype.createVector (COUNT, BLOCKLENGTH, STRIDE,
                                          MPI.DOUBLE);
    vector_t = Datatype.createResized (tmp_vector_t, 0, sizeMpiDouble);
    vector_t.commit ();
    tmp_vector_t.free ();
    if (mytid == 0)
    {
      size       = vector_t.getSize ();
      extent     = vector_t.getExtent ();
      trueExtent = vector_t.getTrueExtent ();
      lb         = vector_t.getLb ();
      trueLb     = vector_t.getTrueLb ();
      System.out.println ("strided vector:\n" +
          "  size of old data type: " + sizeMpiDouble + "\n" +
          "  count:                 " + COUNT + "\n" +
          "  blocklength:           " + BLOCKLENGTH + "\n" +
          "  stride:                " + STRIDE + "\n" +
          "  size:                  " + size + "\n" +
          "  lower bound:           " + lb + "\n" +
          "  extent:                " + extent + "\n" +
          "  true lower bound:      " + trueLb + "\n" +
          "  true extent:           " + trueExtent + "\n");
    }
    vector_t.free ();
    MPI.Finalize ();
  }
}
_______________________________________________
users mailing list
users@lists.open-mpi.org
https://lists.open-mpi.org/mailman/listinfo/users

Reply via email to