Re: [OMPI users] Java: wrong extent value for resized derived data type

2018-07-19 Thread Siegmar Gross

Hi Gilles,

thank you very much for your reply.

I must admit I am having a hard time understanding why MPI.DOUBLE.getSize() 
returns 1 instead of 8 ...
Anyway, for the time being, I think you can get the expected result by 
createResized(..., ..., 8).


I did that before. Unfortunately, MPI.DOUBLE.getSize() returns 1 and I will 
use size 8 in createResized() which is hard to explain to students. If I

remember right, Oscar (who implemented the Java interface) told me years ago
that "size" in Java is not measured in bytes but in data items. In this case
"1" would make sense for size and extent, because both describe one data item
(getSize() and getExtent() return "1" for all basic data types).


If there is a consensus that your program is correct, I will be happy to issue 
a PR
(Simply multiply lb and extent by baseSize before passing them to the native 
function)


I'm not sure if that will break something else, if you want to broadcast or
scatter a structure for example. Hopefully, you will find a solution.


Best regards and thank you very much for your help

Siegmar




Cheers,

Gilles

On Thursday, July 19, 2018, Siegmar Gross 
> wrote:


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



___
users mailing list
users@lists.open-mpi.org
https://lists.open-mpi.org/mailman/listinfo/users
/* A small MPI Java program that prints the sizes of MPI data types.
 *
 * "mpijavac" and Java-bindings are available in "Open MPI
 * version 1.7.4" or newer.
 *
 *
 * Class file generation:
 *   mpijavac MpiDatatypeSizesMain.java
 *
 * Usage:
 *   mpiexec [parameters] java [parameters] MpiDatatypeSizesMain
 *
 * Examples:
 *   mpiexec java MpiDatatypeSizesMain
 *   mpiexec java -cp $HOME/mpi_classfiles MpiDatatypeSizesMain
 *
 *
 * File: MpiDatatypeSizesMain.java  Author: S. Gross
 * Date: 19.07.2018
 *
 */

import mpi.*;

public class MpiDatatypeSizesMain
{
  public static void main (String args[]) throws MPIException
  {
int mytid,  /* my task id   */
sizeMpiChar,/* size of MPI data types   */ 
sizeMpiShort,
sizeMpiInt,
sizeMpiLong,
sizeMpiByte,
sizeMpiBoolean,
sizeMpiFloat,
sizeMpiDouble;

MPI.Init (args);
mytid  = MPI.COMM_WORLD.getRank ();
sizeMpiChar= MPI.CHAR.getSize ();
sizeMpiShort   = MPI.SHORT.getSize ();
sizeMpiInt = MPI.INT.getSize ();
sizeMpiLong= MPI.LONG.getSize ();
sizeMpiByte= MPI.BYTE.getSize ();
sizeMpiBoolean = MPI.BOOLEAN.getSize ();
sizeMpiFloat   = MPI.FLOAT.getSize ();
sizeMpiDouble  = MPI.DOUBLE.getSize ();
if (mytid == 0)
{
  System.out.printf ("  size of MPI.CHAR:%d\n" +
 "  size of MPI.SHORT:   %d\n" +
 "  size of MPI.INT: %d\n" +
 "  size of MPI.LONG:%d\n" +
 "  size of MPI.BYTE:%d\n" +
 "  size of MPI.BOOLEAN: %d\n" +
 "  size of MPI.FLOAT:   %d\n" +
 "  size of MPI.DOUBLE:  %d\n",
 sizeMpiChar,
 sizeMpiShort,
 sizeMpiInt,
 sizeMpiLong,
 sizeMpiByte,
 sizeMpiBoolean,
 sizeMpiFloat,
 sizeMpiDouble);
}
MPI.Finalize ();
  }
}
/* A small MPI Java program that prints the extents of MPI data types.
 *
 * "mpijavac" and Java-bindings are available in "Open MPI
 * version 1.7.4" or newer.
 *
 *
 * 

Re: [OMPI users] Java: wrong extent value for resized derived data type

2018-07-19 Thread Gilles Gouaillardet
Siegmar,


I must admit I am having a hard time understanding why MPI.DOUBLE.getSize()
returns 1 instead of 8 ...

Anyway, for the time being, I think you can get the expected result by
createResized(..., ..., 8).

If there is a consensus that your program is correct, I will be happy to
issue a PR
(Simply multiply lb and extent by baseSize before passing them to the
native function)

Cheers,

Gilles

On Thursday, July 19, 2018, Siegmar Gross <
siegmar.gr...@informatik.hs-fulda.de> wrote:

> 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
>
___
users mailing list
users@lists.open-mpi.org
https://lists.open-mpi.org/mailman/listinfo/users

[OMPI users] Java: wrong extent value for resized derived data type

2018-07-19 Thread Siegmar Gross

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.javaAuthor: 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