src/ffs/ffs_control.c
static int ffs_input_parse(ffs_control_t * obj) {

  int rank, ntask;
  int ifail;
  u_config_t * ffs = NULL;

  MPI_Comm_rank(obj->comm, &rank);
  MPI_Comm_size(obj->comm, &ntask);

  ifail = ((ffs = u_config_get_child(obj->input, FFS_CONFIG_FFS)) == NULL);
  mpilog_if(ifail, obj->log, "No %s config section\n", FFS_CONFIG_FFS);
  dbg_err_ifm(ifail, "u_config_get_child() failed");

  /* Read parameters */

  dbg_err_if(u_config_get_subkey_value_i(ffs, FFS_CONFIG_FFS_INSTANCES,
					 FFS_DEFAULT_FFS_INSTANCES,
					 &obj->ninstances));

  dbg_err_if(u_config_get_subkey_value_i(ffs, FFS_CONFIG_FFS_SEED,
					 FFS_DEFAULT_FFS_SEED,
					 &obj->seed));

  /* Log the parameters received; sanity check parameters */

  ffs_control_log(obj);

  ifail = (obj->ninstances < 1);
  mpilog_if(ifail, obj->log, "Number of instances (%d) is less than one!\n",
	    obj->ninstances);
  dbg_err_ifm(ifail, "Number of instances < 1 (%d)", obj->ninstances);

  ifail = (ntask < obj->ninstances);
  mpilog_if(ifail, obj->log, "Requested more instances than MPI tasks\n");
  dbg_err_ifm(ifail, "Number of instances > MPI tasks (%d)", ntask);

  ifail = ((ntask % obj->ninstances) != 0);
  mpilog_if(ifail, obj->log, "Must have equal number of tasks per instance\n");
  dbg_err_ifm(ifail, "ntask % ninstance != 0"); 

  ifail = (obj->seed < 1);
  mpilog_if(ifail, obj->log, "%s must be > 0\n", FFS_CONFIG_FFS_SEED);
  dbg_err_ifm(ifail, "Bad seed (%d)", obj->seed);

  /* Set the instance id */

  obj->inst_id = rank / (ntask / obj->ninstances);

  return 0;

 err:

  mpilog(obj->log, "Please check input file and try again\n");

  return -1;
}
/*****************************************************************************
 *
 *  ffs_input_parse
 *
 *  At this stage everyone in obj->comm should agree on the contents
 *  of config, so failures are collective.
 *
 *  If the details are acceptable, we can set the instance id via
 *  integer division
 *     inst_id = rank / mpi tasks per instance
 *  so inst id runs 0, ...
 *
 *****************************************************************************/
ffs_input_parse
At this stage everyone in obj->comm should agree on the contents
of config, so failures are collective.

If the details are acceptable, we can set the instance id via
integer division
inst_id = rank / mpi tasks per instance
so inst id runs 0.
ffs_input_parse At this stage everyone in obj - > comm should agree on the contents of config so failures are collective . If the details are acceptable we can set the instance id via integer division inst_id = rank / mpi tasks per instance so inst id runs 0 .
static int ffs_input_parse(ffs_control_t * obj) {
  int rank, ntask;
  int ifail;
  u_config_t * ffs = NULL;
  MPI_Comm_rank(obj->comm, &rank);
  MPI_Comm_size(obj->comm, &ntask);
  ifail = ((ffs = u_config_get_child(obj->input, FFS_CONFIG_FFS)) == NULL);
  mpilog_if(ifail, obj->log, "No %s config section\n", FFS_CONFIG_FFS);
  dbg_err_ifm(ifail, "u_config_get_child() failed");
  dbg_err_if(u_config_get_subkey_value_i(ffs, FFS_CONFIG_FFS_INSTANCES,
					 FFS_DEFAULT_FFS_INSTANCES,
					 &obj->ninstances));
  dbg_err_if(u_config_get_subkey_value_i(ffs, FFS_CONFIG_FFS_SEED,
					 FFS_DEFAULT_FFS_SEED,
					 &obj->seed));
  ffs_control_log(obj);
  ifail = (obj->ninstances < 1);
  mpilog_if(ifail, obj->log, "Number of instances (%d) is less than one!\n",
	    obj->ninstances);
  dbg_err_ifm(ifail, "Number of instances < 1 (%d)", obj->ninstances);
  ifail = (ntask < obj->ninstances);
  mpilog_if(ifail, obj->log, "Requested more instances than MPI tasks\n");
  dbg_err_ifm(ifail, "Number of instances > MPI tasks (%d)", ntask);
  ifail = ((ntask % obj->ninstances) != 0);
  mpilog_if(ifail, obj->log, "Must have equal number of tasks per instance\n");
  dbg_err_ifm(ifail, "ntask % ninstance != 0"); 
  ifail = (obj->seed < 1);
  mpilog_if(ifail, obj->log, "%s must be > 0\n", FFS_CONFIG_FFS_SEED);
  dbg_err_ifm(ifail, "Bad seed (%d)", obj->seed);
  obj->inst_id = rank / (ntask / obj->ninstances);
  return 0;
 err:
  mpilog(obj->log, "Please check input file and try again\n");
  return -1;
}
static int ffs_input_parse ( ffs_control_t * obj ) { int rank , ntask ; int ifail ; u_config_t * ffs = NULL ; MPI_Comm_rank ( obj -> comm , & rank ) ; MPI_Comm_size ( obj -> comm , & ntask ) ; ifail = ( ( ffs = u_config_get_child ( obj -> input , FFS_CONFIG_FFS ) ) == NULL ) ; mpilog_if ( ifail , obj -> log , " \n " , FFS_CONFIG_FFS ) ; dbg_err_ifm ( ifail , " " ) ; dbg_err_if ( u_config_get_subkey_value_i ( ffs , FFS_CONFIG_FFS_INSTANCES , FFS_DEFAULT_FFS_INSTANCES , & obj -> ninstances ) ) ; dbg_err_if ( u_config_get_subkey_value_i ( ffs , FFS_CONFIG_FFS_SEED , FFS_DEFAULT_FFS_SEED , & obj -> seed ) ) ; ffs_control_log ( obj ) ; ifail = ( obj -> ninstances < 1 ) ; mpilog_if ( ifail , obj -> log , " \n " , obj -> ninstances ) ; dbg_err_ifm ( ifail , " " , obj -> ninstances ) ; ifail = ( ntask < obj -> ninstances ) ; mpilog_if ( ifail , obj -> log , " \n " ) ; dbg_err_ifm ( ifail , " " , ntask ) ; ifail = ( ( ntask % obj -> ninstances ) != 0 ) ; mpilog_if ( ifail , obj -> log , " \n " ) ; dbg_err_ifm ( ifail , " " ) ; ifail = ( obj -> seed < 1 ) ; mpilog_if ( ifail , obj -> log , " \n " , FFS_CONFIG_FFS_SEED ) ; dbg_err_ifm ( ifail , " " , obj -> seed ) ; obj -> inst_id = rank / ( ntask / obj -> ninstances ) ; return 0 ; err : mpilog ( obj -> log , " \n " ) ; return -1 ; }
ffs_input_parse
  At this stage everyone in obj->comm should agree on the contents
  of config, so failures are collective.
ffs_input_parse At this stage everyone in obj - > comm should agree on the contents of config so failures are collective .
/* Read parameters */ /* Log the parameters received; sanity check parameters */ /* Set the instance id */