The key for release to market has been expired. Needs new key and package name.
[0xbench:0xbench.git] / src / jnt / scimark2 / commandline.java
1 package jnt.scimark2;
2
3 import java.util.Properties;
4
5 import org.zeroxlab.zeroxbenchmark.TesterScimark2;
6 import android.os.Bundle;
7
8 /**
9     SciMark2: A Java numerical benchmark measuring performance
10     of computational kernels for FFTs, Monte Carlo simulation,
11     sparse matrix computations, Jacobi SOR, and dense LU matrix
12     factorizations.  
13 */
14
15
16 public class commandline
17 {
18
19   /* Benchmark 5 kernels with individual Mflops.
20      "results[0]" has the average Mflop rate.
21
22   */
23
24
25     public static String main(Bundle info) {
26         // default to the (small) cache-contained version
27
28         double min_time = Constants.RESOLUTION_DEFAULT;
29
30         int FFT_size = Constants.FFT_SIZE;
31         int SOR_size =  Constants.SOR_SIZE;
32         int Sparse_size_M = Constants.SPARSE_SIZE_M;
33         int Sparse_size_nz = Constants.SPARSE_SIZE_nz;
34         int LU_size = Constants.LU_SIZE;
35
36         // run the benchmark
37
38         double res[] = new double[6];
39         Random R = new Random(Constants.RANDOM_SEED);
40
41         res[1] = kernel.measureFFT( FFT_size, min_time, R);
42         res[2] = kernel.measureSOR( SOR_size, min_time, R);
43         res[3] = kernel.measureMonteCarlo(min_time, R);
44         res[4] = kernel.measureSparseMatmult( Sparse_size_M, 
45                     Sparse_size_nz, min_time, R);
46         res[5] = kernel.measureLU( LU_size, min_time, R);
47
48
49         res[0] = (res[1] + res[2] + res[3] + res[4] + res[5]) / 5;
50
51
52         // print out results
53
54
55
56         System.out.println();
57         System.out.println("SciMark 2.0a");
58         System.out.println();
59
60         System.out.println("Composite Score: " + res[0]);
61         info.putDouble(TesterScimark2.COMPOSITE, res[0]);
62
63         System.out.print("FFT ("+FFT_size+"): ");
64         if (res[1]==0.0)
65             System.out.println(" ERROR, INVALID NUMERICAL RESULT!");
66         else
67             System.out.println(res[1]);
68         info.putDouble(TesterScimark2.FFT, res[1]);
69
70         System.out.println("SOR ("+SOR_size+"x"+ SOR_size+"): "
71                 + "  " + res[2]);
72         info.putDouble(TesterScimark2.SOR, res[2]);
73
74         System.out.println("Monte Carlo : " + res[3]);
75         info.putDouble(TesterScimark2.MONTECARLO, res[3]);
76
77         System.out.println("Sparse matmult (N="+ Sparse_size_M+ 
78                 ", nz=" + Sparse_size_nz + "): " + res[4]);
79         info.putDouble(TesterScimark2.SPARSEMATMULT, res[4]);
80
81         System.out.print("LU (" + LU_size + "x" + LU_size + "): ");
82         if (res[5]==0.0)
83             System.out.println(" ERROR, INVALID NUMERICAL RESULT!");
84         else
85             System.out.println(res[5]);
86         info.putDouble(TesterScimark2.LU, res[5]);
87
88         return "";
89
90     }
91   
92 }