1
1

Formatting fixes for Java files.

Fixed tab indenting as well as some of the block comments
at the top of a few of the files.

Signed-off-by: Nathaniel Graham <ngraham@lanl.gov>
Этот коммит содержится в:
Nathaniel Graham 2015-07-24 11:02:13 -06:00
родитель 5f14273e32
Коммит 0d7a38552e
34 изменённых файлов: 12060 добавлений и 11125 удалений

Просмотреть файл

@ -16,26 +16,26 @@
* Additional copyrights may follow
*
* $HEADER$
*/
/*
*
*
* This file is almost a complete re-write for Open MPI compared to the
* original mpiJava package. Its license and copyright are listed below.
* See <path to ompi/mpi/java/README> for more information.
*/
/*
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
/*
*
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*
* File : Cartcomm.java
* Author : Xinying Li
* Created : Thu Apr 9 12:22:15 1998
@ -52,32 +52,32 @@ package mpi;
*/
public final class CartComm extends Intracomm
{
static
{
static
{
init();
}
}
private static native void init();
private static native void init();
protected CartComm(long handle) throws MPIException
{
protected CartComm(long handle) throws MPIException
{
super(handle);
}
}
protected CartComm(long[] commRequest)
{
protected CartComm(long[] commRequest)
{
super(commRequest);
}
}
/**
/**
* Duplicates this communicator.
* <p>Java binding of {@code MPI_COMM_DUP}.
* <p>It is recommended to use {@link #dup} instead of {@link #clone}
* because the last can't throw an {@link mpi.MPIException}.
* @return copy of this communicator
*/
@Override public CartComm clone()
{
@Override public CartComm clone()
{
try
{
return dup();
@ -86,21 +86,21 @@ protected CartComm(long[] commRequest)
{
throw new RuntimeException(e.getMessage());
}
}
}
/**
/**
* Duplicates this communicator.
* <p>Java binding of {@code MPI_COMM_DUP}.
* @return copy of this communicator
* @throws MPIException Signals that an MPI exception of some sort has occurred.
*/
@Override public CartComm dup() throws MPIException
{
@Override public CartComm dup() throws MPIException
{
MPI.check();
return new CartComm(dup(handle));
}
}
/**
/**
* Duplicates this communicator.
* <p>Java binding of {@code MPI_COMM_IDUP}.
* <p>The new communicator can't be used before the operation completes.
@ -108,13 +108,13 @@ protected CartComm(long[] commRequest)
* @return copy of this communicator
* @throws MPIException Signals that an MPI exception of some sort has occurred. Signals that an MPI exception of some sort has occurred.
*/
@Override public CartComm iDup() throws MPIException
{
@Override public CartComm iDup() throws MPIException
{
MPI.check();
return new CartComm(iDup(handle));
}
}
/**
/**
* Returns cartesian topology information.
* <p>Java binding of the MPI operations {@code MPI_CARTDIM_GET} and
* {@code MPI_CART_GET}.
@ -123,45 +123,45 @@ protected CartComm(long[] commRequest)
* @return object containing dimensions, periods and local coordinates
* @throws MPIException Signals that an MPI exception of some sort has occurred.
*/
public CartParms getTopo() throws MPIException
{
public CartParms getTopo() throws MPIException
{
MPI.check();
return getTopo(handle);
}
}
private native CartParms getTopo(long comm) throws MPIException;
private native CartParms getTopo(long comm) throws MPIException;
/**
/**
* Translate logical process coordinates to process rank.
* <p>Java binding of the MPI operation {@code MPI_CART_RANK}.
* @param coords Cartesian coordinates of a process
* @return rank of the specified process
* @throws MPIException Signals that an MPI exception of some sort has occurred.
*/
public int getRank(int[] coords) throws MPIException
{
public int getRank(int[] coords) throws MPIException
{
MPI.check();
return getRank(handle, coords);
}
}
private native int getRank(long comm, int[] coords) throws MPIException;
private native int getRank(long comm, int[] coords) throws MPIException;
/**
/**
* Translate process rank to logical process coordinates.
* <p>Java binding of the MPI operation {@code MPI_CART_COORDS}.
* @param rank rank of a process
* @return Cartesian coordinates of the specified process
* @throws MPIException Signals that an MPI exception of some sort has occurred.
*/
public int[] getCoords(int rank) throws MPIException
{
public int[] getCoords(int rank) throws MPIException
{
MPI.check();
return getCoords(handle, rank);
}
}
private native int[] getCoords(long comm, int rank) throws MPIException;
private native int[] getCoords(long comm, int rank) throws MPIException;
/**
/**
* Compute source and destination ranks for "shift" communication.
* <p>Java binding of the MPI operation {@code MPI_CART_SHIFT}.
* @param direction coordinate dimension of shift
@ -169,16 +169,16 @@ private native int[] getCoords(long comm, int rank) throws MPIException;
* @return object containing ranks of source and destination processes
* @throws MPIException Signals that an MPI exception of some sort has occurred.
*/
public ShiftParms shift(int direction, int disp) throws MPIException
{
public ShiftParms shift(int direction, int disp) throws MPIException
{
MPI.check();
return shift(handle, direction, disp);
}
}
private native ShiftParms shift(long comm, int direction, int disp)
private native ShiftParms shift(long comm, int direction, int disp)
throws MPIException;
/**
/**
* Partition cartesian communicator into subgroups of lower dimension.
* <p>Java binding of the MPI operation {@code MPI_CART_SUB}.
* @param remainDims by dimension, {@code true} if dimension is to be kept,
@ -186,15 +186,15 @@ private native ShiftParms shift(long comm, int direction, int disp)
* @return communicator containing subgrid including this process
* @throws MPIException Signals that an MPI exception of some sort has occurred.
*/
public CartComm sub(boolean[] remainDims) throws MPIException
{
public CartComm sub(boolean[] remainDims) throws MPIException
{
MPI.check();
return new CartComm(sub(handle, remainDims));
}
}
private native long sub(long comm, boolean[] remainDims) throws MPIException;
private native long sub(long comm, boolean[] remainDims) throws MPIException;
/**
/**
* Compute an optimal placement.
* <p>Java binding of the MPI operation {@code MPI_CART_MAP}.
* <p>The number of dimensions is taken to be size of the {@code dims} argument.
@ -204,29 +204,29 @@ private native long sub(long comm, boolean[] remainDims) throws MPIException;
* @return reordered rank of calling process
* @throws MPIException Signals that an MPI exception of some sort has occurred.
*/
public int map(int[] dims, boolean[] periods) throws MPIException
{
public int map(int[] dims, boolean[] periods) throws MPIException
{
MPI.check();
return map(handle, dims, periods);
}
}
private native int map(long comm, int[] dims, boolean[] periods)
private native int map(long comm, int[] dims, boolean[] periods)
throws MPIException;
/**
/**
* Select a balanced distribution of processes per coordinate direction.
* <p>Java binding of the MPI operation {@code MPI_DIMS_CREATE}.
* @param nnodes number of nodes in a grid
* @param dims array specifying the number of nodes in each dimension
* @throws MPIException Signals that an MPI exception of some sort has occurred.
*/
public static void createDims(int nnodes, int[] dims) throws MPIException
{
public static void createDims(int nnodes, int[] dims) throws MPIException
{
MPI.check();
createDims_jni(nnodes, dims);
}
}
private static native void createDims_jni(int nnodes, int[] dims)
private static native void createDims_jni(int nnodes, int[] dims)
throws MPIException;
} // Cartcomm

Просмотреть файл

@ -9,31 +9,33 @@
* University of Stuttgart. All rights reserved.
* Copyright (c) 2004-2005 The Regents of the University of California.
* All rights reserved.
* Copyright (c) 2015 Los Alamos National Security, LLC. All rights
* reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
*
* $HEADER$
*/
/*
*
*
* This file is almost a complete re-write for Open MPI compared to the
* original mpiJava package. Its license and copyright are listed below.
* See <path to ompi/mpi/java/README> for more information.
*/
/*
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
/*
*
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*
* File : CartParms.java
* Author : Xinying Li
* Created : Thu Apr 9 12:22:15 1998
@ -50,65 +52,65 @@ package mpi;
*/
public final class CartParms
{
/** Number of processes for each cartesian dimension. */
private final int[] dims;
/** Number of processes for each cartesian dimension. */
private final int[] dims;
/** Periodicity (true/false) for each cartesian dimension. */
private final boolean[] periods;
/** Periodicity (true/false) for each cartesian dimension. */
private final boolean[] periods;
/** Coordinates of calling process in cartesian structure. */
private final int[] coords;
/** Coordinates of calling process in cartesian structure. */
private final int[] coords;
/**
/**
* Constructs a cartesian topology information object.
* @param dims number of processes for each cartesian dimension.
* @param periods periodicity (true/false) for each cartesian dimension.
* @param coords coordinates of calling process in cartesian structure.
*/
protected CartParms(int[] dims, boolean[] periods, int[] coords)
{
protected CartParms(int[] dims, boolean[] periods, int[] coords)
{
this.dims = dims;
this.periods = periods;
this.coords = coords;
}
}
/**
/**
* Returns the number of dimensions.
* @return number of dimensions.
*/
public int getDimCount()
{
public int getDimCount()
{
return dims.length;
}
}
/**
/**
* Returns the number of processes for a cartesian dimension.
* @param i cartesian dimension.
* @return number of processes for a cartesian dimension.
*/
public int getDim(int i)
{
public int getDim(int i)
{
return dims[i];
}
}
/**
/**
* Returns the periodicity (true/false) for a cartesian dimension.
* @param i cartesian dimension.
* @return periodicity for a cartesian dimension.
*/
public boolean getPeriod(int i)
{
public boolean getPeriod(int i)
{
return periods[i];
}
}
/**
/**
* Returns the coordinate of calling process for a cartesian dimension.
* @param i cartesian dimension.
* @return coordinate of calling process for a cartesian dimension.
*/
public int getCoord(int i)
{
public int getCoord(int i)
{
return coords[i];
}
}
} // CartParms

Разница между файлами не показана из-за своего большого размера Загрузить разницу

Просмотреть файл

@ -9,6 +9,8 @@
* University of Stuttgart. All rights reserved.
* Copyright (c) 2004-2005 The Regents of the University of California.
* All rights reserved.
* Copyright (c) 2015 Los Alamos National Security, LLC. All rights
* reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
@ -20,8 +22,7 @@ package mpi;
class Constant
{
protected int THREAD_SINGLE, THREAD_FUNNELED, THREAD_SERIALIZED,
THREAD_MULTIPLE;
protected int THREAD_SINGLE, THREAD_FUNNELED, THREAD_SERIALIZED, THREAD_MULTIPLE;
protected int GRAPH, DIST_GRAPH, CART;
protected int ANY_SOURCE, ANY_TAG;
@ -30,8 +31,7 @@ class Constant
protected int IDENT, CONGRUENT, SIMILAR, UNEQUAL;
protected int TAG_UB, HOST, IO, WTIME_IS_GLOBAL;
protected int APPNUM, LASTUSEDCODE, UNIVERSE_SIZE, WIN_BASE, WIN_SIZE,
WIN_DISP_UNIT;
protected int APPNUM, LASTUSEDCODE, UNIVERSE_SIZE, WIN_BASE, WIN_SIZE, WIN_DISP_UNIT;
protected int VERSION, SUBVERSION;
protected int ROOT, KEYVAL_INVALID, BSEND_OVERHEAD;
@ -39,8 +39,7 @@ class Constant
protected int MAX_INFO_KEY, MAX_INFO_VAL;
protected int ORDER_C, ORDER_FORTRAN;
protected int DISTRIBUTE_BLOCK, DISTRIBUTE_CYCLIC, DISTRIBUTE_NONE,
DISTRIBUTE_DFLT_DARG;
protected int DISTRIBUTE_BLOCK, DISTRIBUTE_CYCLIC, DISTRIBUTE_NONE, DISTRIBUTE_DFLT_DARG;
protected int MODE_CREATE, MODE_RDONLY, MODE_WRONLY, MODE_RDWR,
MODE_DELETE_ON_CLOSE, MODE_UNIQUE_OPEN, MODE_EXCL,

Просмотреть файл

@ -16,26 +16,26 @@
* Additional copyrights may follow
*
* $HEADER$
*/
/*
*
*
* This file is almost a complete re-write for Open MPI compared to the
* original mpiJava package. Its license and copyright are listed below.
* See <path to ompi/mpi/java/README> for more information.
*/
/*
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
/*
*
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*
* File : Datatype.java
* Author : Sang Lim, Sung-Hoon Ko, Xinying Li, Bryan Carpenter
* Created : Thu Apr 9 12:22:15 1998
@ -54,39 +54,39 @@ import java.nio.*;
*/
public final class Datatype implements Freeable
{
protected long handle;
protected int baseType;
protected int baseSize;
protected long handle;
protected int baseType;
protected int baseSize;
// Cache to avoid unnecessary jni calls.
private int lb, extent, trueLb, trueExtent;
// Cache to avoid unnecessary jni calls.
private int lb, extent, trueLb, trueExtent;
protected static final int NULL = 0;
protected static final int BYTE = 1;
protected static final int CHAR = 2;
protected static final int SHORT = 3;
protected static final int BOOLEAN = 4;
protected static final int INT = 5;
protected static final int LONG = 6;
protected static final int FLOAT = 7;
protected static final int DOUBLE = 8;
protected static final int PACKED = 9;
protected static final int INT2 = 10;
protected static final int SHORT_INT = 11;
protected static final int LONG_INT = 12;
protected static final int FLOAT_INT = 13;
protected static final int DOUBLE_INT = 14;
protected static final int FLOAT_COMPLEX = 15;
protected static final int DOUBLE_COMPLEX = 16;
protected static final int NULL = 0;
protected static final int BYTE = 1;
protected static final int CHAR = 2;
protected static final int SHORT = 3;
protected static final int BOOLEAN = 4;
protected static final int INT = 5;
protected static final int LONG = 6;
protected static final int FLOAT = 7;
protected static final int DOUBLE = 8;
protected static final int PACKED = 9;
protected static final int INT2 = 10;
protected static final int SHORT_INT = 11;
protected static final int LONG_INT = 12;
protected static final int FLOAT_INT = 13;
protected static final int DOUBLE_INT = 14;
protected static final int FLOAT_COMPLEX = 15;
protected static final int DOUBLE_COMPLEX = 16;
static
{
static
{
init();
}
}
private static native void init();
private static native void init();
/*
/*
* Constructor used in static initializer of 'MPI'.
*
* (Called before MPI.Init(), so cannot make any native MPI calls.)
@ -95,182 +95,182 @@ private static native void init();
* datatype objects for 'BYTE', etc in static initializers invoked before
* MPI.Init(), then initialize objects after MPI initialized.)
*/
protected Datatype()
{
}
protected Datatype()
{
}
protected void setBasic(int type)
{
protected void setBasic(int type)
{
baseType = type;
handle = getDatatype(type);
baseSize = type == NULL ? 0 : getSize(handle);
}
}
protected void setBasic(int type, Datatype oldType)
{
protected void setBasic(int type, Datatype oldType)
{
baseType = oldType.baseType;
handle = getDatatype(type);
baseSize = oldType.baseSize;
}
}
private static native long getDatatype(int type);
private static native long getDatatype(int type);
/*
/*
* Constructor used in 'create*' methods.
*/
private Datatype(Datatype oldType, long handle)
{
private Datatype(Datatype oldType, long handle)
{
baseType = oldType.baseType;
baseSize = oldType.baseSize;
this.handle = handle;
}
}
/*
/*
* Constructor used in 'create*' methods.
*/
private Datatype(int baseType, int baseSize, long handle)
{
private Datatype(int baseType, int baseSize, long handle)
{
this.baseType = baseType;
this.baseSize = baseSize;
this.handle = handle;
}
}
/**
/**
* Returns the lower bound of a datatype.
* <p>Java binding of the MPI operation {@code MPI_TYPE_GET_EXTENT}.
* @return lower bound of datatype
* @throws MPIException Signals that an MPI exception of some sort has occurred.
*/
public int getLb() throws MPIException
{
public int getLb() throws MPIException
{
if(extent == 0)
getLbExtent();
return lb;
}
}
/**
/**
* Returns the extent of a datatype.
* <p>Java binding of the MPI operation {@code MPI_TYPE_GET_EXTENT}.
* @return datatype extent
* @throws MPIException Signals that an MPI exception of some sort has occurred.
*/
public int getExtent() throws MPIException
{
public int getExtent() throws MPIException
{
if(extent == 0)
getLbExtent();
return extent;
}
}
private void getLbExtent() throws MPIException
{
private void getLbExtent() throws MPIException
{
MPI.check();
int lbExt[] = new int[2];
getLbExtent(handle, lbExt);
lb = lbExt[0] / baseSize;
extent = lbExt[1] / baseSize;
}
}
private native void getLbExtent(long handle, int[] lbExt);
private native void getLbExtent(long handle, int[] lbExt);
/**
/**
* Returns the true lower bound of a datatype.
* <p>Java binding of the MPI operation {@code MPI_TYPE_GET_TRUE_EXTENT}.
* @return lower bound of datatype
* @throws MPIException Signals that an MPI exception of some sort has occurred.
*/
public int getTrueLb() throws MPIException
{
public int getTrueLb() throws MPIException
{
if(trueExtent == 0)
getTrueLbExtent();
return trueLb;
}
}
/**
/**
* Returns the true extent of a datatype.
* <p>Java binding of the MPI operation {@code MPI_TYPE_GET_TRUE_EXTENT}.
* @return datatype true extent
* @throws MPIException Signals that an MPI exception of some sort has occurred.
*/
public int getTrueExtent() throws MPIException
{
public int getTrueExtent() throws MPIException
{
if(trueExtent == 0)
getTrueLbExtent();
return trueExtent;
}
}
private void getTrueLbExtent() throws MPIException
{
private void getTrueLbExtent() throws MPIException
{
MPI.check();
int lbExt[] = new int[2];
getTrueLbExtent(handle, lbExt);
trueLb = lbExt[0] / baseSize;
trueExtent = lbExt[1] / baseSize;
}
}
private native void getTrueLbExtent(long handle, int[] lbExt);
private native void getTrueLbExtent(long handle, int[] lbExt);
/**
/**
* Returns the total size of a datatype - the number of buffer
* elements it represents.
* <p>Java binding of the MPI operation {@code MPI_TYPE_SIZE}.
* @return datatype size
* @throws MPIException Signals that an MPI exception of some sort has occurred.
*/
public int getSize() throws MPIException
{
public int getSize() throws MPIException
{
MPI.check();
return getSize(handle) / baseSize;
}
}
private native int getSize(long type);
private native int getSize(long type);
/**
/**
* Commits a derived datatype.
* Java binding of the MPI operation {@code MPI_TYPE_COMMIT}.
* @throws MPIException Signals that an MPI exception of some sort has occurred.
*/
public void commit() throws MPIException
{
public void commit() throws MPIException
{
MPI.check();
commit(handle);
}
}
private native void commit(long type);
private native void commit(long type);
/**
/**
* Frees the datatype.
* <p>Java binding of the MPI operation {@code MPI_TYPE_FREE}.
* @throws MPIException Signals that an MPI exception of some sort has occurred.
*/
@Override public void free() throws MPIException
{
@Override public void free() throws MPIException
{
MPI.check();
handle = free(handle);
}
}
private native long free(long type) throws MPIException;
private native long free(long type) throws MPIException;
/**
/**
* Returns {@code true} if this datatype is MPI_DATATYPE_NULL.
* @return {@code true} if this datatype is MPI_DATATYPE_NULL
*/
public boolean isNull()
{
public boolean isNull()
{
return handle == MPI.DATATYPE_NULL.handle;
}
}
/**
/**
* Java binding of {@code MPI_TYPE_DUP}.
* <p>It is recommended to use {@link #dup} instead of {@link #clone}
* because the last can't throw an {@link mpi.MPIException}.
* @return new datatype
*/
@Override public Datatype clone()
{
@Override public Datatype clone()
{
try
{
return dup();
@ -279,22 +279,22 @@ public boolean isNull()
{
throw new RuntimeException(e.getMessage());
}
}
}
/**
/**
* Java binding of {@code MPI_TYPE_DUP}.
* @return new datatype
* @throws MPIException Signals that an MPI exception of some sort has occurred.
*/
public Datatype dup() throws MPIException
{
public Datatype dup() throws MPIException
{
MPI.check();
return new Datatype(this, dup(handle));
}
}
private native long dup(long type) throws MPIException;
private native long dup(long type) throws MPIException;
/**
/**
* Construct new datatype representing replication of old datatype into
* contiguous locations.
* <p>Java binding of the MPI operation {@code MPI_TYPE_CONTIGUOUS}.
@ -305,16 +305,16 @@ private native long dup(long type) throws MPIException;
* @return new datatype
* @throws MPIException Signals that an MPI exception of some sort has occurred.
*/
public static Datatype createContiguous(int count, Datatype oldType)
public static Datatype createContiguous(int count, Datatype oldType)
throws MPIException
{
{
MPI.check();
return new Datatype(oldType, getContiguous(count, oldType.handle));
}
}
private static native long getContiguous(int count, long oldType);
private static native long getContiguous(int count, long oldType);
/**
/**
* Construct new datatype representing replication of old datatype into
* locations that consist of equally spaced blocks.
* <p>Java binding of the MPI operation {@code MPI_TYPE_VECTOR}.
@ -327,20 +327,20 @@ private static native long getContiguous(int count, long oldType);
* @return new datatype
* @throws MPIException Signals that an MPI exception of some sort has occurred.
*/
public static Datatype createVector(int count, int blockLength,
public static Datatype createVector(int count, int blockLength,
int stride, Datatype oldType)
throws MPIException
{
{
MPI.check();
long handle = getVector(count, blockLength, stride, oldType.handle);
return new Datatype(oldType, handle);
}
}
private static native long getVector(
private static native long getVector(
int count, int blockLength, int stride, long oldType)
throws MPIException;
/**
/**
* Identical to {@code createVector} except that the stride is expressed
* directly in terms of the buffer index, rather than the units of
* the old type.
@ -352,20 +352,20 @@ private static native long getVector(
* @return new datatype
* @throws MPIException Signals that an MPI exception of some sort has occurred.
*/
public static Datatype createHVector(int count, int blockLength,
public static Datatype createHVector(int count, int blockLength,
int stride, Datatype oldType)
throws MPIException
{
{
MPI.check();
long handle = getHVector(count, blockLength, stride, oldType.handle);
return new Datatype(oldType, handle);
}
}
private static native long getHVector(
private static native long getHVector(
int count, int blockLength, int stride, long oldType)
throws MPIException;
/**
/**
* Construct new datatype representing replication of old datatype into
* a sequence of blocks where each block can contain a different number
* of copies and have a different displacement.
@ -380,20 +380,20 @@ private static native long getHVector(
* @return new datatype
* @throws MPIException Signals that an MPI exception of some sort has occurred.
*/
public static Datatype createIndexed(int[] blockLengths,
public static Datatype createIndexed(int[] blockLengths,
int[] displacements, Datatype oldType)
throws MPIException
{
{
MPI.check();
long handle = getIndexed(blockLengths, displacements, oldType.handle);
return new Datatype(oldType, handle);
}
}
private static native long getIndexed(
private static native long getIndexed(
int[] blockLengths, int[] displacements, long oldType)
throws MPIException;
/**
/**
* Identical to {@code createIndexed} except that the displacements are
* expressed directly in terms of the buffer index, rather than the
* units of the old type.
@ -404,20 +404,20 @@ private static native long getIndexed(
* @return new datatype
* @throws MPIException Signals that an MPI exception of some sort has occurred.
*/
public static Datatype createHIndexed(int[] blockLengths,
public static Datatype createHIndexed(int[] blockLengths,
int[] displacements, Datatype oldType)
throws MPIException
{
{
MPI.check();
long handle = getHIndexed(blockLengths, displacements, oldType.handle);
return new Datatype(oldType, handle);
}
}
private static native long getHIndexed(
private static native long getHIndexed(
int[] blockLengths, int[] displacements, long oldType)
throws MPIException;
/**
/**
* The most general type constructor.
* <p>Java binding of the MPI operation {@code MPI_TYPE_STRUCT}.
* <p>The number of blocks is taken to be size of the {@code blockLengths}
@ -429,24 +429,24 @@ private static native long getHIndexed(
* @return new datatype
* @throws MPIException Signals that an MPI exception of some sort has occurred.
*/
public static Datatype createStruct(int[] blockLengths,
public static Datatype createStruct(int[] blockLengths,
int[] displacements, Datatype[] types)
throws MPIException
{
{
MPI.check();
long handle = getStruct(blockLengths, displacements, types);
return new Datatype(MPI.BYTE, handle);
}
}
private static native long getStruct(
private static native long getStruct(
int[] blockLengths, int[] displacements, Datatype[] types)
throws MPIException;
/*
/*
* JMS add proper documentation here
* JMS int != Aint! This needs to be fixed throughout.
*/
/**
/**
* Create a datatype with a new lower bound and extent from an existing
* datatype.
* <p>Java binding of the MPI operation {@code MPI_TYPE_CREATE_RESIZED}.
@ -456,124 +456,124 @@ private static native long getStruct(
* @return new datatype
* @throws MPIException Signals that an MPI exception of some sort has occurred.
*/
public static Datatype createResized(Datatype oldType, int lb, int extent)
public static Datatype createResized(Datatype oldType, int lb, int extent)
throws MPIException
{
{
MPI.check();
long handle = getResized(oldType.handle, lb, extent);
return new Datatype(oldType, handle);
}
}
private static native long getResized(long oldType, int lb, int extent);
private static native long getResized(long oldType, int lb, int extent);
/**
/**
* Sets the print name for the datatype.
* @param name name for the datatype
* @throws MPIException Signals that an MPI exception of some sort has occurred.
*/
public void setName(String name) throws MPIException
{
public void setName(String name) throws MPIException
{
MPI.check();
setName(handle, name);
}
}
private native void setName(long handle, String name) throws MPIException;
private native void setName(long handle, String name) throws MPIException;
/**
/**
* Return the print name from the datatype.
* @return name of the datatype
* @throws MPIException Signals that an MPI exception of some sort has occurred.
*/
public String getName() throws MPIException
{
public String getName() throws MPIException
{
MPI.check();
return getName(handle);
}
}
private native String getName(long handle) throws MPIException;
private native String getName(long handle) throws MPIException;
/**
/**
* Create a new attribute key.
* <p>Java binding of the MPI operation {@code MPI_TYPE_CREATE_KEYVAL}.
* @return attribute key for future access
* @throws MPIException Signals that an MPI exception of some sort has occurred.
*/
public static int createKeyval() throws MPIException
{
public static int createKeyval() throws MPIException
{
MPI.check();
return createKeyval_jni();
}
}
private static native int createKeyval_jni() throws MPIException;
private static native int createKeyval_jni() throws MPIException;
/**
/**
* Frees an attribute key.
* <p>Java binding of the MPI operation {@code MPI_TYPE_FREE_KEYVAL}.
* @param keyval attribute key
* @throws MPIException Signals that an MPI exception of some sort has occurred.
*/
public static void freeKeyval(int keyval) throws MPIException
{
public static void freeKeyval(int keyval) throws MPIException
{
MPI.check();
freeKeyval_jni(keyval);
}
}
private static native void freeKeyval_jni(int keyval) throws MPIException;
private static native void freeKeyval_jni(int keyval) throws MPIException;
/**
/**
* Stores attribute value associated with a key.
* <p>Java binding of the MPI operation {@code MPI_TYPE_SET_ATTR}.
* @param keyval attribute key
* @param value attribute value
* @throws MPIException Signals that an MPI exception of some sort has occurred.
*/
public void setAttr(int keyval, Object value) throws MPIException
{
public void setAttr(int keyval, Object value) throws MPIException
{
MPI.check();
setAttr(handle, keyval, MPI.attrSet(value));
}
}
private native void setAttr(long type, int keyval, byte[] value)
private native void setAttr(long type, int keyval, byte[] value)
throws MPIException;
/**
/**
* Retrieves attribute value by key.
* <p>Java binding of the MPI operation {@code MPI_TYPE_GET_ATTR}.
* @param keyval attribute key
* @return attribute value or null if no attribute is associated with the key.
* @throws MPIException Signals that an MPI exception of some sort has occurred.
*/
public Object getAttr(int keyval) throws MPIException
{
public Object getAttr(int keyval) throws MPIException
{
MPI.check();
Object obj = getAttr(handle, keyval);
return obj instanceof byte[] ? MPI.attrGet((byte[])obj) : obj;
}
}
private native Object getAttr(long type, int keyval) throws MPIException;
private native Object getAttr(long type, int keyval) throws MPIException;
/**
/**
* Deletes an attribute value associated with a key.
* <p>Java binding of the MPI operation {@code MPI_TYPE_DELETE_ATTR}.
* @param keyval attribute key
* @throws MPIException Signals that an MPI exception of some sort has occurred.
*/
public void deleteAttr(int keyval) throws MPIException
{
public void deleteAttr(int keyval) throws MPIException
{
MPI.check();
deleteAttr(handle, keyval);
}
}
private native void deleteAttr(long type, int keyval) throws MPIException;
private native void deleteAttr(long type, int keyval) throws MPIException;
/**
/**
* Gets the offset of a buffer in bytes.
* @param buffer buffer
* @return offset in bytes
*/
protected int getOffset(Object buffer)
{
protected int getOffset(Object buffer)
{
return baseSize * ((Buffer)buffer).arrayOffset();
}
}
} // Datatype

Просмотреть файл

@ -9,6 +9,8 @@
* University of Stuttgart. All rights reserved.
* Copyright (c) 2004-2005 The Regents of the University of California.
* All rights reserved.
* Copyright (c) 2015 Los Alamos National Security, LLC. All rights
* reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
@ -23,85 +25,85 @@ package mpi;
*/
public final class DistGraphNeighbors
{
private final int[] sources, sourceWeights, destinations, destWeights;
private final boolean weighted;
private final int[] sources, sourceWeights, destinations, destWeights;
private final boolean weighted;
protected DistGraphNeighbors(
protected DistGraphNeighbors(
int[] sources, int[] sourceWeights,
int[] destinations, int[] destWeights, boolean weighted)
{
{
this.sources = sources;
this.sourceWeights = sourceWeights;
this.destinations = destinations;
this.destWeights = destWeights;
this.weighted = weighted;
}
}
/**
/**
* Gets the number of edges into this process.
* @return number of edges into this process
*/
public int getInDegree()
{
public int getInDegree()
{
return sources.length;
}
}
/**
/**
* Gets the number of edges out of this process.
* @return number of edges out of this process
*/
public int getOutDegree()
{
public int getOutDegree()
{
return destinations.length;
}
}
/**
/**
* Returns false if {@code MPI_UNWEIGHTED} was supplied during creation.
* @return false if {@code MPI_UNWEIGHTED} was supplied, true otherwise
*/
public boolean isWeighted()
{
public boolean isWeighted()
{
return weighted;
}
}
/**
/**
* Gets a process for which the calling processs is a destination.
* @param i source index
* @return process for which the calling processs is a destination
*/
public int getSource(int i)
{
public int getSource(int i)
{
return sources[i];
}
}
/**
/**
* Gets the weight of an edge into the calling process.
* @param i source index
* @return weight of the edge into the calling process
*/
public int getSourceWeight(int i)
{
public int getSourceWeight(int i)
{
return sourceWeights[i];
}
}
/**
/**
* Gets a process for which the calling process is a source
* @param i destination index
* @return process for which the calling process is a source
*/
public int getDestination(int i)
{
public int getDestination(int i)
{
return destinations[i];
}
}
/**
/**
* Gets the weight of an edge out of the calling process.
* @param i destination index
* @return weight of an edge out of the calling process
*/
public int getDestinationWeight(int i)
{
public int getDestinationWeight(int i)
{
return destWeights[i];
}
}
} // DistGraphNeighbors

Просмотреть файл

@ -9,6 +9,8 @@
* University of Stuttgart. All rights reserved.
* Copyright (c) 2004-2005 The Regents of the University of California.
* All rights reserved.
* Copyright (c) 2015 Los Alamos National Security, LLC. All rights
* reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
@ -25,124 +27,124 @@ import java.nio.*;
*/
public final class DoubleComplex
{
private final int offset;
private final DoubleBuffer buffer;
private final int offset;
private final DoubleBuffer buffer;
private DoubleComplex(DoubleBuffer buffer, int index)
{
private DoubleComplex(DoubleBuffer buffer, int index)
{
this.buffer = buffer;
this.offset = index * 2;
}
}
/**
/**
* Wraps a complex number stored in a buffer
* @param buffer buffer
* @return complex number
*/
public static DoubleComplex get(DoubleBuffer buffer)
{
public static DoubleComplex get(DoubleBuffer buffer)
{
return new DoubleComplex(buffer, 0);
}
}
/**
/**
* Wraps the complex number at the specified position
* of an array of complex numbers stored in a buffer.
* @param buffer buffer
* @param index index
* @return complex number
*/
public static DoubleComplex get(DoubleBuffer buffer, int index)
{
public static DoubleComplex get(DoubleBuffer buffer, int index)
{
return new DoubleComplex(buffer, index);
}
}
/**
/**
* Wraps a complex number stored in the first two values of an array.
* @param array array
* @return complex number
*/
public static DoubleComplex get(double[] array)
{
public static DoubleComplex get(double[] array)
{
return new DoubleComplex(DoubleBuffer.wrap(array), 0);
}
}
/**
/**
* Wraps the complex number at the specified position of
* an array of complex numbers stored in an array of doubles.
* @param array array
* @param index index
* @return complex number
*/
public static DoubleComplex get(double[] array, int index)
{
public static DoubleComplex get(double[] array, int index)
{
return new DoubleComplex(DoubleBuffer.wrap(array), index);
}
}
/**
/**
* Wraps a complex number stored in a buffer
* @param buffer buffer
* @return complex number
*/
public static DoubleComplex get(ByteBuffer buffer)
{
public static DoubleComplex get(ByteBuffer buffer)
{
return new DoubleComplex(buffer.asDoubleBuffer(), 0);
}
}
/**
/**
* Wraps the complex number at the specified position
* of an array of complex numbers stored in a buffer.
* @param buffer buffer
* @param index index
* @return complex number
*/
public static DoubleComplex get(ByteBuffer buffer, int index)
{
public static DoubleComplex get(ByteBuffer buffer, int index)
{
return new DoubleComplex(buffer.asDoubleBuffer(), index);
}
}
/**
/**
* Gets the real value.
* @return real value
*/
public double getReal()
{
public double getReal()
{
return buffer.get(offset);
}
}
/**
/**
* Gets the imaginary value.
* @return imaginary value.
*/
public double getImag()
{
public double getImag()
{
return buffer.get(offset + 1);
}
}
/**
/**
* Puts the real value.
* @param real real value
*/
public void putReal(double real)
{
public void putReal(double real)
{
buffer.put(offset, real);
}
}
/**
/**
* Puts the imaginary value.
* @param imag imaginary value
*/
public void putImag(double imag)
{
public void putImag(double imag)
{
buffer.put(offset + 1, imag);
}
}
/**
/**
* Gets the buffer where the complex number is stored.
* @return buffer where the complex number is stored
*/
public DoubleBuffer getBuffer()
{
public DoubleBuffer getBuffer()
{
return offset == 0 ? buffer : MPI.slice(buffer, offset);
}
}
} // DoubleComplex

Просмотреть файл

@ -25,16 +25,16 @@ package mpi;
*/
public final class DoubleInt extends Struct
{
private final int iOff, iSize;
private final int iOff, iSize;
/**
/**
* The struct object will be created only in MPI class.
* @param intOff int offset
* @param intSize int size
* @see MPI#doubleInt
*/
protected DoubleInt(int intOff, int intSize)
{
protected DoubleInt(int intOff, int intSize)
{
int dOff = addDouble();
assert dOff == 0;
@ -49,22 +49,22 @@ protected DoubleInt(int intOff, int intSize)
}
assert(intOff == iOff);
}
}
/**
/**
* Creates a Data object.
* @return new Data object.
*/
@Override protected DoubleInt.Data newData()
{
@Override protected DoubleInt.Data newData()
{
return new DoubleInt.Data();
}
}
/**
/**
* Class for reading/writing data in a struct stored in a byte buffer.
*/
public final class Data extends Struct.Data
{
public final class Data extends Struct.Data
{
/**
* Gets the double value.
* @return double value
@ -110,6 +110,6 @@ public final class Data extends Struct.Data
default: throw new AssertionError();
}
}
} // Data
} // Data
} // DoubleInt

Просмотреть файл

@ -9,31 +9,33 @@
* University of Stuttgart. All rights reserved.
* Copyright (c) 2004-2005 The Regents of the University of California.
* All rights reserved.
* Copyright (c) 2015 Los Alamos National Security, LLC. All rights
* reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
*
* $HEADER$
*/
/*
*
*
* This file is almost a complete re-write for Open MPI compared to the
* original mpiJava package. Its license and copyright are listed below.
* See <path to ompi/mpi/java/README> for more information.
*/
/*
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
/*
*
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*
* File : Errhandler.java
* Author : Xinying Li
* Created : Thu Apr 9 12:22:15 1998
@ -50,14 +52,14 @@ package mpi;
*/
public final class Errhandler
{
protected long handle;
protected long handle;
protected static native long getFatal();
protected static native long getReturn();
protected static native long getFatal();
protected static native long getReturn();
protected Errhandler(long handle)
{
protected Errhandler(long handle)
{
this.handle = handle;
}
}
} // Errhandler

Разница между файлами не показана из-за своего большого размера Загрузить разницу

Просмотреть файл

@ -9,6 +9,8 @@
* University of Stuttgart. All rights reserved.
* Copyright (c) 2004-2005 The Regents of the University of California.
* All rights reserved.
* Copyright (c) 2015 Los Alamos National Security, LLC. All rights
* reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
@ -23,59 +25,59 @@ package mpi;
*/
public final class FileView
{
private final long disp;
private final Datatype etype, filetype;
private final String datarep;
private final long disp;
private final Datatype etype, filetype;
private final String datarep;
/**
/**
* Constructs a file view.
* @param disp displacement
* @param etype elementary datatype
* @param filetype file type
* @param datarep data representation
*/
public FileView(long disp, Datatype etype, Datatype filetype, String datarep)
{
public FileView(long disp, Datatype etype, Datatype filetype, String datarep)
{
this.disp = disp;
this.etype = etype;
this.filetype = filetype;
this.datarep = datarep;
}
}
/**
/**
* Gets the displacement.
* @return displacement
*/
public long getDisp()
{
public long getDisp()
{
return disp;
}
}
/**
/**
* Gets the elementary datatype.
* @return elementary datatype
*/
public Datatype getEType()
{
public Datatype getEType()
{
return etype;
}
}
/**
/**
* Gets the file type.
* @return file type
*/
public Datatype getFileType()
{
public Datatype getFileType()
{
return filetype;
}
}
/**
/**
* Gets the data representation.
* @return data representation
*/
public String getDataRep()
{
public String getDataRep()
{
return datarep;
}
}
} // FileView

Просмотреть файл

@ -9,6 +9,8 @@
* University of Stuttgart. All rights reserved.
* Copyright (c) 2004-2005 The Regents of the University of California.
* All rights reserved.
* Copyright (c) 2015 Los Alamos National Security, LLC. All rights
* reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
@ -25,124 +27,124 @@ import java.nio.*;
*/
public final class FloatComplex
{
private final int offset;
private final FloatBuffer buffer;
private final int offset;
private final FloatBuffer buffer;
private FloatComplex(FloatBuffer buffer, int index)
{
private FloatComplex(FloatBuffer buffer, int index)
{
this.buffer = buffer;
this.offset = index * 2;
}
}
/**
/**
* Wraps a complex number stored in a buffer
* @param buffer buffer
* @return complex number
*/
public static FloatComplex get(FloatBuffer buffer)
{
public static FloatComplex get(FloatBuffer buffer)
{
return new FloatComplex(buffer, 0);
}
}
/**
/**
* Wraps the complex number at the specified position
* of an array of complex numbers stored in a buffer.
* @param buffer buffer
* @param index index
* @return complex number
*/
public static FloatComplex get(FloatBuffer buffer, int index)
{
public static FloatComplex get(FloatBuffer buffer, int index)
{
return new FloatComplex(buffer, index);
}
}
/**
/**
* Wraps a complex number stored in the first two values of an array.
* @param array array
* @return complex number
*/
public static FloatComplex get(float[] array)
{
public static FloatComplex get(float[] array)
{
return new FloatComplex(FloatBuffer.wrap(array), 0);
}
}
/**
/**
* Wraps the complex number at the specified position of
* an array of complex numbers stored in an array of floats.
* @param array array
* @param index index
* @return complex number
*/
public static FloatComplex get(float[] array, int index)
{
public static FloatComplex get(float[] array, int index)
{
return new FloatComplex(FloatBuffer.wrap(array), index);
}
}
/**
/**
* Wraps a complex number stored in a buffer
* @param buffer buffer
* @return complex number
*/
public static FloatComplex get(ByteBuffer buffer)
{
public static FloatComplex get(ByteBuffer buffer)
{
return new FloatComplex(buffer.asFloatBuffer(), 0);
}
}
/**
/**
* Wraps the complex number at the specified position
* of an array of complex numbers stored in a buffer.
* @param buffer buffer
* @param index index
* @return complex number
*/
public static FloatComplex get(ByteBuffer buffer, int index)
{
public static FloatComplex get(ByteBuffer buffer, int index)
{
return new FloatComplex(buffer.asFloatBuffer(), index);
}
}
/**
/**
* Gets the real value.
* @return real value
*/
public float getReal()
{
public float getReal()
{
return buffer.get(offset);
}
}
/**
/**
* Gets the imaginary value.
* @return imaginary value.
*/
public float getImag()
{
public float getImag()
{
return buffer.get(offset + 1);
}
}
/**
/**
* Puts the real value.
* @param real real value
*/
public void putReal(float real)
{
public void putReal(float real)
{
buffer.put(offset, real);
}
}
/**
/**
* Puts the imaginary value.
* @param imag imaginary value
*/
public void putImag(float imag)
{
public void putImag(float imag)
{
buffer.put(offset + 1, imag);
}
}
/**
/**
* Gets the buffer where the complex number is stored.
* @return buffer where the complex number is stored
*/
public FloatBuffer getBuffer()
{
public FloatBuffer getBuffer()
{
return offset == 0 ? buffer : MPI.slice(buffer, offset);
}
}
} // FloatComplex

Просмотреть файл

@ -25,16 +25,16 @@ package mpi;
*/
public final class FloatInt extends Struct
{
private final int iOff, iSize;
private final int iOff, iSize;
/**
/**
* The struct object will be created only in MPI class.
* @param intOff int offset
* @param intSize int size
* @see MPI#floatInt
*/
protected FloatInt(int intOff, int intSize)
{
protected FloatInt(int intOff, int intSize)
{
int fOff = addFloat();
assert fOff == 0;
@ -49,22 +49,22 @@ protected FloatInt(int intOff, int intSize)
}
assert(intOff == iOff);
}
}
/**
/**
* Creates a Data object.
* @return new Data object.
*/
@Override protected Data newData()
{
@Override protected Data newData()
{
return new Data();
}
}
/**
/**
* Class for reading/writing data in a struct stored in a byte buffer.
*/
public final class Data extends Struct.Data
{
public final class Data extends Struct.Data
{
/**
* Gets the float value.
* @return float value
@ -110,6 +110,6 @@ public final class Data extends Struct.Data
default: throw new AssertionError();
}
}
} // Data
} // Data
} // FloatInt

Просмотреть файл

@ -16,26 +16,26 @@
* Additional copyrights may follow
*
* $HEADER$
*/
/*
*
*
* This file is almost a complete re-write for Open MPI compared to the
* original mpiJava package. Its license and copyright are listed below.
* See <path to ompi/mpi/java/README> for more information.
*/
/*
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
/*
*
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*
* File : Freeable.java
* Author : Bryan Carpenter
* Created : Wed Jan 15 23:14:43 EST 2003

Просмотреть файл

@ -16,26 +16,26 @@
* Additional copyrights may follow
*
* $HEADER$
*/
/*
*
*
* This file is almost a complete re-write for Open MPI compared to the
* original mpiJava package. Its license and copyright are listed below.
* See <path to ompi/mpi/java/README> for more information.
*/
/*
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
/*
*
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*
* File : Graphcomm.java
* Author : Xinying Li
* Created : Thu Apr 9 12:22:15 1998
@ -52,32 +52,32 @@ package mpi;
*/
public final class GraphComm extends Intracomm
{
static
{
static
{
init();
}
}
private static native void init();
private static native void init();
protected GraphComm(long handle) throws MPIException
{
protected GraphComm(long handle) throws MPIException
{
super(handle);
}
}
protected GraphComm(long[] commRequest)
{
protected GraphComm(long[] commRequest)
{
super(commRequest);
}
}
/**
/**
* Duplicates this communicator.
* <p>Java binding of {@code MPI_COMM_DUP}.
* <p>It is recommended to use {@link #dup} instead of {@link #clone}
* because the last can't throw an {@link mpi.MPIException}.
* @return copy of this communicator
*/
@Override public GraphComm clone()
{
@Override public GraphComm clone()
{
try
{
return dup();
@ -86,21 +86,21 @@ protected GraphComm(long[] commRequest)
{
throw new RuntimeException(e.getMessage());
}
}
}
/**
/**
* Duplicates this communicator.
* <p>Java binding of {@code MPI_COMM_DUP}.
* @return copy of this communicator
* @throws MPIException Signals that an MPI exception of some sort has occurred.
*/
@Override public GraphComm dup() throws MPIException
{
@Override public GraphComm dup() throws MPIException
{
MPI.check();
return new GraphComm(dup(handle));
}
}
/**
/**
* Duplicates this communicator.
* <p>The new communicator can't be used before the operation completes.
* The request object must be obtained calling {@link #getRequest}.
@ -108,13 +108,13 @@ protected GraphComm(long[] commRequest)
* @return copy of this communicator
* @throws MPIException Signals that an MPI exception of some sort has occurred.
*/
@Override public GraphComm iDup() throws MPIException
{
@Override public GraphComm iDup() throws MPIException
{
MPI.check();
return new GraphComm(iDup(handle));
}
}
/**
/**
* Returns graph topology information.
* <p>Java binding of the MPI operations {@code MPI_GRAPHDIMS_GET}
* and {@code MPI_GRAPH_GET}.
@ -124,15 +124,15 @@ protected GraphComm(long[] commRequest)
* @return object defining node degress and edges of graph
* @throws MPIException Signals that an MPI exception of some sort has occurred.
*/
public GraphParms getDims() throws MPIException
{
public GraphParms getDims() throws MPIException
{
MPI.check();
return getDims(handle);
}
}
private native GraphParms getDims(long comm) throws MPIException;
private native GraphParms getDims(long comm) throws MPIException;
/**
/**
* Provides adjacency information for general graph topology.
* <p>Java binding of the MPI operations {@code MPI_GRAPH_NEIGHBORS_COUNT}
* and {@code MPI_GRAPH_NEIGHBORS}.
@ -141,29 +141,29 @@ private native GraphParms getDims(long comm) throws MPIException;
* @return array of ranks of neighbouring processes to one specified
* @throws MPIException Signals that an MPI exception of some sort has occurred.
*/
public int[] getNeighbors(int rank) throws MPIException
{
public int[] getNeighbors(int rank) throws MPIException
{
MPI.check();
return getNeighbors(handle, rank);
}
}
private native int[] getNeighbors(long comm, int rank) throws MPIException;
private native int[] getNeighbors(long comm, int rank) throws MPIException;
/**
/**
* Gets the adjacency information for a distributed graph topology.
* @return adjacency information for a distributed graph topology
* @throws MPIException Signals that an MPI exception of some sort has occurred.
*/
public DistGraphNeighbors getDistGraphNeighbors() throws MPIException
{
public DistGraphNeighbors getDistGraphNeighbors() throws MPIException
{
MPI.check();
return getDistGraphNeighbors(handle);
}
}
private native DistGraphNeighbors getDistGraphNeighbors(long comm)
private native DistGraphNeighbors getDistGraphNeighbors(long comm)
throws MPIException;
/**
/**
* Compute an optimal placement.
* <p>Java binding of the MPI operation {@code MPI_GRAPH_MAP}.
* <p>The number of nodes is taken to be size of the {@code index} argument.
@ -172,12 +172,12 @@ private native DistGraphNeighbors getDistGraphNeighbors(long comm)
* @return reordered rank of calling process
* @throws MPIException Signals that an MPI exception of some sort has occurred.
*/
public int map(int[] index, int[] edges) throws MPIException
{
public int map(int[] index, int[] edges) throws MPIException
{
MPI.check();
return map(handle, index, edges);
}
}
private native int map(long comm, int[] index, int[] edges) throws MPIException;
private native int map(long comm, int[] index, int[] edges) throws MPIException;
} // Graphcomm

Просмотреть файл

@ -9,31 +9,33 @@
* University of Stuttgart. All rights reserved.
* Copyright (c) 2004-2005 The Regents of the University of California.
* All rights reserved.
* Copyright (c) 2015 Los Alamos National Security, LLC. All rights
* reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
*
* $HEADER$
*/
/*
*
*
* This file is almost a complete re-write for Open MPI compared to the
* original mpiJava package. Its license and copyright are listed below.
* See <path to ompi/mpi/java/README> for more information.
*/
/*
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
/*
*
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*
* File : GraphParms.java
* Author : Xinying Li
* Created : Thu Apr 9 12:22:15 1998
@ -50,54 +52,54 @@ package mpi;
*/
public final class GraphParms
{
/** Node degrees. */
private final int[] index;
/** Node degrees. */
private final int[] index;
/** Graph edges. */
private final int[] edges;
/** Graph edges. */
private final int[] edges;
/**
/**
* Constructs a graph topology information object.
* @param index node degrees.
* @param edges graph edges.
*/
protected GraphParms(int[] index, int[] edges)
{
protected GraphParms(int[] index, int[] edges)
{
this.index = index;
this.edges = edges;
}
}
/**
/**
* Returns the number of nodes.
* @return number of nodes.
*/
public int getIndexCount()
{
public int getIndexCount()
{
return index.length;
}
}
/**
/**
* Returns the index of the node {@code i}.
* <p>{@code getIndex(0)} returns the degree of the node {@code 0}, and
* {@code getIndex(i)-getIndex(i-1)} is the degree of the node {@code i}.
* @param i position of the node.
* @return the index.
*/
public int getIndex(int i)
{
public int getIndex(int i)
{
return index[i];
}
}
/**
/**
* Returns the number of edges.
* @return number of edges.
*/
public int getEdgeCount()
{
public int getEdgeCount()
{
return edges.length;
}
}
/**
/**
* Returns the edge {@code i}.
* <p>The list of neighbors of node zero is stored in {@code getEdge(j)},
* for {@code 0} &le; {@code j} &le; {@code getIndex(0)-1} and the list
@ -107,9 +109,9 @@ public int getEdgeCount()
* @param i index of the edge.
* @return the edge.
*/
public int getEdge(int i)
{
public int getEdge(int i)
{
return edges[i];
}
}
} // GraphParms

Просмотреть файл

@ -16,26 +16,26 @@
* Additional copyrights may follow
*
* $HEADER$
*/
/*
*
*
* This file is almost a complete re-write for Open MPI compared to the
* original mpiJava package. Its license and copyright are listed below.
* See <path to ompi/mpi/java/README> for more information.
*/
/*
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
/*
*
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*
* File : Group.java
* Author : Xinying Li, Bryan Carpenter
* Created : Thu Apr 9 12:22:15 1998
@ -52,72 +52,72 @@ package mpi;
*/
public final class Group implements Freeable
{
protected long handle;
private static long nullHandle;
protected long handle;
private static long nullHandle;
static
{
static
{
init();
}
}
private static native void init();
private static native void init();
protected static native long getEmpty();
protected static native long getEmpty();
protected Group(long handle)
{
protected Group(long handle)
{
this.handle = handle;
}
}
/**
/**
* Java binding of the MPI operation {@code MPI_GROUP_SIZE}.
* @return number of processes in the group
* @throws MPIException Signals that an MPI exception of some sort has occurred.
*/
public int getSize() throws MPIException
{
public int getSize() throws MPIException
{
MPI.check();
return getSize(handle);
}
}
private native int getSize(long group) throws MPIException;
private native int getSize(long group) throws MPIException;
/**
/**
* Rank of this process in the group.
* <p>Java binding of the MPI operation {@code MPI_GROUP_RANK}.
* @return rank of this process in the group, or {@code MPI.UNDEFINED}
* if this process is not a member of the group.
* @throws MPIException Signals that an MPI exception of some sort has occurred.
*/
public int getRank() throws MPIException
{
public int getRank() throws MPIException
{
MPI.check();
return getRank(handle);
}
}
private native int getRank(long group) throws MPIException;
private native int getRank(long group) throws MPIException;
/**
/**
* Java binding of the MPI operation {@code MPI_GROUP_FREE}.
*/
@Override public void free() throws MPIException
{
@Override public void free() throws MPIException
{
MPI.check();
handle = free(handle);
}
}
private native long free(long group);
private native long free(long group);
/**
/**
* Test if group object is null.
* @return true if the group object is null.
*/
public boolean isNull()
{
public boolean isNull()
{
return handle == nullHandle;
}
}
/**
/**
* Translate ranks within one group to ranks within another.
* <p>Java binding of the MPI operation {@code MPI_GROUP_TRANSLATE_RANKS}.
* <p>Result elements are {@code MPI.UNDEFINED} where no correspondence exists.
@ -127,17 +127,17 @@ public boolean isNull()
* @return array of corresponding ranks in group2
* @throws MPIException Signals that an MPI exception of some sort has occurred.
*/
public static int[] translateRanks(Group group1, int[] ranks1, Group group2)
public static int[] translateRanks(Group group1, int[] ranks1, Group group2)
throws MPIException
{
{
MPI.check();
return translateRanks(group1.handle, ranks1, group2.handle);
}
}
private static native int[] translateRanks(
private static native int[] translateRanks(
long group1, int[] ranks1, long group2) throws MPIException;
/**
/**
* Compare two groups.
* <p>Java binding of the MPI operation {@code MPI_GROUP_COMPARE}.
* @param group1 first group
@ -147,15 +147,15 @@ private static native int[] translateRanks(
* the same but the order is different, {@code MPI.UNEQUAL} otherwise.
* @throws MPIException Signals that an MPI exception of some sort has occurred.
*/
public static int compare(Group group1, Group group2) throws MPIException
{
public static int compare(Group group1, Group group2) throws MPIException
{
MPI.check();
return compare(group1.handle, group2.handle);
}
}
private static native int compare(long group1, long group2) throws MPIException;
private static native int compare(long group1, long group2) throws MPIException;
/**
/**
* Set union of two groups.
* <p>Java binding of the MPI operation {@code MPI_GROUP_UNION}.
* @param group1 first group
@ -163,15 +163,15 @@ private static native int compare(long group1, long group2) throws MPIException;
* @return union group
* @throws MPIException Signals that an MPI exception of some sort has occurred.
*/
public static Group union(Group group1, Group group2) throws MPIException
{
public static Group union(Group group1, Group group2) throws MPIException
{
MPI.check();
return new Group(union(group1.handle, group2.handle));
}
}
private static native long union(long group1, long group2);
private static native long union(long group1, long group2);
/**
/**
* Set intersection of two groups.
* Java binding of the MPI operation {@code MPI_GROUP_INTERSECTION}.
* @param group1 first group
@ -179,15 +179,15 @@ private static native long union(long group1, long group2);
* @return intersection group
* @throws MPIException Signals that an MPI exception of some sort has occurred.
*/
public static Group intersection(Group group1, Group group2) throws MPIException
{
public static Group intersection(Group group1, Group group2) throws MPIException
{
MPI.check();
return new Group(intersection(group1.handle, group2.handle));
}
}
private static native long intersection(long group1, long group2);
private static native long intersection(long group1, long group2);
/**
/**
* Set difference of two groups.
* Java binding of the MPI operation {@code MPI_GROUP_DIFFERENCE}.
* @param group1 first group
@ -195,45 +195,45 @@ private static native long intersection(long group1, long group2);
* @return difference group
* @throws MPIException Signals that an MPI exception of some sort has occurred.
*/
public static Group difference(Group group1, Group group2) throws MPIException
{
public static Group difference(Group group1, Group group2) throws MPIException
{
MPI.check();
return new Group(difference(group1.handle, group2.handle));
}
}
private static native long difference(long group1, long group2);
private static native long difference(long group1, long group2);
/**
/**
* Create a subset group including specified processes.
* <p>Java binding of the MPI operation {@code MPI_GROUP_INCL}.
* @param ranks ranks from this group to appear in new group
* @return new group
* @throws MPIException Signals that an MPI exception of some sort has occurred.
*/
public Group incl(int[] ranks) throws MPIException
{
public Group incl(int[] ranks) throws MPIException
{
MPI.check();
return new Group(incl(handle, ranks));
}
}
private native long incl(long group, int[] ranks);
private native long incl(long group, int[] ranks);
/**
/**
* Create a subset group excluding specified processes.
* <p>Java binding of the MPI operation {@code MPI_GROUP_EXCL}.
* @param ranks ranks from this group <em>not</em> to appear in new group
* @return new group
* @throws MPIException Signals that an MPI exception of some sort has occurred.
*/
public Group excl(int[] ranks) throws MPIException
{
public Group excl(int[] ranks) throws MPIException
{
MPI.check();
return new Group(excl(handle, ranks));
}
}
private native long excl(long group, int[] ranks);
private native long excl(long group, int[] ranks);
/**
/**
* Create a subset group including processes specified
* by strided intervals of ranks.
* <p>Java binding of the MPI operation {@code MPI_GROUP_RANGE_INCL}.
@ -245,15 +245,15 @@ private native long excl(long group, int[] ranks);
* @return new group
* @throws MPIException Signals that an MPI exception of some sort has occurred.
*/
public Group rangeIncl(int[][] ranges) throws MPIException
{
public Group rangeIncl(int[][] ranges) throws MPIException
{
MPI.check();
return new Group(rangeIncl(handle, ranges));
}
}
private native long rangeIncl(long group, int[][] ranges);
private native long rangeIncl(long group, int[][] ranges);
/**
/**
* Create a subset group excluding processes specified
* by strided intervals of ranks.
* <p>Java binding of the MPI operation {@code MPI_GROUP_RANGE_EXCL}.
@ -263,12 +263,12 @@ private native long rangeIncl(long group, int[][] ranges);
* @return new group
* @throws MPIException Signals that an MPI exception of some sort has occurred.
*/
public Group rangeExcl(int[][] ranges) throws MPIException
{
public Group rangeExcl(int[][] ranges) throws MPIException
{
MPI.check();
return new Group(rangeExcl(handle, ranges));
}
}
private native long rangeExcl(long group, int[][] ranges);
private native long rangeExcl(long group, int[][] ranges);
} // Group

Просмотреть файл

@ -25,111 +25,111 @@ package mpi;
*/
public final class Info implements Freeable
{
protected long handle;
protected static final long NULL = getNull();
protected long handle;
protected static final long NULL = getNull();
/**
/**
* Java binding of the MPI operation {@code MPI_INFO_CREATE}.
* @throws MPIException Signals that an MPI exception of some sort has occurred.
*/
public Info() throws MPIException
{
public Info() throws MPIException
{
MPI.check();
handle = create();
}
}
protected Info(long handle)
{
protected Info(long handle)
{
this.handle = handle;
}
}
private native long create();
private native long create();
protected static Info newEnv()
{
protected static Info newEnv()
{
return new Info(getEnv());
}
}
private native static long getEnv();
private native static long getNull();
private native static long getEnv();
private native static long getNull();
/**
/**
* Java binding of the MPI operation {@code MPI_INFO_SET}.
* @param key key
* @param value value
* @throws MPIException Signals that an MPI exception of some sort has occurred.
*/
public void set(String key, String value) throws MPIException
{
public void set(String key, String value) throws MPIException
{
MPI.check();
set(handle, key, value);
}
}
private native void set(long handle, String key, String value)
private native void set(long handle, String key, String value)
throws MPIException;
/**
/**
* Java binding of the MPI operation {@code MPI_INFO_SET}.
* @param key key
* @return value or {@code null} if key is not defined
* @throws MPIException Signals that an MPI exception of some sort has occurred.
*/
public String get(String key) throws MPIException
{
public String get(String key) throws MPIException
{
MPI.check();
return get(handle, key);
}
}
private native String get(long handle, String key) throws MPIException;
private native String get(long handle, String key) throws MPIException;
/**
/**
* Java binding of the MPI operation {@code MPI_INFO_SET}.
* @param key key
* @throws MPIException Signals that an MPI exception of some sort has occurred.
*/
public void delete(String key) throws MPIException
{
public void delete(String key) throws MPIException
{
MPI.check();
delete(handle, key);
}
}
private native void delete(long handle, String key) throws MPIException;
private native void delete(long handle, String key) throws MPIException;
/**
/**
* Java binding of the MPI operation {@code MPI_INFO_GET_NKEYS}.
* @return number of defined keys
* @throws MPIException Signals that an MPI exception of some sort has occurred.
*/
public int size() throws MPIException
{
public int size() throws MPIException
{
MPI.check();
return size(handle);
}
}
private native int size(long handle) throws MPIException;
private native int size(long handle) throws MPIException;
/**
/**
* Java binding of the MPI operation {@code MPI_INFO_GET_NTHKEY}.
* @param i key number
* @return key
* @throws MPIException Signals that an MPI exception of some sort has occurred.
*/
public String getKey(int i) throws MPIException
{
public String getKey(int i) throws MPIException
{
MPI.check();
return getKey(handle, i);
}
}
private native String getKey(long handle, int i) throws MPIException;
private native String getKey(long handle, int i) throws MPIException;
/**
/**
* Java binding of the MPI operation {@code MPI_INFO_DUP}.
* <p>It is recommended to use {@link #dup} instead of {@link #clone}
* because the last can't throw an {@link mpi.MPIException}.
* @return info object
*/
@Override public Info clone()
{
@Override public Info clone()
{
try
{
return dup();
@ -138,42 +138,42 @@ private native String getKey(long handle, int i) throws MPIException;
{
throw new RuntimeException(e.getMessage());
}
}
}
/**
/**
* Java binding of the MPI operation {@code MPI_INFO_DUP}.
* @return info object
* @throws MPIException Signals that an MPI exception of some sort has occurred.
*/
public Info dup() throws MPIException
{
public Info dup() throws MPIException
{
MPI.check();
return new Info(dup(handle));
}
}
private native long dup(long handle) throws MPIException;
private native long dup(long handle) throws MPIException;
/**
/**
* Java binding of the MPI operation {@code MPI_INFO_FREE}.
* @throws MPIException Signals that an MPI exception of some sort has occurred.
*/
@Override public void free() throws MPIException
{
@Override public void free() throws MPIException
{
MPI.check();
handle = free(handle);
}
}
private native long free(long handle) throws MPIException;
private native long free(long handle) throws MPIException;
/**
/**
* Tests if the info object is {@code MPI_INFO_NULL} (has been freed).
* @return true if the info object is {@code MPI_INFO_NULL}, false otherwise.
*/
public boolean isNull()
{
public boolean isNull()
{
return isNull(handle);
}
}
private native boolean isNull(long handle);
private native boolean isNull(long handle);
} // Info

Просмотреть файл

@ -25,48 +25,48 @@ package mpi;
*/
public final class Int2 extends Struct
{
private final int iOff, iSize;
private final int iOff, iSize;
/**
/**
* The struct object will be created only in MPI class.
* @param intOff int offset
* @param intSize int size
* @see MPI#int2
*/
protected Int2(int intOff, int intSize)
{
protected Int2(int intOff, int intSize)
{
iSize = intSize;
int off = addIntField();
assert off == 0;
setOffset(intOff);
iOff = addIntField();
assert intOff == iOff;
}
}
private int addIntField()
{
private int addIntField()
{
switch(iSize)
{
case 4: return addInt();
case 8: return addLong();
default: throw new AssertionError("Unsupported int size: "+ iSize);
}
}
}
/**
/**
* Creates a Data object.
* @return new Data object.
*/
@Override protected Int2.Data newData()
{
@Override protected Int2.Data newData()
{
return new Int2.Data();
}
}
/**
/**
* Class for reading/writing data in a struct stored in a byte buffer.
*/
public final class Data extends Struct.Data
{
public final class Data extends Struct.Data
{
/**
* Gets the first int.
* @return first int
@ -122,6 +122,6 @@ public final class Data extends Struct.Data
default: throw new AssertionError();
}
}
} // Data
} // Data
} // Int2

Просмотреть файл

@ -16,26 +16,26 @@
* Additional copyrights may follow
*
* $HEADER$
*/
/*
*
*
* This file is almost a complete re-write for Open MPI compared to the
* original mpiJava package. Its license and copyright are listed below.
* See <path to ompi/mpi/java/README> for more information.
*/
/*
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
/*
*
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*
* File : Intercomm.java
* Author : Xinying Li
* Created : Thu Apr 9 12:22:15 1998
@ -52,25 +52,25 @@ package mpi;
*/
public final class Intercomm extends Comm
{
protected Intercomm(long handle)
{
protected Intercomm(long handle)
{
super(handle);
}
}
protected Intercomm(long[] commRequest)
{
protected Intercomm(long[] commRequest)
{
super(commRequest);
}
}
/**
/**
* Duplicates this communicator.
* <p>Java binding of {@code MPI_COMM_DUP}.
* <p>It is recommended to use {@link #dup} instead of {@link #clone}
* because the last can't throw an {@link mpi.MPIException}.
* @return copy of this communicator
*/
@Override public Intercomm clone()
{
@Override public Intercomm clone()
{
try
{
return dup();
@ -79,21 +79,21 @@ protected Intercomm(long[] commRequest)
{
throw new RuntimeException(e.getMessage());
}
}
}
/**
/**
* Duplicates this communicator.
* <p>Java binding of {@code MPI_COMM_DUP}.
* @return copy of this communicator
* @throws MPIException Signals that an MPI exception of some sort has occurred.
*/
@Override public Intercomm dup() throws MPIException
{
@Override public Intercomm dup() throws MPIException
{
MPI.check();
return new Intercomm(dup(handle));
}
}
/**
/**
* Duplicates this communicator.
* <p>Java binding of {@code MPI_COMM_IDUP}.
* <p>The new communicator can't be used before the operation completes.
@ -101,68 +101,68 @@ protected Intercomm(long[] commRequest)
* @return copy of this communicator
* @throws MPIException Signals that an MPI exception of some sort has occurred.
*/
@Override public Intercomm iDup() throws MPIException
{
@Override public Intercomm iDup() throws MPIException
{
MPI.check();
return new Intercomm(iDup(handle));
}
}
// Inter-Communication
// Inter-Communication
/**
/**
* Size of remote group.
* <p>Java binding of the MPI operation {@code MPI_COMM_REMOTE_SIZE}.
* @return number of process in remote group of this communicator
* @throws MPIException Signals that an MPI exception of some sort has occurred.
*/
public int getRemoteSize() throws MPIException
{
public int getRemoteSize() throws MPIException
{
MPI.check();
return getRemoteSize_jni();
}
}
private native int getRemoteSize_jni() throws MPIException;
private native int getRemoteSize_jni() throws MPIException;
/**
/**
* Return the remote group.
* <p>Java binding of the MPI operation {@code MPI_COMM_REMOTE_GROUP}.
* @return remote group of this communicator
* @throws MPIException Signals that an MPI exception of some sort has occurred.
*/
public Group getRemoteGroup() throws MPIException
{
public Group getRemoteGroup() throws MPIException
{
MPI.check();
return new Group(getRemoteGroup_jni());
}
}
private native long getRemoteGroup_jni();
private native long getRemoteGroup_jni();
/**
/**
* Creates an intracommuncator from an intercommunicator
* <p>Java binding of the MPI operation {@code MPI_INTERCOMM_MERGE}.
* @param high true if the local group has higher ranks in combined group
* @return new intra-communicator
* @throws MPIException Signals that an MPI exception of some sort has occurred.
*/
public Intracomm merge(boolean high) throws MPIException
{
public Intracomm merge(boolean high) throws MPIException
{
MPI.check();
return new Intracomm(merge_jni(high));
}
}
private native long merge_jni(boolean high);
private native long merge_jni(boolean high);
/**
/**
* Java binding of {@code MPI_COMM_GET_PARENT}.
* @return the parent communicator
* @throws MPIException Signals that an MPI exception of some sort has occurred.
*/
public static Intercomm getParent() throws MPIException
{
public static Intercomm getParent() throws MPIException
{
MPI.check();
return new Intercomm(getParent_jni());
}
}
private native static long getParent_jni() throws MPIException;
private native static long getParent_jni() throws MPIException;
} // Intercomm

Просмотреть файл

@ -16,26 +16,26 @@
* Additional copyrights may follow
*
* $HEADER$
*/
/*
*
*
* This file is almost a complete re-write for Open MPI compared to the
* original mpiJava package. Its license and copyright are listed below.
* See <path to ompi/mpi/java/README> for more information.
*/
/*
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
/*
*
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*
* File : Intracommm.java
* Author : Sang Lim, Xinying Li, Bryan Carpenter
* Created : Thu Apr 9 12:22:15 1998
@ -43,9 +43,9 @@
* Updated : $Date: 2002/12/16 15:25:13 $
* Copyright: Northeast Parallel Architectures Center
* at Syracuse University 1998
*/
/*
*
*
*
* IMPLEMENTATION DETAILS
*
* All methods with buffers that can be direct or non direct have
@ -65,29 +65,29 @@ import static mpi.MPI.assertDirectBuffer;
*/
public class Intracomm extends Comm
{
protected Intracomm()
{
}
protected Intracomm()
{
}
protected Intracomm(long handle)
{
protected Intracomm(long handle)
{
super(handle);
}
}
protected Intracomm(long[] commRequest)
{
protected Intracomm(long[] commRequest)
{
super(commRequest);
}
}
/**
/**
* Duplicates this communicator.
* <p>Java binding of {@code MPI_COMM_DUP}.
* <p>It is recommended to use {@link #dup} instead of {@link #clone}
* because the last can't throw an {@link mpi.MPIException}.
* @return copy of this communicator
*/
@Override public Intracomm clone()
{
@Override public Intracomm clone()
{
try
{
return dup();
@ -96,21 +96,21 @@ protected Intracomm(long[] commRequest)
{
throw new RuntimeException(e.getMessage());
}
}
}
/**
/**
* Duplicates this communicator.
* <p>Java binding of {@code MPI_COMM_DUP}.
* @return copy of this communicator
* @throws MPIException Signals that an MPI exception of some sort has occurred.
*/
@Override public Intracomm dup() throws MPIException
{
@Override public Intracomm dup() throws MPIException
{
MPI.check();
return new Intracomm(dup(handle));
}
}
/**
/**
* Duplicates this communicator.
* <p>Java binding of {@code MPI_COMM_IDUP}.
* <p>The new communicator can't be used before the operation completes.
@ -118,13 +118,13 @@ protected Intracomm(long[] commRequest)
* @return copy of this communicator
* @throws MPIException Signals that an MPI exception of some sort has occurred.
*/
@Override public Intracomm iDup() throws MPIException
{
@Override public Intracomm iDup() throws MPIException
{
MPI.check();
return new Intracomm(iDup(handle));
}
}
/**
/**
* Partition the group associated with this communicator and create
* a new communicator within each subgroup.
* <p>Java binding of the MPI operation {@code MPI_COMM_SPLIT}.
@ -133,15 +133,15 @@ protected Intracomm(long[] commRequest)
* @return new communicator
* @throws MPIException Signals that an MPI exception of some sort has occurred.
*/
public final Intracomm split(int colour, int key) throws MPIException
{
public final Intracomm split(int colour, int key) throws MPIException
{
MPI.check();
return new Intracomm(split(handle, colour, key));
}
}
private native long split(long comm, int colour, int key) throws MPIException;
private native long split(long comm, int colour, int key) throws MPIException;
/**
/**
* Partition the group associated with this communicator and create
* a new communicator within each subgroup.
* <p>Java binding of the MPI operation {@code MPI_COMM_SPLIT_TYPE}.
@ -151,32 +151,32 @@ private native long split(long comm, int colour, int key) throws MPIException;
* @return new communicator
* @throws MPIException Signals that an MPI exception of some sort has occurred.
*/
public final Intracomm splitType(int splitType, int key, Info info) throws MPIException
{
public final Intracomm splitType(int splitType, int key, Info info) throws MPIException
{
MPI.check();
return new Intracomm(splitType(handle, splitType, key, info.handle));
}
}
private native long splitType(long comm, int colour, int key, long info) throws MPIException;
private native long splitType(long comm, int colour, int key, long info) throws MPIException;
/**
/**
* Create a new communicator.
* <p>Java binding of the MPI operation {@code MPI_COMM_CREATE}.
* @param group group which is a subset of the group of this communicator
* @return new communicator
* @throws MPIException Signals that an MPI exception of some sort has occurred.
*/
public final Intracomm create(Group group) throws MPIException
{
public final Intracomm create(Group group) throws MPIException
{
MPI.check();
return new Intracomm(create(handle, group.handle));
}
}
private native long create(long comm, long group);
private native long create(long comm, long group);
// Topology Constructors
// Topology Constructors
/**
/**
* Creates a communicator to which the Cartesian topology
* information is attached.
* Create a cartesian topology communicator whose group is a subset
@ -193,18 +193,18 @@ private native long create(long comm, long group);
* @return new cartesian topology communicator
* @throws MPIException Signals that an MPI exception of some sort has occurred.
*/
public final CartComm createCart(int[] dims, boolean[] periods, boolean reorder)
public final CartComm createCart(int[] dims, boolean[] periods, boolean reorder)
throws MPIException
{
{
MPI.check();
return new CartComm(createCart(handle, dims, periods, reorder));
}
}
private native long createCart(
private native long createCart(
long comm, int[] dims, boolean[] periods, boolean reorder)
throws MPIException;
/**
/**
* Creates a communicator to which the graph topology information is attached.
* <p>Java binding of the MPI operation {@code MPI_GRAPH_CREATE}.
* <p>The number of nodes in the graph, <em>nnodes</em>, is taken
@ -216,18 +216,18 @@ private native long createCart(
* @return new graph topology communicator
* @throws MPIException Signals that an MPI exception of some sort has occurred.
*/
public final GraphComm createGraph(int[] index, int[] edges, boolean reorder)
public final GraphComm createGraph(int[] index, int[] edges, boolean reorder)
throws MPIException
{
{
MPI.check();
return new GraphComm(createGraph(handle, index, edges, reorder));
}
}
private native long createGraph(
private native long createGraph(
long comm, int[] index, int[] edges, boolean reorder)
throws MPIException;
/**
/**
* Creates a communicator to which the distributed graph topology
* information is attached.
* <p>Java binding of the MPI operation {@code MPI_DIST_GRAPH_CREATE}.
@ -241,19 +241,19 @@ private native long createGraph(
* @return communicator with distributed graph topology
* @throws MPIException Signals that an MPI exception of some sort has occurred.
*/
public final GraphComm createDistGraph(
public final GraphComm createDistGraph(
int[] sources, int[] degrees, int[] destinations,
int[] weights, Info info, boolean reorder)
throws MPIException
{
{
MPI.check();
return new GraphComm(createDistGraph(
handle, sources, degrees, destinations,
weights, info.handle, reorder, true));
}
}
/**
/**
* Creates a communicator to which the distributed graph topology
* information is attached.
* <p>Java binding of the MPI operation {@code MPI_DIST_GRAPH_CREATE}
@ -267,25 +267,25 @@ public final GraphComm createDistGraph(
* @return communicator with distributed graph topology
* @throws MPIException Signals that an MPI exception of some sort has occurred.
*/
public final GraphComm createDistGraph(
public final GraphComm createDistGraph(
int[] sources, int[] degrees, int[] destinations,
Info info, boolean reorder)
throws MPIException
{
{
MPI.check();
return new GraphComm(createDistGraph(
handle, sources, degrees, destinations,
null, info.handle, reorder, false));
}
}
private native long createDistGraph(
private native long createDistGraph(
long comm, int[] sources, int[] degrees, int[] destinations,
int[] weights, long info, boolean reorder, boolean weighted)
throws MPIException;
/**
/**
* Creates a communicator to which the distributed graph topology
* information is attached.
* <p>Java binding of the MPI operation {@code MPI_DIST_GRAPH_CREATE_ADJACENT}.
@ -302,19 +302,19 @@ private native long createDistGraph(
* @return communicator with distributed graph topology
* @throws MPIException Signals that an MPI exception of some sort has occurred.
*/
public final GraphComm createDistGraphAdjacent(
public final GraphComm createDistGraphAdjacent(
int[] sources, int[] sourceWeights,
int[] destinations, int[] destWeights, Info info, boolean reorder)
throws MPIException
{
{
MPI.check();
return new GraphComm(createDistGraphAdjacent(
handle, sources, sourceWeights, destinations,
destWeights, info.handle, reorder, true));
}
}
/**
/**
* Creates a communicator to which the distributed graph topology
* information is attached.
* <p>Java binding of the MPI operation {@code MPI_DIST_GRAPH_CREATE_ADJACENT}
@ -330,24 +330,24 @@ public final GraphComm createDistGraphAdjacent(
* @return communicator with distributed graph topology
* @throws MPIException Signals that an MPI exception of some sort has occurred.
*/
public final GraphComm createDistGraphAdjacent(
public final GraphComm createDistGraphAdjacent(
int[] sources, int[] destinations, Info info, boolean reorder)
throws MPIException
{
{
MPI.check();
return new GraphComm(createDistGraphAdjacent(
handle, sources, null, destinations, null,
info.handle, reorder, false));
}
}
private native long createDistGraphAdjacent(
private native long createDistGraphAdjacent(
long comm, int[] sources, int []sourceweights, int[] destinations,
int[] distweights, long info, boolean reorder, boolean weighted)
throws MPIException;
/**
/**
* Perform a prefix reduction on data distributed across the group.
* <p>Java binding of the MPI operation {@code MPI_SCAN}.
* @param sendbuf send buffer array
@ -357,10 +357,10 @@ private native long createDistGraphAdjacent(
* @param op reduce operation
* @throws MPIException Signals that an MPI exception of some sort has occurred.
*/
public final void scan(Object sendbuf, Object recvbuf,
public final void scan(Object sendbuf, Object recvbuf,
int count, Datatype type, Op op)
throws MPIException
{
{
MPI.check();
int sendoff = 0,
@ -385,9 +385,9 @@ public final void scan(Object sendbuf, Object recvbuf,
scan(handle, sendbuf, sdb, sendoff, recvbuf, rdb, recvoff,
count, type.handle, type.baseType, op, op.handle);
}
}
/**
/**
* Perform a prefix reduction on data distributed across the group.
* <p>Java binding of the MPI operation {@code MPI_SCAN}
* using {@code MPI_IN_PLACE} instead of the send buffer.
@ -397,9 +397,9 @@ public final void scan(Object sendbuf, Object recvbuf,
* @param op reduce operation
* @throws MPIException Signals that an MPI exception of some sort has occurred.
*/
public final void scan(Object recvbuf, int count, Datatype type, Op op)
public final void scan(Object recvbuf, int count, Datatype type, Op op)
throws MPIException
{
{
MPI.check();
int recvoff = 0;
boolean rdb = false;
@ -414,14 +414,14 @@ public final void scan(Object recvbuf, int count, Datatype type, Op op)
scan(handle, null, false, 0, recvbuf, rdb, recvoff,
count, type.handle, type.baseType, op, op.handle);
}
}
private native void scan(
private native void scan(
long comm, Object sendbuf, boolean sdb, int sendoff,
Object recvbuf, boolean rdb, int recvoff, int count,
long type, int baseType, Op jOp, long hOp) throws MPIException;
/**
/**
* Perform a prefix reduction on data distributed across the group.
* <p>Java binding of the MPI operation {@code MPI_ISCAN}.
* @param sendbuf send buffer array
@ -432,19 +432,19 @@ private native void scan(
* @return communication request
* @throws MPIException Signals that an MPI exception of some sort has occurred.
*/
public final Request iScan(Buffer sendbuf, Buffer recvbuf,
public final Request iScan(Buffer sendbuf, Buffer recvbuf,
int count, Datatype type, Op op)
throws MPIException
{
{
MPI.check();
op.setDatatype(type);
assertDirectBuffer(sendbuf, recvbuf);
return new Request(iScan(handle, sendbuf, recvbuf, count,
type.handle, type.baseType, op, op.handle));
}
}
/**
/**
* Perform a prefix reduction on data distributed across the group.
* <p>Java binding of the MPI operation {@code MPI_ISCAN}
* using {@code MPI_IN_PLACE} instead of the send buffer.
@ -455,9 +455,9 @@ public final Request iScan(Buffer sendbuf, Buffer recvbuf,
* @return communication request
* @throws MPIException Signals that an MPI exception of some sort has occurred.
*/
public final Request iScan(Buffer buf, int count, Datatype type, Op op)
public final Request iScan(Buffer buf, int count, Datatype type, Op op)
throws MPIException
{
{
MPI.check();
op.setDatatype(type);
assertDirectBuffer(buf);
@ -465,13 +465,13 @@ public final Request iScan(Buffer buf, int count, Datatype type, Op op)
return new Request(iScan(
handle, null, buf, count,
type.handle, type.baseType, op, op.handle));
}
}
private native long iScan(
private native long iScan(
long comm, Buffer sendbuf, Buffer recvbuf, int count,
long type, int baseType, Op jOp, long hOp) throws MPIException;
/**
/**
* Perform a prefix reduction on data distributed across the group.
* <p>Java binding of the MPI operation {@code MPI_EXSCAN}.
* @param sendbuf send buffer array
@ -481,10 +481,10 @@ private native long iScan(
* @param op reduce operation
* @throws MPIException Signals that an MPI exception of some sort has occurred.
*/
public final void exScan(Object sendbuf, Object recvbuf,
public final void exScan(Object sendbuf, Object recvbuf,
int count, Datatype type, Op op)
throws MPIException
{
{
MPI.check();
int sendoff = 0,
@ -509,9 +509,9 @@ public final void exScan(Object sendbuf, Object recvbuf,
exScan(handle, sendbuf, sdb, sendoff, recvbuf, rdb, recvoff,
count, type.handle, type.baseType, op, op.handle);
}
}
/**
/**
* Perform a prefix reduction on data distributed across the group.
* <p>Java binding of the MPI operation {@code MPI_EXSCAN}
* using {@code MPI_IN_PLACE} instead of the send buffer.
@ -521,9 +521,9 @@ public final void exScan(Object sendbuf, Object recvbuf,
* @param op reduce operation
* @throws MPIException Signals that an MPI exception of some sort has occurred.
*/
public final void exScan(Object buf, int count, Datatype type, Op op)
public final void exScan(Object buf, int count, Datatype type, Op op)
throws MPIException
{
{
MPI.check();
int off = 0;
boolean db = false;
@ -538,14 +538,14 @@ public final void exScan(Object buf, int count, Datatype type, Op op)
exScan(handle, null, false, 0, buf, db, off, count,
type.handle, type.baseType, op, op.handle);
}
}
private native void exScan(
private native void exScan(
long comm, Object sendbuf, boolean sdb, int sendoff,
Object recvbuf, boolean rdb, int recvoff, int count,
long type, int baseType, Op jOp, long hOp) throws MPIException;
/**
/**
* Perform a prefix reduction on data distributed across the group.
* <p>Java binding of the MPI operation {@code MPI_IEXSCAN}.
* @param sendbuf send buffer array
@ -556,19 +556,19 @@ private native void exScan(
* @return communication request
* @throws MPIException Signals that an MPI exception of some sort has occurred.
*/
public final Request iExScan(Buffer sendbuf, Buffer recvbuf,
public final Request iExScan(Buffer sendbuf, Buffer recvbuf,
int count, Datatype type, Op op)
throws MPIException
{
{
MPI.check();
op.setDatatype(type);
assertDirectBuffer(sendbuf, recvbuf);
return new Request(iExScan(handle, sendbuf, recvbuf, count,
type.handle, type.baseType, op, op.handle));
}
}
/**
/**
* Perform a prefix reduction on data distributed across the group.
* <p>Java binding of the MPI operation {@code MPI_IEXSCAN}
* using {@code MPI_IN_PLACE} instead of the send buffer.
@ -579,9 +579,9 @@ public final Request iExScan(Buffer sendbuf, Buffer recvbuf,
* @return communication request
* @throws MPIException Signals that an MPI exception of some sort has occurred.
*/
public final Request iExScan(Buffer buf, int count, Datatype type, Op op)
public final Request iExScan(Buffer buf, int count, Datatype type, Op op)
throws MPIException
{
{
MPI.check();
op.setDatatype(type);
assertDirectBuffer(buf);
@ -589,64 +589,64 @@ public final Request iExScan(Buffer buf, int count, Datatype type, Op op)
return new Request(iExScan(
handle, null, buf, count,
type.handle, type.baseType, op, op.handle));
}
}
private native long iExScan(
private native long iExScan(
long comm, Buffer sendbuf, Buffer recvbuf, int count,
long type, int baseType, Op jOp, long hOp) throws MPIException;
/**
/**
* Java binding of {@code MPI_OPEN_PORT} using {@code MPI_INFO_NULL}.
* @return port name
* @throws MPIException Signals that an MPI exception of some sort has occurred.
*/
public static String openPort() throws MPIException
{
public static String openPort() throws MPIException
{
MPI.check();
return openPort(Info.NULL);
}
}
/**
/**
* Java binding of {@code MPI_OPEN_PORT}.
* @param info implementation-specific information
* @return port name
* @throws MPIException Signals that an MPI exception of some sort has occurred.
*/
public static String openPort(Info info) throws MPIException
{
public static String openPort(Info info) throws MPIException
{
MPI.check();
return openPort(info.handle);
}
}
private native static String openPort(long info) throws MPIException;
private native static String openPort(long info) throws MPIException;
/**
/**
* Java binding of {@code MPI_CLOSE_PORT}.
* @param name port name
* @throws MPIException Signals that an MPI exception of some sort has occurred.
*/
public static void closePort(String name) throws MPIException
{
public static void closePort(String name) throws MPIException
{
MPI.check();
closePort_jni(name);
}
}
private native static void closePort_jni(String name) throws MPIException;
private native static void closePort_jni(String name) throws MPIException;
/**
/**
* Java binding of {@code MPI_COMM_ACCEPT} using {@code MPI_INFO_NULL}.
* @param port port name
* @param root rank in comm of root node
* @return intercommunicator with client as remote group
* @throws MPIException Signals that an MPI exception of some sort has occurred.
*/
public final Intercomm accept(String port, int root) throws MPIException
{
public final Intercomm accept(String port, int root) throws MPIException
{
MPI.check();
return new Intercomm(accept(handle, port, Info.NULL, root));
}
}
/**
/**
* Java binding of {@code MPI_COMM_ACCEPT}.
* @param port port name
* @param info implementation-specific information
@ -654,30 +654,30 @@ public final Intercomm accept(String port, int root) throws MPIException
* @return intercommunicator with client as remote group
* @throws MPIException Signals that an MPI exception of some sort has occurred.
*/
public final Intercomm accept(String port, Info info, int root)
public final Intercomm accept(String port, Info info, int root)
throws MPIException
{
{
MPI.check();
return new Intercomm(accept(handle, port, info.handle, root));
}
}
private native long accept(long comm, String port, long info, int root)
private native long accept(long comm, String port, long info, int root)
throws MPIException;
/**
/**
* Java binding of {@code MPI_COMM_CONNECT} using {@code MPI_INFO_NULL}.
* @param port port name
* @param root rank in comm of root node
* @return intercommunicator with server as remote group
* @throws MPIException Signals that an MPI exception of some sort has occurred.
*/
public final Intercomm connect(String port, int root) throws MPIException
{
public final Intercomm connect(String port, int root) throws MPIException
{
MPI.check();
return new Intercomm(connect(handle, port, Info.NULL, root));
}
}
/**
/**
* Java binding of {@code MPI_COMM_CONNECT}.
* @param port port name
* @param info implementation-specific information
@ -685,105 +685,105 @@ public final Intercomm connect(String port, int root) throws MPIException
* @return intercommunicator with server as remote group
* @throws MPIException Signals that an MPI exception of some sort has occurred.
*/
public final Intercomm connect(String port, Info info, int root)
public final Intercomm connect(String port, Info info, int root)
throws MPIException
{
{
MPI.check();
return new Intercomm(connect(handle, port, info.handle, root));
}
}
private native long connect(long comm, String port, long info, int root)
private native long connect(long comm, String port, long info, int root)
throws MPIException;
/**
/**
* Java binding of {@code MPI_PUBLISH_NAME} using {@code MPI_INFO_NULL}.
* @param service service name
* @param port port name
* @throws MPIException Signals that an MPI exception of some sort has occurred.
*/
public static void publishName(String service, String port)
public static void publishName(String service, String port)
throws MPIException
{
{
MPI.check();
publishName(service, Info.NULL, port);
}
}
/**
/**
* Java binding of {@code MPI_PUBLISH_NAME}.
* @param service service name
* @param info implementation-specific information
* @param port port name
* @throws MPIException Signals that an MPI exception of some sort has occurred.
*/
public static void publishName(String service, Info info, String port)
public static void publishName(String service, Info info, String port)
throws MPIException
{
{
MPI.check();
publishName(service, info.handle, port);
}
}
private native static void publishName(String service, long info, String port)
private native static void publishName(String service, long info, String port)
throws MPIException;
/**
/**
* Java binding of {@code MPI_UNPUBLISH_NAME} using {@code MPI_INFO_NULL}.
* @param service service name
* @param port port name
* @throws MPIException Signals that an MPI exception of some sort has occurred.
*/
public static void unpublishName(String service, String port)
public static void unpublishName(String service, String port)
throws MPIException
{
{
MPI.check();
unpublishName(service, Info.NULL, port);
}
}
/**
/**
* Java binding of {@code MPI_UNPUBLISH_NAME}.
* @param service service name
* @param info implementation-specific information
* @param port port name
* @throws MPIException Signals that an MPI exception of some sort has occurred.
*/
public static void unpublishName(String service, Info info, String port)
public static void unpublishName(String service, Info info, String port)
throws MPIException
{
{
MPI.check();
unpublishName(service, info.handle, port);
}
}
private native static void unpublishName(String service, long info, String port)
private native static void unpublishName(String service, long info, String port)
throws MPIException;
/**
/**
* Java binding of {@code MPI_LOOKUP_NAME} using {@code MPI_INFO_NULL}.
* @param service service name
* @return port name
* @throws MPIException Signals that an MPI exception of some sort has occurred.
*/
public static String lookupName(String service) throws MPIException
{
public static String lookupName(String service) throws MPIException
{
MPI.check();
return lookupName(service, Info.NULL);
}
}
/**
/**
* Java binding of {@code MPI_LOOKUP_NAME}.
* @param service service name
* @param info mplementation-specific information
* @return port name
* @throws MPIException Signals that an MPI exception of some sort has occurred.
*/
public static String lookupName(String service, Info info) throws MPIException
{
public static String lookupName(String service, Info info) throws MPIException
{
MPI.check();
return lookupName(service, info.handle);
}
}
private native static String lookupName(String service, long info)
private native static String lookupName(String service, long info)
throws MPIException;
/**
/**
* Java binding of {@code MPI_COMM_SPAWN}.
* This intracommunicator will contain the group of spawned processes.
* @param command name of program to be spawned
@ -798,21 +798,21 @@ private native static String lookupName(String service, long info)
* @return intercommunicator between original group and the newly spawned group
* @throws MPIException Signals that an MPI exception of some sort has occurred.
*/
public final Intercomm spawn(String command, String[] argv, int maxprocs,
public final Intercomm spawn(String command, String[] argv, int maxprocs,
Info info, int root, int[] errcodes)
throws MPIException
{
{
MPI.check();
return new Intercomm(spawn(handle, command, argv, maxprocs,
info.handle, root, errcodes));
}
}
private native long spawn(long comm, String command, String[] argv,
private native long spawn(long comm, String command, String[] argv,
int maxprocs, long info, int root, int[] errcodes)
throws MPIException;
/**
/**
* Java binding of {@code MPI_COMM_SPAWN_MULTIPLE}.
* This intracommunicator will contain the group of spawned processes.
* @param commands programs to be executed
@ -827,11 +827,11 @@ private native long spawn(long comm, String command, String[] argv,
* @return intercommunicator between original group and the newly spawned group
* @throws MPIException Signals that an MPI exception of some sort has occurred.
*/
public final Intercomm spawnMultiple(
public final Intercomm spawnMultiple(
String[] commands, String[][] argv, int[] maxprocs,
Info[] info, int root, int[] errcodes)
throws MPIException
{
{
MPI.check();
long hInfo[] = new long[info.length];
@ -841,9 +841,9 @@ public final Intercomm spawnMultiple(
return new Intercomm(spawnMultiple(handle, commands, argv, maxprocs,
hInfo, root, errcodes));
}
}
private native long spawnMultiple(
private native long spawnMultiple(
long comm, String[] commands, String[][] argv, int[] maxprocs,
long[] info, int root, int[] errcodes) throws MPIException;

Просмотреть файл

@ -25,17 +25,17 @@ package mpi;
*/
public final class LongInt extends Struct
{
private final int lSize, iOff, iSize;
private final int lSize, iOff, iSize;
/**
/**
* The struct object will be created only in MPI class.
* @param longSize size of long
* @param intOff int offset
* @param intSize int size
* @see MPI#longInt
*/
protected LongInt(int longSize, int intOff, int intSize)
{
protected LongInt(int longSize, int intOff, int intSize)
{
lSize = longSize;
iSize = intSize;
int lOff;
@ -58,22 +58,22 @@ protected LongInt(int longSize, int intOff, int intSize)
}
assert(intOff == iOff);
}
}
/**
/**
* Creates a Data object.
* @return new Data object.
*/
@Override protected LongInt.Data newData()
{
@Override protected LongInt.Data newData()
{
return new LongInt.Data();
}
}
/**
/**
* Class for reading/writing data in a struct stored in a byte buffer.
*/
public final class Data extends Struct.Data
{
public final class Data extends Struct.Data
{
/**
* Gets the long value.
* @return long value
@ -129,6 +129,6 @@ public final class Data extends Struct.Data
default: throw new AssertionError();
}
}
} // Data
} // Data
} // LongInt

Разница между файлами не показана из-за своего большого размера Загрузить разницу

Просмотреть файл

@ -9,31 +9,33 @@
* University of Stuttgart. All rights reserved.
* Copyright (c) 2004-2005 The Regents of the University of California.
* All rights reserved.
* Copyright (c) 2015 Los Alamos National Security, LLC. All rights
* reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
*
* $HEADER$
*/
/*
*
*
* This file is almost a complete re-write for Open MPI compared to the
* original mpiJava package. Its license and copyright are listed below.
* See <path to ompi/mpi/java/README> for more information.
*/
/*
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
/*
*
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*
* File : MPIException.java
* Author : Bryan Carpenter
* Created : Tue Sep 14 13:03:57 EDT 1999
@ -52,50 +54,50 @@ package mpi;
*/
public final class MPIException extends Exception
{
private int errorCode, errorClass;
private int errorCode, errorClass;
protected MPIException(int code, int clazz, String message)
{
protected MPIException(int code, int clazz, String message)
{
super(message);
errorCode = code;
errorClass = clazz;
}
}
/**
/**
* Creates an exception.
* @param message message associated to the exception
*/
public MPIException(String message)
{
public MPIException(String message)
{
super(message);
}
}
/**
/**
* Creates an exception:
* @param cause cause associated to the exception
*/
public MPIException(Throwable cause)
{
public MPIException(Throwable cause)
{
super(cause);
setStackTrace(cause.getStackTrace());
}
}
/**
/**
* Gets the MPI error code.
* @return error code
*/
public int getErrorCode()
{
public int getErrorCode()
{
return errorCode;
}
}
/**
/**
* Gets the MPI error class.
* @return error class
*/
public int getErrorClass()
{
public int getErrorClass()
{
return errorClass;
}
}
} // MPIException

Просмотреть файл

@ -16,8 +16,8 @@
* Additional copyrights may follow
*
* $HEADER$
*/
/*
*
*
* IMPLEMENTATION DETAILS
*
* All methods with buffers that can be direct or non direct have
@ -36,43 +36,43 @@ import static mpi.MPI.assertDirectBuffer;
*/
public final class Message
{
protected long handle;
private static long NULL, NO_PROC;
protected long handle;
private static long NULL, NO_PROC;
static
{
static
{
init();
}
}
private static native void init();
private static native void init();
/**
/**
* Creates a {@code MPI_MESSAGE_NULL}.
*/
public Message()
{
public Message()
{
handle = NULL;
}
}
/**
/**
* Tests if the message is {@code MPI_MESSAGE_NULL}.
* @return true if the message is {@code MPI_MESSAGE_NULL}.
*/
public boolean isNull()
{
public boolean isNull()
{
return handle == NULL;
}
}
/**
/**
* Tests if the message is {@code MPI_MESSAGE_NO_PROC}.
* @return true if the message is {@code MPI_MESSAGE_NO_PROC}.
*/
public boolean isNoProc()
{
public boolean isNoProc()
{
return handle == NO_PROC;
}
}
/**
/**
* Java binding of {@code MPI_MPROBE}.
* @param source rank of the source
* @param tag message tag
@ -80,18 +80,18 @@ public boolean isNoProc()
* @return status object
* @throws MPIException Signals that an MPI exception of some sort has occurred.
*/
public Status mProbe(int source, int tag, Comm comm) throws MPIException
{
public Status mProbe(int source, int tag, Comm comm) throws MPIException
{
MPI.check();
Status status = new Status();
handle = mProbe(source, tag, comm.handle, status.data);
return status;
}
}
private native long mProbe(int source, int tag, long comm, long[] status)
private native long mProbe(int source, int tag, long comm, long[] status)
throws MPIException;
/**
/**
* Java binding of {@code MPI_IMPROBE}.
* @param source rank of the source
* @param tag message tag
@ -99,16 +99,16 @@ private native long mProbe(int source, int tag, long comm, long[] status)
* @return status object if there is a message, {@code null} otherwise
* @throws MPIException Signals that an MPI exception of some sort has occurred.
*/
public Status imProbe(int source, int tag, Comm comm) throws MPIException
{
public Status imProbe(int source, int tag, Comm comm) throws MPIException
{
MPI.check();
return imProbe(source, tag, comm.handle);
}
}
private native Status imProbe(int source, int tag, long comm)
private native Status imProbe(int source, int tag, long comm)
throws MPIException;
/**
/**
* Java binding of {@code MPI_MRECV}.
* @param buf receive buffer
* @param count number of elements in receve buffer
@ -116,8 +116,8 @@ private native Status imProbe(int source, int tag, long comm)
* @return status object
* @throws MPIException Signals that an MPI exception of some sort has occurred.
*/
public Status mRecv(Object buf, int count, Datatype type) throws MPIException
{
public Status mRecv(Object buf, int count, Datatype type) throws MPIException
{
MPI.check();
int off = 0;
boolean db = false;
@ -133,13 +133,13 @@ public Status mRecv(Object buf, int count, Datatype type) throws MPIException
type.handle, type.baseType, status.data);
return status;
}
}
private native long mRecv(
private native long mRecv(
long message, Object buf, boolean db, int offset, int count,
long type, int baseType, long[] status) throws MPIException;
/**
/**
* Java binding of {@code MPI_IMRECV}.
* @param buf receive buffer
* @param count number of elements in receve buffer
@ -147,15 +147,15 @@ private native long mRecv(
* @return request object
* @throws MPIException Signals that an MPI exception of some sort has occurred.
*/
public Request imRecv(Buffer buf, int count, Datatype type)
public Request imRecv(Buffer buf, int count, Datatype type)
throws MPIException
{
{
MPI.check();
assertDirectBuffer(buf);
return new Request(imRecv(handle, buf, count, type.handle));
}
}
private native long imRecv(long message, Object buf, int count, long type)
private native long imRecv(long message, Object buf, int count, long type)
throws MPIException;
} // Message

Просмотреть файл

@ -16,26 +16,26 @@
* Additional copyrights may follow
*
* $HEADER$
*/
/*
*
*
* This file is almost a complete re-write for Open MPI compared to the
* original mpiJava package. Its license and copyright are listed below.
* See <path to ompi/mpi/java/README> for more information.
*/
/*
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
/*
*
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*
* File : Op.java
* Author : Xinying Li, Sang LIm
* Created : Thu Apr 9 12:22:15 1998
@ -54,48 +54,48 @@ import java.nio.*;
*/
public final class Op implements Freeable
{
protected final UserFunction uf;
private boolean commute;
private Datatype datatype;
protected long handle;
protected final UserFunction uf;
private boolean commute;
private Datatype datatype;
protected long handle;
static
{
static
{
init();
}
}
private static native void init();
private static native void init();
protected Op(int type)
{
protected Op(int type)
{
getOp(type);
uf = null;
commute = true;
}
}
private native void getOp(int type);
private native void getOp(int type);
/**
/**
* Bind a user-defined global reduction operation to an {@code Op} object.
* <p>Java binding of the MPI operation {@code MPI_OP_CREATE}.
* @param function user defined function
* @param commute {@code true} if commutative, {@code false} otherwise
*/
public Op(UserFunction function, boolean commute)
{
public Op(UserFunction function, boolean commute)
{
handle = 0; // When JNI code gets the handle it will be initialized.
uf = function;
this.commute = commute;
}
}
protected void setDatatype(Datatype t)
{
protected void setDatatype(Datatype t)
{
datatype = t;
}
}
protected void call(Object invec, Object inoutvec, int count)
protected void call(Object invec, Object inoutvec, int count)
throws MPIException
{
{
if(datatype.baseType == Datatype.BOOLEAN)
{
uf.call(invec, inoutvec, count, datatype);
@ -106,28 +106,28 @@ protected void call(Object invec, Object inoutvec, int count)
((ByteBuffer)inoutvec).order(ByteOrder.nativeOrder()),
count, datatype);
}
}
}
/**
/**
* Test if the operation is conmutative.
* <p>Java binding of the MPI operation {@code MPI_OP_COMMUTATIVE}.
* @return {@code true} if commutative, {@code false} otherwise
*/
public boolean isCommutative()
{
public boolean isCommutative()
{
return commute;
}
}
/**
/**
* Java binding of the MPI operation {@code MPI_OP_FREE}.
* @throws MPIException Signals that an MPI exception of some sort has occurred.
*/
@Override public native void free() throws MPIException;
@Override public native void free() throws MPIException;
/**
/**
* Test if operation object is null.
* @return true if the operation object is null, false otherwise
*/
public native boolean isNull();
public native boolean isNull();
} // Op

Просмотреть файл

@ -16,26 +16,26 @@
* Additional copyrights may follow
*
* $HEADER$
*/
/*
*
*
* This file is almost a complete re-write for Open MPI compared to the
* original mpiJava package. Its license and copyright are listed below.
* See <path to ompi/mpi/java/README> for more information.
*/
/*
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
/*
*
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*
* File : Prequest.java
* Author : Sang Lim, Xinying Li, Bryan Carpenter
* Created : Thu Apr 9 12:22:15 1998
@ -52,16 +52,16 @@ package mpi;
*/
public final class Prequest extends Request
{
/**
/**
* Constructor used by {@code sendInit}, etc.
* @param handle Handle for the Prequest object
*/
protected Prequest(long handle)
{
protected Prequest(long handle)
{
super(handle);
}
}
/**
/**
* Activate a persistent communication request.
* <p>Java binding of the MPI operation {@code MPI_START}.
* The communication is completed by using the request in
@ -70,27 +70,27 @@ protected Prequest(long handle)
* It can be reactivated by a further call to {@code Start}.
* @throws MPIException Signals that an MPI exception of some sort has occurred.
*/
public void start() throws MPIException
{
public void start() throws MPIException
{
handle = start(handle);
}
}
private native long start(long request) throws MPIException;
private native long start(long request) throws MPIException;
/**
/**
* Activate a list of communication requests.
* <p>Java binding of the MPI operation {@code MPI_STARTALL}.
* @param requests array of requests
* @throws MPIException Signals that an MPI exception of some sort has occurred.
*/
public static void startAll(Prequest[] requests) throws MPIException
{
public static void startAll(Prequest[] requests) throws MPIException
{
MPI.check();
long[] r = getHandles(requests);
startAll(r);
setHandles(requests, r);
}
}
private native static void startAll(long[] requests) throws MPIException;
private native static void startAll(long[] requests) throws MPIException;
} // Prequest

Просмотреть файл

@ -16,35 +16,35 @@
* Additional copyrights may follow
*
* $HEADER$
*/
/*
*
*
* This file is almost a complete re-write for Open MPI compared to the
* original mpiJava package. Its license and copyright are listed below.
* See <path to ompi/mpi/java/README> for more information.
*/
/*
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
/* File : Request.java
*
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* File : Request.java
* Author : Sang Lim, Xinying Li, Bryan Carpenter
* Created : Thu Apr 9 12:22:15 1998
* Revision : $Revision: 1.11 $
* Updated : $Date: 2001/08/07 16:36:25 $
* Copyright: Northeast Parallel Architectures Center
* at Syracuse University 1998
*/
/*
*
*
*
* Note: in a send request for a buffer containing objects, the primary
* `MPI_Request' referenced by `handle' is the request to send the data.
* The request to send the header is in the secondary field, `hdrReq'.
@ -52,9 +52,9 @@
* the primary `MPI_Request' is the request to send the header.
* The receive of the data is not initiated until a `wait' or `test'
* operation succeeds.
*/
/*
*
*
*
* Probably `Request' should be an abstract class, and there should
* be several concrete subclasses. At the moment requests are created
* in a few different ways, and the differently constructed requests are
@ -68,91 +68,91 @@ package mpi;
*/
public class Request implements Freeable
{
protected long handle;
protected long handle;
static
{
static
{
init();
}
}
private static native void init();
private static native void init();
protected static native long getNull();
protected static native long getNull();
protected Request(long handle)
{
protected Request(long handle)
{
this.handle = handle;
}
}
/**
/**
* Set the request object to be void.
* Java binding of the MPI operation {@code MPI_REQUEST_FREE}.
*/
@Override public void free() throws MPIException
{
@Override public void free() throws MPIException
{
if(!isNull())
{
MPI.check();
handle = free(handle);
}
}
}
private native long free(long req) throws MPIException;
private native long free(long req) throws MPIException;
/**
/**
* Mark a pending nonblocking communication for cancellation.
* Java binding of the MPI operation {@code MPI_CANCEL}.
* @throws MPIException Signals that an MPI exception of some sort has occurred.
*/
public final void cancel() throws MPIException
{
public final void cancel() throws MPIException
{
MPI.check();
cancel(handle);
}
}
private native void cancel(long request) throws MPIException;
private native void cancel(long request) throws MPIException;
/**
/**
* Test if request object is null.
* @return true if the request object is null, false otherwise
*/
public final boolean isNull()
{
public final boolean isNull()
{
return handle == 0 || handle == MPI.REQUEST_NULL.handle;
}
}
/**
/**
* Blocks until the operation identified by the request is complete.
* <p>Java binding of the MPI operation {@code MPI_WAIT}.
* <p>After the call returns, the request object becomes inactive.
* @return status object
* @throws MPIException Signals that an MPI exception of some sort has occurred.
*/
public final Status waitStatus() throws MPIException
{
public final Status waitStatus() throws MPIException
{
MPI.check();
Status status = new Status();
handle = waitStatus(handle, status.data);
return status;
}
}
private native long waitStatus(long request, long[] stat) throws MPIException;
private native long waitStatus(long request, long[] stat) throws MPIException;
/**
/**
* Blocks until the operation identified by the request is complete.
* <p>Java binding of the MPI operation {@code MPI_WAIT}.
* <p>After the call returns, the request object becomes inactive.
* @throws MPIException Signals that an MPI exception of some sort has occurred.
*/
public final void waitFor() throws MPIException
{
public final void waitFor() throws MPIException
{
MPI.check();
handle = waitFor(handle);
}
}
private native long waitFor(long request) throws MPIException;
private native long waitFor(long request) throws MPIException;
/**
/**
* Returns a status object if the operation identified by the request
* is complete, or a null reference otherwise.
* <p>Java binding of the MPI operation {@code MPI_TEST}.
@ -161,15 +161,15 @@ private native long waitFor(long request) throws MPIException;
* @return status object
* @throws MPIException Signals that an MPI exception of some sort has occurred.
*/
public final Status testStatus() throws MPIException
{
public final Status testStatus() throws MPIException
{
MPI.check();
return testStatus(handle);
}
}
private native Status testStatus(long request) throws MPIException;
private native Status testStatus(long request) throws MPIException;
/**
/**
* Returns true if the operation identified by the request
* is complete, or false otherwise.
* <p>Java binding of the MPI operation {@code MPI_TEST}.
@ -178,15 +178,15 @@ private native Status testStatus(long request) throws MPIException;
* @return true if the operation identified by the request, false otherwise
* @throws MPIException Signals that an MPI exception of some sort has occurred.
*/
public final boolean test() throws MPIException
{
public final boolean test() throws MPIException
{
MPI.check();
return test(handle);
}
}
private native boolean test(long handle) throws MPIException;
private native boolean test(long handle) throws MPIException;
/**
/**
* Blocks until one of the operations associated with the active
* requests in the array has completed.
* <p>Java binding of the MPI operation {@code MPI_WAITANY}.
@ -198,20 +198,20 @@ private native boolean test(long handle) throws MPIException;
* @return status object
* @throws MPIException Signals that an MPI exception of some sort has occurred.
*/
public static Status waitAnyStatus(Request[] requests) throws MPIException
{
public static Status waitAnyStatus(Request[] requests) throws MPIException
{
MPI.check();
long[] r = getHandles(requests);
Status status = new Status();
waitAnyStatus(r, status.data);
setHandles(requests, r);
return status;
}
}
private static native void waitAnyStatus(long[] requests, long[] status)
private static native void waitAnyStatus(long[] requests, long[] status)
throws MPIException;
/**
/**
* Blocks until one of the operations associated with the active
* requests in the array has completed.
* <p>Java binding of the MPI operation {@code MPI_WAITANY}.
@ -222,18 +222,18 @@ private static native void waitAnyStatus(long[] requests, long[] status)
* is returned as {@code MPI.UNDEFINED}.
* @throws MPIException Signals that an MPI exception of some sort has occurred.
*/
public static int waitAny(Request[] requests) throws MPIException
{
public static int waitAny(Request[] requests) throws MPIException
{
MPI.check();
long[] r = getHandles(requests);
int index = waitAny(r);
setHandles(requests, r);
return index;
}
}
private static native int waitAny(long[] requests) throws MPIException;
private static native int waitAny(long[] requests) throws MPIException;
/**
/**
* Tests for completion of either one or none of the operations
* associated with active requests.
* <p>Java binding of the MPI operation {@code MPI_TESTANY}.
@ -245,18 +245,18 @@ private static native int waitAny(long[] requests) throws MPIException;
* @return status object if one request completed, {@code null} otherwise.
* @throws MPIException Signals that an MPI exception of some sort has occurred.
*/
public static Status testAnyStatus(Request[] requests) throws MPIException
{
public static Status testAnyStatus(Request[] requests) throws MPIException
{
MPI.check();
long[] r = getHandles(requests);
Status status = testAnyStatus(r);
setHandles(requests, r);
return status;
}
}
private static native Status testAnyStatus(long[] requests) throws MPIException;
private static native Status testAnyStatus(long[] requests) throws MPIException;
/**
/**
* Tests for completion of either one or none of the operations
* associated with active requests.
* <p>Java binding of the MPI operation {@code MPI_TESTANY}.
@ -266,18 +266,18 @@ private static native Status testAnyStatus(long[] requests) throws MPIException;
* if none completed.
* @throws MPIException Signals that an MPI exception of some sort has occurred.
*/
public static int testAny(Request[] requests) throws MPIException
{
public static int testAny(Request[] requests) throws MPIException
{
MPI.check();
long[] r = getHandles(requests);
int index = testAny(r);
setHandles(requests, r);
return index;
}
}
private static native int testAny(long[] requests) throws MPIException;
private static native int testAny(long[] requests) throws MPIException;
/**
/**
* Blocks until all of the operations associated with the active
* requests in the array have completed.
* <p>Java binding of the MPI operation {@code MPI_WAITALL}.
@ -288,36 +288,36 @@ private static native int testAny(long[] requests) throws MPIException;
* @return array of statuses
* @throws MPIException Signals that an MPI exception of some sort has occurred.
*/
public static Status[] waitAllStatus(Request[] requests) throws MPIException
{
public static Status[] waitAllStatus(Request[] requests) throws MPIException
{
MPI.check();
long[] r = getHandles(requests);
Status[] status = waitAllStatus(r);
setHandles(requests, r);
return status;
}
}
private static native Status[] waitAllStatus(long[] requests)
private static native Status[] waitAllStatus(long[] requests)
throws MPIException;
/**
/**
* Blocks until all of the operations associated with the active
* requests in the array have completed.
* <p>Java binding of the MPI operation {@code MPI_WAITALL}.
* @param requests array of requests
* @throws MPIException Signals that an MPI exception of some sort has occurred.
*/
public static void waitAll(Request[] requests) throws MPIException
{
public static void waitAll(Request[] requests) throws MPIException
{
MPI.check();
long[] r = getHandles(requests);
waitAll(r);
setHandles(requests, r);
}
}
private static native void waitAll(long[] requests) throws MPIException;
private static native void waitAll(long[] requests) throws MPIException;
/**
/**
* Tests for completion of <em>all</em> of the operations associated
* with active requests.
* <p>Java binding of the MPI operation {@code MPI_TESTALL}.
@ -328,19 +328,19 @@ private static native void waitAll(long[] requests) throws MPIException;
* {@code null} otherwise.
* @throws MPIException Signals that an MPI exception of some sort has occurred.
*/
public static Status[] testAllStatus(Request[] requests) throws MPIException
{
public static Status[] testAllStatus(Request[] requests) throws MPIException
{
MPI.check();
long[] r = getHandles(requests);
Status[] status = testAllStatus(r);
setHandles(requests, r);
return status;
}
}
private static native Status[] testAllStatus(long[] requests)
private static native Status[] testAllStatus(long[] requests)
throws MPIException;
/**
/**
* Tests for completion of <em>all</em> of the operations associated
* with active requests.
* <p>Java binding of the MPI operation {@code MPI_TESTALL}.
@ -349,18 +349,18 @@ private static native Status[] testAllStatus(long[] requests)
* {@code false} otherwise.
* @throws MPIException Signals that an MPI exception of some sort has occurred.
*/
public static boolean testAll(Request[] requests) throws MPIException
{
public static boolean testAll(Request[] requests) throws MPIException
{
MPI.check();
long[] r = getHandles(requests);
boolean completed = testAll(r);
setHandles(requests, r);
return completed;
}
}
private static native boolean testAll(long[] requests) throws MPIException;
private static native boolean testAll(long[] requests) throws MPIException;
/**
/**
* Blocks until at least one of the operations associated with the active
* requests in the array has completed.
* <p>Java binding of the MPI operation {@code MPI_WAITSOME}.
@ -374,19 +374,19 @@ private static native boolean testAll(long[] requests) throws MPIException;
* completed is {@code MPI_UNDEFINED}.
* @throws MPIException Signals that an MPI exception of some sort has occurred.
*/
public static Status[] waitSomeStatus(Request[] requests) throws MPIException
{
public static Status[] waitSomeStatus(Request[] requests) throws MPIException
{
MPI.check();
long[] r = getHandles(requests);
Status[] status = waitSomeStatus(r);
setHandles(requests, r);
return status;
}
}
private static native Status[] waitSomeStatus(long[] requests)
private static native Status[] waitSomeStatus(long[] requests)
throws MPIException;
/**
/**
* Blocks until at least one of the operations associated with the active
* active requests in the array has completed.
* <p>Java binding of the MPI operation {@code MPI_WAITSOME}.
@ -398,18 +398,18 @@ private static native Status[] waitSomeStatus(long[] requests)
* if the number of operations completed is {@code MPI_UNDEFINED}.
* @throws MPIException Signals that an MPI exception of some sort has occurred.
*/
public static int[] waitSome(Request[] requests) throws MPIException
{
public static int[] waitSome(Request[] requests) throws MPIException
{
MPI.check();
long[] r = getHandles(requests);
int[] indexes = waitSome(r);
setHandles(requests, r);
return indexes;
}
}
private static native int[] waitSome(long[] requests) throws MPIException;
private static native int[] waitSome(long[] requests) throws MPIException;
/**
/**
* Behaves like {@code waitSome}, except that it returns immediately.
* <p>Java binding of the MPI operation {@code MPI_TESTSOME}.
* <p>If no operation has completed, {@code testSome} returns an array of
@ -418,19 +418,19 @@ private static native int[] waitSome(long[] requests) throws MPIException;
* @return array of statuses
* @throws MPIException Signals that an MPI exception of some sort has occurred.
*/
public static Status[] testSomeStatus(Request[] requests) throws MPIException
{
public static Status[] testSomeStatus(Request[] requests) throws MPIException
{
MPI.check();
long[] r = getHandles(requests);
Status[] status = testSomeStatus(r);
setHandles(requests, r);
return status;
}
}
private static native Status[] testSomeStatus(long[] requests)
private static native Status[] testSomeStatus(long[] requests)
throws MPIException;
/**
/**
* Behaves like {@code waitSome}, except that it returns immediately.
* <p>Java binding of the MPI operation {@code MPI_TESTSOME}.
* <p>If no operation has completed, {@code testSome} returns an array of
@ -439,31 +439,31 @@ private static native Status[] testSomeStatus(long[] requests)
* @return array of indexes of {@code requests} that completed.
* @throws MPIException Signals that an MPI exception of some sort has occurred.
*/
public static int[] testSome(Request[] requests) throws MPIException
{
public static int[] testSome(Request[] requests) throws MPIException
{
MPI.check();
long[] r = getHandles(requests);
int[] indexes = testSome(r);
setHandles(requests, r);
return indexes;
}
}
private static native int[] testSome(long[] requests) throws MPIException;
private static native int[] testSome(long[] requests) throws MPIException;
protected static long[] getHandles(Request[] r)
{
protected static long[] getHandles(Request[] r)
{
long[] h = new long[r.length];
for(int i = 0; i < r.length; i++)
h[i] = r[i].handle;
return h;
}
}
protected static void setHandles(Request[] r, long[] h)
{
protected static void setHandles(Request[] r, long[] h)
{
for(int i = 0; i < r.length; i++)
r[i].handle = h[i];
}
}
} // Request

Просмотреть файл

@ -9,31 +9,33 @@
* University of Stuttgart. All rights reserved.
* Copyright (c) 2004-2005 The Regents of the University of California.
* All rights reserved.
* Copyright (c) 2015 Los Alamos National Security, LLC. All rights
* reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
*
* $HEADER$
*/
/*
*
*
* This file is almost a complete re-write for Open MPI compared to the
* original mpiJava package. Its license and copyright are listed below.
* See <path to ompi/mpi/java/README> for more information.
*/
/*
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
/*
*
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*
* File : ShiftParms.java
* Author : Xinying Li
* Created : Thu Apr 9 12:22:15 1998
@ -50,31 +52,31 @@ package mpi;
*/
public final class ShiftParms
{
private final int rankSource;
private final int rankDest;
private final int rankSource;
private final int rankDest;
protected ShiftParms(int rankSource, int rankDest)
{
protected ShiftParms(int rankSource, int rankDest)
{
this.rankSource = rankSource;
this.rankDest = rankDest;
}
}
/**
/**
* Gets the source rank.
* @return source rank
*/
public int getRankSource()
{
public int getRankSource()
{
return rankSource;
}
}
/**
/**
* Gets the destination rank.
* @return destination rank
*/
public int getRankDest()
{
public int getRankDest()
{
return rankDest;
}
}
} // ShiftParms

Просмотреть файл

@ -25,17 +25,17 @@ package mpi;
*/
public final class ShortInt extends Struct
{
private final int sSize, iOff, iSize;
private final int sSize, iOff, iSize;
/**
/**
* The struct object will be created only in MPI class.
* @param shortSize short size
* @param intOff int offset
* @param intSize int size
* @see MPI#shortInt
*/
protected ShortInt(int shortSize, int intOff, int intSize)
{
protected ShortInt(int shortSize, int intOff, int intSize)
{
sSize = shortSize;
iSize = intSize;
int sOff;
@ -59,22 +59,22 @@ protected ShortInt(int shortSize, int intOff, int intSize)
}
assert(intOff == iOff);
}
}
/**
/**
* Creates a Data object.
* @return new Data object.
*/
@Override protected Data newData()
{
@Override protected Data newData()
{
return new Data();
}
}
/**
/**
* Class for reading/writing data in a struct stored in a byte buffer.
*/
public final class Data extends Struct.Data
{
public final class Data extends Struct.Data
{
/**
* Gets the short value.
* @return short value
@ -132,6 +132,6 @@ public final class Data extends Struct.Data
default: throw new AssertionError();
}
}
} // Data
} // Data
} // ShortInt

Просмотреть файл

@ -16,26 +16,26 @@
* Additional copyrights may follow
*
* $HEADER$
*/
/*
*
*
* This file is almost a complete re-write for Open MPI compared to the
* original mpiJava package. Its license and copyright are listed below.
* See <path to ompi/mpi/java/README> for more information.
*/
/*
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
/*
*
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*
* File : Status.java
* Author : Sang Lim, Sung-Hoon Ko, Xinying Li, Bryan Carpenter
* Created : Thu Apr 9 12:22:15 1998
@ -52,32 +52,32 @@ package mpi;
*/
public final class Status
{
protected final long[] data;
protected final long[] data;
static
{
static
{
init();
}
}
private static native void init();
private static native void init();
/**
/**
* Status objects must be created only by the MPI methods.
*/
protected Status()
{
protected Status()
{
data = new long[6];
}
}
/**
/**
* Returns the number of received entries.
* <p>Java binding of the MPI operation {@code MPI_GET_COUNT}.
* @param datatype datatype of each item in receive buffer
* @return number of received entries
* @throws MPIException Signals that an MPI exception of some sort has occurred.
*/
public int getCount(Datatype datatype) throws MPIException
{
public int getCount(Datatype datatype) throws MPIException
{
MPI.check();
int i = 0;
int source = (int)data[i++];
@ -86,20 +86,20 @@ public int getCount(Datatype datatype) throws MPIException
int cancelled = (int)data[i++];
long ucount = data[i++];
return getCount(source, tag, error, cancelled, ucount, datatype.handle);
}
}
private native int getCount(
private native int getCount(
int source, int tag, int error,
int cancelled, long ucount, long datatype) throws MPIException;
/**
/**
* Tests if the communication was cancelled.
* <p>Java binding of the MPI operation {@code MPI_TEST_CANCELLED}.
* @return true if the operation was succesfully cancelled, false otherwise
* @throws MPIException Signals that an MPI exception of some sort has occurred.
*/
public boolean isCancelled() throws MPIException
{
public boolean isCancelled() throws MPIException
{
MPI.check();
int i = 0;
int source = (int)data[i++];
@ -108,21 +108,21 @@ public boolean isCancelled() throws MPIException
int cancelled = (int)data[i++];
long ucount = data[i++];
return isCancelled(source, tag, error, cancelled, ucount);
}
}
private native boolean isCancelled(
private native boolean isCancelled(
int source, int tag, int error, int cancelled, long ucount)
throws MPIException;
/**
/**
* Retrieves the number of basic elements from status.
* <p>Java binding of the MPI operation {@code MPI_GET_ELEMENTS}.
* @param datatype datatype used by receive operation
* @return number of received basic elements
* @throws MPIException Signals that an MPI exception of some sort has occurred.
*/
public int getElements(Datatype datatype) throws MPIException
{
public int getElements(Datatype datatype) throws MPIException
{
MPI.check();
int i = 0;
int source = (int)data[i++];
@ -131,48 +131,48 @@ public int getElements(Datatype datatype) throws MPIException
int cancelled = (int)data[i++];
long ucount = data[i++];
return getElements(source, tag, error, cancelled, ucount, datatype.handle);
}
}
private native int getElements(
private native int getElements(
int source, int tag, int error,
int cancelled, long ucount, long datatype) throws MPIException;
/**
/**
* Returns the "source" of message.
* <p>Java binding of the MPI value {@code MPI_SOURCE}.
* @return source of message
*/
public int getSource()
{
public int getSource()
{
return (int)data[0];
}
}
/**
/**
* Returns the "tag" of message.
* <p>Java binding of the MPI value {@code MPI_TAG}.
* @return tag of message
*/
public int getTag()
{
public int getTag()
{
return (int)data[1];
}
}
/**
/**
* Returns the {@code MPI_ERROR} of message.
* @return error of message.
*/
public int getError()
{
public int getError()
{
return (int)data[2];
}
}
/**
/**
* Returns the index of message.
* @return index of message.
*/
public int getIndex()
{
public int getIndex()
{
return (int)data[5];
}
}
} // Status

Просмотреть файл

@ -28,21 +28,21 @@ import java.util.*;
*/
public abstract class Struct
{
private int extent;
private ArrayList<Field> fields = new ArrayList<Field>();
private int extent;
private ArrayList<Field> fields = new ArrayList<Field>();
private Datatype datatype, types[];
private int offsets[], lengths[];
private static final String typeMismatch = "Type mismatch";
private Datatype datatype, types[];
private int offsets[], lengths[];
private static final String typeMismatch = "Type mismatch";
private void commit() throws MPIException
{
private void commit() throws MPIException
{
if(datatype == null)
createStruct();
}
}
private void createStruct() throws MPIException
{
private void createStruct() throws MPIException
{
int count = fields.size();
types = new Datatype[count];
offsets = new int[count];
@ -61,60 +61,60 @@ private void createStruct() throws MPIException
datatype = Datatype.createStruct(lengths, offsets, types);
datatype.commit();
extent = datatype.getExtent();
}
}
/**
/**
* Returns the extent of the struct data type.
* @return Extent of the struct data type.
* @throws MPIException Signals that an MPI exception of some sort has occurred.
*/
public final int getExtent() throws MPIException
{
public final int getExtent() throws MPIException
{
commit();
return extent;
}
}
/**
/**
* Returns the data type of the struct.
* @return The data type of the struct.
* @throws MPIException Signals that an MPI exception of some sort has occurred.
*/
public final Datatype getType() throws MPIException
{
public final Datatype getType() throws MPIException
{
commit();
return datatype;
}
}
/**
/**
* Creates a Data object.
* @return New Data object.
*/
protected abstract Data newData();
protected abstract Data newData();
@SuppressWarnings("unchecked")
private <T extends Data> T newData(ByteBuffer buffer, int offset)
{
@SuppressWarnings("unchecked")
private <T extends Data> T newData(ByteBuffer buffer, int offset)
{
Data d = newData();
d.buffer = buffer;
d.offset = offset;
return (T)d;
}
}
@SuppressWarnings("javadoc")
/**
@SuppressWarnings("javadoc")
/**
* Gets a Data object in order to access to the buffer.
* @param buffer the Data object will read/write on this buffer.
* @return Data object
* @throws MPIException Signals that an MPI exception of some sort has occurred.
*/
public final <T extends Data> T getData(ByteBuffer buffer) throws MPIException
{
public final <T extends Data> T getData(ByteBuffer buffer) throws MPIException
{
commit();
return newData(buffer, 0);
}
}
@SuppressWarnings("javadoc")
/**
@SuppressWarnings("javadoc")
/**
* Gets a Data object in order to access to the struct at the
* specified position of a struct array stored in a Buffer.
* @param buffer The Data object will read/write on this buffer.
@ -122,29 +122,29 @@ public final <T extends Data> T getData(ByteBuffer buffer) throws MPIException
* @return Data object.
* @throws MPIException Signals that an MPI exception of some sort has occurred.
*/
public final <T extends Data> T getData(ByteBuffer buffer, int index)
public final <T extends Data> T getData(ByteBuffer buffer, int index)
throws MPIException
{
{
commit();
return newData(buffer, index * extent);
}
}
@SuppressWarnings("javadoc")
/**
@SuppressWarnings("javadoc")
/**
* Gets a Data object in order to access to the byte array.
* @param array The Data object will read/write on this byte array.
* @return Data object.
* @throws MPIException Signals that an MPI exception of some sort has occurred.
*/
public final <T extends Data> T getData(byte[] array) throws MPIException
{
public final <T extends Data> T getData(byte[] array) throws MPIException
{
ByteBuffer buffer = ByteBuffer.wrap(array);
buffer.order(ByteOrder.nativeOrder());
return getData(buffer);
}
}
@SuppressWarnings("javadoc")
/**
@SuppressWarnings("javadoc")
/**
* Gets a Data object in order to access to the struct at the
* specified position of a struct array stored in a byte array.
* @param array The Data object will read/write on this byte array.
@ -152,16 +152,16 @@ public final <T extends Data> T getData(byte[] array) throws MPIException
* @return Data object.
* @throws MPIException Signals that an MPI exception of some sort has occurred.
*/
public final <T extends Data> T getData(byte[] array, int index)
public final <T extends Data> T getData(byte[] array, int index)
throws MPIException
{
{
ByteBuffer buffer = ByteBuffer.wrap(array);
buffer.order(ByteOrder.nativeOrder());
return getData(buffer, index);
}
}
private int addField(Object type, int typeExtent, int length)
{
private int addField(Object type, int typeExtent, int length)
{
if(datatype != null)
throw new AssertionError("The struct data type was committed.");
@ -169,16 +169,16 @@ private int addField(Object type, int typeExtent, int length)
extent += typeExtent * length;
fields.add(new Field(type, offset, length));
return offset;
}
}
/**
/**
* Sets the offset of the next field.
* <p>The offset must be greater or equal to the accumulated extent.
* @param offset offset of the next field
* @return this object in order to allow adding fields in a chained expression
*/
public final Struct setOffset(int offset)
{
public final Struct setOffset(int offset)
{
if(datatype != null)
throw new AssertionError("The struct data type was committed.");
@ -190,196 +190,196 @@ public final Struct setOffset(int offset)
extent = offset;
return this;
}
}
/**
/**
* Adds a byte field to this struct.
* @return Offset of the new field.
*/
public final int addByte()
{
public final int addByte()
{
return addByte(1);
}
}
/**
/**
* Adds a byte array to this struct.
* @param length Length of the array.
* @return Offset of the new field.
*/
public final int addByte(int length)
{
public final int addByte(int length)
{
return addField(MPI.BYTE, 1, length);
}
}
/**
/**
* Adds a char field to this struct.
* @return Offset of the new field.
*/
public final int addChar()
{
public final int addChar()
{
return addChar(1);
}
}
/**
/**
* Adds a char array to this struct.
* @param length Length of the array.
* @return Offset of the new field.
*/
public final int addChar(int length)
{
public final int addChar(int length)
{
return addField(MPI.CHAR, 2, length);
}
}
/**
/**
* Adds a short field to this struct.
* @return Offset of the new field.
*/
public final int addShort()
{
public final int addShort()
{
return addShort(1);
}
}
/**
/**
* Adds a short array to this struct.
* @param length Length of the array.
* @return Offset of the new field.
*/
public final int addShort(int length)
{
public final int addShort(int length)
{
return addField(MPI.SHORT, 2, length);
}
}
/**
/**
* Adds an int field to this struct.
* @return Offset of the new field.
*/
public final int addInt()
{
public final int addInt()
{
return addInt(1);
}
}
/**
/**
* Adds an int array to this struct.
* @param length Length of the array.
* @return Offset of the new field.
*/
public final int addInt(int length)
{
public final int addInt(int length)
{
return addField(MPI.INT, 4, length);
}
}
/**
/**
* Adds a long field to this struct.
* @return Offset of the new field.
*/
public final int addLong()
{
public final int addLong()
{
return addLong(1);
}
}
/**
/**
* Adds a long array to this struct.
* @param length Length of the array.
* @return Offset of the new field.
*/
public final int addLong(int length)
{
public final int addLong(int length)
{
return addField(MPI.LONG, 8, length);
}
}
/**
/**
* Adds a float field to this struct.
* @return Offset of the new field.
*/
public final int addFloat()
{
public final int addFloat()
{
return addFloat(1);
}
}
/**
/**
* Adds a float array to this struct.
* @param length Length of the array.
* @return Offset of the new field.
*/
public final int addFloat(int length)
{
public final int addFloat(int length)
{
return addField(MPI.FLOAT, 4, length);
}
}
/**
/**
* Adds a double field to this struct.
* @return Offset of the new field.
*/
public final int addDouble()
{
public final int addDouble()
{
return addDouble(1);
}
}
/**
/**
* Adds a double array to this struct.
* @param length Length of the array.
* @return Offset of the new field.
*/
public final int addDouble(int length)
{
public final int addDouble(int length)
{
return addField(MPI.DOUBLE, 8, length);
}
}
/**
/**
* Adds a struct field to this struct.
* @param struct Type of the field.
* @return Offset of the new field.
* @throws MPIException Signals that an MPI exception of some sort has occurred.
*/
public final int addStruct(Struct struct) throws MPIException
{
public final int addStruct(Struct struct) throws MPIException
{
return addStruct(struct, 1);
}
}
/**
/**
* Adds an array of structs to this struct.
* @param struct Type of the array.
* @param length Length of the array.
* @return Offset of the new field.
* @throws MPIException Signals that an MPI exception of some sort has occurred.
*/
public final int addStruct(Struct struct, int length) throws MPIException
{
public final int addStruct(Struct struct, int length) throws MPIException
{
struct.commit();
return addField(struct, struct.extent, length);
}
}
/**
/**
* Adds a field of the specified data type.
* @param type Data type.
* @return Offset of the new field.
* @throws MPIException Signals that an MPI exception of some sort has occurred.
*/
public final int addData(Datatype type) throws MPIException
{
public final int addData(Datatype type) throws MPIException
{
return addData(type, 1);
}
}
/**
/**
* Adds an array of the specified data type.
* @param type Data type.
* @param length Length of the array.
* @return Offset of the new field.
* @throws MPIException Signals that an MPI exception of some sort has occurred.
*/
public final int addData(Datatype type, int length) throws MPIException
{
public final int addData(Datatype type, int length) throws MPIException
{
return addField(type, type.getExtent() * type.baseSize, length);
}
}
private boolean validType(int fieldOffset, int index, Datatype type)
{
private boolean validType(int fieldOffset, int index, Datatype type)
{
int i = Arrays.binarySearch(offsets, fieldOffset);
return index >= 0 && index < lengths[i] && type == types[i];
}
}
private static class Field
{
private static class Field
{
private Object type;
private int offset, length;
@ -390,13 +390,13 @@ private static class Field
this.length = length;
}
} // Field
} // Field
/**
/**
* Base class for reading/writing data in a struct stored in a byte buffer.
*/
public abstract class Data
{
public abstract class Data
{
private ByteBuffer buffer;
private int offset;
@ -797,6 +797,6 @@ public abstract class Data
return position == 0 ? buffer : MPI.slice(buffer, position);
}
} // Data
} // Data
} // Struct

Просмотреть файл

@ -34,7 +34,7 @@
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
*/
/*
* File : User_function.java
* Author : Xinying Li
@ -54,7 +54,7 @@ import java.nio.*;
*/
public abstract class UserFunction
{
/**
/**
* User-defined function for a new {@code Op}.
* @param inVec array of values to combine with {@code inoutvec} elements
* @param inOutVec in-out array of accumulator locations
@ -62,13 +62,13 @@ public abstract class UserFunction
* @param datatype type of each item
* @throws MPIException Signals that an MPI exception of some sort has occurred.
*/
public void call(Object inVec, Object inOutVec, int count, Datatype datatype)
public void call(Object inVec, Object inOutVec, int count, Datatype datatype)
throws MPIException
{
{
throw new UnsupportedOperationException("Not supported yet.");
}
}
/**
/**
* User-defined function for a new {@code Op}.
* @param in direct byte buffer to combine with {@code inOut} buffer
* @param inOut in-out direct byte buffer of accumulator locations
@ -76,9 +76,9 @@ public void call(Object inVec, Object inOutVec, int count, Datatype datatype)
* @param datatype type of each item
* @throws MPIException Signals that an MPI exception of some sort has occurred.
*/
public void call(ByteBuffer in, ByteBuffer inOut, int count, Datatype datatype)
public void call(ByteBuffer in, ByteBuffer inOut, int count, Datatype datatype)
throws MPIException
{
{
switch(datatype.baseType)
{
case Datatype.BYTE:
@ -108,11 +108,11 @@ public void call(ByteBuffer in, ByteBuffer inOut, int count, Datatype datatype)
default:
throw new IllegalArgumentException("Unsupported datatype.");
}
}
}
private void vCall(ByteBuffer in, ByteBuffer inOut,
private void vCall(ByteBuffer in, ByteBuffer inOut,
int count, Datatype datatype) throws MPIException
{
{
int extent = datatype.getExtent();
byte[] inVec = new byte[count * extent],
inOutVec = new byte[count * extent];
@ -122,11 +122,11 @@ private void vCall(ByteBuffer in, ByteBuffer inOut,
call(inVec, inOutVec, count, datatype);
inOut.clear();
inOut.put(inOutVec);
}
}
private void vCall(CharBuffer inBuf, CharBuffer inOutBuf,
private void vCall(CharBuffer inBuf, CharBuffer inOutBuf,
int count, Datatype datatype) throws MPIException
{
{
int extent = datatype.getExtent();
char[] inVec = new char[count * extent],
inOutVec = new char[count * extent];
@ -136,11 +136,11 @@ private void vCall(CharBuffer inBuf, CharBuffer inOutBuf,
call(inVec, inOutVec, count, datatype);
inOutBuf.clear();
inOutBuf.put(inOutVec);
}
}
private void vCall(ShortBuffer inBuf, ShortBuffer inOutBuf,
private void vCall(ShortBuffer inBuf, ShortBuffer inOutBuf,
int count, Datatype datatype) throws MPIException
{
{
int extent = datatype.getExtent();
short[] inVec = new short[count * extent],
inOutVec = new short[count * extent];
@ -150,11 +150,11 @@ private void vCall(ShortBuffer inBuf, ShortBuffer inOutBuf,
call(inVec, inOutVec, count, datatype);
inOutBuf.clear();
inOutBuf.put(inOutVec);
}
}
private void vCall(IntBuffer inBuf, IntBuffer inOutBuf,
private void vCall(IntBuffer inBuf, IntBuffer inOutBuf,
int count, Datatype datatype) throws MPIException
{
{
int extent = datatype.getExtent();
int[] inVec = new int[count * extent],
inOutVec = new int[count * extent];
@ -164,11 +164,11 @@ private void vCall(IntBuffer inBuf, IntBuffer inOutBuf,
call(inVec, inOutVec, count, datatype);
inOutBuf.clear();
inOutBuf.put(inOutVec);
}
}
private void vCall(LongBuffer inBuf, LongBuffer inOutBuf,
private void vCall(LongBuffer inBuf, LongBuffer inOutBuf,
int count, Datatype datatype) throws MPIException
{
{
int extent = datatype.getExtent();
long[] inVec = new long[count * extent],
inOutVec = new long[count * extent];
@ -178,11 +178,11 @@ private void vCall(LongBuffer inBuf, LongBuffer inOutBuf,
call(inVec, inOutVec, count, datatype);
inOutBuf.clear();
inOutBuf.put(inOutVec);
}
}
private void vCall(FloatBuffer inBuf, FloatBuffer inOutBuf,
private void vCall(FloatBuffer inBuf, FloatBuffer inOutBuf,
int count, Datatype datatype) throws MPIException
{
{
int extent = datatype.getExtent();
float[] inVec = new float[count * extent],
inOutVec = new float[count * extent];
@ -192,11 +192,11 @@ private void vCall(FloatBuffer inBuf, FloatBuffer inOutBuf,
call(inVec, inOutVec, count, datatype);
inOutBuf.clear();
inOutBuf.put(inOutVec);
}
}
private void vCall(DoubleBuffer inBuf, DoubleBuffer inOutBuf,
private void vCall(DoubleBuffer inBuf, DoubleBuffer inOutBuf,
int count, Datatype datatype) throws MPIException
{
{
int extent = datatype.getExtent();
double[] inVec = new double[count * extent],
inOutVec = new double[count * extent];
@ -206,6 +206,6 @@ private void vCall(DoubleBuffer inBuf, DoubleBuffer inOutBuf,
call(inVec, inOutVec, count, datatype);
inOutBuf.clear();
inOutBuf.put(inOutVec);
}
}
} // UserFunction

Просмотреть файл

@ -29,12 +29,12 @@ import java.nio.*;
*/
public final class Win implements Freeable
{
private long handle;
public static final int WIN_NULL = 0;
public static final int FLAVOR_PRIVATE = 0;
public static final int FLAVOR_SHARED = 1;
private long handle;
public static final int WIN_NULL = 0;
public static final int FLAVOR_PRIVATE = 0;
public static final int FLAVOR_SHARED = 1;
/**
/**
* Java binding of {@code MPI_WIN_CREATE}.
* @param base initial address of window
* @param size size of window (buffer elements)
@ -43,9 +43,9 @@ public static final int FLAVOR_SHARED = 1;
* @param comm communicator
* @throws MPIException Signals that an MPI exception of some sort has occurred.
*/
public Win(Buffer base, int size, int dispUnit, Info info, Comm comm)
public Win(Buffer base, int size, int dispUnit, Info info, Comm comm)
throws MPIException
{
{
if(!base.isDirect())
throw new IllegalArgumentException("The buffer must be direct.");
@ -66,13 +66,13 @@ public Win(Buffer base, int size, int dispUnit, Info info, Comm comm)
dispBytes = dispUnit * baseSize;
handle = createWin(base, sizeBytes, dispBytes, info.handle, comm.handle);
}
}
private native long createWin(
private native long createWin(
Buffer base, int size, int dispUnit, long info, long comm)
throws MPIException;
/**
/**
* Java binding of {@code MPI_WIN_ALLOCATE} and {@code MPI_WIN_ALLOCATE_SHARED}.
* @param size size of window (buffer elements)
* @param dispUnit local unit size for displacements (buffer elements)
@ -82,9 +82,9 @@ private native long createWin(
* @param flavor FLAVOR_PRIVATE or FLAVOR_SHARED
* @throws MPIException Signals that an MPI exception of some sort has occurred.
*/
public Win(int size, int dispUnit, Info info, Comm comm, Buffer base, int flavor)
public Win(int size, int dispUnit, Info info, Comm comm, Buffer base, int flavor)
throws MPIException
{
{
if(!base.isDirect())
throw new IllegalArgumentException("The buffer must be direct.");
@ -109,34 +109,34 @@ public Win(int size, int dispUnit, Info info, Comm comm, Buffer base, int flavor
} else if(flavor == 1) {
handle = allocateSharedWin(sizeBytes, dispBytes, info.handle, comm.handle, base);
}
}
}
private native long allocateWin(
private native long allocateWin(
int size, int dispUnit, long info, long comm, Buffer base)
throws MPIException;
private native long allocateSharedWin(
private native long allocateSharedWin(
int size, int dispUnit, long info, long comm, Buffer base)
throws MPIException;
/**
/**
* Java binding of {@code MPI_WIN_CREATE_DYNAMIC}.
* @param info info object
* @param comm communicator
* @throws MPIException Signals that an MPI exception of some sort has occurred.
*/
public Win(Info info, Comm comm)
public Win(Info info, Comm comm)
throws MPIException
{
{
handle = createDynamicWin(info.handle, comm.handle);
}
}
private native long createDynamicWin(
private native long createDynamicWin(
long info, long comm)
throws MPIException;
private int getBaseType(Datatype orgType, Datatype targetType)
{
private int getBaseType(Datatype orgType, Datatype targetType)
{
int baseType = orgType.baseType;
if(baseType != targetType.baseType)
@ -147,16 +147,16 @@ private int getBaseType(Datatype orgType, Datatype targetType)
}
return baseType;
}
}
/**
/**
* Java binding of {@code MPI_WIN_ATTACH}.
* @param base initial address of window
* @param size size of window (buffer elements)
* @throws MPIException Signals that an MPI exception of some sort has occurred.
*/
public void attach(Buffer base, int size) throws MPIException
{
public void attach(Buffer base, int size) throws MPIException
{
MPI.check();
if(!base.isDirect())
throw new IllegalArgumentException("The buffer must be direct.");
@ -177,40 +177,40 @@ public void attach(Buffer base, int size) throws MPIException
int sizeBytes = size * baseSize;
attach(handle, base, sizeBytes);
}
}
private native void attach(long win, Buffer base, int size) throws MPIException;
private native void attach(long win, Buffer base, int size) throws MPIException;
/**
/**
* Java binding of {@code MPI_WIN_DETACH}.
* @param base initial address of window
* @throws MPIException Signals that an MPI exception of some sort has occurred.
*/
public void detach(Buffer base) throws MPIException
{
public void detach(Buffer base) throws MPIException
{
MPI.check();
if(!base.isDirect())
throw new IllegalArgumentException("The buffer must be direct.");
detach(handle, base);
}
}
private native void detach(long win, Buffer base) throws MPIException;
private native void detach(long win, Buffer base) throws MPIException;
/**
/**
* Java binding of the MPI operation {@code MPI_GET_GROUP}.
* @return group of processes which share access to the window
* @throws MPIException Signals that an MPI exception of some sort has occurred.
*/
public Group getGroup() throws MPIException
{
public Group getGroup() throws MPIException
{
MPI.check();
return new Group(getGroup(handle));
}
}
private native long getGroup(long win) throws MPIException;
private native long getGroup(long win) throws MPIException;
/**
/**
* Java binding of {@code MPI_PUT}.
* @param origin origin buffer
* @param orgCount number of entries in origin buffer
@ -221,11 +221,11 @@ private native long getGroup(long win) throws MPIException;
* @param targetType datatype of each entry in target buffer
* @throws MPIException Signals that an MPI exception of some sort has occurred.
*/
public void put(Buffer origin, int orgCount, Datatype orgType,
public void put(Buffer origin, int orgCount, Datatype orgType,
int targetRank, int targetDisp, int targetCount,
Datatype targetType)
throws MPIException
{
{
MPI.check();
if(!origin.isDirect())
@ -234,14 +234,14 @@ public void put(Buffer origin, int orgCount, Datatype orgType,
put(handle, origin, orgCount, orgType.handle,
targetRank, targetDisp, targetCount, targetType.handle,
getBaseType(orgType, targetType));
}
}
private native void put(
private native void put(
long win, Buffer origin, int orgCount, long orgType,
int targetRank, int targetDisp, int targetCount, long targetType,
int baseType) throws MPIException;
/**
/**
* Java binding of {@code MPI_GET}.
* @param origin origin buffer
* @param orgCount number of entries in origin buffer
@ -252,11 +252,11 @@ private native void put(
* @param targetType datatype of each entry in target buffer
* @throws MPIException Signals that an MPI exception of some sort has occurred.
*/
public void get(Buffer origin, int orgCount, Datatype orgType,
public void get(Buffer origin, int orgCount, Datatype orgType,
int targetRank, int targetDisp, int targetCount,
Datatype targetType)
throws MPIException
{
{
MPI.check();
if(!origin.isDirect())
@ -265,14 +265,14 @@ public void get(Buffer origin, int orgCount, Datatype orgType,
get(handle, origin, orgCount, orgType.handle,
targetRank, targetDisp, targetCount, targetType.handle,
getBaseType(orgType, targetType));
}
}
private native void get(
private native void get(
long win, Buffer origin, int orgCount, long orgType,
int targetRank, int targetDisp, int targetCount, long targetType,
int baseType) throws MPIException;
/**
/**
* Java binding of {@code MPI_ACCUMULATE}.
* @param origin origin buffer
* @param orgCount number of entries in origin buffer
@ -284,11 +284,11 @@ private native void get(
* @param op reduce operation
* @throws MPIException Signals that an MPI exception of some sort has occurred.
*/
public void accumulate(Buffer origin, int orgCount, Datatype orgType,
public void accumulate(Buffer origin, int orgCount, Datatype orgType,
int targetRank, int targetDisp, int targetCount,
Datatype targetType, Op op)
throws MPIException
{
{
MPI.check();
if(!origin.isDirect())
@ -297,264 +297,264 @@ public void accumulate(Buffer origin, int orgCount, Datatype orgType,
accumulate(handle, origin, orgCount, orgType.handle,
targetRank, targetDisp, targetCount, targetType.handle,
op, op.handle, getBaseType(orgType, targetType));
}
}
private native void accumulate(
private native void accumulate(
long win, Buffer origin, int orgCount, long orgType,
int targetRank, int targetDisp, int targetCount, long targetType,
Op jOp, long hOp, int baseType) throws MPIException;
/**
/**
* Java binding of {@code MPI_WIN_FENCE}.
* @param assertion program assertion
* @throws MPIException Signals that an MPI exception of some sort has occurred.
*/
public void fence(int assertion) throws MPIException
{
public void fence(int assertion) throws MPIException
{
MPI.check();
fence(handle, assertion);
}
}
private native void fence(long win, int assertion) throws MPIException;
private native void fence(long win, int assertion) throws MPIException;
/**
/**
* Java binding of the MPI operation {@code MPI_WIN_START}.
* @param group group of target processes
* @param assertion program assertion
* @throws MPIException Signals that an MPI exception of some sort has occurred.
*/
public void start(Group group, int assertion) throws MPIException
{
public void start(Group group, int assertion) throws MPIException
{
MPI.check();
start(handle, group.handle, assertion);
}
}
private native void start(long win, long group, int assertion)
private native void start(long win, long group, int assertion)
throws MPIException;
/**
/**
* Java binding of the MPI operation {@code MPI_WIN_COMPLETE}.
* @throws MPIException Signals that an MPI exception of some sort has occurred.
*/
public void complete() throws MPIException
{
public void complete() throws MPIException
{
MPI.check();
complete(handle);
}
}
private native void complete(long win) throws MPIException;
private native void complete(long win) throws MPIException;
/**
/**
* Java binding of the MPI operation {@code MPI_WIN_POST}.
* @param group group of origin processes
* @param assertion program assertion
* @throws MPIException Signals that an MPI exception of some sort has occurred.
*/
public void post(Group group, int assertion) throws MPIException
{
public void post(Group group, int assertion) throws MPIException
{
MPI.check();
post(handle, group.handle, assertion);
}
}
private native void post(long win, long group, int assertion)
private native void post(long win, long group, int assertion)
throws MPIException;
/**
/**
* Java binding of the MPI operation {@code MPI_WIN_WAIT}.
* @throws MPIException Signals that an MPI exception of some sort has occurred.
*/
public void waitFor() throws MPIException
{
public void waitFor() throws MPIException
{
MPI.check();
waitFor(handle);
}
}
private native void waitFor(long win) throws MPIException;
private native void waitFor(long win) throws MPIException;
/**
/**
* Java binding of the MPI operation {@code MPI_WIN_TEST}.
* @return true if success
* @throws MPIException Signals that an MPI exception of some sort has occurred.
*/
public boolean test() throws MPIException
{
public boolean test() throws MPIException
{
MPI.check();
return test(handle);
}
}
private native boolean test(long win) throws MPIException;
private native boolean test(long win) throws MPIException;
/**
/**
* Java binding of the MPI operation {@code MPI_WIN_LOCK}.
* @param lockType either MPI.LOCK_EXCLUSIVE or MPI.LOCK_SHARED
* @param rank rank of locked window
* @param assertion program assertion
* @throws MPIException Signals that an MPI exception of some sort has occurred.
*/
public void lock(int lockType, int rank, int assertion) throws MPIException
{
public void lock(int lockType, int rank, int assertion) throws MPIException
{
MPI.check();
lock(handle, lockType, rank, assertion);
}
}
private native void lock(long win, int lockType, int rank, int assertion)
private native void lock(long win, int lockType, int rank, int assertion)
throws MPIException;
/**
/**
* Java binding of the MPI operation {@code MPI_WIN_UNLOCK}.
* @param rank rank of window
* @throws MPIException Signals that an MPI exception of some sort has occurred.
*/
public void unlock(int rank) throws MPIException
{
public void unlock(int rank) throws MPIException
{
MPI.check();
unlock(handle, rank);
}
}
private native void unlock(long win, int rank) throws MPIException;
private native void unlock(long win, int rank) throws MPIException;
/**
/**
* Java binding of the MPI operation {@code MPI_WIN_SET_ERRHANDLER}.
* @param errhandler new MPI error handler for window
* @throws MPIException Signals that an MPI exception of some sort has occurred.
*/
public void setErrhandler(Errhandler errhandler) throws MPIException
{
public void setErrhandler(Errhandler errhandler) throws MPIException
{
MPI.check();
setErrhandler(handle, errhandler.handle);
}
}
private native void setErrhandler(long win, long errhandler)
private native void setErrhandler(long win, long errhandler)
throws MPIException;
/**
/**
* Java binding of the MPI operation {@code MPI_WIN_CALL_ERRHANDLER}.
* @param errorCode error code
* @throws MPIException Signals that an MPI exception of some sort has occurred.
*/
public void callErrhandler(int errorCode) throws MPIException
{
public void callErrhandler(int errorCode) throws MPIException
{
callErrhandler(handle, errorCode);
}
}
private native void callErrhandler(long handle, int errorCode)
private native void callErrhandler(long handle, int errorCode)
throws MPIException;
/**
/**
* Create a new attribute key.
* <p>Java binding of the MPI operation {@code MPI_WIN_CREATE_KEYVAL}.
* @return attribute key for future access
* @throws MPIException Signals that an MPI exception of some sort has occurred.
*/
public static int createKeyval() throws MPIException
{
public static int createKeyval() throws MPIException
{
MPI.check();
return createKeyval_jni();
}
}
private static native int createKeyval_jni() throws MPIException;
private static native int createKeyval_jni() throws MPIException;
/**
/**
* Frees an attribute key.
* <p>Java binding of the MPI operation {@code MPI_WIN_FREE_KEYVAL}.
* @param keyval attribute key
* @throws MPIException Signals that an MPI exception of some sort has occurred.
*/
public static void freeKeyval(int keyval) throws MPIException
{
public static void freeKeyval(int keyval) throws MPIException
{
MPI.check();
freeKeyval_jni(keyval);
}
}
private static native void freeKeyval_jni(int keyval) throws MPIException;
private static native void freeKeyval_jni(int keyval) throws MPIException;
/**
/**
* Stores attribute value associated with a key.
* <p>Java binding of the MPI operation {@code MPI_WIN_SET_ATTR}.
* @param keyval attribute key
* @param value attribute value
* @throws MPIException Signals that an MPI exception of some sort has occurred.
*/
public void setAttr(int keyval, Object value) throws MPIException
{
public void setAttr(int keyval, Object value) throws MPIException
{
MPI.check();
setAttr(handle, keyval, MPI.attrSet(value));
}
}
private native void setAttr(long win, int keyval, byte[] value)
private native void setAttr(long win, int keyval, byte[] value)
throws MPIException;
/**
/**
* Retrieves attribute value by key.
* <p>Java binding of the MPI operation {@code MPI_WIN_GET_ATTR}.
* @param keyval attribute key
* @return attribute value or null if no attribute is associated with the key.
* @throws MPIException Signals that an MPI exception of some sort has occurred.
*/
public Object getAttr(int keyval) throws MPIException
{
public Object getAttr(int keyval) throws MPIException
{
MPI.check();
Object obj = getAttr(handle, keyval);
return obj instanceof byte[] ? MPI.attrGet((byte[])obj) : obj;
}
}
private native Object getAttr(long win, int keyval) throws MPIException;
private native Object getAttr(long win, int keyval) throws MPIException;
/**
/**
* Deletes an attribute value associated with a key.
* <p>Java binding of the MPI operation {@code MPI_WIN_DELETE_ATTR}.
* @param keyval attribute key
* @throws MPIException Signals that an MPI exception of some sort has occurred.
*/
public void deleteAttr(int keyval) throws MPIException
{
public void deleteAttr(int keyval) throws MPIException
{
MPI.check();
deleteAttr(handle, keyval);
}
}
private native void deleteAttr(long win, int keyval) throws MPIException;
private native void deleteAttr(long win, int keyval) throws MPIException;
/**
/**
* Java binding of {@code MPI_WIN_FREE}.
* @throws MPIException Signals that an MPI exception of some sort has occurred.
*/
@Override public void free() throws MPIException
{
@Override public void free() throws MPIException
{
MPI.check();
handle = free(handle);
}
}
private native long free(long win) throws MPIException;
private native long free(long win) throws MPIException;
/**
/**
* Java binding of the MPI operation {@code MPI_WIN_GET_INFO}.
* @return Info Info object associated with this window
* @throws MPIException Signals that an MPI exception of some sort has occurred.
*/
public Info getInfo() throws MPIException
{
public Info getInfo() throws MPIException
{
MPI.check();
return new Info(getInfo(handle));
}
}
private native long getInfo(long win)
private native long getInfo(long win)
throws MPIException;
/**
/**
* Java binding of the MPI operation {@code MPI_WIN_SET_INFO}.
* @param info the new info
* @throws MPIException Signals that an MPI exception of some sort has occurred.
*/
public void setInfo(Info info) throws MPIException
{
public void setInfo(Info info) throws MPIException
{
MPI.check();
setInfo(handle, info.handle);
}
}
private native void setInfo(long win, long info)
private native void setInfo(long win, long info)
throws MPIException;
/**
/**
* <p>Java binding of the MPI operation {@code MPI_RPUT}.
* @param origin_addr initial address of origin buffer
* @param origin_count number of entries in origin buffer
@ -566,25 +566,25 @@ private native void setInfo(long win, long info)
* @return RMA request
* @throws MPIException Signals that an MPI exception of some sort has occurred.
*/
public final Request rPut(Buffer origin_addr, int origin_count,
public final Request rPut(Buffer origin_addr, int origin_count,
Datatype origin_datatype, int target_rank, int target_disp,
int target_count, Datatype target_datatype)
throws MPIException
{
{
if(!origin_addr.isDirect())
throw new IllegalArgumentException("The origin must be direct buffer.");
return new Request(rPut(handle, origin_addr, origin_count,
origin_datatype.handle, target_rank, target_disp,
target_count, target_datatype.handle, getBaseType(origin_datatype, target_datatype)));
}
}
private native long rPut(long win, Buffer origin_addr, int origin_count,
private native long rPut(long win, Buffer origin_addr, int origin_count,
long origin_datatype, int target_rank, int target_disp,
int target_count, long target_datatype, int baseType)
throws MPIException;
/**
/**
* Java binding of {@code MPI_RGET}.
* @param origin origin buffer
* @param orgCount number of entries in origin buffer
@ -596,11 +596,11 @@ private native long rPut(long win, Buffer origin_addr, int origin_count,
* @return RMA request
* @throws MPIException Signals that an MPI exception of some sort has occurred.
*/
public final Request rGet(Buffer origin, int orgCount, Datatype orgType,
public final Request rGet(Buffer origin, int orgCount, Datatype orgType,
int targetRank, int targetDisp, int targetCount,
Datatype targetType)
throws MPIException
{
{
MPI.check();
if(!origin.isDirect())
@ -609,14 +609,14 @@ public final Request rGet(Buffer origin, int orgCount, Datatype orgType,
return new Request(rGet(handle, origin, orgCount, orgType.handle,
targetRank, targetDisp, targetCount, targetType.handle,
getBaseType(orgType, targetType)));
}
}
private native long rGet(
private native long rGet(
long win, Buffer origin, int orgCount, long orgType,
int targetRank, int targetDisp, int targetCount, long targetType,
int baseType) throws MPIException;
/**
/**
* Java binding of {@code MPI_RACCUMULATE}.
* @param origin origin buffer
* @param orgCount number of entries in origin buffer
@ -629,11 +629,11 @@ private native long rGet(
* @return RMA request
* @throws MPIException Signals that an MPI exception of some sort has occurred.
*/
public Request rAccumulate(Buffer origin, int orgCount, Datatype orgType,
public Request rAccumulate(Buffer origin, int orgCount, Datatype orgType,
int targetRank, int targetDisp, int targetCount,
Datatype targetType, Op op)
throws MPIException
{
{
MPI.check();
if(!origin.isDirect())
@ -642,14 +642,14 @@ public Request rAccumulate(Buffer origin, int orgCount, Datatype orgType,
return new Request(rAccumulate(handle, origin, orgCount, orgType.handle,
targetRank, targetDisp, targetCount, targetType.handle,
op, op.handle, getBaseType(orgType, targetType)));
}
}
private native long rAccumulate(
private native long rAccumulate(
long win, Buffer origin, int orgCount, long orgType,
int targetRank, int targetDisp, int targetCount, long targetType,
Op jOp, long hOp, int baseType) throws MPIException;
/**
/**
* Java binding of {@code MPI_GET_ACCUMULATE}.
* @param origin origin buffer
* @param orgCount number of entries in origin buffer
@ -665,12 +665,12 @@ private native long rAccumulate(
* @throws MPIException Signals that an MPI exception of some sort has occurred.
*/
public void getAccumulate(Buffer origin, int orgCount, Datatype orgType,
public void getAccumulate(Buffer origin, int orgCount, Datatype orgType,
Buffer resultAddr, int resultCount, Datatype resultType,
int targetRank, int targetDisp, int targetCount,
Datatype targetType, Op op)
throws MPIException
{
{
MPI.check();
if(!origin.isDirect())
@ -680,15 +680,15 @@ public void getAccumulate(Buffer origin, int orgCount, Datatype orgType,
resultAddr, resultCount, resultType.handle,
targetRank, targetDisp, targetCount, targetType.handle,
op, op.handle, getBaseType(orgType, targetType));
}
}
private native void getAccumulate(
private native void getAccumulate(
long win, Buffer origin, int orgCount, long orgType,
Buffer resultAddr, int resultCount, long resultType,
int targetRank, int targetDisp, int targetCount, long targetType,
Op jOp, long hOp, int baseType) throws MPIException;
/**
/**
* Java binding of {@code MPI_RGET_ACCUMULATE}.
* @param origin origin buffer
* @param orgCount number of entries in origin buffer
@ -705,12 +705,12 @@ private native void getAccumulate(
* @throws MPIException Signals that an MPI exception of some sort has occurred.
*/
public Request rGetAccumulate(Buffer origin, int orgCount, Datatype orgType,
public Request rGetAccumulate(Buffer origin, int orgCount, Datatype orgType,
Buffer resultAddr, int resultCount, Datatype resultType,
int targetRank, int targetDisp, int targetCount,
Datatype targetType, Op op)
throws MPIException
{
{
MPI.check();
if(!origin.isDirect())
@ -720,78 +720,78 @@ public Request rGetAccumulate(Buffer origin, int orgCount, Datatype orgType,
resultAddr, resultCount, resultType.handle,
targetRank, targetDisp, targetCount, targetType.handle,
op, op.handle, getBaseType(orgType, targetType)));
}
}
private native long rGetAccumulate(
private native long rGetAccumulate(
long win, Buffer origin, int orgCount, long orgType,
Buffer resultAddr, int resultCount, long resultType,
int targetRank, int targetDisp, int targetCount, long targetType,
Op jOp, long hOp, int baseType) throws MPIException;
/**
/**
* Java binding of the MPI operation {@code MPI_WIN_LOCK_ALL}.
* @param assertion program assertion
* @throws MPIException Signals that an MPI exception of some sort has occurred.
*/
public void lockAll(int assertion) throws MPIException
{
public void lockAll(int assertion) throws MPIException
{
MPI.check();
lockAll(handle, assertion);
}
}
private native void lockAll(long win, int assertion)
private native void lockAll(long win, int assertion)
throws MPIException;
/**
/**
* Java binding of the MPI operation {@code MPI_WIN_UNLOCK_ALL}.
* @throws MPIException Signals that an MPI exception of some sort has occurred.
*/
public void unlockAll() throws MPIException
{
public void unlockAll() throws MPIException
{
MPI.check();
unlockAll(handle);
}
}
private native void unlockAll(long win) throws MPIException;
private native void unlockAll(long win) throws MPIException;
/**
/**
* Java binding of the MPI operation {@code MPI_WIN_SYNC}.
* @throws MPIException Signals that an MPI exception of some sort has occurred.
*/
public void sync() throws MPIException
{
public void sync() throws MPIException
{
MPI.check();
sync(handle);
}
}
private native void sync(long win) throws MPIException;
private native void sync(long win) throws MPIException;
/**
/**
* Java binding of the MPI operation {@code MPI_WIN_FLUSH}.
* @param targetRank rank of target window
* @throws MPIException Signals that an MPI exception of some sort has occurred.
*/
public void flush(int targetRank) throws MPIException
{
public void flush(int targetRank) throws MPIException
{
MPI.check();
flush(handle, targetRank);
}
}
private native void flush(long win, int targetRank) throws MPIException;
private native void flush(long win, int targetRank) throws MPIException;
/**
/**
* Java binding of the MPI operation {@code MPI_WIN_FLUSH_ALL}.
* @throws MPIException Signals that an MPI exception of some sort has occurred.
*/
public void flushAll() throws MPIException
{
public void flushAll() throws MPIException
{
MPI.check();
flushAll(handle);
}
}
private native void flushAll(long win) throws MPIException;
private native void flushAll(long win) throws MPIException;
/**
/**
* Java binding of {@code MPI_COMPARE_AND_SWAP}.
* @param origin origin buffer
* @param compareAddr compare buffer
@ -802,10 +802,10 @@ private native void flushAll(long win) throws MPIException;
* @throws MPIException Signals that an MPI exception of some sort has occurred.
*/
public void compareAndSwap(Buffer origin, Buffer compareAddr, Buffer resultAddr,
public void compareAndSwap(Buffer origin, Buffer compareAddr, Buffer resultAddr,
Datatype targetType, int targetRank, int targetDisp)
throws MPIException
{
{
MPI.check();
if(!origin.isDirect())
@ -813,13 +813,13 @@ public void compareAndSwap(Buffer origin, Buffer compareAddr, Buffer resultAddr,
compareAndSwap(handle, origin, compareAddr, resultAddr,
targetType.handle, targetRank, targetDisp);
}
}
private native void compareAndSwap(
private native void compareAndSwap(
long win, Buffer origin, Buffer compareAddr, Buffer resultAddr,
long targetType, int targetRank, int targetDisp) throws MPIException;
/**
/**
* Java binding of {@code MPI_FETCH_AND_OP}.
* @param origin origin buffer
* @param resultAddr result buffer
@ -830,10 +830,10 @@ private native void compareAndSwap(
* @throws MPIException Signals that an MPI exception of some sort has occurred.
*/
public void fetchAndOp(Buffer origin, Buffer resultAddr, Datatype dataType,
public void fetchAndOp(Buffer origin, Buffer resultAddr, Datatype dataType,
int targetRank, int targetDisp, Op op)
throws MPIException
{
{
MPI.check();
if(!origin.isDirect())
@ -841,63 +841,63 @@ public void fetchAndOp(Buffer origin, Buffer resultAddr, Datatype dataType,
fetchAndOp(handle, origin, resultAddr, dataType.handle, targetRank,
targetDisp, op, op.handle, getBaseType(dataType, dataType));
}
}
private native void fetchAndOp(
private native void fetchAndOp(
long win, Buffer origin, Buffer resultAddr, long targetType, int targetRank,
int targetDisp, Op jOp, long hOp, int baseType) throws MPIException;
/**
/**
* Java binding of the MPI operation {@code MPI_WIN_FLUSH_LOCAL}.
* @param targetRank rank of target window
* @throws MPIException Signals that an MPI exception of some sort has occurred.
*/
public void flushLocal(int targetRank) throws MPIException
{
public void flushLocal(int targetRank) throws MPIException
{
MPI.check();
flushLocal(handle, targetRank);
}
}
private native void flushLocal(long win, int targetRank) throws MPIException;
private native void flushLocal(long win, int targetRank) throws MPIException;
/**
/**
* Java binding of the MPI operation {@code MPI_WIN_FLUSH_LOCAL_ALL}.
* @throws MPIException Signals that an MPI exception of some sort has occurred.
*/
public void flushLocalAll() throws MPIException
{
public void flushLocalAll() throws MPIException
{
MPI.check();
flushLocalAll(handle);
}
}
private native void flushLocalAll(long win) throws MPIException;
private native void flushLocalAll(long win) throws MPIException;
/**
/**
* Java binding of the MPI operation {@code MPI_WIN_GET_NAME}.
* @return the name associated with this window
* @throws MPIException Signals that an MPI exception of some sort has occurred.
*/
public String getName() throws MPIException
{
public String getName() throws MPIException
{
MPI.check();
return getName(handle);
}
}
private native String getName(long handle) throws MPIException;
private native String getName(long handle) throws MPIException;
/**
/**
* Java binding of the MPI operation {@code MPI_WIN_SET_NAME}.
* @param name the name to associate with this window
* @throws MPIException Signals that an MPI exception of some sort has occurred.
*/
public void setName(String name) throws MPIException
{
public void setName(String name) throws MPIException
{
MPI.check();
setName(handle, name);
}
}
private native void setName(long handle, String name) throws MPIException;
private native void setName(long handle, String name) throws MPIException;
} // Win