示例#1
0
文件: ObjectSet.cpp 项目: akva2/BSGUI
File::File(QString fn, Node *parent)
    : Node(parent)
    , _change(FC_NONE)
    , lastCheckedSize(0)
{
    m.lock();

    if (fn == "")
    {
        fileName = "<none>";
        absolutePath = "";
    }
    else
    {
        QFileInfo info(fn);
        fileName = info.fileName();
        absolutePath = info.absoluteFilePath();
        _size = info.size();
        modified = info.lastModified();

        computeChecksums(&checksums);
    }

    m.unlock();
}
示例#2
0
文件: ObjectSet.cpp 项目: akva2/BSGUI
void File::refreshInfo()
{
    QFileInfo info(absolutePath);
    _size = info.size();
    modified = info.lastModified();

    computeChecksums(&checksums);
}
void outputResults(const char* inputFile, double* localRows, double* localSolution, float ddtime, float bstime, float fetime, float pvtime)
{
	// Gather X and U on root node.
	double X[MAX_N];
	double* U = malloc(N * (N + 1) * sizeof(double));
	
	gatherSolution(localSolution, X);
	gatherU(localRows, U);
	
	double cx1, cx2, cu1, cu2;
	
	if(PID == 0)
	{
		computeChecksums(U, X, &cu1, &cu2, &cx1, &cx2);
		
		//float time = mstime() - startTime;
		float sequentialTimeDDBSFEPV = 0;
		float sequentialTimeDD = 0;
		float sequentialTimeBS = 0;
		float sequentialTimeFE = 0;
		float sequentialTimeFENOPV = 0;
		float sequentialTimePV = 0;
		char filename[32];
		
		if(P > 1)
		{
			// Read linear time from saved file (if we are not running in sequential mode)
			sprintf(filename, "op_P_%d_N_%d_R_%d_%d.txt", 1, N, R, DISTRIBUTE_READ);
			FILE* in = fopen(filename, "r");
			
			char line[512];
			// skip first three lines (headers)
			fgets(line, 512, in);
			fgets(line, 512, in);
			fgets(line, 512, in);
			
			fscanf(in, "Sequential Time w/DD+BS     : %f(ms)\n", &sequentialTimeDDBSFEPV);
			fscanf(in, "Sequential Time DD only     : %f(ms)\n", &sequentialTimeDD);
			fscanf(in, "Sequential Time BS only     : %f(ms)\n", &sequentialTimeBS);
			fscanf(in, "Sequential Time PV only     : %f(ms)\n", &sequentialTimePV);
			fscanf(in, "Sequential Time w/oDD+BS    : %f(ms)\n", &sequentialTimeFE);
			fscanf(in, "Sequential Time w/oDD+BS+PV : %f(ms)\n", &sequentialTimeFENOPV);
			fclose(in);
		}
		
		// Write output
		sprintf(filename, "op_P_%d_N_%d_R_%d_%d.txt", P, N, R, DISTRIBUTE_READ);
		FILE* out = fopen(filename, "a");
		
		fprintf(out, "P = %d, distributed_read = %d, N = %d, R = %d, input = %s\n", P, DISTRIBUTE_READ, N, R, inputFile);
		fprintf(out, "Checksum1(X) = %11.4e,    Checksum2(X) = %11.4e,    Checksum1(U) = %11.4e,    Checksum2(U) = %11.4e\n", cx1, cx2, cu1, cu2);
		fprintf(out, "-------------------------------------------------------------------------------------------------------------\n");
		
		if(P == 1)
		{
			// Print times
			fprintf(out, "Sequential Time w/DD+BS     : %.3f(ms)\n", ddtime + fetime + bstime);
			fprintf(out, "Sequential Time DD only     : %.3f(ms)\n", ddtime);
			fprintf(out, "Sequential Time BS only     : %.3f(ms)\n", bstime);
			fprintf(out, "Sequential Time PV only     : %.3f(ms)\n", pvtime);
			fprintf(out, "Sequential Time w/oDD+BS    : %.3f(ms)\n", fetime);
			fprintf(out, "Sequential Time w/oDD+BS+PV : %.3f(ms)\n", fetime - pvtime);
		}
		else
		{
			fprintf(out, "Sequential Time w/DD+BS     : %.3f(ms)\n", sequentialTimeDDBSFEPV);
			fprintf(out, "Sequential Time DD only     : %.3f(ms)\n", sequentialTimeDD);
			fprintf(out, "Sequential Time BS only     : %.3f(ms)\n", sequentialTimeBS);
			fprintf(out, "Sequential Time PV only     : %.3f(ms)\n", sequentialTimePV);
			fprintf(out, "Sequential Time w/oDD+BS    : %.3f(ms)\n", sequentialTimeFE);
			fprintf(out, "Sequential Time w/oDD+BS+PV : %.3f(ms)\n\n", sequentialTimeFENOPV);
		}
		
		// Print Speedups
		if(P > 1)
		{
			fprintf(out, "Parallel Time w/DD+BS  : %.3f(ms)\n", ddtime + fetime + bstime);
			fprintf(out, "Speedup       w/DD+BS  : %.3f\n\n", sequentialTimeDDBSFEPV / (ddtime + fetime + bstime));
			
			fprintf(out, "Parallel Time DD only     : %.3f(ms)\n", ddtime);
			fprintf(out, "Speedup       DD only     : %.3f\n\n", sequentialTimeDD / ddtime);
			
			fprintf(out, "Parallel Time BS only     : %.3f(ms)\n", bstime);
			fprintf(out, "Speedup       BS only     : %.3f\n\n", sequentialTimeBS / bstime);
			
			fprintf(out, "Parallel Time PV only     : %.3f(ms)\n", pvtime);
			fprintf(out, "Speedup       PV only     : %.3f\n\n", sequentialTimePV / pvtime);
			
			fprintf(out, "Parallel Time w/oDD+BS    : %.3f(ms)\n", fetime);
			fprintf(out, "Speedup       w/oDD+BS    : %.3f\n", sequentialTimeFE / fetime);
			
			fprintf(out, "Parallel Time w/oDD+BS+PV    : %.3f(ms)\n", fetime - pvtime);
			fprintf(out, "Speedup       w/oDD+BS+PV    : %.3f\n", (sequentialTimeFE -  sequentialTimePV) / (fetime - pvtime));
		}
		fprintf(out, "-------------------------------------------------------------------------------------------------------------\n\n");
		fclose(out);
		
		// Write aggregated results
		// In a csv file with columns
		// INPUT NAME, N, P, R, DISTRIBUTE_READ, TIME, SPEEDUP
		out = fopen("aggregatedResults.csv", "a");
		fprintf(out, "%s, %d, %d, %d, %d, %f, %f, %f, %f, %f, %f, ", inputFile, N, P, R, DISTRIBUTE_READ, 
			(ddtime + fetime + bstime), ddtime, bstime, pvtime, fetime, (fetime - pvtime));
		if(P > 1)
		{		
			fprintf(out, "%f, ", sequentialTimeDDBSFEPV / (ddtime + fetime + bstime));
			fprintf(out, "%f, ", sequentialTimeDD / ddtime);
			fprintf(out, "%f, ", sequentialTimeBS / bstime);
			fprintf(out, "%f, ", sequentialTimePV / pvtime);
			fprintf(out, "%f, ", sequentialTimeFE / fetime);
			fprintf(out, "%f\n", (sequentialTimeFE -  sequentialTimePV) / (fetime - pvtime));
		}
		else 
		{
			fprintf(out, "1.0, 1.0, 1.0, 1.0\n");
		}
		fclose(out);
	}
	
	if(OUTPUT_UX)
	{
		if(PID == 0)
		{
			// Write the solution vector and U matrix.
			char filename[32];
			sprintf(filename, "op_P_%d_N_%d_R_%d_%d_UX.txt", P, N, R, DISTRIBUTE_READ);
			FILE* out = fopen(filename, "w");
			fprintf(out, "P = %d, distributed_read = %d, N = %d, R = %d, input = %s\n", P, DISTRIBUTE_READ, N, R, inputFile);
			fprintf(out, "Checksum1(X) = %11.4e,    Checksum2(X) = %11.4e,    Checksum1(U) = %11.4e,    Checksum2(U) = %11.4e\n", cx1, cx2, cu1, cu2);
			fprintf(out, "---------------------------------------------------------------------------------------------------\n");
			fprintf(out, "Solution Vector:\n");
			outputSolution(out, X);
			fprintf(out, "---------------------------------------------------------------------------------------------------\n");
			fprintf(out, "U Matrix:\n");
			outputMatrix(out, U);
			fclose(out);
		}
	}
}