private boolean isFirstRun;
+ public boolean validationTest;
+
public Barneshut(){
isFirstRun = true;
+ validationTest=false;
}
private void ReadInput(String filename) {
epssq = eps * eps;
itolsq = 1.0 / (tol * tol);
- if (isFirstRun) {
+ if (isFirstRun && !validationTest) {
System.out.println("configuration: " + nbodies + " bodies, " + ntimesteps + " time steps");
System.out.println("");
}
mintime =9223372036854775807L;
run = 0;
+ if (args.length > 1 ) {
+ bh.validationTest=true;
+ }
+
// while (((run < 3) || (Math.abs(lasttime-runtime)*64 > min(lasttime, runtime))) && (run < 7)) {
runtime = bh.run(args);
if (runtime < mintime) mintime = runtime;
run++;
// }
- System.out.println("minimum runtime: " + mintime + " ms");
- System.out.println("");
+ if(!bh.validationTest){
+ System.out.println("minimum runtime: " + mintime + " ms");
+ System.out.println("");
+ }
}
public long run(String args[]) {
- if (isFirstRun) {
+ if (isFirstRun && !validationTest) {
System.out.println("Lonestar Benchmark Suite v2.1");
System.out.println("Copyright (C) 2007, 2008, 2009 The University of Texas at Austin");
System.out.println("http://iss.ices.utexas.edu/lonestar/");
System.out.println("http://iss.ices.utexas.edu/lonestar/barneshut.html");
System.out.println("");
}
- if (args.length != 1) {
+ if (args.length ==0 ) {
System.out.println("arguments: input_file_name");
System.exit(-1);
}
long fstart_time = System.currentTimeMillis();
ReadInput(args[0]);
long fend_time = System.currentTimeMillis();
- System.out.println("file reading time="+(fend_time-fstart_time));
+ if(!validationTest){
+ System.out.println("file reading time="+(fend_time-fstart_time));
+ }
long runtime = 0;
int local_nbodies=nbodies;
int local_ntimesteps=ntimesteps;
long end_time=System.currentTimeMillis();
if (isFirstRun) {
- /*
- for (int i = 0; i < local_nbodies; i++) {
- System.out.println(body[i].posx + " " + body[i].posy + " " + body[i].posz); // print result
+ if(validationTest){
+ for (int i = 0; i < local_nbodies; i++) {
+ System.out.println(body[i].posx + " " + body[i].posy + " " + body[i].posz); // print result
+ }
+ System.out.println("");
}
- */
- System.out.println("");
}
runtime += (end_time-start_time);
- System.out.println("runtime: " + runtime + " ms");
+ if(!validationTest){
+ System.out.println("runtime: " + runtime + " ms");
+ }
isFirstRun = false;
return runtime;
short[] userkey; // Key for encryption/decryption.
int[] Z; // Encryption subkey (userkey derived).
int[] DK; // Decryption subkey (userkey derived).
+
+ public boolean validationTest;
// buildTestData
// Builds the data used for the test -- each time the test is run.
datasizes[0] = 3000000;
datasizes[1] = 20000000;
datasizes[2] = 1000000000;
+ validationTest=false;
}
public void JGFsetsize(int size, int nWorker) {
}
int p=plain2[0];
long endT=System.currentTimeMillis();
- System.out.println(p+"runningtime="+(endT-startT));
-
-// boolean error = false;
-// for (int i = 0; i < array_rows; i++){
-// error = (plain1 [i] != plain2 [i]);
-// if (error){
-// System.out.println("Validation failed");
-// System.out.println("Original Byte " + i + " = " + plain1[i]);
-// System.out.println("Encrypted Byte " + i + " = " + crypt1[i]);
-// System.out.println("Decrypted Byte " + i + " = " + plain2[i]);
-// return;
-// }
-// }
-// System.out.println("Validation Success");
+ if(!validationTest){
+ System.out.println(p+"runningtime="+(endT-startT));
+ }
+
+ if(validationTest){
+ boolean error = false;
+ for (int i = 0; i < array_rows; i++){
+ error = (plain1 [i] != plain2 [i]);
+ if (error){
+ System.out.println("Validation failed");
+ System.out.println("Original Byte " + i + " = " + plain1[i]);
+ System.out.println("Encrypted Byte " + i + " = " + crypt1[i]);
+ System.out.println("Decrypted Byte " + i + " = " + plain2[i]);
+ return;
+ }
+ }
+ System.out.println("VALID");
+ }
+
}
public void JGFrun(int size, int nWorker) {
long endT=System.currentTimeMillis();
JGFkernel();
- System.out.println("init="+(endT-startT));
+ if(!validationTest){
+ System.out.println("init="+(endT-startT));
+ }
}
public static void main(String argv[]) {
if (argv.length > 1) {
nWorker = Integer.parseInt(argv[1]);
}
+
+ if(argv.length > 2){
+ cb.validationTest=true;
+ }
cb.JGFrun(problem_size, nWorker);
* Output: Cluster centers
**/
float[][] cluster_centres;
+
+ public boolean validationTest;
public KMeans() {
max_nclusters = 13;
use_zscore_transform = 1;
threshold = (float) 0.001;
best_nclusters=0;
+ validationTest=false;
}
public KMeans(int threadid, GlobalArgs g_args) {
}
long endT=System.currentTimeMillis();
+ if(!kms.validationTest){
System.out.println("running time="+(endT-startT));
+ }
// System.out.println("TIME="+g_args.global_time);
System.out.println("Printing output......");
System.out.println("Best_nclusters= " + kms.best_nclusters);
/* Output: the coordinates of the cluster centres */
- /*
- {
- for (int i = 0; i < kms.best_nclusters; i++) {
- System.out.print(i + " ");
- for (int j = 0; j < numAttributes; j++) {
- System.out.print(kms.cluster_centres[i][j] + " ");
- }
- System.out.println("\n");
- }
+ if(kms.validationTest){
+ for (int i = 0; i < kms.best_nclusters; i++) {
+ System.out.print(i + " ");
+ for (int j = 0; j < numAttributes; j++) {
+ System.out.print(kms.cluster_centres[i][j] + " ");
+ }
+ System.out.println("\n");
+ }
}
- */
System.out.println("Finished......");
}
} else if(arg.equals("-h")) {
km.usage();
+ } else if(arg.equals("-v")){
+ km.validationTest=true;
}
}
if(km.nthreads == 0 || km.filename == null) {
if(!stats)
System.out.println("Verification not passed");
else
- System.out.println("Verification passed.");
+ System.out.println("VALID");
System.out.println("Finished");
}
*/\r
\r
public class MergeSort4 extends MergeSort {\r
+ \r
+ public boolean validationTest;\r
\r
public static void main(String[] args) {\r
int problemSize = 4194304;\r
int parallelBranch=32;\r
+ \r
+ MergeSort4 sort = new MergeSort4();\r
+ \r
if (args.length > 0) {\r
problemSize = Integer.parseInt(args[0]);\r
}\r
if (args.length > 1) {\r
parallelBranch = Integer.parseInt(args[1]);\r
}\r
- MergeSort4 sort = new MergeSort4();\r
+ if (args.length > 2){\r
+ sort.validationTest=true;\r
+ }\r
sort.run(problemSize,parallelBranch);\r
}\r
\r
public MergeSort4() {\r
super();\r
+ validationTest=false;\r
}\r
\r
public void runWorkAndTest() {\r
long endT=System.currentTimeMillis();\r
System.out.println("running time="+(endT-startT));\r
}\r
-// sese test{\r
-// checkSorted(output);\r
-// }\r
+ if(validationTest){\r
+ sese test{\r
+ checkSorted(output);\r
+ }\r
+ }\r
}\r
\r
public int[] serializedSort(int A[], int low, int high) {\r
return;\r
}\r
}\r
- System.out.println("Validation Success.");\r
+ System.out.println("VALID");\r
}\r
\r
protected void merge(int A[], int B[], int out[]) {\r
if (l != r ){
System.printString("Validation failed\n");
System.printString("Kinetic Energy = " + (long)dval + " " + (long)dev + " " + size + "\n");
+ }else{
+ System.printString("VALID\n");
}
System.printString("Finished\n");
System.out.println(" expectedReturnRate= " + getAppDemo().JGFavgExpectedReturnRateMC + " " + dev
+ " " + size);
}else{
- System.out.println("Validation success");
+ System.out.println("VALID");
}
}
**/
public static void main(String args[]) {
- boolean printResults = false;
+ boolean validationTest = false;
boolean printMsgs =true;
// the input size is fixed, but the user may want the result printed
// parseCmdLine(args);
+
+ if(args.length>0){
+ validationTest=true;
+ }
// initial pass
long start0 = System.currentTimeMillis();
while (true) {
r.compute();
- if (printResults)
+ if (validationTest)
System.out.println(r);
if (r.reachedLimit())
break;
- r.nextIter(printResults);
+ r.nextIter(validationTest);
} /* while */
long end1 = System.currentTimeMillis();
- if (printMsgs) {
+ if (printMsgs && (!validationTest)) {
System.out.println("Power build time " + (end0 - start0) / 1000.0);
System.out
.println("Power compute time " + (end1 - start1) / 1000.0);
}
- public void JGFapplication() {
+ public void JGFapplication(boolean vtest) {
// instr.startTimer("Section3:RayTracer:Run");
Interval interval = new Interval(0, width, height, 0, height, 1);
// Do the business!
- render(interval);
+ render(interval,vtest);
// System.out.println("DONE");
// instr.stopTimer("Section3:RayTracer:Run");
// System.gc();
}
- public void JGFrun(int size, JGFInstrumentor instr) {
+ public void JGFrun(int size, JGFInstrumentor instr,boolean vtest) {
// instr.addTimer("Section3:RayTracer:Total", "Solutions", size);
// instr.addTimer("Section3:RayTracer:Init", "Objects", size);
// instr.startTimer("Section3:RayTracer:Total");
JGFinitialise();
- JGFapplication();
+ JGFapplication(vtest);
// JGFvalidate();
// JGFtidyup();
view = scene.getView();
}
- public void render(Interval interval) {
+ public void render(Interval interval,boolean vtest) {
// long checksum;
// checksum=0;
} // end for (y)
- System.out.println("END OF WORK");
+ if(!vtest){
+ System.out.println("END OF WORK");
+ }
}
public class test {
public static void main(String argv[]) {
- JGFInstrumentor instr = new JGFInstrumentor();
- instr.printHeader(3, 0);
-
- JGFRayTracerBench rtb = new JGFRayTracerBench(instr);
+ boolean vtest=false;
int size=1;
if( argv.length>0 ){
size=Integer.parseInt(argv[0]);
+ if(argv.length>1){
+ vtest=true;
+ }
}
- rtb.JGFrun(size, instr);
+ JGFInstrumentor instr = new JGFInstrumentor();
+ if(!vtest){
+ instr.printHeader(3, 0);
+ }
+
+ JGFRayTracerBench rtb = new JGFRayTracerBench(instr);
+ rtb.JGFrun(size, instr,vtest);
}
}
--- /dev/null
+#!/bin/bash
+
+CURDIR=`pwd`
+SINGF=output.sing
+DOJF=output.doj
+DIF=$CURDIR/validation-result.txt
+rm -f $DIF
+
+BDIR=( raytracer barneshut tracking voronoi kmeans power )
+BCOM=( test Barneshut TrackingBench TestRunner KMeans Power )
+BARGS=( "1 1" "./inputs/BarnesHutLarge.in 1" "" "1000000 -p" "-m 40 -n 40 -t 0.00001 -i inputs/random-n65536-d32-c16.txt -nthreads 1 -v" "1" )
+
+for((i=0; i<${#BDIR[@]}; i++))
+do
+cd $CURDIR/${BDIR[$i]}
+ rm -f $SINGF
+ rm -f $DOJF
+ make clean;
+ make single;make rcrpointer
+ ./${BCOM[$i]}s.bin ${BARGS[$i]} > $SINGF
+ ./${BCOM[$i]}r.bin ${BARGS[$i]} > $DOJF
+ echo ${BDIR[$i]} >> $DIF
+ diff $SINGF $DOJF >> $DIF
+ rm -f $SINGF
+ rm -f $DOJF
+ make clean;
+done
+
+BDIR2=( crypt monte moldyn labyrinth sor mergesort )
+BCOM2=( JGFCryptBench JGFMonteCarloBench JGFMolDynBenchSizeB Labyrinth JGFSORBenchSizeD MergeSort4 )
+BARGS2=( "2 43 1" "" "1 215" "-w 22 -i ./inputs/random-x7-y512-z512-n512.txt" "" "134217728 32 1" )
+
+for((i=0; i<${#BDIR2[@]}; i++))
+do
+cd $CURDIR/${BDIR2[$i]}
+ make rcrpointer
+ ./${BCOM2[$i]}r.bin ${BARGS2[$i]} > $DOJF
+ if [ $(grep -c VALID $DOJF) -ne 0 ]
+ then
+ echo ${BDIR2[$i]} >> $DIF
+ else
+ echo ${BDIR2[$i]} "FAIL" >> $DIF
+ fi
+ rm -f $DOJF
+ make clean;
+done
\ No newline at end of file
System.out.println("Validation failed");
System.out.println("Gtotal = " + Gtotal + " dev=" + dev + " sizeParam=" + size);
}else{
- System.out.println("Validataion Success! dev="+dev);
+ System.out.println("VALID dev="+dev);
}
}
long start1 = System.currentTimeMillis();
Edge edge = point.buildDelaunayTriangulation(extra, 0);
long end1 = System.currentTimeMillis();
- System.out.println("Build time " + (end0 - start0) / 1000.0);
- System.out.println("Compute time " + (end1 - start1) / 1000.0);
- System.out.println("Total time " + (end1 - start0) / 1000.0);
- System.out.println("Done!");
+ if (!printResults){
+ System.out.println("Build time " + (end0 - start0) / 1000.0);
+ System.out.println("Compute time " + (end1 - start1) / 1000.0);
+ System.out.println("Total time " + (end1 - start0) / 1000.0);
+ System.out.println("Done!");
+ }
if (printResults)
edge.outputVoronoiDiagram();