Example #1
0
void mpi_random_set_stat(const vector<string> &stat) {
  mpi_call(mpi_random_set_stat_slave, 0, 0);

  for (int i = 1; i < n_nodes; i++) {
    mpiCallbacks().comm().send(i, SOME_TAG, stat[i]);
  }

  set_state(stat[0]);
}
Example #2
0
void mpi_random_seed(int cnt, vector<int> &seeds) {
  int this_seed;
  mpi_call(mpi_random_seed_slave, -1, cnt);

  MPI_Scatter(&seeds[0], 1, MPI_INT, &this_seed, 1, MPI_INT, 0, comm_cart);

  RANDOM_TRACE(printf("%d: Received seed %d\n", this_node, this_seed));

  init_random_seed(this_seed);
}
Example #3
0
string mpi_random_get_stat() {
  string res = get_state();

  mpi_call(mpi_random_get_stat_slave, 0, 0);

  for (int i = 1; i < n_nodes; i++) {
    string tmp;
    mpiCallbacks().comm().recv(i, SOME_TAG, tmp);
    res.append(" ");
    res.append(tmp);
  }

  return res;
}
Example #4
0
void set_parameters(const std::string &method, const std::string &params, bool dipolar_ia) {
  mpi_call(mpi_scafacos_set_parameters_slave, method.size(), params.size());

  /** This requires C++11, otherwise this is undefined because std::string was not required to have conitnuous memory before. */
  /* const_cast is ok, this code runs only on rank 0 where the mpi call does not modify the buffer */
  MPI_Bcast(const_cast<char *>(&(*method.begin())), method.size(), MPI_CHAR, 0, comm_cart);
  MPI_Bcast(const_cast<char *>(&(*params.begin())), params.size(), MPI_CHAR, 0, comm_cart);
  
  #ifdef SCAFACOS_DIPOLES
    bool d=dipolar_ia;
    MPI_Bcast(&d,sizeof(bool), MPI_CHAR, 0, comm_cart);
  #endif


  set_params_safe(method, params,dipolar_ia);
  #ifdef SCAFACOS_DIPOLES
    set_dipolar(d);
  #endif

}