예제 #1
0
Agent *
init(int * argc, char ** argv, int * myid, int * numprocs)
{
  MPI_Init(argc, &argv);
  MPI_Comm_size(MPI_COMM_WORLD, numprocs);
  MPI_Comm_rank(MPI_COMM_WORLD, myid);
  
  /* ローカルのエージェント数は、割り算で */
  N_AGENTS = ALL_N_AGENTS / *numprocs;
  init_rand(myid);
  Agent * agents = malloc(sizeof(Agent) * N_AGENTS);
  init_agents(agents, N_AGENTS);
  return agents;
}
예제 #2
0
Agent *
init(int * argc, char ** argv,
    ulong * number_total_agents,
    ulong * number_local_agents,
    ulong * number_trials,
    int * myid, int * numprocs)
{
  init_rand();
  MPI_Init(argc, &argv);
  MPI_Comm_size(MPI_COMM_WORLD, numprocs);
  MPI_Comm_rank(MPI_COMM_WORLD, myid);
  
  *number_total_agents = atoi(argv[1]);
  *number_local_agents = *number_total_agents / *numprocs;
  *number_trials = atoi(argv[2]);

  Agent * agents = malloc(sizeof(Agent) * *number_local_agents);
  init_agents(agents, *number_local_agents);
  return agents;
}