1 2//--------------------------------------------------------------------- 3//--------------------------------------------------------------------- 4#include <math.h> 5#include "mpinpb.h" 6#include "npbparams.h" 7#include "RCCE.h" 8 9int setup_mpi(int *argc, char **argv[]) { 10 11//--------------------------------------------------------------------- 12//--------------------------------------------------------------------- 13 14//--------------------------------------------------------------------- 15// set up MPI stuff 16//--------------------------------------------------------------------- 17 int error, color, nc; 18 19 if (error = RCCE_init(argc, argv)) return(error); 20 21 total_nodes = RCCE_num_ues(); 22 node = RCCE_ue(); 23 24//--------------------------------------------------------------------- 25// compute square root; add small number to allow for roundoff 26//--------------------------------------------------------------------- 27 nc = (int)(sqrt((double)(total_nodes) + 0.00001e0)); 28 29//--------------------------------------------------------------------- 30// We handle a non-square number of nodes by making the excess nodes 31// inactive. However, we can never handle more cells than were compiled 32// in. 33//--------------------------------------------------------------------- 34 35 if (nc > MAXCELLS) nc = MAXCELLS; 36 no_nodes = nc*nc; 37 38//--------------------------------------------------------------------- 39// let node 0 be the root for the group (there is only one) 40//--------------------------------------------------------------------- 41 root = 0; 42 43 return(0); 44} 45 46