1
1

Merge pull request #746 from nrgraham23/formatting_fixes

Formatting fixes for Java files.
Этот коммит содержится в:
Howard Pritchard 2015-07-24 14:25:14 -06:00
родитель 13bfb2baab f87c41e926
Коммит dd231870a2
34 изменённых файлов: 11144 добавлений и 11128 удалений

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

@ -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,181 +52,181 @@ package mpi;
*/
public final class CartComm extends Intracomm
{
static
{
init();
}
static
{
init();
}
private static native void init();
private static native void init();
protected CartComm(long handle) throws MPIException
{
super(handle);
}
protected CartComm(long handle) throws MPIException
{
super(handle);
}
protected CartComm(long[] commRequest)
{
super(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()
{
try
{
return dup();
}
catch(MPIException e)
{
throw new RuntimeException(e.getMessage());
}
}
/**
* 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()
{
try
{
return dup();
}
catch(MPIException e)
{
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
{
MPI.check();
return new CartComm(dup(handle));
}
/**
* 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
{
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.
* The request object must be obtained calling {@link #getRequest}.
* @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
{
MPI.check();
return new CartComm(iDup(handle));
}
/**
* Duplicates this communicator.
* <p>Java binding of {@code MPI_COMM_IDUP}.
* <p>The new communicator can't be used before the operation completes.
* The request object must be obtained calling {@link #getRequest}.
* @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
{
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}.
* <p>The number of dimensions can be obtained from the size of (eg)
* {@code dims} field of the returned object.
* @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
{
MPI.check();
return getTopo(handle);
}
/**
* Returns cartesian topology information.
* <p>Java binding of the MPI operations {@code MPI_CARTDIM_GET} and
* {@code MPI_CART_GET}.
* <p>The number of dimensions can be obtained from the size of (eg)
* {@code dims} field of the returned object.
* @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
{
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
{
MPI.check();
return getRank(handle, coords);
}
/**
* 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
{
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
{
MPI.check();
return getCoords(handle, rank);
}
/**
* 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
{
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
* @param disp displacement
* @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
{
MPI.check();
return shift(handle, direction, disp);
}
/**
* 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
* @param disp displacement
* @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
{
MPI.check();
return shift(handle, direction, disp);
}
private native ShiftParms shift(long comm, int direction, int disp)
throws MPIException;
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,
* {@code false} otherwise
* @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
{
MPI.check();
return new CartComm(sub(handle, remainDims));
}
/**
* 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,
* {@code false} otherwise
* @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
{
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.
* @param dims the number of processes in each dimension
* @param periods {@code true} if grid is periodic,
* {@code false} if not, in each dimension
* @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
{
MPI.check();
return map(handle, dims, periods);
}
/**
* 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.
* @param dims the number of processes in each dimension
* @param periods {@code true} if grid is periodic,
* {@code false} if not, in each dimension
* @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
{
MPI.check();
return map(handle, dims, periods);
}
private native int map(long comm, int[] dims, boolean[] periods)
throws MPIException;
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
{
MPI.check();
createDims_jni(nnodes, dims);
}
/**
* 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
{
MPI.check();
createDims_jni(nnodes, dims);
}
private static native void createDims_jni(int nnodes, int[] dims)
throws MPIException;
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)
{
this.dims = dims;
this.periods = periods;
this.coords = 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)
{
this.dims = dims;
this.periods = periods;
this.coords = coords;
}
/**
* Returns the number of dimensions.
* @return number of dimensions.
*/
public int getDimCount()
{
return dims.length;
}
/**
* Returns the number of dimensions.
* @return number of dimensions.
*/
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)
{
return dims[i];
}
/**
* 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)
{
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)
{
return periods[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)
{
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)
{
return coords[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)
{
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,103 +22,100 @@ 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;
protected int PROC_NULL;
protected int UNDEFINED;
protected int IDENT, CONGRUENT, SIMILAR, UNEQUAL;
protected int TAG_UB, HOST, IO, WTIME_IS_GLOBAL;
protected int GRAPH, DIST_GRAPH, CART;
protected int ANY_SOURCE, ANY_TAG;
protected int PROC_NULL;
protected int UNDEFINED;
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;
protected int MAX_OBJECT_NAME, MAX_PORT_NAME, MAX_DATAREP_STRING;
protected int MAX_INFO_KEY, MAX_INFO_VAL;
protected int ORDER_C, ORDER_FORTRAN;
protected int VERSION, SUBVERSION;
protected int ROOT, KEYVAL_INVALID, BSEND_OVERHEAD;
protected int MAX_OBJECT_NAME, MAX_PORT_NAME, MAX_DATAREP_STRING;
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,
MODE_APPEND, MODE_SEQUENTIAL;
protected int MODE_CREATE, MODE_RDONLY, MODE_WRONLY, MODE_RDWR,
MODE_DELETE_ON_CLOSE, MODE_UNIQUE_OPEN, MODE_EXCL,
MODE_APPEND, MODE_SEQUENTIAL;
protected int DISPLACEMENT_CURRENT;
protected int SEEK_SET, SEEK_CUR, SEEK_END;
protected int DISPLACEMENT_CURRENT;
protected int SEEK_SET, SEEK_CUR, SEEK_END;
protected int MODE_NOCHECK, MODE_NOPRECEDE, MODE_NOPUT, MODE_NOSTORE,
MODE_NOSUCCEED;
protected int MODE_NOCHECK, MODE_NOPRECEDE, MODE_NOPUT, MODE_NOSTORE,
MODE_NOSUCCEED;
protected int LOCK_EXCLUSIVE, LOCK_SHARED;
protected int LOCK_EXCLUSIVE, LOCK_SHARED;
// Error classes and codes
protected int SUCCESS;
protected int ERR_BUFFER;
protected int ERR_COUNT;
protected int ERR_TYPE;
protected int ERR_TAG;
protected int ERR_COMM;
protected int ERR_RANK;
protected int ERR_REQUEST;
protected int ERR_ROOT;
protected int ERR_GROUP;
protected int ERR_OP;
protected int ERR_TOPOLOGY;
protected int ERR_DIMS;
protected int ERR_ARG;
protected int ERR_UNKNOWN;
protected int ERR_TRUNCATE;
protected int ERR_OTHER;
protected int ERR_INTERN;
protected int ERR_IN_STATUS;
protected int ERR_PENDING;
protected int ERR_ACCESS;
protected int ERR_AMODE;
protected int ERR_ASSERT;
protected int ERR_BAD_FILE;
protected int ERR_BASE;
protected int ERR_CONVERSION;
protected int ERR_DISP;
protected int ERR_DUP_DATAREP;
protected int ERR_FILE_EXISTS;
protected int ERR_FILE_IN_USE;
protected int ERR_FILE;
protected int ERR_INFO_KEY;
protected int ERR_INFO_NOKEY;
protected int ERR_INFO_VALUE;
protected int ERR_INFO;
protected int ERR_IO;
protected int ERR_KEYVAL;
protected int ERR_LOCKTYPE;
protected int ERR_NAME;
protected int ERR_NO_MEM;
protected int ERR_NOT_SAME;
protected int ERR_NO_SPACE;
protected int ERR_NO_SUCH_FILE;
protected int ERR_PORT;
protected int ERR_QUOTA;
protected int ERR_READ_ONLY;
protected int ERR_RMA_CONFLICT;
protected int ERR_RMA_SYNC;
protected int ERR_SERVICE;
protected int ERR_SIZE;
protected int ERR_SPAWN;
protected int ERR_UNSUPPORTED_DATAREP;
protected int ERR_UNSUPPORTED_OPERATION;
protected int ERR_WIN;
protected int ERR_LASTCODE;
protected int ERR_SYSRESOURCE;
// Error classes and codes
protected int SUCCESS;
protected int ERR_BUFFER;
protected int ERR_COUNT;
protected int ERR_TYPE;
protected int ERR_TAG;
protected int ERR_COMM;
protected int ERR_RANK;
protected int ERR_REQUEST;
protected int ERR_ROOT;
protected int ERR_GROUP;
protected int ERR_OP;
protected int ERR_TOPOLOGY;
protected int ERR_DIMS;
protected int ERR_ARG;
protected int ERR_UNKNOWN;
protected int ERR_TRUNCATE;
protected int ERR_OTHER;
protected int ERR_INTERN;
protected int ERR_IN_STATUS;
protected int ERR_PENDING;
protected int ERR_ACCESS;
protected int ERR_AMODE;
protected int ERR_ASSERT;
protected int ERR_BAD_FILE;
protected int ERR_BASE;
protected int ERR_CONVERSION;
protected int ERR_DISP;
protected int ERR_DUP_DATAREP;
protected int ERR_FILE_EXISTS;
protected int ERR_FILE_IN_USE;
protected int ERR_FILE;
protected int ERR_INFO_KEY;
protected int ERR_INFO_NOKEY;
protected int ERR_INFO_VALUE;
protected int ERR_INFO;
protected int ERR_IO;
protected int ERR_KEYVAL;
protected int ERR_LOCKTYPE;
protected int ERR_NAME;
protected int ERR_NO_MEM;
protected int ERR_NOT_SAME;
protected int ERR_NO_SPACE;
protected int ERR_NO_SUCH_FILE;
protected int ERR_PORT;
protected int ERR_QUOTA;
protected int ERR_READ_ONLY;
protected int ERR_RMA_CONFLICT;
protected int ERR_RMA_SYNC;
protected int ERR_SERVICE;
protected int ERR_SIZE;
protected int ERR_SPAWN;
protected int ERR_UNSUPPORTED_DATAREP;
protected int ERR_UNSUPPORTED_OPERATION;
protected int ERR_WIN;
protected int ERR_LASTCODE;
protected int ERR_SYSRESOURCE;
protected Constant()
{
setConstant();
}
protected Constant()
{
setConstant();
}
private native void setConstant();
private native void setConstant();
} // Constant

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

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

@ -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(
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;
}
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()
{
return sources.length;
}
/**
* Gets the number of edges into this process.
* @return number of edges into this process
*/
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()
{
return destinations.length;
}
/**
* Gets the number of edges out of this process.
* @return number of edges out of this process
*/
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()
{
return weighted;
}
/**
* Returns false if {@code MPI_UNWEIGHTED} was supplied during creation.
* @return false if {@code MPI_UNWEIGHTED} was supplied, true otherwise
*/
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)
{
return sources[i];
}
/**
* 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)
{
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)
{
return sourceWeights[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)
{
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)
{
return destinations[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)
{
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)
{
return destWeights[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)
{
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)
{
this.buffer = buffer;
this.offset = index * 2;
}
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)
{
return new DoubleComplex(buffer, 0);
}
/**
* Wraps a complex number stored in a buffer
* @param buffer buffer
* @return complex number
*/
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)
{
return new DoubleComplex(buffer, index);
}
/**
* 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)
{
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)
{
return new DoubleComplex(DoubleBuffer.wrap(array), 0);
}
/**
* 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)
{
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)
{
return new DoubleComplex(DoubleBuffer.wrap(array), index);
}
/**
* 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)
{
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)
{
return new DoubleComplex(buffer.asDoubleBuffer(), 0);
}
/**
* Wraps a complex number stored in a buffer
* @param buffer buffer
* @return complex number
*/
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)
{
return new DoubleComplex(buffer.asDoubleBuffer(), index);
}
/**
* 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)
{
return new DoubleComplex(buffer.asDoubleBuffer(), index);
}
/**
* Gets the real value.
* @return real value
*/
public double getReal()
{
return buffer.get(offset);
}
/**
* Gets the real value.
* @return real value
*/
public double getReal()
{
return buffer.get(offset);
}
/**
* Gets the imaginary value.
* @return imaginary value.
*/
public double getImag()
{
return buffer.get(offset + 1);
}
/**
* Gets the imaginary value.
* @return imaginary value.
*/
public double getImag()
{
return buffer.get(offset + 1);
}
/**
* Puts the real value.
* @param real real value
*/
public void putReal(double real)
{
buffer.put(offset, real);
}
/**
* Puts the real value.
* @param real real value
*/
public void putReal(double real)
{
buffer.put(offset, real);
}
/**
* Puts the imaginary value.
* @param imag imaginary value
*/
public void putImag(double imag)
{
buffer.put(offset + 1, imag);
}
/**
* Puts the imaginary value.
* @param imag imaginary value
*/
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()
{
return offset == 0 ? buffer : MPI.slice(buffer, offset);
}
/**
* Gets the buffer where the complex number is stored.
* @return buffer where the complex number is stored
*/
public DoubleBuffer getBuffer()
{
return offset == 0 ? buffer : MPI.slice(buffer, offset);
}
} // DoubleComplex

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

