/**
   * GB distributed client.
   *
   * @param rank of the MPI where the server runs on.
   * @throws IOException
   */
  public void clientPart(int rank) throws IOException, MPIException {
    if (rank != 0) {
      throw new UnsupportedOperationException("only master at rank 0 implemented: " + rank);
    }
    Comm engine = MPIEngine.getCommunicator();

    DistHashTableMPI<Integer, GenPolynomial<C>> theList =
        new DistHashTableMPI<Integer, GenPolynomial<C>>();
    theList.init();

    MPIChannel chan = new MPIChannel(engine, rank);

    MPIReducerClient<C> R = new MPIReducerClient<C>(chan, theList);
    R.run();

    chan.close();
    theList.terminate();
    return;
  }
 /**
  * Constructor.
  *
  * @param threads number of threads to use.
  * @param pool ThreadPool to use.
  * @param pl pair selection strategy
  */
 public GroebnerBaseDistributedMPI(int threads, ThreadPool pool, PairList<C> pl)
     throws IOException {
   super(new ReductionPar<C>(), pl);
   int size = 0;
   try {
     engine = MPIEngine.getCommunicator();
     size = engine.Size();
   } catch (MPIException e) {
     throw new IOException(e);
   }
   if (size < 2) {
     throw new IllegalArgumentException("Minimal 2 MPI processes required, not " + size);
   }
   if (threads != size || pool.getNumber() != size) {
     throw new IllegalArgumentException(
         "threads != size: " + threads + " != " + size + ", #pool " + pool.getNumber());
   }
   this.threads = threads;
   this.pool = pool;
 }