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

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

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

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

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

@ -9,6 +9,8 @@
* University of Stuttgart. All rights reserved. * University of Stuttgart. All rights reserved.
* Copyright (c) 2004-2005 The Regents of the University of California. * Copyright (c) 2004-2005 The Regents of the University of California.
* All rights reserved. * All rights reserved.
* Copyright (c) 2015 Los Alamos National Security, LLC. All rights
* reserved.
* $COPYRIGHT$ * $COPYRIGHT$
* *
* Additional copyrights may follow * Additional copyrights may follow
@ -20,103 +22,100 @@ package mpi;
class Constant class Constant
{ {
protected int THREAD_SINGLE, THREAD_FUNNELED, THREAD_SERIALIZED, protected int THREAD_SINGLE, THREAD_FUNNELED, THREAD_SERIALIZED, THREAD_MULTIPLE;
THREAD_MULTIPLE;
protected int GRAPH, DIST_GRAPH, CART; protected int GRAPH, DIST_GRAPH, CART;
protected int ANY_SOURCE, ANY_TAG; protected int ANY_SOURCE, ANY_TAG;
protected int PROC_NULL; protected int PROC_NULL;
protected int UNDEFINED; protected int UNDEFINED;
protected int IDENT, CONGRUENT, SIMILAR, UNEQUAL; protected int IDENT, CONGRUENT, SIMILAR, UNEQUAL;
protected int TAG_UB, HOST, IO, WTIME_IS_GLOBAL; protected int TAG_UB, HOST, IO, WTIME_IS_GLOBAL;
protected int APPNUM, LASTUSEDCODE, UNIVERSE_SIZE, WIN_BASE, WIN_SIZE, protected int APPNUM, LASTUSEDCODE, UNIVERSE_SIZE, WIN_BASE, WIN_SIZE, WIN_DISP_UNIT;
WIN_DISP_UNIT;
protected int VERSION, SUBVERSION; protected int VERSION, SUBVERSION;
protected int ROOT, KEYVAL_INVALID, BSEND_OVERHEAD; protected int ROOT, KEYVAL_INVALID, BSEND_OVERHEAD;
protected int MAX_OBJECT_NAME, MAX_PORT_NAME, MAX_DATAREP_STRING; protected int MAX_OBJECT_NAME, MAX_PORT_NAME, MAX_DATAREP_STRING;
protected int MAX_INFO_KEY, MAX_INFO_VAL; protected int MAX_INFO_KEY, MAX_INFO_VAL;
protected int ORDER_C, ORDER_FORTRAN; protected int ORDER_C, ORDER_FORTRAN;
protected int DISTRIBUTE_BLOCK, DISTRIBUTE_CYCLIC, DISTRIBUTE_NONE, protected int DISTRIBUTE_BLOCK, DISTRIBUTE_CYCLIC, DISTRIBUTE_NONE, DISTRIBUTE_DFLT_DARG;
DISTRIBUTE_DFLT_DARG;
protected int MODE_CREATE, MODE_RDONLY, MODE_WRONLY, MODE_RDWR, protected int MODE_CREATE, MODE_RDONLY, MODE_WRONLY, MODE_RDWR,
MODE_DELETE_ON_CLOSE, MODE_UNIQUE_OPEN, MODE_EXCL, MODE_DELETE_ON_CLOSE, MODE_UNIQUE_OPEN, MODE_EXCL,
MODE_APPEND, MODE_SEQUENTIAL; MODE_APPEND, MODE_SEQUENTIAL;
protected int DISPLACEMENT_CURRENT; protected int DISPLACEMENT_CURRENT;
protected int SEEK_SET, SEEK_CUR, SEEK_END; protected int SEEK_SET, SEEK_CUR, SEEK_END;
protected int MODE_NOCHECK, MODE_NOPRECEDE, MODE_NOPUT, MODE_NOSTORE, protected int MODE_NOCHECK, MODE_NOPRECEDE, MODE_NOPUT, MODE_NOSTORE,
MODE_NOSUCCEED; MODE_NOSUCCEED;
protected int LOCK_EXCLUSIVE, LOCK_SHARED; protected int LOCK_EXCLUSIVE, LOCK_SHARED;
// Error classes and codes // Error classes and codes
protected int SUCCESS; protected int SUCCESS;
protected int ERR_BUFFER; protected int ERR_BUFFER;
protected int ERR_COUNT; protected int ERR_COUNT;
protected int ERR_TYPE; protected int ERR_TYPE;
protected int ERR_TAG; protected int ERR_TAG;
protected int ERR_COMM; protected int ERR_COMM;
protected int ERR_RANK; protected int ERR_RANK;
protected int ERR_REQUEST; protected int ERR_REQUEST;
protected int ERR_ROOT; protected int ERR_ROOT;
protected int ERR_GROUP; protected int ERR_GROUP;
protected int ERR_OP; protected int ERR_OP;
protected int ERR_TOPOLOGY; protected int ERR_TOPOLOGY;
protected int ERR_DIMS; protected int ERR_DIMS;
protected int ERR_ARG; protected int ERR_ARG;
protected int ERR_UNKNOWN; protected int ERR_UNKNOWN;
protected int ERR_TRUNCATE; protected int ERR_TRUNCATE;
protected int ERR_OTHER; protected int ERR_OTHER;
protected int ERR_INTERN; protected int ERR_INTERN;
protected int ERR_IN_STATUS; protected int ERR_IN_STATUS;
protected int ERR_PENDING; protected int ERR_PENDING;
protected int ERR_ACCESS; protected int ERR_ACCESS;
protected int ERR_AMODE; protected int ERR_AMODE;
protected int ERR_ASSERT; protected int ERR_ASSERT;
protected int ERR_BAD_FILE; protected int ERR_BAD_FILE;
protected int ERR_BASE; protected int ERR_BASE;
protected int ERR_CONVERSION; protected int ERR_CONVERSION;
protected int ERR_DISP; protected int ERR_DISP;
protected int ERR_DUP_DATAREP; protected int ERR_DUP_DATAREP;
protected int ERR_FILE_EXISTS; protected int ERR_FILE_EXISTS;
protected int ERR_FILE_IN_USE; protected int ERR_FILE_IN_USE;
protected int ERR_FILE; protected int ERR_FILE;
protected int ERR_INFO_KEY; protected int ERR_INFO_KEY;
protected int ERR_INFO_NOKEY; protected int ERR_INFO_NOKEY;
protected int ERR_INFO_VALUE; protected int ERR_INFO_VALUE;
protected int ERR_INFO; protected int ERR_INFO;
protected int ERR_IO; protected int ERR_IO;
protected int ERR_KEYVAL; protected int ERR_KEYVAL;
protected int ERR_LOCKTYPE; protected int ERR_LOCKTYPE;
protected int ERR_NAME; protected int ERR_NAME;
protected int ERR_NO_MEM; protected int ERR_NO_MEM;
protected int ERR_NOT_SAME; protected int ERR_NOT_SAME;
protected int ERR_NO_SPACE; protected int ERR_NO_SPACE;
protected int ERR_NO_SUCH_FILE; protected int ERR_NO_SUCH_FILE;
protected int ERR_PORT; protected int ERR_PORT;
protected int ERR_QUOTA; protected int ERR_QUOTA;
protected int ERR_READ_ONLY; protected int ERR_READ_ONLY;
protected int ERR_RMA_CONFLICT; protected int ERR_RMA_CONFLICT;
protected int ERR_RMA_SYNC; protected int ERR_RMA_SYNC;
protected int ERR_SERVICE; protected int ERR_SERVICE;
protected int ERR_SIZE; protected int ERR_SIZE;
protected int ERR_SPAWN; protected int ERR_SPAWN;
protected int ERR_UNSUPPORTED_DATAREP; protected int ERR_UNSUPPORTED_DATAREP;
protected int ERR_UNSUPPORTED_OPERATION; protected int ERR_UNSUPPORTED_OPERATION;
protected int ERR_WIN; protected int ERR_WIN;
protected int ERR_LASTCODE; protected int ERR_LASTCODE;
protected int ERR_SYSRESOURCE; protected int ERR_SYSRESOURCE;
protected Constant() protected Constant()
{ {
setConstant(); setConstant();
} }
private native void setConstant(); private native void setConstant();
} // Constant } // Constant

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

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

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

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

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

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

@ -25,91 +25,91 @@ package mpi;
*/ */
public final class DoubleInt extends Struct 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. * The struct object will be created only in MPI class.
* @param intOff int offset * @param intOff int offset
* @param intSize int size * @param intSize int size
* @see MPI#doubleInt * @see MPI#doubleInt
*/ */
protected DoubleInt(int intOff, int intSize) protected DoubleInt(int intOff, int intSize)
{ {
int dOff = addDouble(); int dOff = addDouble();
assert dOff == 0; assert dOff == 0;
iSize = intSize; iSize = intSize;
setOffset(intOff); setOffset(intOff);
switch(iSize) switch(iSize)
{ {
case 4: iOff = addInt(); break; case 4: iOff = addInt(); break;
case 8: iOff = addLong(); break; case 8: iOff = addLong(); break;
default: throw new AssertionError("Unsupported int size: "+ iSize); default: throw new AssertionError("Unsupported int size: "+ iSize);
} }
assert(intOff == iOff); assert(intOff == iOff);
} }
/** /**
* Creates a Data object. * Creates a Data object.
* @return new Data object. * @return new Data object.
*/ */
@Override protected DoubleInt.Data newData() @Override protected DoubleInt.Data newData()
{ {
return new DoubleInt.Data(); return new DoubleInt.Data();
} }
/** /**
* Class for reading/writing data in a struct stored in a byte buffer. * Class for reading/writing data in a struct stored in a byte buffer.
*/ */
public final class Data extends Struct.Data public final class Data extends Struct.Data
{ {
/** /**
* Gets the double value. * Gets the double value.
* @return double value * @return double value
*/ */
public double getValue() public double getValue()
{ {
return getDouble(0); return getDouble(0);
} }
/** /**
* Gets the int value. * Gets the int value.
* @return int value * @return int value
*/ */
public int getIndex() public int getIndex()
{ {
switch(iSize) switch(iSize)
{ {
case 4: return getInt(iOff); case 4: return getInt(iOff);
case 8: return (int)getLong(iOff); case 8: return (int)getLong(iOff);
default: throw new AssertionError(); default: throw new AssertionError();
} }
} }
/** /**
* Puts the double value. * Puts the double value.
* @param v double value * @param v double value
*/ */
public void putValue(double v) public void putValue(double v)
{ {
putDouble(0, v); putDouble(0, v);
} }
/** /**
* Puts the int value. * Puts the int value.
* @param v int value * @param v int value
*/ */
public void putIndex(int v) public void putIndex(int v)
{ {
switch(iSize) switch(iSize)
{ {
case 4: putInt(iOff, v); break; case 4: putInt(iOff, v); break;
case 8: putLong(iOff, v); break; case 8: putLong(iOff, v); break;
default: throw new AssertionError(); default: throw new AssertionError();
} }
} }
} // Data } // Data
} // DoubleInt } // DoubleInt

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

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

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

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

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

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

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

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

@ -25,91 +25,91 @@ package mpi;
*/ */
public final class FloatInt extends Struct 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. * The struct object will be created only in MPI class.
* @param intOff int offset * @param intOff int offset
* @param intSize int size * @param intSize int size
* @see MPI#floatInt * @see MPI#floatInt
*/ */
protected FloatInt(int intOff, int intSize) protected FloatInt(int intOff, int intSize)
{ {
int fOff = addFloat(); int fOff = addFloat();
assert fOff == 0; assert fOff == 0;
iSize = intSize; iSize = intSize;
setOffset(intOff); setOffset(intOff);
switch(iSize) switch(iSize)
{ {
case 4: iOff = addInt(); break; case 4: iOff = addInt(); break;
case 8: iOff = addLong(); break; case 8: iOff = addLong(); break;
default: throw new AssertionError("Unsupported int size: "+ iSize); default: throw new AssertionError("Unsupported int size: "+ iSize);
} }
assert(intOff == iOff); assert(intOff == iOff);
} }
/** /**
* Creates a Data object. * Creates a Data object.
* @return new Data object. * @return new Data object.
*/ */
@Override protected Data newData() @Override protected Data newData()
{ {
return new Data(); return new Data();
} }
/** /**
* Class for reading/writing data in a struct stored in a byte buffer. * Class for reading/writing data in a struct stored in a byte buffer.
*/ */
public final class Data extends Struct.Data public final class Data extends Struct.Data
{ {
/** /**
* Gets the float value. * Gets the float value.
* @return float value * @return float value
*/ */
public float getValue() public float getValue()
{ {
return getFloat(0); return getFloat(0);
} }
/** /**
* Gets the int value. * Gets the int value.
* @return int value * @return int value
*/ */
public int getIndex() public int getIndex()
{ {
switch(iSize) switch(iSize)
{ {
case 4: return getInt(iOff); case 4: return getInt(iOff);
case 8: return (int)getLong(iOff); case 8: return (int)getLong(iOff);
default: throw new AssertionError(); default: throw new AssertionError();
} }
} }
/** /**
* Puts the float value. * Puts the float value.
* @param v float value * @param v float value
*/ */
public void putValue(float v) public void putValue(float v)
{ {
putFloat(0, v); putFloat(0, v);
} }
/** /**
* Puts the int value. * Puts the int value.
* @param v int value * @param v int value
*/ */
public void putIndex(int v) public void putIndex(int v)
{ {
switch(iSize) switch(iSize)
{ {
case 4: putInt(iOff, v); break; case 4: putInt(iOff, v); break;
case 8: putLong(iOff, v); break; case 8: putLong(iOff, v); break;
default: throw new AssertionError(); default: throw new AssertionError();
} }
} }
} // Data } // Data
} // FloatInt } // FloatInt

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

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

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

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

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

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

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

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

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

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

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

@ -25,103 +25,103 @@ package mpi;
*/ */
public final class Int2 extends Struct 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. * The struct object will be created only in MPI class.
* @param intOff int offset * @param intOff int offset
* @param intSize int size * @param intSize int size
* @see MPI#int2 * @see MPI#int2
*/ */
protected Int2(int intOff, int intSize) protected Int2(int intOff, int intSize)
{ {
iSize = intSize; iSize = intSize;
int off = addIntField(); int off = addIntField();
assert off == 0; assert off == 0;
setOffset(intOff); setOffset(intOff);
iOff = addIntField(); iOff = addIntField();
assert intOff == iOff; assert intOff == iOff;
} }
private int addIntField() private int addIntField()
{ {
switch(iSize) switch(iSize)
{ {
case 4: return addInt(); case 4: return addInt();
case 8: return addLong(); case 8: return addLong();
default: throw new AssertionError("Unsupported int size: "+ iSize); default: throw new AssertionError("Unsupported int size: "+ iSize);
} }
} }
/** /**
* Creates a Data object. * Creates a Data object.
* @return new Data object. * @return new Data object.
*/ */
@Override protected Int2.Data newData() @Override protected Int2.Data newData()
{ {
return new Int2.Data(); return new Int2.Data();
} }
/** /**
* Class for reading/writing data in a struct stored in a byte buffer. * Class for reading/writing data in a struct stored in a byte buffer.
*/ */
public final class Data extends Struct.Data public final class Data extends Struct.Data
{ {
/** /**
* Gets the first int. * Gets the first int.
* @return first int * @return first int
*/ */
public int getValue() public int getValue()
{ {
return get(0); return get(0);
} }
/** /**
* Gets the second int. * Gets the second int.
* @return second int * @return second int
*/ */
public int getIndex() public int getIndex()
{ {
return get(iOff); return get(iOff);
} }
/** /**
* Puts the first int. * Puts the first int.
* @param v first value * @param v first value
*/ */
public void putValue(int v) public void putValue(int v)
{ {
put(0, v); put(0, v);
} }
/** /**
* Puts the second int. * Puts the second int.
* @param v second int * @param v second int
*/ */
public void putIndex(int v) public void putIndex(int v)
{ {
put(iOff, v); put(iOff, v);
} }
private int get(int off) private int get(int off)
{ {
switch(iSize) switch(iSize)
{ {
case 4: return getInt(off); case 4: return getInt(off);
case 8: return (int)getLong(off); case 8: return (int)getLong(off);
default: throw new AssertionError(); default: throw new AssertionError();
} }
} }
private void put(int off, int v) private void put(int off, int v)
{ {
switch(iSize) switch(iSize)
{ {
case 4: putInt(off, v); break; case 4: putInt(off, v); break;
case 8: putLong(off, v); break; case 8: putLong(off, v); break;
default: throw new AssertionError(); default: throw new AssertionError();
} }
} }
} // Data } // Data
} // Int2 } // Int2

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

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

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

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

@ -25,110 +25,110 @@ package mpi;
*/ */
public final class LongInt extends Struct 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. * The struct object will be created only in MPI class.
* @param longSize size of long * @param longSize size of long
* @param intOff int offset * @param intOff int offset
* @param intSize int size * @param intSize int size
* @see MPI#longInt * @see MPI#longInt
*/ */
protected LongInt(int longSize, int intOff, int intSize) protected LongInt(int longSize, int intOff, int intSize)
{ {
lSize = longSize; lSize = longSize;
iSize = intSize; iSize = intSize;
int lOff; int lOff;
switch(lSize) switch(lSize)
{ {
case 4: lOff = addInt(); break; case 4: lOff = addInt(); break;
case 8: lOff = addLong(); break; case 8: lOff = addLong(); break;
default: throw new AssertionError("Unsupported long size: "+ lSize); default: throw new AssertionError("Unsupported long size: "+ lSize);
} }
assert lOff == 0; assert lOff == 0;
setOffset(intOff); setOffset(intOff);
switch(iSize) switch(iSize)
{ {
case 4: iOff = addInt(); break; case 4: iOff = addInt(); break;
case 8: iOff = addLong(); break; case 8: iOff = addLong(); break;
default: throw new AssertionError("Unsupported int size: "+ iSize); default: throw new AssertionError("Unsupported int size: "+ iSize);
} }
assert(intOff == iOff); assert(intOff == iOff);
} }
/** /**
* Creates a Data object. * Creates a Data object.
* @return new Data object. * @return new Data object.
*/ */
@Override protected LongInt.Data newData() @Override protected LongInt.Data newData()
{ {
return new LongInt.Data(); return new LongInt.Data();
} }
/** /**
* Class for reading/writing data in a struct stored in a byte buffer. * Class for reading/writing data in a struct stored in a byte buffer.
*/ */
public final class Data extends Struct.Data public final class Data extends Struct.Data
{ {
/** /**
* Gets the long value. * Gets the long value.
* @return long value * @return long value
*/ */
public long getValue() public long getValue()
{ {
switch(lSize) switch(lSize)
{ {
case 8: return getLong(0); case 8: return getLong(0);
case 4: return getInt(0); case 4: return getInt(0);
default: throw new AssertionError(); default: throw new AssertionError();
} }
} }
/** /**
* Gets the int value. * Gets the int value.
* @return int value * @return int value
*/ */
public int getIndex() public int getIndex()
{ {
switch(iSize) switch(iSize)
{ {
case 4: return getInt(iOff); case 4: return getInt(iOff);
case 8: return (int)getLong(iOff); case 8: return (int)getLong(iOff);
default: throw new AssertionError(); default: throw new AssertionError();
} }
} }
/** /**
* Puts the long value. * Puts the long value.
* @param v long value * @param v long value
*/ */
public void putValue(long v) public void putValue(long v)
{ {
switch(lSize) switch(lSize)
{ {
case 8: putLong(0, v); break; case 8: putLong(0, v); break;
case 4: putInt(0, (int)v); break; case 4: putInt(0, (int)v); break;
default: throw new AssertionError(); default: throw new AssertionError();
} }
} }
/** /**
* Puts the int value. * Puts the int value.
* @param v int value * @param v int value
*/ */
public void putIndex(int v) public void putIndex(int v)
{ {
switch(iSize) switch(iSize)
{ {
case 4: putInt(iOff, v); break; case 4: putInt(iOff, v); break;
case 8: putLong(iOff, v); break; case 8: putLong(iOff, v); break;
default: throw new AssertionError(); default: throw new AssertionError();
} }
} }
} // Data } // Data
} // LongInt } // LongInt

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

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

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

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

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

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

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

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

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

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

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

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

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

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

@ -25,113 +25,113 @@ package mpi;
*/ */
public final class ShortInt extends Struct 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. * The struct object will be created only in MPI class.
* @param shortSize short size * @param shortSize short size
* @param intOff int offset * @param intOff int offset
* @param intSize int size * @param intSize int size
* @see MPI#shortInt * @see MPI#shortInt
*/ */
protected ShortInt(int shortSize, int intOff, int intSize) protected ShortInt(int shortSize, int intOff, int intSize)
{ {
sSize = shortSize; sSize = shortSize;
iSize = intSize; iSize = intSize;
int sOff; int sOff;
switch(sSize) switch(sSize)
{ {
case 2: sOff = addShort(); break; case 2: sOff = addShort(); break;
case 4: sOff = addInt(); break; case 4: sOff = addInt(); break;
case 8: sOff = addLong(); break; case 8: sOff = addLong(); break;
default: throw new AssertionError("Unsupported short size: "+ sSize); default: throw new AssertionError("Unsupported short size: "+ sSize);
} }
assert sOff == 0; assert sOff == 0;
setOffset(intOff); setOffset(intOff);
switch(iSize) switch(iSize)
{ {
case 4: iOff = addInt(); break; case 4: iOff = addInt(); break;
case 8: iOff = addLong(); break; case 8: iOff = addLong(); break;
default: throw new AssertionError("Unsupported int size: "+ iSize); default: throw new AssertionError("Unsupported int size: "+ iSize);
} }
assert(intOff == iOff); assert(intOff == iOff);
} }
/** /**
* Creates a Data object. * Creates a Data object.
* @return new Data object. * @return new Data object.
*/ */
@Override protected Data newData() @Override protected Data newData()
{ {
return new Data(); return new Data();
} }
/** /**
* Class for reading/writing data in a struct stored in a byte buffer. * Class for reading/writing data in a struct stored in a byte buffer.
*/ */
public final class Data extends Struct.Data public final class Data extends Struct.Data
{ {
/** /**
* Gets the short value. * Gets the short value.
* @return short value * @return short value
*/ */
public short getValue() public short getValue()
{ {
switch(sSize) switch(sSize)
{ {
case 2: return getShort(0); case 2: return getShort(0);
case 4: return (short)getInt(0); case 4: return (short)getInt(0);
case 8: return (short)getLong(0); case 8: return (short)getLong(0);
default: throw new AssertionError(); default: throw new AssertionError();
} }
} }
/** /**
* Gets the int value. * Gets the int value.
* @return int value * @return int value
*/ */
public int getIndex() public int getIndex()
{ {
switch(iSize) switch(iSize)
{ {
case 4: return getInt(iOff); case 4: return getInt(iOff);
case 8: return (int)getLong(iOff); case 8: return (int)getLong(iOff);
default: throw new AssertionError(); default: throw new AssertionError();
} }
} }
/** /**
* Puts the short value. * Puts the short value.
* @param v short value * @param v short value
*/ */
public void putValue(short v) public void putValue(short v)
{ {
switch(sSize) switch(sSize)
{ {
case 2: putShort(0, v); break; case 2: putShort(0, v); break;
case 4: putInt(0, v); break; case 4: putInt(0, v); break;
case 8: putLong(0, v); break; case 8: putLong(0, v); break;
default: throw new AssertionError(); default: throw new AssertionError();
} }
} }
/** /**
* Puts the int value. * Puts the int value.
* @param v int value * @param v int value
*/ */
public void putIndex(int v) public void putIndex(int v)
{ {
switch(iSize) switch(iSize)
{ {
case 4: putInt(iOff, v); break; case 4: putInt(iOff, v); break;
case 8: putLong(iOff, v); break; case 8: putLong(iOff, v); break;
default: throw new AssertionError(); default: throw new AssertionError();
} }
} }
} // Data } // Data
} // ShortInt } // ShortInt

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

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

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

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

@ -34,7 +34,7 @@
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and See the License for the specific language governing permissions and
limitations under the License. limitations under the License.
*/ */
/* /*
* File : User_function.java * File : User_function.java
* Author : Xinying Li * Author : Xinying Li
@ -54,158 +54,158 @@ import java.nio.*;
*/ */
public abstract class UserFunction public abstract class UserFunction
{ {
/** /**
* User-defined function for a new {@code Op}. * User-defined function for a new {@code Op}.
* @param inVec array of values to combine with {@code inoutvec} elements * @param inVec array of values to combine with {@code inoutvec} elements
* @param inOutVec in-out array of accumulator locations * @param inOutVec in-out array of accumulator locations
* @param count number of items in arrays * @param count number of items in arrays
* @param datatype type of each item * @param datatype type of each item
* @throws MPIException Signals that an MPI exception of some sort has occurred. * @throws MPIException Signals that an MPI exception of some sort has occurred.
*/ */
public void call(Object inVec, Object inOutVec, int count, Datatype datatype) public void call(Object inVec, Object inOutVec, int count, Datatype datatype)
throws MPIException throws MPIException
{ {
throw new UnsupportedOperationException("Not supported yet."); throw new UnsupportedOperationException("Not supported yet.");
} }
/** /**
* User-defined function for a new {@code Op}. * User-defined function for a new {@code Op}.
* @param in direct byte buffer to combine with {@code inOut} buffer * @param in direct byte buffer to combine with {@code inOut} buffer
* @param inOut in-out direct byte buffer of accumulator locations * @param inOut in-out direct byte buffer of accumulator locations
* @param count number of items in buffers * @param count number of items in buffers
* @param datatype type of each item * @param datatype type of each item
* @throws MPIException Signals that an MPI exception of some sort has occurred. * @throws MPIException Signals that an MPI exception of some sort has occurred.
*/ */
public void call(ByteBuffer in, ByteBuffer inOut, int count, Datatype datatype) public void call(ByteBuffer in, ByteBuffer inOut, int count, Datatype datatype)
throws MPIException throws MPIException
{ {
switch(datatype.baseType) switch(datatype.baseType)
{ {
case Datatype.BYTE: case Datatype.BYTE:
vCall(in, inOut, count, datatype); vCall(in, inOut, count, datatype);
break; break;
case Datatype.CHAR: case Datatype.CHAR:
vCall(in.asCharBuffer(), inOut.asCharBuffer(), count, datatype); vCall(in.asCharBuffer(), inOut.asCharBuffer(), count, datatype);
break; break;
case Datatype.SHORT: case Datatype.SHORT:
vCall(in.asShortBuffer(), inOut.asShortBuffer(), count, datatype); vCall(in.asShortBuffer(), inOut.asShortBuffer(), count, datatype);
break; break;
case Datatype.INT: case Datatype.INT:
vCall(in.asIntBuffer(), inOut.asIntBuffer(), count, datatype); vCall(in.asIntBuffer(), inOut.asIntBuffer(), count, datatype);
break; break;
case Datatype.LONG: case Datatype.LONG:
vCall(in.asLongBuffer(), inOut.asLongBuffer(), count, datatype); vCall(in.asLongBuffer(), inOut.asLongBuffer(), count, datatype);
break; break;
case Datatype.FLOAT: case Datatype.FLOAT:
vCall(in.asFloatBuffer(), inOut.asFloatBuffer(), count, datatype); vCall(in.asFloatBuffer(), inOut.asFloatBuffer(), count, datatype);
break; break;
case Datatype.DOUBLE: case Datatype.DOUBLE:
vCall(in.asDoubleBuffer(), inOut.asDoubleBuffer(), count, datatype); vCall(in.asDoubleBuffer(), inOut.asDoubleBuffer(), count, datatype);
break; break;
case Datatype.PACKED: case Datatype.PACKED:
vCall(in, inOut, count, datatype); vCall(in, inOut, count, datatype);
break; break;
default: default:
throw new IllegalArgumentException("Unsupported datatype."); throw new IllegalArgumentException("Unsupported datatype.");
} }
} }
private void vCall(ByteBuffer in, ByteBuffer inOut, private void vCall(ByteBuffer in, ByteBuffer inOut,
int count, Datatype datatype) throws MPIException int count, Datatype datatype) throws MPIException
{ {
int extent = datatype.getExtent(); int extent = datatype.getExtent();
byte[] inVec = new byte[count * extent], byte[] inVec = new byte[count * extent],
inOutVec = new byte[count * extent]; inOutVec = new byte[count * extent];
in.get(inVec); in.get(inVec);
inOut.get(inOutVec); inOut.get(inOutVec);
call(inVec, inOutVec, count, datatype); call(inVec, inOutVec, count, datatype);
inOut.clear(); inOut.clear();
inOut.put(inOutVec); inOut.put(inOutVec);
} }
private void vCall(CharBuffer inBuf, CharBuffer inOutBuf, private void vCall(CharBuffer inBuf, CharBuffer inOutBuf,
int count, Datatype datatype) throws MPIException int count, Datatype datatype) throws MPIException
{ {
int extent = datatype.getExtent(); int extent = datatype.getExtent();
char[] inVec = new char[count * extent], char[] inVec = new char[count * extent],
inOutVec = new char[count * extent]; inOutVec = new char[count * extent];
inBuf.get(inVec); inBuf.get(inVec);
inOutBuf.get(inOutVec); inOutBuf.get(inOutVec);
call(inVec, inOutVec, count, datatype); call(inVec, inOutVec, count, datatype);
inOutBuf.clear(); inOutBuf.clear();
inOutBuf.put(inOutVec); inOutBuf.put(inOutVec);
} }
private void vCall(ShortBuffer inBuf, ShortBuffer inOutBuf, private void vCall(ShortBuffer inBuf, ShortBuffer inOutBuf,
int count, Datatype datatype) throws MPIException int count, Datatype datatype) throws MPIException
{ {
int extent = datatype.getExtent(); int extent = datatype.getExtent();
short[] inVec = new short[count * extent], short[] inVec = new short[count * extent],
inOutVec = new short[count * extent]; inOutVec = new short[count * extent];
inBuf.get(inVec); inBuf.get(inVec);
inOutBuf.get(inOutVec); inOutBuf.get(inOutVec);
call(inVec, inOutVec, count, datatype); call(inVec, inOutVec, count, datatype);
inOutBuf.clear(); inOutBuf.clear();
inOutBuf.put(inOutVec); inOutBuf.put(inOutVec);
} }
private void vCall(IntBuffer inBuf, IntBuffer inOutBuf, private void vCall(IntBuffer inBuf, IntBuffer inOutBuf,
int count, Datatype datatype) throws MPIException int count, Datatype datatype) throws MPIException
{ {
int extent = datatype.getExtent(); int extent = datatype.getExtent();
int[] inVec = new int[count * extent], int[] inVec = new int[count * extent],
inOutVec = new int[count * extent]; inOutVec = new int[count * extent];
inBuf.get(inVec); inBuf.get(inVec);
inOutBuf.get(inOutVec); inOutBuf.get(inOutVec);
call(inVec, inOutVec, count, datatype); call(inVec, inOutVec, count, datatype);
inOutBuf.clear(); inOutBuf.clear();
inOutBuf.put(inOutVec); inOutBuf.put(inOutVec);
} }
private void vCall(LongBuffer inBuf, LongBuffer inOutBuf, private void vCall(LongBuffer inBuf, LongBuffer inOutBuf,
int count, Datatype datatype) throws MPIException int count, Datatype datatype) throws MPIException
{ {
int extent = datatype.getExtent(); int extent = datatype.getExtent();
long[] inVec = new long[count * extent], long[] inVec = new long[count * extent],
inOutVec = new long[count * extent]; inOutVec = new long[count * extent];
inBuf.get(inVec); inBuf.get(inVec);
inOutBuf.get(inOutVec); inOutBuf.get(inOutVec);
call(inVec, inOutVec, count, datatype); call(inVec, inOutVec, count, datatype);
inOutBuf.clear(); inOutBuf.clear();
inOutBuf.put(inOutVec); inOutBuf.put(inOutVec);
} }
private void vCall(FloatBuffer inBuf, FloatBuffer inOutBuf, private void vCall(FloatBuffer inBuf, FloatBuffer inOutBuf,
int count, Datatype datatype) throws MPIException int count, Datatype datatype) throws MPIException
{ {
int extent = datatype.getExtent(); int extent = datatype.getExtent();
float[] inVec = new float[count * extent], float[] inVec = new float[count * extent],
inOutVec = new float[count * extent]; inOutVec = new float[count * extent];
inBuf.get(inVec); inBuf.get(inVec);
inOutBuf.get(inOutVec); inOutBuf.get(inOutVec);
call(inVec, inOutVec, count, datatype); call(inVec, inOutVec, count, datatype);
inOutBuf.clear(); inOutBuf.clear();
inOutBuf.put(inOutVec); inOutBuf.put(inOutVec);
} }
private void vCall(DoubleBuffer inBuf, DoubleBuffer inOutBuf, private void vCall(DoubleBuffer inBuf, DoubleBuffer inOutBuf,
int count, Datatype datatype) throws MPIException int count, Datatype datatype) throws MPIException
{ {
int extent = datatype.getExtent(); int extent = datatype.getExtent();
double[] inVec = new double[count * extent], double[] inVec = new double[count * extent],
inOutVec = new double[count * extent]; inOutVec = new double[count * extent];
inBuf.get(inVec); inBuf.get(inVec);
inOutBuf.get(inOutVec); inOutBuf.get(inOutVec);
call(inVec, inOutVec, count, datatype); call(inVec, inOutVec, count, datatype);
inOutBuf.clear(); inOutBuf.clear();
inOutBuf.put(inOutVec); inOutBuf.put(inOutVec);
} }
} // UserFunction } // UserFunction

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