@ -25,91 +25,91 @@ 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)
{
int dOff = addDouble();
assert dOff == 0;
/**
* 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)
{
int dOff = addDouble();
assert dOff == 0;
iSize = intSize;
setOffset(intOff);
iSize = intSize;
setOffset(intOff);
switch(iSize)
{
case 4: iOff = addInt(); break;
case 8: iOff = addLong(); break;
default: throw new AssertionError("Unsupported int size: "+ iSize);
}
switch(iSize)
{
case 4: iOff = addInt(); break;
case 8: iOff = addLong(); break;
default: throw new AssertionError("Unsupported int size: "+ iSize);
}
assert(intOff == iOff);
}
assert(intOff == iOff);
}
/**
* Creates a Data object.
* @return new Data object.
*/
@Override protected DoubleInt.Data newData()
{
return new DoubleInt.Data();
}
/**
* Creates a Data object.
* @return new Data object.
*/
@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
{
/**
* Gets the double value.
* @return double value
*/
public double getValue()
{
return getDouble(0);
}
/**
* Class for reading/writing data in a struct stored in a byte buffer.
*/
public final class Data extends Struct.Data
{
/**
* Gets the double value.
* @return double value
*/
public double getValue()
{
return getDouble(0);
}
/**
* Gets the int value.
* @return int value
*/
public int getIndex()
{
switch(iSize)
{
case 4: return getInt(iOff);
case 8: return (int)getLong(iOff);
default: throw new AssertionError();
}
}
/**
* Gets the int value.
* @return int value
*/
public int getIndex()
{
switch(iSize)
{
case 4: return getInt(iOff);
case 8: return (int)getLong(iOff);
default: throw new AssertionError();
}
}
/**
* Puts the double value.
* @param v double value
*/
public void putValue(double v)
{
putDouble(0, v);
}
/**
* Puts the double value.
* @param v double value
*/
public void putValue(double v)
{
putDouble(0, v);
}
/**
* Puts the int value.
* @param v int value
*/
public void putIndex(int v)
{
switch(iSize)
{
case 4: putInt(iOff, v); break;
case 8: putLong(iOff, v); break;
default: throw new AssertionError();
}
}
} // Data
/**
* Puts the int value.
* @param v int value
*/
public void putIndex(int v)
{
switch(iSize)
{
case 4: putInt(iOff, v); break;
case 8: putLong(iOff, v); break;
default: throw new AssertionError();
}
}
} // 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)
{
this.handle = 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)
{
this.disp = disp;
this.etype = etype;
this.filetype = filetype;
this.datarep = 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)
{
this.disp = disp;
this.etype = etype;
this.filetype = filetype;
this.datarep = datarep;
}
/**
* Gets the displacement.
* @return displacement
*/
public long getDisp()
{
return disp;
}
/**
* Gets the displacement.
* @return displacement
*/
public long getDisp()
{
return disp;
}
/**
* Gets the elementary datatype.
* @return elementary datatype
*/
public Datatype getEType()
{
return etype;
}
/**
* Gets the elementary datatype.
* @return elementary datatype
*/
public Datatype getEType()
{
return etype;
}
/**
* Gets the file type.
* @return file type
*/
public Datatype getFileType()
{
return filetype;
}
/**
* Gets the file type.
* @return file type
*/
public Datatype getFileType()
{
return filetype;
}
/**
* Gets the data representation.
* @return data representation
*/
public String getDataRep()
{
return datarep;
}
/**
* Gets the data representation.
* @return data representation
*/
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)
{
this.buffer = buffer;
this.offset = index * 2;
}
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)
{
return new FloatComplex(buffer, 0);
}
/**
* Wraps a complex number stored in a buffer
* @param buffer buffer
* @return complex number
*/
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)
{
return new FloatComplex(buffer, index);
}
/**
* 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)
{
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)
{
return new FloatComplex(FloatBuffer.wrap(array), 0);
}
/**
* 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)
{
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)
{
return new FloatComplex(FloatBuffer.wrap(array), index);
}
/**
* 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)
{
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)
{
return new FloatComplex(buffer.asFloatBuffer(), 0);
}
/**
* Wraps a complex number stored in a buffer
* @param buffer buffer
* @return complex number
*/
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)
{
return new FloatComplex(buffer.asFloatBuffer(), index);
}
/**
* 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)
{
return new FloatComplex(buffer.asFloatBuffer(), index);
}
/**
* Gets the real value.
* @return real value
*/
public float getReal()
{
return buffer.get(offset);
}
/**
* Gets the real value.
* @return real value
*/
public float getReal()
{
return buffer.get(offset);
}
/**
* Gets the imaginary value.
* @return imaginary value.
*/
public float getImag()
{
return buffer.get(offset + 1);
}
/**
* Gets the imaginary value.
* @return imaginary value.
*/
public float getImag()
{
return buffer.get(offset + 1);
}
/**
* Puts the real value.
* @param real real value
*/
public void putReal(float real)
{
buffer.put(offset, real);
}
/**
* Puts the real value.
* @param real real value
*/
public void putReal(float real)
{
buffer.put(offset, real);
}
/**
* Puts the imaginary value.
* @param imag imaginary value
*/
public void putImag(float imag)
{
buffer.put(offset + 1, imag);
}
/**
* Puts the imaginary value.
* @param imag imaginary value
*/
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()
{
return offset == 0 ? buffer : MPI.slice(buffer, offset);
}
/**
* Gets the buffer where the complex number is stored.
* @return buffer where the complex number is stored
*/
public FloatBuffer getBuffer()
{
return offset == 0 ? buffer : MPI.slice(buffer, offset);
}
} // FloatComplex

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

