Beispiel #1
0
void
toi_init(int argc, char **argv)
{
	gv_tbl = st_init_numtable();

	Init_thread();
	THREAD(cur_thr)->recv = main_thread();
	if (THREAD(main_thread())->env_tbl)
		st_free_table(THREAD(main_thread())->env_tbl);
	THREAD(main_thread())->env_tbl = gv_tbl;

	Init_symbol();
	Init_class();

	/* have to call Init_thread() again */
	Init_thread();

	Init_kernel();
	cself = cKernel;
	Init_numeric();
	Init_float();
	Init_integer();
	Init_array();
	Init_hash();
	Init_string();
	Init_iostream();
	Init_exception();

	toi_set_argv(argc, argv);

	Init_gc();

	signal(SIGINT, handle_sigint);
}
Beispiel #2
0
  bool init(int *ac, const char **av, bool useCommWorld)
  {
    int initialized = false;
    MPI_CALL(Initialized(&initialized));

    int provided = 0;
    if (!initialized) {
      /* MPI not initialized by the app - it's up to us */
      MPI_CALL(Init_thread(ac, const_cast<char ***>(&av),
                           MPI_THREAD_MULTIPLE, &provided));
    } else {
      /* MPI was already initialized by the app that called us! */
      MPI_Query_thread(&provided);
    }
    if (provided != MPI_THREAD_MULTIPLE && provided != MPI_THREAD_SERIALIZED) {
      throw std::runtime_error("MPI initialization error: The MPI runtime must"
                               " support either MPI_THREAD_MULTIPLE or"
                               " MPI_THREAD_SERIALIZED.");
    }
    mpiIsThreaded = provided == MPI_THREAD_MULTIPLE;

    if (useCommWorld) {
      world.setTo(MPI_COMM_WORLD);
    }
    return !initialized;
  }