/* !-------------------------------------------------------------------------! ! ! ! N A S P A R A L L E L B E N C H M A R K S 3.0 ! ! ! ! J A V A V E R S I O N ! ! ! ! I S ! ! ! !-------------------------------------------------------------------------! ! ! ! This benchmark is a serial/multithreaded version of the ! ! NPB_JAV IS code. ! ! ! ! Permission to use, copy, distribute and modify this software ! ! for any purpose with or without fee is hereby granted. We ! ! request, however, that all derived work reference the NAS ! ! Parallel Benchmarks 3.0. This software is provided "as is" ! ! without express or implied warranty. ! ! ! ! Information on NPB 3.0, including the Technical Report NAS-02-008 ! ! "Implementation of the NAS Parallel Benchmarks in Java", ! ! original specifications, source code, results and information ! ! on how to submit new results, is available at: ! ! ! ! http://www.nas.nasa.gov/Software/NPB/ ! ! ! ! Send comments or suggestions to npb@nas.nasa.gov ! ! ! ! NAS Parallel Benchmarks Group ! ! NASA Ames Research Center ! ! Mail Stop: T27A-1 ! ! Moffett Field, CA 94035-1000 ! ! ! ! E-mail: npb@nas.nasa.gov ! ! Fax: (650) 604-3957 ! ! ! !-------------------------------------------------------------------------! ! Authors: M. Yarrow ! ! Translation to Java and MultiThreaded Code ! ! M. Frumkin ! ! M. Schultz ! !-------------------------------------------------------------------------! */ package NPB_JAV; import NPB_JAV.ISThreads.*; import NPB_JAV.BMInOut.*; public class IS extends ISBase{ public int bid=-1; public BMResults results; public boolean serial=false; Random rng; protected static final double amult = 1220703125.0; public IS(char clss, int np, boolean ser){ super(clss,np,ser); serial=ser; rng=new Random(); } public static void main(String argv[] ){ IS is = null; BMArgs.ParseCmdLineArgs(argv,BMName); char CLSS=BMArgs.CLASS; int np=BMArgs.num_threads; boolean serial=BMArgs.serial; try{ is = new IS(CLSS,np,serial); }catch(OutOfMemoryError e){ BMArgs.outOfMemoryMessage(); System.exit(0); } is.runBenchMark(); } public void run(){runBenchMark();} public void runBenchMark(){ BMArgs.Banner(BMName,CLASS,serial,num_threads); System.out.println(" Size: "+ TOTAL_KEYS +" Iterations: " + MAX_ITERATIONS); //Initialize timer timer = new Timer(); timer.resetTimer( 0 ); //Generate random number sequence and subsequent keys on all procs initKeys(amult); // Random number gen seed // Random number gen mult /* Do one interation for free (i.e., untimed) to guarantee initialization of all data and code pages and respective tables */ if(serial){ rank( 1 ); }else{ setupThreads(this); RankThread.iteration=1; doSort(); for(int i=0; i 0 ){ mops = (double) niter+num_keys; mops *= niter / (total_time*1000000.0); } return mops; } void rank( int iteration ){ key_array[iteration] = iteration; key_array[iteration+MAX_ITERATIONS] = MAX_KEY - iteration; for(int i=0; i=MAX_KEY||idx>=NUM_KEYS) break; } key_array[idx] = key; idx++; } //Confirm keys correctly sorted: count incorrectly sorted keys, if any int count = 0; for(int i=1; i key_array[i] ) count++; if( count != 0 ){ System.out.println( "Full_verify: number of keys out of sort: " + count); }else passed_verification++; return passed_verification; } void initKeys( double a ){ double x; int k = MAX_KEY/4; for (int i=0; i