@ -25,91 +25,91 @@ 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)
{
int fOff = addFloat();
assert fOff == 0;
/**
* 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)
{
int fOff = addFloat();
assert fOff == 0;
iSize = intSize;
setOffset(intOff);
iSize = intSize;
setOffset(intOff);
switch(iSize)
{
case 4: iOff = addInt(); break;
case 8: iOff = addLong(); break;
default: throw new AssertionError("Unsupported int size: "+ iSize);
}
switch(iSize)
{
case 4: iOff = addInt(); break;
case 8: iOff = addLong(); break;
default: throw new AssertionError("Unsupported int size: "+ iSize);
}
assert(intOff == iOff);
}
assert(intOff == iOff);
}
/**
* Creates a Data object.
* @return new Data object.
*/
@Override protected Data newData()
{
return new Data();
}
/**
* Creates a Data object.
* @return new Data object.
*/
@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
{
/**
* Gets the float value.
* @return float value
*/
public float getValue()
{
return getFloat(0);
}
/**
* Class for reading/writing data in a struct stored in a byte buffer.
*/
public final class Data extends Struct.Data
{
/**
* Gets the float value.
* @return float value
*/
public float getValue()
{
return getFloat(0);
}
/**
* Gets the int value.
* @return int value
*/
public int getIndex()
{
switch(iSize)
{
case 4: return getInt(iOff);
case 8: return (int)getLong(iOff);
default: throw new AssertionError();
}
}
/**
* Gets the int value.
* @return int value
*/
public int getIndex()
{
switch(iSize)
{
case 4: return getInt(iOff);
case 8: return (int)getLong(iOff);
default: throw new AssertionError();
}
}
/**
* Puts the float value.
* @param v float value
*/
public void putValue(float v)
{
putFloat(0, v);
}
/**
* Puts the float value.
* @param v float value
*/
public void putValue(float v)
{
putFloat(0, v);
}
/**
* Puts the int value.
* @param v int value
*/
public void putIndex(int v)
{
switch(iSize)
{
case 4: putInt(iOff, v); break;
case 8: putLong(iOff, v); break;
default: throw new AssertionError();
}
}
} // Data
/**
* Puts the int value.
* @param v int value
*/
public void putIndex(int v)
{
switch(iSize)
{
case 4: putInt(iOff, v); break;
case 8: putLong(iOff, v); break;
default: throw new AssertionError();
}
}
} // 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
@ -50,10 +50,10 @@ package mpi;
*/
public interface Freeable
{
/**
* Frees a freeable object.
* @throws MPIException Signals that an MPI exception of some sort has occurred.
*/
void free() throws MPIException;
/**
* Frees a freeable object.
* @throws MPIException Signals that an MPI exception of some sort has occurred.
*/
void free() throws MPIException;
}

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

@ -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,132 +52,132 @@ package mpi;
*/
public final class GraphComm extends Intracomm
{
static
{
init();
}
static
{
init();
}
private static native void init();
private static native void init();
protected GraphComm(long handle) throws MPIException
{
super(handle);
}
protected GraphComm(long handle) throws MPIException
{
super(handle);
}
protected GraphComm(long[] commRequest)
{
super(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()
{
try
{
return dup();
}
catch(MPIException e)
{
throw new RuntimeException(e.getMessage());
}
}
/**
* 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()
{
try
{
return dup();
}
catch(MPIException e)
{
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
{
MPI.check();
return new GraphComm(dup(handle));
}
/**
* 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
{
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}.
* <p>Java binding of {@code MPI_COMM_IDUP}.
* @return copy of this communicator
* @throws MPIException Signals that an MPI exception of some sort has occurred.
*/
@Override public GraphComm iDup() throws MPIException
{
MPI.check();
return new GraphComm(iDup(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}.
* <p>Java binding of {@code MPI_COMM_IDUP}.
* @return copy of this communicator
* @throws MPIException Signals that an MPI exception of some sort has occurred.
*/
@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}.
* <p>The number of nodes and number of edges can be extracted
* from the sizes of the {@code index} and {@code edges} fields
* of the returned object.
* @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
{
MPI.check();
return getDims(handle);
}
/**
* Returns graph topology information.
* <p>Java binding of the MPI operations {@code MPI_GRAPHDIMS_GET}
* and {@code MPI_GRAPH_GET}.
* <p>The number of nodes and number of edges can be extracted
* from the sizes of the {@code index} and {@code edges} fields
* of the returned object.
* @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
{
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}.
* <p>The number of neighbors can be extracted from the size of the result.
* @param rank rank of a process in the group of this communicator
* @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
{
MPI.check();
return getNeighbors(handle, rank);
}
/**
* Provides adjacency information for general graph topology.
* <p>Java binding of the MPI operations {@code MPI_GRAPH_NEIGHBORS_COUNT}
* and {@code MPI_GRAPH_NEIGHBORS}.
* <p>The number of neighbors can be extracted from the size of the result.
* @param rank rank of a process in the group of this communicator
* @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
{
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
{
MPI.check();
return getDistGraphNeighbors(handle);
}
/**
* 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
{
MPI.check();
return getDistGraphNeighbors(handle);
}
private native DistGraphNeighbors getDistGraphNeighbors(long comm)
throws MPIException;
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.
* @param index node degrees
* @param edges graph edges
* @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
{
MPI.check();
return map(handle, index, edges);
}
/**
* 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.
* @param index node degrees
* @param edges graph edges
* @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
{
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,66 +52,66 @@ 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)
{
this.index = index;
this.edges = edges;
}
/**
* Constructs a graph topology information object.
* @param index node degrees.
* @param edges graph 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()
{
return index.length;
}
/**
* Returns the number of nodes.
* @return number of nodes.
*/
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)
{
return index[i];
}
/**
* 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)
{
return index[i];
}
/**
* Returns the number of edges.
* @return number of edges.
*/
public int getEdgeCount()
{
return edges.length;
}
/**
* Returns the number of edges.
* @return number of edges.
*/
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
* of neighbors of node {@code i}, {@code i} &gt; {@code 0}, is stored
* in {@code getEdge(j)}, {@code getIndex(i-1)} &le; {@code j} &le;
* {@code getIndex(i)-1}.
* @param i index of the edge.
* @return the edge.
*/
public int getEdge(int i)
{
return edges[i];
}
/**
* 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
* of neighbors of node {@code i}, {@code i} &gt; {@code 0}, is stored
* in {@code getEdge(j)}, {@code getIndex(i-1)} &le; {@code j} &le;
* {@code getIndex(i)-1}.
* @param i index of the edge.
* @return the edge.
*/
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,223 +52,223 @@ package mpi;
*/
public final class Group implements Freeable
{
protected long handle;
private static long nullHandle;
protected long handle;
private static long nullHandle;
static
{
init();
}
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)
{
this.handle = 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
{
MPI.check();
return getSize(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
{
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
{
MPI.check();
return getRank(handle);
}
/**
* 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
{
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
{
MPI.check();
handle = free(handle);
}
/**
* Java binding of the MPI operation {@code MPI_GROUP_FREE}.
*/
@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()
{
return handle == nullHandle;
}
/**
* Test if group object is null.
* @return true if the group object is null.
*/
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.
* @param group1 a group
* @param ranks1 array of valid ranks in group1
* @param group2 another group
* @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)
throws MPIException
{
MPI.check();
return translateRanks(group1.handle, ranks1, group2.handle);
}
/**
* 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.
* @param group1 a group
* @param ranks1 array of valid ranks in group1
* @param group2 another group
* @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)
throws MPIException
{
MPI.check();
return translateRanks(group1.handle, ranks1, group2.handle);
}
private static native int[] translateRanks(
long group1, int[] ranks1, long group2) throws MPIException;
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
* @param group2 second group
* @return {@code MPI.IDENT} if the group members and group order are exactly
* the same in both groups, {@code MPI.SIMILAR} if the group members are
* 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
{
MPI.check();
return compare(group1.handle, group2.handle);
}
/**
* Compare two groups.
* <p>Java binding of the MPI operation {@code MPI_GROUP_COMPARE}.
* @param group1 first group
* @param group2 second group
* @return {@code MPI.IDENT} if the group members and group order are exactly
* the same in both groups, {@code MPI.SIMILAR} if the group members are
* 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
{
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
* @param group2 second group
* @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
{
MPI.check();
return new Group(union(group1.handle, group2.handle));
}
/**
* Set union of two groups.
* <p>Java binding of the MPI operation {@code MPI_GROUP_UNION}.
* @param group1 first group
* @param group2 second group
* @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
{
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
* @param group2 second group
* @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
{
MPI.check();
return new Group(intersection(group1.handle, group2.handle));
}
/**
* Set intersection of two groups.
* Java binding of the MPI operation {@code MPI_GROUP_INTERSECTION}.
* @param group1 first group
* @param group2 second group
* @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
{
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
* @param group2 second group
* @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
{
MPI.check();
return new Group(difference(group1.handle, group2.handle));
}
/**
* Set difference of two groups.
* Java binding of the MPI operation {@code MPI_GROUP_DIFFERENCE}.
* @param group1 first group
* @param group2 second group
* @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
{
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
{
MPI.check();
return new Group(incl(handle, ranks));
}
/**
* 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
{
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
{
MPI.check();
return new Group(excl(handle, 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
{
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}.
* <p>The triplets are of the form (first rank, last rank, stride)
* indicating ranks in this group to be included in the new group.
* The size of the first dimension of {@code ranges} is the number
* of triplets. The size of the second dimension is 3.
* @param ranges array of integer triplets
* @return new group
* @throws MPIException Signals that an MPI exception of some sort has occurred.
*/
public Group rangeIncl(int[][] ranges) throws MPIException
{
MPI.check();
return new Group(rangeIncl(handle, ranges));
}
/**
* Create a subset group including processes specified
* by strided intervals of ranks.
* <p>Java binding of the MPI operation {@code MPI_GROUP_RANGE_INCL}.
* <p>The triplets are of the form (first rank, last rank, stride)
* indicating ranks in this group to be included in the new group.
* The size of the first dimension of {@code ranges} is the number
* of triplets. The size of the second dimension is 3.
* @param ranges array of integer triplets
* @return new group
* @throws MPIException Signals that an MPI exception of some sort has occurred.
*/
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}.
* <p>Triplet array is defined as for {@code rangeIncl}, the ranges
* indicating ranks in this group to be excluded from the new group.
* @param ranges array of integer triplets
* @return new group
* @throws MPIException Signals that an MPI exception of some sort has occurred.
*/
public Group rangeExcl(int[][] ranges) throws MPIException
{
MPI.check();
return new Group(rangeExcl(handle, 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}.
* <p>Triplet array is defined as for {@code rangeIncl}, the ranges
* indicating ranks in this group to be excluded from the new group.
* @param ranges array of integer triplets
* @return new group
* @throws MPIException Signals that an MPI exception of some sort has occurred.
*/
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,155 +25,155 @@ 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
{
MPI.check();
handle = create();
}
/**
* 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
{
MPI.check();
handle = create();
}
protected Info(long handle)
{
this.handle = handle;
}
protected Info(long handle)
{
this.handle = handle;
}
private native long create();
private native long create();
protected static Info newEnv()
{
return new Info(getEnv());
}
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
{
MPI.check();
set(handle, key, value);
}
/**
* 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
{
MPI.check();
set(handle, key, value);
}
private native void set(long handle, String key, String value)
throws MPIException;
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
{
MPI.check();
return get(handle, key);
}
/**
* 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
{
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
{
MPI.check();
delete(handle, key);
}
/**
* 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
{
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
{
MPI.check();
return size(handle);
}
/**
* 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
{
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
{
MPI.check();
return getKey(handle, i);
}
/**
* 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
{
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()
{
try
{
return dup();
}
catch(MPIException e)
{
throw new RuntimeException(e.getMessage());
}
}
/**
* 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()
{
try
{
return dup();
}
catch(MPIException e)
{
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
{
MPI.check();
return new Info(dup(handle));
}
/**
* 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
{
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
{
MPI.check();
handle = free(handle);
}
/**
* 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
{
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()
{
return isNull(handle);
}
/**
* 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()
{
return isNull(handle);
}
private native boolean isNull(long handle);
private native boolean isNull(long handle);
} // Info

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

@ -25,103 +25,103 @@ 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)
{
iSize = intSize;
int off = addIntField();
assert off == 0;
setOffset(intOff);
iOff = addIntField();
assert intOff == iOff;
}
/**
* 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)
{
iSize = intSize;
int off = addIntField();
assert off == 0;
setOffset(intOff);
iOff = addIntField();
assert intOff == iOff;
}
private int addIntField()
{
switch(iSize)
{
case 4: return addInt();
case 8: return addLong();
default: throw new AssertionError("Unsupported int size: "+ iSize);
}
}
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()
{
return new Int2.Data();
}
/**
* Creates a Data object.
* @return new Data object.
*/
@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
{
/**
* Gets the first int.
* @return first int
*/
public int getValue()
{
return get(0);
}
/**
* Class for reading/writing data in a struct stored in a byte buffer.
*/
public final class Data extends Struct.Data
{
/**
* Gets the first int.
* @return first int
*/
public int getValue()
{
return get(0);
}
/**
* Gets the second int.
* @return second int
*/
public int getIndex()
{
return get(iOff);
}
/**
* Gets the second int.
* @return second int
*/
public int getIndex()
{
return get(iOff);
}
/**
* Puts the first int.
* @param v first value
*/
public void putValue(int v)
{
put(0, v);
}
/**
* Puts the first int.
* @param v first value
*/
public void putValue(int v)
{
put(0, v);
}
/**
* Puts the second int.
* @param v second int
*/
public void putIndex(int v)
{
put(iOff, v);
}
/**
* Puts the second int.
* @param v second int
*/
public void putIndex(int v)
{
put(iOff, v);
}
private int get(int off)
{
switch(iSize)
{
case 4: return getInt(off);
case 8: return (int)getLong(off);
default: throw new AssertionError();
}
}
private int get(int off)
{
switch(iSize)
{
case 4: return getInt(off);
case 8: return (int)getLong(off);
default: throw new AssertionError();
}
}
private void put(int off, int v)
{
switch(iSize)
{
case 4: putInt(off, v); break;
case 8: putLong(off, v); break;
default: throw new AssertionError();
}
}
} // Data
private void put(int off, int v)
{
switch(iSize)
{
case 4: putInt(off, v); break;
case 8: putLong(off, v); break;
default: throw new AssertionError();
}
}
} // 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,117 +52,117 @@ package mpi;
*/
public final class Intercomm extends Comm
{
protected Intercomm(long handle)
{
super(handle);
}
protected Intercomm(long handle)
{
super(handle);
}
protected Intercomm(long[] commRequest)
{
super(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()
{
try
{
return dup();
}
catch(MPIException e)
{
throw new RuntimeException(e.getMessage());
}
}
/**
* 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()
{
try
{
return dup();
}
catch(MPIException e)
{
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
{
MPI.check();
return new Intercomm(dup(handle));
}
/**
* 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
{
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.
* The request object must be obtained calling {@link #getRequest}.
* @return copy of this communicator
* @throws MPIException Signals that an MPI exception of some sort has occurred.
*/
@Override public Intercomm iDup() throws MPIException
{
MPI.check();
return new Intercomm(iDup(handle));
}
/**
* Duplicates this communicator.
* <p>Java binding of {@code MPI_COMM_IDUP}.
* <p>The new communicator can't be used before the operation completes.
* The request object must be obtained calling {@link #getRequest}.
* @return copy of this communicator
* @throws MPIException Signals that an MPI exception of some sort has occurred.
*/
@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
{
MPI.check();
return getRemoteSize_jni();
}
/**
* 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
{
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
{
MPI.check();
return new Group(getRemoteGroup_jni());
}
/**
* 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
{
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
{
MPI.check();
return new Intracomm(merge_jni(high));
}
/**
* 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
{
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
{
MPI.check();
return new Intercomm(getParent_jni());
}
/**
* 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
{
MPI.check();
return new Intercomm(getParent_jni());
}
private native static long getParent_jni() throws MPIException;
private native static long getParent_jni() throws MPIException;
} // Intercomm

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

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

@ -25,110 +25,110 @@ 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)
{
lSize = longSize;
iSize = intSize;
int lOff;
/**
* 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)
{
lSize = longSize;
iSize = intSize;
int lOff;
switch(lSize)
{
case 4: lOff = addInt(); break;
case 8: lOff = addLong(); break;
default: throw new AssertionError("Unsupported long size: "+ lSize);
}
switch(lSize)
{
case 4: lOff = addInt(); break;
case 8: lOff = addLong(); break;
default: throw new AssertionError("Unsupported long size: "+ lSize);
}
assert lOff == 0;
setOffset(intOff);
assert lOff == 0;
setOffset(intOff);
switch(iSize)
{
case 4: iOff = addInt(); break;
case 8: iOff = addLong(); break;
default: throw new AssertionError("Unsupported int size: "+ iSize);
}
switch(iSize)
{
case 4: iOff = addInt(); break;
case 8: iOff = addLong(); break;
default: throw new AssertionError("Unsupported int size: "+ iSize);
}
assert(intOff == iOff);
}
assert(intOff == iOff);
}
/**
* Creates a Data object.
* @return new Data object.
*/
@Override protected LongInt.Data newData()
{
return new LongInt.Data();
}
/**
* Creates a Data object.
* @return new Data object.
*/
@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
{
/**
* Gets the long value.
* @return long value
*/
public long getValue()
{
switch(lSize)
{
case 8: return getLong(0);
case 4: return getInt(0);
default: throw new AssertionError();
}
}
/**
* Class for reading/writing data in a struct stored in a byte buffer.
*/
public final class Data extends Struct.Data
{
/**
* Gets the long value.
* @return long value
*/
public long getValue()
{
switch(lSize)
{
case 8: return getLong(0);
case 4: return getInt(0);
default: throw new AssertionError();
}
}
/**
* Gets the int value.
* @return int value
*/
public int getIndex()
{
switch(iSize)
{
case 4: return getInt(iOff);
case 8: return (int)getLong(iOff);
default: throw new AssertionError();
}
}
/**
* Gets the int value.
* @return int value
*/
public int getIndex()
{
switch(iSize)
{
case 4: return getInt(iOff);
case 8: return (int)getLong(iOff);
default: throw new AssertionError();
}
}
/**
* Puts the long value.
* @param v long value
*/
public void putValue(long v)
{
switch(lSize)
{
case 8: putLong(0, v); break;
case 4: putInt(0, (int)v); break;
default: throw new AssertionError();
}
}
/**
* Puts the long value.
* @param v long value
*/
public void putValue(long v)
{
switch(lSize)
{
case 8: putLong(0, v); break;
case 4: putInt(0, (int)v); break;
default: throw new AssertionError();
}
}
/**
* Puts the int value.
* @param v int value
*/
public void putIndex(int v)
{
switch(iSize)
{
case 4: putInt(iOff, v); break;
case 8: putLong(iOff, v); break;
default: throw new AssertionError();
}
}
} // Data
/**
* Puts the int value.
* @param v int value
*/
public void putIndex(int v)
{
switch(iSize)
{
case 4: putInt(iOff, v); break;
case 8: putLong(iOff, v); break;
default: throw new AssertionError();
}
}
} // 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)
{
super(message);
errorCode = code;
errorClass = clazz;
}
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)
{
super(message);
}
/**
* Creates an exception.
* @param message message associated to the exception
*/
public MPIException(String message)
{
super(message);
}
/**
* Creates an exception:
* @param cause cause associated to the exception
*/
public MPIException(Throwable cause)
{
super(cause);
setStackTrace(cause.getStackTrace());
}
/**
* Creates an exception:
* @param cause cause associated to the exception
*/
public MPIException(Throwable cause)
{
super(cause);
setStackTrace(cause.getStackTrace());
}
/**
* Gets the MPI error code.
* @return error code
*/
public int getErrorCode()
{
return errorCode;
}
/**
* Gets the MPI error code.
* @return error code
*/
public int getErrorCode()
{
return errorCode;
}
/**
* Gets the MPI error class.
* @return error class
*/
public int getErrorClass()
{
return errorClass;
}
/**
* Gets the MPI error class.
* @return error class
*/
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,126 +36,126 @@ 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
{
init();
}
static
{
init();
}
private static native void init();
private static native void init();
/**
* Creates a {@code MPI_MESSAGE_NULL}.
*/
public Message()
{
handle = NULL;
}
/**
* Creates a {@code MPI_MESSAGE_NULL}.
*/
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()
{
return handle == NULL;
}
/**
* Tests if the message is {@code MPI_MESSAGE_NULL}.
* @return true if the message is {@code MPI_MESSAGE_NULL}.
*/
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()
{
return handle == NO_PROC;
}
/**
* Tests if the message is {@code MPI_MESSAGE_NO_PROC}.
* @return true if the message is {@code MPI_MESSAGE_NO_PROC}.
*/
public boolean isNoProc()
{
return handle == NO_PROC;
}
/**
* Java binding of {@code MPI_MPROBE}.
* @param source rank of the source
* @param tag message tag
* @param comm communicator
* @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
{
MPI.check();
Status status = new Status();
handle = mProbe(source, tag, comm.handle, status.data);
return status;
}
/**
* Java binding of {@code MPI_MPROBE}.
* @param source rank of the source
* @param tag message tag
* @param comm communicator
* @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
{
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)
throws MPIException;
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
* @param comm communicator
* @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
{
MPI.check();
return imProbe(source, tag, comm.handle);
}
/**
* Java binding of {@code MPI_IMPROBE}.
* @param source rank of the source
* @param tag message tag
* @param comm communicator
* @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
{
MPI.check();
return imProbe(source, tag, comm.handle);
}
private native Status imProbe(int source, int tag, long comm)
throws MPIException;
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
* @param type datatype of each receive buffer element
* @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
{
MPI.check();
int off = 0;
boolean db = false;
Status status = new Status();
/**
* Java binding of {@code MPI_MRECV}.
* @param buf receive buffer
* @param count number of elements in receve buffer
* @param type datatype of each receive buffer element
* @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
{
MPI.check();
int off = 0;
boolean db = false;
Status status = new Status();
if(buf instanceof Buffer && !(db = ((Buffer)buf).isDirect()))
{
off = type.getOffset(buf);
buf = ((Buffer)buf).array();
}
if(buf instanceof Buffer && !(db = ((Buffer)buf).isDirect()))
{
off = type.getOffset(buf);
buf = ((Buffer)buf).array();
}
handle = mRecv(handle, buf, db, off, count,
type.handle, type.baseType, status.data);
handle = mRecv(handle, buf, db, off, count,
type.handle, type.baseType, status.data);
return status;
}
return status;
}
private native long mRecv(
long message, Object buf, boolean db, int offset, int count,
long type, int baseType, long[] status) throws MPIException;
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
* @param type datatype of each receive buffer element
* @return request object
* @throws MPIException Signals that an MPI exception of some sort has occurred.
*/
public Request imRecv(Buffer buf, int count, Datatype type)
throws MPIException
{
MPI.check();
assertDirectBuffer(buf);
return new Request(imRecv(handle, buf, count, type.handle));
}
/**
* Java binding of {@code MPI_IMRECV}.
* @param buf receive buffer
* @param count number of elements in receve buffer
* @param type datatype of each receive buffer element
* @return request object
* @throws MPIException Signals that an MPI exception of some sort has occurred.
*/
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)
throws MPIException;
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,80 +54,80 @@ 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
{
init();
}
static
{
init();
}
private static native void init();
private static native void init();
protected Op(int type)
{
getOp(type);
uf = null;
commute = true;
}
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)
{
handle = 0; // When JNI code gets the handle it will be initialized.
uf = function;
this.commute = commute;
}
/**
* 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)
{
handle = 0; // When JNI code gets the handle it will be initialized.
uf = function;
this.commute = commute;
}
protected void setDatatype(Datatype t)
{
datatype = t;
}
protected void setDatatype(Datatype t)
{
datatype = t;
}
protected void call(Object invec, Object inoutvec, int count)
throws MPIException
{
if(datatype.baseType == Datatype.BOOLEAN)
{
uf.call(invec, inoutvec, count, datatype);
}
else
{
uf.call(((ByteBuffer)invec).order(ByteOrder.nativeOrder()),
((ByteBuffer)inoutvec).order(ByteOrder.nativeOrder()),
count, datatype);
}
}
protected void call(Object invec, Object inoutvec, int count)
throws MPIException
{
if(datatype.baseType == Datatype.BOOLEAN)
{
uf.call(invec, inoutvec, count, datatype);
}
else
{
uf.call(((ByteBuffer)invec).order(ByteOrder.nativeOrder()),
((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()
{
return commute;
}
/**
* 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()
{
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;
/**
* 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;
/**
* Test if operation object is null.
* @return true if the operation object is null, false otherwise
*/
public native boolean isNull();
/**
* Test if operation object is null.
* @return true if the operation object is null, false otherwise
*/
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,45 +52,45 @@ 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)
{
super(handle);
}
/**
* Constructor used by {@code sendInit}, etc.
* @param handle Handle for the Prequest object
*/
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
* one of the {@code wait} or {@code test} operations.
* On successful completion the request becomes inactive again.
* 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
{
handle = start(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
* one of the {@code wait} or {@code test} operations.
* On successful completion the request becomes inactive again.
* 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
{
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
{
MPI.check();
long[] r = getHandles(requests);
startAll(r);
setHandles(requests, r);
}
/**
* 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
{
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,402 +68,402 @@ package mpi;
*/
public class Request implements Freeable
{
protected long handle;
protected long handle;
static
{
init();
}
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)
{
this.handle = 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
{
if(!isNull())
{
MPI.check();
handle = free(handle);
}
}
/**
* Set the request object to be void.
* Java binding of the MPI operation {@code MPI_REQUEST_FREE}.
*/
@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
{
MPI.check();
cancel(handle);
}
/**
* 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
{
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()
{
return handle == 0 || handle == MPI.REQUEST_NULL.handle;
}
/**
* Test if request object is null.
* @return true if the request object is null, false otherwise
*/
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
{
MPI.check();
Status status = new Status();
handle = waitStatus(handle, status.data);
return status;
}
/**
* 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
{
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
{
MPI.check();
handle = waitFor(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.
* @throws MPIException Signals that an MPI exception of some sort has occurred.
*/
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}.
* <p>After the call, if the operation is complete (ie, if the return
* value is non-null), the request object becomes inactive.
* @return status object
* @throws MPIException Signals that an MPI exception of some sort has occurred.
*/
public final Status testStatus() throws MPIException
{
MPI.check();
return testStatus(handle);
}
/**
* 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}.
* <p>After the call, if the operation is complete (ie, if the return
* value is non-null), the request object becomes inactive.
* @return status object
* @throws MPIException Signals that an MPI exception of some sort has occurred.
*/
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}.
* <p>After the call, if the operation is complete (ie, if the return
* value is true), the request object becomes inactive.
* @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
{
MPI.check();
return test(handle);
}
/**
* Returns true if the operation identified by the request
* is complete, or false otherwise.
* <p>Java binding of the MPI operation {@code MPI_TEST}.
* <p>After the call, if the operation is complete (ie, if the return
* value is true), the request object becomes inactive.
* @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
{
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}.
* <p>The index in array of {@code requests} for the request that
* completed can be obtained from the returned status object through
* the {@code Status.getIndex()} method. The corresponding element
* of array of {@code requests} becomes inactive.
* @param requests array of requests
* @return status object
* @throws MPIException Signals that an MPI exception of some sort has occurred.
*/
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;
}
/**
* 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}.
* <p>The index in array of {@code requests} for the request that
* completed can be obtained from the returned status object through
* the {@code Status.getIndex()} method. The corresponding element
* of array of {@code requests} becomes inactive.
* @param requests array of requests
* @return status object
* @throws MPIException Signals that an MPI exception of some sort has occurred.
*/
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)
throws MPIException;
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}.
* <p>The request that completed becomes inactive.
* @param requests array of requests
* @return The index in array of {@code requests} for the request that
* completed. If all of the requests are MPI_REQUEST_NULL, then index
* 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
{
MPI.check();
long[] r = getHandles(requests);
int index = waitAny(r);
setHandles(requests, r);
return index;
}
/**
* 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}.
* <p>The request that completed becomes inactive.
* @param requests array of requests
* @return The index in array of {@code requests} for the request that
* completed. If all of the requests are MPI_REQUEST_NULL, then index
* 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
{
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}.
* <p>If some request completed, the index in array of {@code requests}
* for that request can be obtained from the returned status object.
* The corresponding element in array of {@code requests} becomes inactive.
* If no request completed, {testAny} returns {@code null}.
* @param requests array of requests
* @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
{
MPI.check();
long[] r = getHandles(requests);
Status status = testAnyStatus(r);
setHandles(requests, r);
return status;
}
/**
* 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}.
* <p>If some request completed, the index in array of {@code requests}
* for that request can be obtained from the returned status object.
* The corresponding element in array of {@code requests} becomes inactive.
* If no request completed, {testAny} returns {@code null}.
* @param requests array of requests
* @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
{
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}.
* <p>If some request completed, ii becomes inactive.
* @param requests array of requests
* @return index of operation that completed, or {@code MPI.UNDEFINED}
* if none completed.
* @throws MPIException Signals that an MPI exception of some sort has occurred.
*/
public static int testAny(Request[] requests) throws MPIException
{
MPI.check();
long[] r = getHandles(requests);
int index = testAny(r);
setHandles(requests, r);
return index;
}
/**
* 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}.
* <p>If some request completed, ii becomes inactive.
* @param requests array of requests
* @return index of operation that completed, or {@code MPI.UNDEFINED}
* if none completed.
* @throws MPIException Signals that an MPI exception of some sort has occurred.
*/
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}.
* <p>On exit, requests become inactive. If the <em>input</em> value of
* array of {@code requests} contains inactive requests, corresponding
* elements of the status array will contain null status references.
* @param requests array of requests
* @return array of statuses
* @throws MPIException Signals that an MPI exception of some sort has occurred.
*/
public static Status[] waitAllStatus(Request[] requests) throws MPIException
{
MPI.check();
long[] r = getHandles(requests);
Status[] status = waitAllStatus(r);
setHandles(requests, r);
return status;
}
/**
* 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}.
* <p>On exit, requests become inactive. If the <em>input</em> value of
* array of {@code requests} contains inactive requests, corresponding
* elements of the status array will contain null status references.
* @param requests array of requests
* @return array of statuses
* @throws MPIException Signals that an MPI exception of some sort has occurred.
*/
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)
throws MPIException;
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
{
MPI.check();
long[] r = getHandles(requests);
waitAll(r);
setHandles(requests, r);
}
/**
* 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
{
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}.
* <p>If all operations have completed, the exit value of the argument array
* is as for {@code waitAllStatus}.
* @param requests array of requests
* @return array of statuses if all operations have completed,
* {@code null} otherwise.
* @throws MPIException Signals that an MPI exception of some sort has occurred.
*/
public static Status[] testAllStatus(Request[] requests) throws MPIException
{
MPI.check();
long[] r = getHandles(requests);
Status[] status = testAllStatus(r);
setHandles(requests, r);
return status;
}
/**
* Tests for completion of <em>all</em> of the operations associated
* with active requests.
* <p>Java binding of the MPI operation {@code MPI_TESTALL}.
* <p>If all operations have completed, the exit value of the argument array
* is as for {@code waitAllStatus}.
* @param requests array of requests
* @return array of statuses if all operations have completed,
* {@code null} otherwise.
* @throws MPIException Signals that an MPI exception of some sort has occurred.
*/
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)
throws MPIException;
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}.
* @param requests array of requests
* @return {@code true} if all operations have completed,
* {@code false} otherwise.
* @throws MPIException Signals that an MPI exception of some sort has occurred.
*/
public static boolean testAll(Request[] requests) throws MPIException
{
MPI.check();
long[] r = getHandles(requests);
boolean completed = testAll(r);
setHandles(requests, r);
return completed;
}
/**
* Tests for completion of <em>all</em> of the operations associated
* with active requests.
* <p>Java binding of the MPI operation {@code MPI_TESTALL}.
* @param requests array of requests
* @return {@code true} if all operations have completed,
* {@code false} otherwise.
* @throws MPIException Signals that an MPI exception of some sort has occurred.
*/
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}.
* <p>The size of the result array will be the number of operations that
* completed. The index in array of {@code requests} for each request that
* completed can be obtained from the returned status objects through the
* {@code Status.getIndex()} method. The corresponding element in
* array of {@code requests} becomes inactive.
* @param requests array of requests
* @return array of statuses or {@code null} if the number of operations
* 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
{
MPI.check();
long[] r = getHandles(requests);
Status[] status = waitSomeStatus(r);
setHandles(requests, r);
return status;
}
/**
* 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}.
* <p>The size of the result array will be the number of operations that
* completed. The index in array of {@code requests} for each request that
* completed can be obtained from the returned status objects through the
* {@code Status.getIndex()} method. The corresponding element in
* array of {@code requests} becomes inactive.
* @param requests array of requests
* @return array of statuses or {@code null} if the number of operations
* 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
{
MPI.check();
long[] r = getHandles(requests);
Status[] status = waitSomeStatus(r);
setHandles(requests, r);
return status;
}
private static native Status[] waitSomeStatus(long[] requests)
throws MPIException;
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}.
* <p>The size of the result array will be the number of operations that
* completed. The corresponding element in array of {@code requests} becomes
* inactive.
* @param requests array of requests
* @return array of indexes of {@code requests} that completed or {@code null}
* 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
{
MPI.check();
long[] r = getHandles(requests);
int[] indexes = waitSome(r);
setHandles(requests, r);
return indexes;
}
/**
* 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}.
* <p>The size of the result array will be the number of operations that
* completed. The corresponding element in array of {@code requests} becomes
* inactive.
* @param requests array of requests
* @return array of indexes of {@code requests} that completed or {@code null}
* 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
{
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
* length zero, otherwise the return value are as for {@code waitSome}.
* @param requests array of requests
* @return array of statuses
* @throws MPIException Signals that an MPI exception of some sort has occurred.
*/
public static Status[] testSomeStatus(Request[] requests) throws MPIException
{
MPI.check();
long[] r = getHandles(requests);
Status[] status = testSomeStatus(r);
setHandles(requests, r);
return status;
}
/**
* 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
* length zero, otherwise the return value are as for {@code waitSome}.
* @param requests array of requests
* @return array of statuses
* @throws MPIException Signals that an MPI exception of some sort has occurred.
*/
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)
throws MPIException;
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
* length zero, otherwise the return value are as for {@code waitSome}.
* @param requests array of 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
{
MPI.check();
long[] r = getHandles(requests);
int[] indexes = testSome(r);
setHandles(requests, r);
return indexes;
}
/**
* 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
* length zero, otherwise the return value are as for {@code waitSome}.
* @param requests array of 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
{
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)
{
long[] h = new long[r.length];
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;
for(int i = 0; i < r.length; i++)
h[i] = r[i].handle;
return h;
}
return h;
}
protected static void setHandles(Request[] r, long[] h)
{
for(int i = 0; i < r.length; i++)
r[i].handle = h[i];
}
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)
{
this.rankSource = rankSource;
this.rankDest = rankDest;
}
protected ShiftParms(int rankSource, int rankDest)
{
this.rankSource = rankSource;
this.rankDest = rankDest;
}
/**
* Gets the source rank.
* @return source rank
*/
public int getRankSource()
{
return rankSource;
}
/**
* Gets the source rank.
* @return source rank
*/
public int getRankSource()
{
return rankSource;
}
/**
* Gets the destination rank.
* @return destination rank
*/
public int getRankDest()
{
return rankDest;
}
/**
* Gets the destination rank.
* @return destination rank
*/
public int getRankDest()
{
return rankDest;
}
} // ShiftParms

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

