Beispiel #1
0
RESULT
mono_domain (void)
{
	AppConfigInfo *info;

	info = domain_test ("<configuration><!--hello--><startup><!--world--><requiredRuntime version=\"v1\"><!--r--></requiredRuntime></startup></configuration>"); 
	if (info->required_runtime == NULL)
		return FAILED ("No required runtime section");
	if (strcmp (info->required_runtime, "v1") != 0)
		return FAILED ("Got a runtime version %s, expected v1", info->required_runtime);
	domain_free (info);

	info = domain_test ("<configuration><startup><requiredRuntime version=\"v1\"/><!--comment--></configuration><!--end-->");
	if (info->required_runtime == NULL)
		return FAILED ("No required runtime section on auto-close section");
	if (strcmp (info->required_runtime, "v1") != 0)
		return FAILED ("Got a runtime version %s, expected v1", info->required_runtime);
	domain_free (info);

	info = domain_test ("<!--start--><configuration><startup><supportedRuntime version=\"v1\"/><!--middle--><supportedRuntime version=\"v2\"/></startup></configuration>");
	if ((strcmp ((char*)info->supported_runtimes->data, "v1") == 0)){
		if (info->supported_runtimes->next == NULL)
			return FAILED ("Expected 2 supported runtimes");
		
		if ((strcmp ((char*)info->supported_runtimes->next->data, "v2") != 0))
			return FAILED ("Expected v1, v2, got %s", info->supported_runtimes->next->data);
		if (info->supported_runtimes->next->next != NULL)
			return FAILED ("Expected v1, v2, got more");
	} else
		return FAILED ("Expected `v1', got %s", info->supported_runtimes->data);
	domain_free (info);

	return NULL;
}
Beispiel #2
0
void memclr( void )
{
   char *me = "memclr";
   char msg[256], **names = NULL;
   int iblk,i,j,k,len2,num_tp_curs,icur, num_edits, num_tpc, num_tp;
   TimePlotCurve_t *tpc_ptr = NULL;
   TimePlot_t *tp_ptr = NULL;
   RGST_AttributeElem_t *func;
   if (domains != NULL) {
     for ( iblk = 0 ; iblk < nblk ; iblk++ ) {
        domain_free(&domains[iblk]);
     }
   }
   spline_free();
   decomp_free();
   NodeList_free();
   conditionals_free();
   species_free();
   TimeStepControl_free(NULL);
   FunctionTimer_free(gv_hash_tbl);
   FunctionTimer_ht_remove(gv_hash_tbl, "global");
   FunctionTimer_ht_setup (gv_hash_tbl, "global");
   UserList_free();
   if (ifcom) freecom();
   FREEMEM(lnbuf);
   line = NULL;
   GlobalArrays_free(NULL);
   func = rgst_list_attr(A_OBJECT, "Function_Free");
   while (func != NULL) {
      Command_t *cp = (Command_t *) func->rgst_obj->obj;
      (*(cp->proc))(NULL);
      func = func->next;
   }
   if (rgst_check_for_obj("sourceData") == TRUE)  {
     rgst_del("sourceData");
     for ( i = 0 ; i < nsrc ; i++ ) {
       if (src[i].nzsrc  > 0) { FREEMEM(src[i].ndxsrc) ; }
       if (src[i].nidat1 > 0) { FREEMEM(src[i].idat1) ; }
       if (src[i].nfdat1 > 0) { FREEMEM(src[i].fdat1) ; }
       if (src[i].ndat2  > 0) { FREEMEM(src[i].dat2) ; }
     }
     FREEMEM(src) ;
   }
   nsrc = 0;
   if (rgst_check_for_obj("freqMesgData") == TRUE) {
     rgst_del("freqMesgData");
     for ( i = 0 ; i < nfq ; i++ ) {
       rgst_del (fq[i].name);
       FREEMEM(fq[i].msg) ;
       FREEMEM(fq[i].name) ;
     }
     FREEMEM(fq) ;
     FREEMEM(fqtp) ;
   }
   nfq = 0;
   if (rgst_check_for_obj("cycleMesgData") == TRUE) {
     rgst_del("cycleMesgData");
     for ( i = 0 ; i < ncyc ; i++ ) {
       rgst_del (cyc[i].name);
       FREEMEM(cyc[i].msg) ;
       FREEMEM(cyc[i].name) ;
     }
     FREEMEM(cyc) ;
     FREEMEM(cyctp) ;
   }
   ncyc = 0;
   if (rgst_check_for_obj("gparmData") == TRUE) {
     rgst_del("gparmData");
     FREEMEM(gparm);
   }
   if (rgst_check_for_obj("timePlotData") == TRUE) {
     rgst_del("timePlotData");
     for (i=0 ; i<ntp ; i++) {
       for (icur=0; icur<tpdata[i]->num_tp_curs; icur++) {
         rgst_del(tpdata[i]->tp_curs[icur]->name);
         TimePlotCurve_destruct(tpdata[i]->tp_curs[icur]);
       }
       rgst_del(tpdata[i]->name);
       TimePlot_destruct(tpdata[i]);
     }
     FREEMEM(tpdata);
   }
   ntp = 0;
   Region_free();
   if (ptab != NULL) rgst_del("ptabData");
   if (etab != NULL) rgst_del("etabData");
   if (ktab != NULL) rgst_del("ktabData");
   if (stab != NULL) rgst_del("stabData");
   FREEMEM(ptab);
   FREEMEM(etab);
   FREEMEM(ktab);
   FREEMEM(stab);
   nbq = 0;
   if (rgst_check_for_obj("domains") == TRUE) {
      rgst_del("domains");
   }
   FREEMEM(domains);       
   names = rgst_list_objs_by_type( &num_tp, "TimePlot_t");
   for (i = 0; i<num_tp; i++) {
     ctlwarning(me,"shawn, why are there time plots left, they should have"
              "been removed by now");
     tp_ptr = rgst_get_t(names[i],"TimePlot_t");
     if (tp_ptr == NULL) ctlerror(me,logic_err);
     rgst_del(names[i]);
     tp_ptr = TimePlot_destruct(tp_ptr);
     FREEMEM(names[i]);
   }
   FREEMEM(names);
   hash_del_objs_of_type(gv_hash_tbl,"double",NULL);
#ifdef DEBUG
   hash_print_by_type(rgst_objs_hash_tbl); 
   hash_print_by_type(gv_hash_tbl);
#endif
}
Beispiel #3
0
static void try_spare_migration(struct state *statelist, struct alert_info *info)
{
	struct state *from;
	struct state *st;

	link_containers_with_subarrays(statelist);
	for (st = statelist; st; st = st->next)
		if (st->active < st->raid &&
		    st->spare == 0 && !st->err) {
			struct domainlist *domlist = NULL;
			int d;
			struct state *to = st;
			unsigned long long min_size;

			if (to->parent_devnm[0] && !to->parent)
				/* subarray monitored without parent container
				 * we can't move spares here */
				continue;

			if (to->parent)
				/* member of a container */
				to = to->parent;

			if (get_min_spare_size_required(to, &min_size))
				continue;
			if (to->metadata->ss->external) {
				/* We must make sure there is
				 * no suitable spare in container already.
				 * If there is we don't add more */
				dev_t devid = container_choose_spare(
					to, to, NULL, min_size, st->active);
				if (devid > 0)
					continue;
			}
			for (d = 0; d < MAX_DISKS; d++)
				if (to->devid[d])
					domainlist_add_dev(&domlist,
							   to->devid[d],
							   to->metadata->ss->name);
			if (to->spare_group)
				domain_add(&domlist, to->spare_group);
			/*
			 * No spare migration if the destination
			 * has no domain. Skip this array.
			 */
			if (!domlist)
				continue;
			for (from=statelist ; from ; from=from->next) {
				dev_t devid;
				if (!check_donor(from, to))
					continue;
				if (from->metadata->ss->external)
					devid = container_choose_spare(
						from, to, domlist, min_size, 0);
				else
					devid = choose_spare(from, to, domlist,
							     min_size);
				if (devid > 0
				    && move_spare(from->devname, to->devname, devid)) {
					alert("MoveSpare", to->devname, from->devname, info);
					break;
				}
			}
			domain_free(domlist);
		}
}
Beispiel #4
0
void production_schur_test( int argc, char *argv[] )
{
	//int _debugwait = 1;
	int loop;
	TMPI_dat This;
	Tdomain dom;
	Tmtx_CRS_dist Ad;
	Tvec_dist x, b;
	int i, thisroot, root=0, nloop=7;
	Tgmres run;
	Tprecon P;
	char *fname_stub;
	double precon_time, gmres_time;
	//double *col_norms;

// TESTING 2006
// ------------
//    double* xx = NULL;
// ------------

	Ad.init = Ad.mtx.init  = 0;
	x.init = b.init = 0;
	P.init = 0;
	
	/*
	 *		initialise the MPI stuff
	 */
	
	// setup MPI as per command line
	BMPI_init( argc, argv, &This );
	
	// setup a local communicator for This process
	BMPI_local_comm_create( &This );
		
	if( root==This.this_proc )
		thisroot = 1;
	else
		thisroot = 0;
	
	/*if( thisroot )
		while( _debugwait );
	MPI_Barrier( This.comm );*/

	// Load the matrix
	if( !This.this_proc )
		printf( "loading matrix...\n" );
	fname_stub = argv[1];

	if( !jacobian_load( &Ad, &dom, fname_stub, &This ) )
	{
		if( thisroot )
			printf( "Unable to reload the jacobian data\n\n" );
		MPI_Finalize();
		return;
	}
		
	// create the preconditioner
	if( !This.this_proc )
		printf( "loading preconditioner parameters... %s\n", "./params/precon.txt" );
	
	if( !precon_load( &P, &Ad, "./params/precon.txt") )
	{
		printf( "ERROR : Unable to load preconditioner\n" );
		MPI_Finalize();
		return;		
	}
	if( !This.this_proc )
	{
		printf( "calculating preconditioner... " );
		precon_print_name( stdout, P.type );
	}	
	
	// setup the GMRES parameters
	if( !This.this_proc )
		printf( "loading GMRES info... %s\n", "./params/GMRES.txt" );
	if( !GMRES_params_load( &run, "./params/GMRES.txt" ) )
	{
		printf( "P%d : ERROR loading GMRES info\n", This.this_proc );
		MPI_Finalize();
		exit(1);
	}

	// loop the preconditioner and GMRES calculation to illustrate the solver
	// in a loop
	precon_time = gmres_time = 0.;
	for( loop=0; loop<nloop; loop++ )
	{

		MPI_Barrier( This.comm );
		precon_time = MPI_Wtime() - precon_time;

		// initialise the preconditioner
		// this preserves the parameters in the preconditioner
		precon_init( &P, &Ad, P.type );
		
		if( P.type==PRECON_SCHUR )
		{
			if( !precon( &P, &Ad, &dom ) )
			{
				printf( "ERROR : Unable to form preconditioner\n" );
				MPI_Finalize();
				return;
			}
		}
		else if( !precon( &P, &Ad, NULL ) )
		{
			printf( "ERROR : Unable to form preconditioner\n" );
			MPI_Finalize();
			return;
		}
		
		MPI_Barrier( This.comm );
		precon_time = MPI_Wtime() - precon_time;

		// initialise the vectors
		vec_dist_init( &b, &This, Ad.mtx.nrows, Ad.mtx.block, Ad.vtxdist );
		vec_dist_init_vec( &x, &b );
		
		// make RHS vector by finding b = A*ones
		for( i=0; i<x.n; i++ )
			x.dat[i] = 1;
		
		mtx_CRS_dist_gemv( &Ad, &x, &b, 1., 0., 'N' );

		vec_dist_clear( &x );
		
		// perform GMRES iteration	
//		if( !This.this_proc )
//			printf( "starting GMRES...\n" );
		gmresFH( &Ad, &b, &x, &run, &P, 0 );

		gmres_time += run.time_gmres;
	}
	// print out some stats
	if( !This.this_proc )
		fprintf( stdout, "\nTimes\n\tpreconditioner calculation :\t%g seconds\n\tGMRES iterations :\t\t%g seconds\n", precon_time/(double)nloop, gmres_time/(double)nloop );
	
	MPI_Barrier( This.comm );
	
	if( !This.this_proc )
		printf( "\nFreeing data...\n" );
	
	precon_free( &P );
	vec_dist_free( &x );
	vec_dist_free( &b );
	mtx_CRS_dist_free( &Ad );
	GMRES_params_free( &run );
	BMPI_free( &This );

// BUGFIX 2006
// -----------
        domain_free( &dom );
// -----------
	
	// close MPI
	MPI_Finalize();
}