cmdArray[5] = "tile0.s";
cmdArray[5] = "tile" + tileNumber + ".s"; cmdArray[6] = "&>"; cmdArray[7] = "/dev/null"; */  String[] cmdArray = { "/bin/bash", "-c", "make -C " + dir + " -f Makefile.streamit tile" + tileNumber + ".s  &> /dev/null" };
    public boolean fits(SIRFilter oldFilter)     {	// if we have an identity filter, just return 0 since these	// aren't mapped onto Raw	if (oldFilter instanceof SIRIdentity || 	    oldFilter instanceof SIRFileWriter ||	    oldFilter instanceof SIRFileReader) {	    return true;	}	TESTING_IMEM = true;	boolean fits = true;	boolean oldMagicNetValue = KjcOptions.magic_net;	boolean oldRateMatchValue = KjcOptions.ratematch;	int oldOutputsValue = KjcOptions.outputs;	//clone the Filter and create a dummy pipeline with just this	//new cloned filter	SIRFilter filter = (SIRFilter)ObjectDeepCloner.deepCopy(oldFilter);	Util.removeIO(filter);	//just call this 	StreamGraph streamGraph = StreamGraph.constructStreamGraph(filter);	StaticStreamGraph fakeSSG = streamGraph.getStaticSubGraphs()[0];	//make a new directory and change the current working dir	String dir = File.separator + "tmp" + File.separator + 	    filter.getName();		int length = Math.min(dir.length() , 20);	dir = dir.substring(0, length) + rand.nextInt(99999) + user;	System.out.println("Checking IMEM Size (DIR: " + dir + ") ...");	     	File file = new File(dir);	file.mkdir();	// set magic net to false	KjcOptions.magic_net = false;	//set rate match to false	KjcOptions.ratematch = false;	//turn off output limiting	KjcOptions.outputs = -1;		//VarDecl Raise to move array assignments up	new VarDeclRaiser().raiseVars(filter);		//VarDecl Raise to move peek index up so	//constant prop propagates the peek buffer index	new VarDeclRaiser().raiseVars(filter);	// layout the components (assign filters to tiles)		streamGraph.getLayout().singleFilterAssignment();	//Generate the tile code	if (!containsRawMain(filter)) {	    RawExecutionCode rawExe = new RawExecutionCode(fakeSSG);	    fakeSSG.getTopLevel().accept(rawExe, null, true);	}		if (KjcOptions.removeglobals) {	    RemoveGlobals.doit(fakeSSG.getTopLevel());	}		// make structures header file in this directory	StructureIncludeFile.doit(SpaceDynamicBackend.structures, streamGraph, dir);	TileCode.generateCode(streamGraph);	MakefileGenerator.createMakefile(streamGraph);		try {	    //move the files 	    {		System.out.println("moving...");		String[] cmdArray = new String[5];		cmdArray[0] = "mv";		cmdArray[1] = "tile0.c";		cmdArray[2] = "Makefile.streamit";		cmdArray[3] = "fileio.bc";		cmdArray[4] = dir;    		Process jProcess = Runtime.getRuntime().exec(cmdArray);		jProcess.waitFor();	    }	    //now see if the compile succeeds	    {		System.out.println("build...");		String[] cmdArray = new String[6];		cmdArray[0] = "make";		cmdArray[1] = "-C";		cmdArray[2] = dir;		cmdArray[3] = "-f";		cmdArray[4] = "Makefile.streamit";		cmdArray[5] = "tile0.s";		Process jProcess = Runtime.getRuntime().exec(cmdArray);		jProcess.waitFor();		//dump the output so that the process does not hang on it		InputStream output = jProcess.getInputStream();		try {		    InputStreamReader isr = new InputStreamReader(output);		    BufferedReader br = new BufferedReader(isr);		    String line = null;		    while ((line = br.readLine()) != null) {		    }		}		catch (Exception e) {		    e.printStackTrace();		}		//set the return value based on the exit code of the make 		assert (jProcess.exitValue() == 0) : 		    "Failure to build C file for IMEM estimation";	    }	    //now determine if the filter fit in IMEM	    {		System.out.println("verify imem...");		String[] cmdArray = new String[6];		cmdArray[0] = "make";		cmdArray[1] = "-C";		cmdArray[2] = dir;		cmdArray[3] = "-f";		cmdArray[4] = "Makefile.streamit";		cmdArray[5] = "verify_imem";		Process jProcess = Runtime.getRuntime().exec(cmdArray);		jProcess.waitFor();		//dump the output so that the process does not hang on it		InputStream output = jProcess.getInputStream();		try {		    InputStreamReader isr = new InputStreamReader(output);		    BufferedReader br = new BufferedReader(isr);		    String line = null;		    while ((line = br.readLine()) != null) {		    }		}		catch (Exception e) {		    e.printStackTrace();		}		//set the return value based on the exit code of the make 		fits = (jProcess.exitValue() == 0);	    }	    //remove the directory	    {		System.out.println("remove dir..."); 		String[] cmdArray = new String[3]; 		cmdArray[0] = "rm"; 		cmdArray[1] = "-rf"; 		cmdArray[2] = dir; 		Process jProcess = Runtime.getRuntime().exec(cmdArray); 		jProcess.waitFor();	    }	}	catch (Exception e) {	    e.printStackTrace();	    Utils.fail("Error running the raw simulator for work estimation");	}		TESTING_IMEM = false;	KjcOptions.magic_net = oldMagicNetValue;	KjcOptions.ratematch = oldRateMatchValue;	KjcOptions.outputs = oldOutputsValue;	//do something with layout	//Layout.setLayout(oldLayout);	return fits;    }