@ -25,113 +25,113 @@ 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)
{
sSize = shortSize;
iSize = intSize;
int sOff;
/**
* 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)
{
sSize = shortSize;
iSize = intSize;
int sOff;
switch(sSize)
{
case 2: sOff = addShort(); break;
case 4: sOff = addInt(); break;
case 8: sOff = addLong(); break;
default: throw new AssertionError("Unsupported short size: "+ sSize);
}
switch(sSize)
{
case 2: sOff = addShort(); break;
case 4: sOff = addInt(); break;
case 8: sOff = addLong(); break;
default: throw new AssertionError("Unsupported short size: "+ sSize);
}
assert sOff == 0;
setOffset(intOff);
assert sOff == 0;
setOffset(intOff);
switch(iSize)
{
case 4: iOff = addInt(); break;
case 8: iOff = addLong(); break;
default: throw new AssertionError("Unsupported int size: "+ iSize);
}
switch(iSize)
{
case 4: iOff = addInt(); break;
case 8: iOff = addLong(); break;
default: throw new AssertionError("Unsupported int size: "+ iSize);
}
assert(intOff == iOff);
}
assert(intOff == iOff);
}
/**
* Creates a Data object.
* @return new Data object.
*/
@Override protected Data newData()
{
return new Data();
}
/**
* Creates a Data object.
* @return new Data object.
*/
@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
{
/**
* Gets the short value.
* @return short value
*/
public short getValue()
{
switch(sSize)
{
case 2: return getShort(0);
case 4: return (short)getInt(0);
case 8: return (short)getLong(0);
default: throw new AssertionError();
}
}
/**
* Class for reading/writing data in a struct stored in a byte buffer.
*/
public final class Data extends Struct.Data
{
/**
* Gets the short value.
* @return short value
*/
public short getValue()
{
switch(sSize)
{
case 2: return getShort(0);
case 4: return (short)getInt(0);
case 8: return (short)getLong(0);
default: throw new AssertionError();
}
}
/**
* Gets the int value.
* @return int value
*/
public int getIndex()
{
switch(iSize)
{
case 4: return getInt(iOff);
case 8: return (int)getLong(iOff);
default: throw new AssertionError();
}
}
/**
* Gets the int value.
* @return int value
*/
public int getIndex()
{
switch(iSize)
{
case 4: return getInt(iOff);
case 8: return (int)getLong(iOff);
default: throw new AssertionError();
}
}
/**
* Puts the short value.
* @param v short value
*/
public void putValue(short v)
{
switch(sSize)
{
case 2: putShort(0, v); break;
case 4: putInt(0, v); break;
case 8: putLong(0, v); break;
default: throw new AssertionError();
}
}
/**
* Puts the short value.
* @param v short value
*/
public void putValue(short v)
{
switch(sSize)
{
case 2: putShort(0, v); break;
case 4: putInt(0, v); break;
case 8: putLong(0, v); break;
default: throw new AssertionError();
}
}
/**
* Puts the int value.
* @param v int value
*/
public void putIndex(int v)
{
switch(iSize)
{
case 4: putInt(iOff, v); break;
case 8: putLong(iOff, v); break;
default: throw new AssertionError();
}
}
} // Data
/**
* Puts the int value.
* @param v int value
*/
public void putIndex(int v)
{
switch(iSize)
{
case 4: putInt(iOff, v); break;
case 8: putLong(iOff, v); break;
default: throw new AssertionError();
}
}
} // 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,127 +52,127 @@ package mpi;
*/
public final class Status
{
protected final long[] data;
protected final long[] data;
static
{
init();
}
static
{
init();
}
private static native void init();
private static native void init();
/**
* Status objects must be created only by the MPI methods.
*/
protected Status()
{
data = new long[6];
}
/**
* Status objects must be created only by the MPI methods.
*/
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
{
MPI.check();
int i = 0;
int source = (int)data[i++];
int tag = (int)data[i++];
int error = (int)data[i++];
int cancelled = (int)data[i++];
long ucount = data[i++];
return getCount(source, tag, error, cancelled, ucount, datatype.handle);
}
/**
* 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
{
MPI.check();
int i = 0;
int source = (int)data[i++];
int tag = (int)data[i++];
int error = (int)data[i++];
int cancelled = (int)data[i++];
long ucount = data[i++];
return getCount(source, tag, error, cancelled, ucount, datatype.handle);
}
private native int getCount(
int source, int tag, int error,
int cancelled, long ucount, long datatype) throws MPIException;
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
{
MPI.check();
int i = 0;
int source = (int)data[i++];
int tag = (int)data[i++];
int error = (int)data[i++];
int cancelled = (int)data[i++];
long ucount = data[i++];
return isCancelled(source, tag, error, cancelled, ucount);
}
/**
* 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
{
MPI.check();
int i = 0;
int source = (int)data[i++];
int tag = (int)data[i++];
int error = (int)data[i++];
int cancelled = (int)data[i++];
long ucount = data[i++];
return isCancelled(source, tag, error, cancelled, ucount);
}
private native boolean isCancelled(
int source, int tag, int error, int cancelled, long ucount)
throws MPIException;
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
{
MPI.check();
int i = 0;
int source = (int)data[i++];
int tag = (int)data[i++];
int error = (int)data[i++];
int cancelled = (int)data[i++];
long ucount = data[i++];
return getElements(source, tag, error, cancelled, ucount, datatype.handle);
}
/**
* 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
{
MPI.check();
int i = 0;
int source = (int)data[i++];
int tag = (int)data[i++];
int error = (int)data[i++];
int cancelled = (int)data[i++];
long ucount = data[i++];
return getElements(source, tag, error, cancelled, ucount, datatype.handle);
}
private native int getElements(
int source, int tag, int error,
int cancelled, long ucount, long datatype) throws MPIException;
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()
{
return (int)data[0];
}
/**
* Returns the "source" of message.
* <p>Java binding of the MPI value {@code MPI_SOURCE}.
* @return source of message
*/
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()
{
return (int)data[1];
}
/**
* Returns the "tag" of message.
* <p>Java binding of the MPI value {@code MPI_TAG}.
* @return tag of message
*/
public int getTag()
{
return (int)data[1];
}
/**
* Returns the {@code MPI_ERROR} of message.
* @return error of message.
*/
public int getError()
{
return (int)data[2];
}
/**
* Returns the {@code MPI_ERROR} of message.
* @return error of message.
*/
public int getError()
{
return (int)data[2];
}
/**
* Returns the index of message.
* @return index of message.
*/
public int getIndex()
{
return (int)data[5];
}
/**
* Returns the index of message.
* @return index of message.
*/
public int getIndex()
{
return (int)data[5];
}
} // Status

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

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

@ -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,158 +54,158 @@ 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
* @param count number of items in arrays
* @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)
throws MPIException
{
throw new UnsupportedOperationException("Not supported yet.");
}
/**
* 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
* @param count number of items in arrays
* @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)
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
* @param count number of items in buffers
* @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)
throws MPIException
{
switch(datatype.baseType)
{
case Datatype.BYTE:
vCall(in, inOut, count, datatype);
break;
case Datatype.CHAR:
vCall(in.asCharBuffer(), inOut.asCharBuffer(), count, datatype);
break;
case Datatype.SHORT:
vCall(in.asShortBuffer(), inOut.asShortBuffer(), count, datatype);
break;
case Datatype.INT:
vCall(in.asIntBuffer(), inOut.asIntBuffer(), count, datatype);
break;
case Datatype.LONG:
vCall(in.asLongBuffer(), inOut.asLongBuffer(), count, datatype);
break;
case Datatype.FLOAT:
vCall(in.asFloatBuffer(), inOut.asFloatBuffer(), count, datatype);
break;
case Datatype.DOUBLE:
vCall(in.asDoubleBuffer(), inOut.asDoubleBuffer(), count, datatype);
break;
case Datatype.PACKED:
vCall(in, inOut, count, datatype);
break;
default:
throw new IllegalArgumentException("Unsupported datatype.");
}
}
/**
* 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
* @param count number of items in buffers
* @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)
throws MPIException
{
switch(datatype.baseType)
{
case Datatype.BYTE:
vCall(in, inOut, count, datatype);
break;
case Datatype.CHAR:
vCall(in.asCharBuffer(), inOut.asCharBuffer(), count, datatype);
break;
case Datatype.SHORT:
vCall(in.asShortBuffer(), inOut.asShortBuffer(), count, datatype);
break;
case Datatype.INT:
vCall(in.asIntBuffer(), inOut.asIntBuffer(), count, datatype);
break;
case Datatype.LONG:
vCall(in.asLongBuffer(), inOut.asLongBuffer(), count, datatype);
break;
case Datatype.FLOAT:
vCall(in.asFloatBuffer(), inOut.asFloatBuffer(), count, datatype);
break;
case Datatype.DOUBLE:
vCall(in.asDoubleBuffer(), inOut.asDoubleBuffer(), count, datatype);
break;
case Datatype.PACKED:
vCall(in, inOut, count, datatype);
break;
default:
throw new IllegalArgumentException("Unsupported datatype.");
}
}
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];
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];
in.get(inVec);
inOut.get(inOutVec);
call(inVec, inOutVec, count, datatype);
inOut.clear();
inOut.put(inOutVec);
}
in.get(inVec);
inOut.get(inOutVec);
call(inVec, inOutVec, count, datatype);
inOut.clear();
inOut.put(inOutVec);
}
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];
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];
inBuf.get(inVec);
inOutBuf.get(inOutVec);
call(inVec, inOutVec, count, datatype);
inOutBuf.clear();
inOutBuf.put(inOutVec);
}
inBuf.get(inVec);
inOutBuf.get(inOutVec);
call(inVec, inOutVec, count, datatype);
inOutBuf.clear();
inOutBuf.put(inOutVec);
}
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];
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];
inBuf.get(inVec);
inOutBuf.get(inOutVec);
call(inVec, inOutVec, count, datatype);
inOutBuf.clear();
inOutBuf.put(inOutVec);
}
inBuf.get(inVec);
inOutBuf.get(inOutVec);
call(inVec, inOutVec, count, datatype);
inOutBuf.clear();
inOutBuf.put(inOutVec);
}
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];
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];
inBuf.get(inVec);
inOutBuf.get(inOutVec);
call(inVec, inOutVec, count, datatype);
inOutBuf.clear();
inOutBuf.put(inOutVec);
}
inBuf.get(inVec);
inOutBuf.get(inOutVec);
call(inVec, inOutVec, count, datatype);
inOutBuf.clear();
inOutBuf.put(inOutVec);
}
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];
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];
inBuf.get(inVec);
inOutBuf.get(inOutVec);
call(inVec, inOutVec, count, datatype);
inOutBuf.clear();
inOutBuf.put(inOutVec);
}
inBuf.get(inVec);
inOutBuf.get(inOutVec);
call(inVec, inOutVec, count, datatype);
inOutBuf.clear();
inOutBuf.put(inOutVec);
}
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];
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];
inBuf.get(inVec);
inOutBuf.get(inOutVec);
call(inVec, inOutVec, count, datatype);
inOutBuf.clear();
inOutBuf.put(inOutVec);
}
inBuf.get(inVec);
inOutBuf.get(inOutVec);
call(inVec, inOutVec, count, datatype);
inOutBuf.clear();
inOutBuf.put(inOutVec);
}
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];
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];
inBuf.get(inVec);
inOutBuf.get(inOutVec);
call(inVec, inOutVec, count, datatype);
inOutBuf.clear();
inOutBuf.put(inOutVec);
}
inBuf.get(inVec);
inOutBuf.get(inOutVec);
call(inVec, inOutVec, count, datatype);
inOutBuf.clear();
inOutBuf.put(inOutVec);
}
} // UserFunction

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