コード例 #1
0
		/// <summary>
		///  Benchmark 5 kernels with individual Mflops.
		///  "results[0]" has the average Mflop rate.
		/// </summary>
		public static void  Main (System.String[] args, ILog logger)
		{
			// default to the (small) cache-contained version
			double min_time = Constants.RESOLUTION_DEFAULT;
			
			int FFT_size = Constants.FFT_SIZE;
			int SOR_size = Constants.SOR_SIZE;
			int Sparse_size_M = Constants.SPARSE_SIZE_M;
			int Sparse_size_nz = Constants.SPARSE_SIZE_nz;
			int LU_size = Constants.LU_SIZE;
			
			// look for runtime options
			if (args.Length < 1) {
				logger.InfoFormat ("Usage: <benchmark-name>");
				return;
			}


			logger.InfoFormat ("**                                                               **");
			logger.InfoFormat ("** SciMark2a Numeric Benchmark, see http://math.nist.gov/scimark **");
			logger.InfoFormat ("**                                                               **");
		
			// run the benchmark
			SciMark.Random R = new SciMark.Random (Constants.RANDOM_SEED);
			
			logger.InfoFormat ("Mininum running time = {0} seconds", min_time);
			double res;
			switch (args [0]) {
			case "fft":
				res = kernel.measureFFT (FFT_size, min_time, R);
				logger.InfoFormat ("FFT            : {0} - ({1})", res == 0.0 ? "ERROR, INVALID NUMERICAL RESULT!" : res.ToString ("F2"), FFT_size);            
				break;
			case "sor":
				res = kernel.measureSOR (SOR_size, min_time, R);
				logger.InfoFormat ("SOR            : {1:F2} - ({0}x{0})", SOR_size, res);
				break;
			case "mc":
				res = kernel.measureMonteCarlo (min_time, R);
				logger.InfoFormat ("Monte Carlo    :  {0:F2}", res);
				break;
			case "mm":
				res = kernel.measureSparseMatmult (Sparse_size_M, Sparse_size_nz, min_time, R);
				logger.InfoFormat ("Sparse MatMult : {2:F2} - (N={0}, nz={1})", Sparse_size_M, Sparse_size_nz, res);
				break;
			case "lu":
				res = kernel.measureLU (LU_size, min_time, R);	
				logger.InfoFormat ("LU             : {1} - ({0}x{0})", LU_size, res == 0.0 ? "ERROR, INVALID NUMERICAL RESULT!" : res.ToString ("F2"));
				break;
			default:
				logger.InfoFormat ("Invalid benchmark: {0}", args [1]);
				break;
			}
		}
コード例 #2
0
ファイル: MonteCarlo.cs プロジェクト: lewurm/benchmarker
		public static double integrate(int Num_samples)
		{
			
			SciMark.Random R = new SciMark.Random(SEED);
			
			
			int under_curve = 0;
			 for (int count = 0; count < Num_samples; count++)
			{
				double x = R.nextDouble();
				double y = R.nextDouble();
				
				if (x * x + y * y <= 1.0)
					under_curve++;
				
			}
			
			return ((double) under_curve / Num_samples) * 4.0;
		}
コード例 #3
0
ファイル: MonteCarlo.cs プロジェクト: modulexcite/benchmarker
        public static double integrate(int Num_samples)
        {
            SciMark.Random R = new SciMark.Random(SEED);


            int under_curve = 0;

            for (int count = 0; count < Num_samples; count++)
            {
                double x = R.nextDouble();
                double y = R.nextDouble();

                if (x * x + y * y <= 1.0)
                {
                    under_curve++;
                }
            }

            return(((double)under_curve / Num_samples) * 4.0);
        }
コード例 #4
0
        /// <summary>
        ///  Benchmark 5 kernels with individual Mflops.
        ///  "results[0]" has the average Mflop rate.
        /// </summary>
        public static void  Main(System.String[] args, ILog logger)
        {
            // default to the (small) cache-contained version
            double min_time = Constants.RESOLUTION_DEFAULT;

            int FFT_size       = Constants.FFT_SIZE;
            int SOR_size       = Constants.SOR_SIZE;
            int Sparse_size_M  = Constants.SPARSE_SIZE_M;
            int Sparse_size_nz = Constants.SPARSE_SIZE_nz;
            int LU_size        = Constants.LU_SIZE;

            // look for runtime options
            if (args.Length < 1)
            {
                logger.InfoFormat("Usage: <benchmark-name>");
                return;
            }


            logger.InfoFormat("**                                                               **");
            logger.InfoFormat("** SciMark2a Numeric Benchmark, see http://math.nist.gov/scimark **");
            logger.InfoFormat("**                                                               **");

            // run the benchmark
            SciMark.Random R = new SciMark.Random(Constants.RANDOM_SEED);

            logger.InfoFormat("Mininum running time = {0} seconds", min_time);
            double res;

            switch (args [0])
            {
            case "fft":
                res = kernel.measureFFT(FFT_size, min_time, R);
                logger.InfoFormat("FFT            : {0} - ({1})", res == 0.0 ? "ERROR, INVALID NUMERICAL RESULT!" : res.ToString("F2"), FFT_size);
                break;

            case "sor":
                res = kernel.measureSOR(SOR_size, min_time, R);
                logger.InfoFormat("SOR            : {1:F2} - ({0}x{0})", SOR_size, res);
                break;

            case "mc":
                res = kernel.measureMonteCarlo(min_time, R);
                logger.InfoFormat("Monte Carlo    :  {0:F2}", res);
                break;

            case "mm":
                res = kernel.measureSparseMatmult(Sparse_size_M, Sparse_size_nz, min_time, R);
                logger.InfoFormat("Sparse MatMult : {2:F2} - (N={0}, nz={1})", Sparse_size_M, Sparse_size_nz, res);
                break;

            case "lu":
                res = kernel.measureLU(LU_size, min_time, R);
                logger.InfoFormat("LU             : {1} - ({0}x{0})", LU_size, res == 0.0 ? "ERROR, INVALID NUMERICAL RESULT!" : res.ToString("F2"));
                break;

            default:
                logger.InfoFormat("Invalid benchmark: {0}", args [1]);
                break;
            }
        }