Home My Page Projects Code Snippets Project Openings diderot
Summary Activity Tracker Tasks SCM

SCM Repository

[diderot] View of /branches/lamont/test/boids/benchmark/genData.c
ViewVC logotype

View of /branches/lamont/test/boids/benchmark/genData.c

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2561 - (download) (as text) (annotate)
Thu Mar 6 17:45:45 2014 UTC (5 years, 5 months ago) by lamonts
File size: 1042 byte(s)
Adding script for producing boids benchmark
#include <stdio.h> 
#include <stdlib.h> 

void genData(const char * inFile, const char * outFile, int col, int colCount, int runCount){

	FILE * infp, * outfp;

	if((infp = fopen(inFile,"r")) == NULL){
		fprintf(stderr, "Could not open file:%s\n", inFile);
		exit(EXIT_FAILURE); 
	}
	if((outfp = fopen(outFile,"a")) == NULL){
		fprintf(stderr, "Could not create file:%s\n", outFile);
		exit(EXIT_FAILURE); 
	}
	double value,mean=0.0; 
	int count=0;  
	while((fscanf(infp,"usr=%lf\n",&value)) != EOF) {mean +=value;} 
	
	mean/=runCount; 

	if(!(col % colCount))  
	  fprintf(outfp,"%f\n",mean);  
	else 
	  fprintf(outfp,"%f ",mean);  

	fclose(infp);
	fclose(outfp); 

}
int main(int argc, char * argv[]){ 

	if(argc >= 5){
		int runCount = atoi(argv[1]); 
		int col = atoi(argv[2]); 
		int colCount = atoi(argv[3]); 
		printf("Infile=%s\n",argv[4]); 
		genData(argv[4],"parallel.dat",col,colCount,runCount); 

	}else {
		fprintf(stderr, "genData runCount col colCount processor_data_file");
		exit(EXIT_FAILURE); 
	}
	return EXIT_SUCCESS; 
}

root@smlnj-gforge.cs.uchicago.edu
ViewVC Help
Powered by ViewVC 1.0.0