root/ompi/mpi/java/java/GraphComm.java

/* [<][>][^][v][top][bottom][index][help] */

DEFINITIONS

This source file includes following definitions.
  1. init
  2. clone
  3. dup
  4. iDup
  5. dupWithInfo
  6. getDims
  7. getDims
  8. getNeighbors
  9. getNeighbors
  10. getDistGraphNeighbors
  11. getDistGraphNeighbors
  12. map
  13. map

   1 /*
   2  * Copyright (c) 2004-2007 The Trustees of Indiana University and Indiana
   3  *                         University Research and Technology
   4  *                         Corporation.  All rights reserved.
   5  * Copyright (c) 2004-2005 The University of Tennessee and The University
   6  *                         of Tennessee Research Foundation.  All rights
   7  *                         reserved.
   8  * Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
   9  *                         University of Stuttgart.  All rights reserved.
  10  * Copyright (c) 2004-2005 The Regents of the University of California.
  11  *                         All rights reserved.
  12  * Copyright (c) 2015      Los Alamos National Security, LLC. All rights
  13  *                         reserved.
  14  * Copyright (c) 2018      FUJITSU LIMITED.  All rights reserved.
  15  * $COPYRIGHT$
  16  *
  17  * Additional copyrights may follow
  18  *
  19  * $HEADER$
  20  *
  21  *
  22  * This file is almost a complete re-write for Open MPI compared to the
  23  * original mpiJava package. Its license and copyright are listed below.
  24  * See <path to ompi/mpi/java/README> for more information.
  25  *
  26  *
  27  *  Licensed under the Apache License, Version 2.0 (the "License");
  28  *  you may not use this file except in compliance with the License.
  29  *  You may obtain a copy of the License at
  30  *
  31  *     http://www.apache.org/licenses/LICENSE-2.0
  32  *
  33  *  Unless required by applicable law or agreed to in writing, software
  34  *  distributed under the License is distributed on an "AS IS" BASIS,
  35  *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  36  *  See the License for the specific language governing permissions and
  37  *  limitations under the License.
  38  *
  39  *
  40  * File         : Graphcomm.java
  41  * Author       : Xinying Li
  42  * Created      : Thu Apr  9 12:22:15 1998
  43  * Revision     : $Revision: 1.5 $
  44  * Updated      : $Date: 2001/10/22 21:07:55 $
  45  * Copyright: Northeast Parallel Architectures Center
  46  *            at Syracuse University 1998
  47  */
  48 
  49 package mpi;
  50 
  51 /**
  52  * Communicator with graph structure.
  53  */
  54 public final class GraphComm extends Intracomm
  55 {
  56         static
  57         {
  58                 init();
  59         }
  60 
  61         private static native void init();
  62 
  63         protected GraphComm(long handle) throws MPIException
  64         {
  65                 super(handle);
  66         }
  67 
  68         protected GraphComm(long[] commRequest)
  69         {
  70                 super(commRequest);
  71         }
  72 
  73         /**
  74          * Duplicates this communicator.
  75          * <p>Java binding of {@code MPI_COMM_DUP}.
  76          * <p>It is recommended to use {@link #dup} instead of {@link #clone}
  77          * because the last can't throw an {@link mpi.MPIException}.
  78          * @return copy of this communicator
  79          */
  80         @Override public GraphComm clone()
  81         {
  82                 try
  83                 {
  84                         return dup();
  85                 }
  86                 catch(MPIException e)
  87                 {
  88                         throw new RuntimeException(e.getMessage());
  89                 }
  90         }
  91 
  92         /**
  93          * Duplicates this communicator.
  94          * <p>Java binding of {@code MPI_COMM_DUP}.
  95          * @return copy of this communicator
  96          * @throws MPIException Signals that an MPI exception of some sort has occurred.
  97          */
  98         @Override public GraphComm dup() throws MPIException
  99         {
 100                 MPI.check();
 101                 return new GraphComm(dup(handle));
 102         }
 103 
 104         /**
 105          * Duplicates this communicator.
 106          * <p>The new communicator can't be used before the operation completes.
 107          * The request object must be obtained calling {@link #getRequest}.
 108          * <p>Java binding of {@code MPI_COMM_IDUP}.
 109          * @return copy of this communicator
 110          * @throws MPIException Signals that an MPI exception of some sort has occurred.
 111          */
 112         @Override public GraphComm iDup() throws MPIException
 113         {
 114                 MPI.check();
 115                 return new GraphComm(iDup(handle));
 116         }
 117 
 118         /**
 119         * Duplicates this communicator with the info object used in the call.
 120         * <p>Java binding of {@code MPI_COMM_DUP_WITH_INFO}.
 121         * @param info   info object to associate with the new communicator
 122         * @return copy of this communicator
 123         * @throws MPIException Signals that an MPI exception of some sort has occurred.
 124         */
 125         @Override public GraphComm dupWithInfo(Info info) throws MPIException
 126         {
 127             MPI.check();
 128             return new GraphComm(dupWithInfo(handle, info.handle));
 129         }
 130 
 131         /**
 132          * Returns graph topology information.
 133          * <p>Java binding of the MPI operations {@code MPI_GRAPHDIMS_GET}
 134          * and {@code MPI_GRAPH_GET}.
 135          * <p>The number of nodes and number of edges can be extracted
 136          * from the sizes of the {@code index} and {@code edges} fields
 137          * of the returned object.
 138          * @return object defining node degress and edges of graph
 139          * @throws MPIException Signals that an MPI exception of some sort has occurred.
 140          */
 141         public GraphParms getDims() throws MPIException
 142         {
 143                 MPI.check();
 144                 return getDims(handle);
 145         }
 146 
 147         private native GraphParms getDims(long comm) throws MPIException;
 148 
 149         /**
 150          * Provides adjacency information for general graph topology.
 151          * <p>Java binding of the MPI operations {@code MPI_GRAPH_NEIGHBORS_COUNT}
 152          * and {@code MPI_GRAPH_NEIGHBORS}.
 153          * <p>The number of neighbors can be extracted from the size of the result.
 154          * @param rank rank of a process in the group of this communicator
 155          * @return array of ranks of neighboring processes to one specified
 156          * @throws MPIException Signals that an MPI exception of some sort has occurred.
 157          */
 158         public int[] getNeighbors(int rank) throws MPIException
 159         {
 160                 MPI.check();
 161                 return getNeighbors(handle, rank);
 162         }
 163 
 164         private native int[] getNeighbors(long comm, int rank) throws MPIException;
 165 
 166         /**
 167          * Gets the adjacency information for a distributed graph topology.
 168          * @return adjacency information for a distributed graph topology
 169          * @throws MPIException Signals that an MPI exception of some sort has occurred.
 170          */
 171         public DistGraphNeighbors getDistGraphNeighbors() throws MPIException
 172         {
 173                 MPI.check();
 174                 return getDistGraphNeighbors(handle);
 175         }
 176 
 177         private native DistGraphNeighbors getDistGraphNeighbors(long comm)
 178                         throws MPIException;
 179 
 180         /**
 181          * Compute an optimal placement.
 182          * <p>Java binding of the MPI operation {@code MPI_GRAPH_MAP}.
 183          * <p>The number of nodes is taken to be size of the {@code index} argument.
 184          * @param index node degrees
 185          * @param edges graph edges
 186          * @return reordered rank of calling process
 187          * @throws MPIException Signals that an MPI exception of some sort has occurred.
 188          */
 189         public int map(int[] index, int[] edges) throws MPIException
 190         {
 191                 MPI.check();
 192                 return map(handle, index, edges);
 193         }
 194 
 195         private native int map(long comm, int[] index, int[] edges) throws MPIException;
 196 
 197 } // Graphcomm

/* [<][>][^][v][top][bottom][index][help] */