/* !-------------------------------------------------------------------------! ! ! ! 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 ! ! ! ! M G B a s e ! ! ! !-------------------------------------------------------------------------! ! ! ! MGBase implements base class for MG benchmark. ! ! ! ! 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 ! ! ! !-------------------------------------------------------------------------! ! Translation to Java and MultiThreaded Code ! ! M. Frumkin ! ! M. Schultz ! !-------------------------------------------------------------------------! */ package NPB_JAV.MGThreads; import NPB_JAV.*; import NPB_JAV.MG; public class MGBase extends Thread{ public static final String BMName="MG"; public char CLASS = 'S'; public static final int maxlevel=11; public int nit; public int nx_default, ny_default, nz_default; public int nit_default, lm, lt_default; public int ndim1, ndim2, ndim3; public int nm,nv,nr,nm2; public int nx[],ny[],nz[]; public int ir[],m1[],m2[],m3[]; public int lt,lb; public double u[],v[],r[],a[],c[]; public int zoff,zsize3,zsize2,zsize1; public int uoff,usize1,usize2,usize3; public int roff,rsize1,rsize2,rsize3; protected static final int T_total=0, T_init=1, T_bench=2, T_mg3P=3, T_psinv=4, T_resid=5, T_resid2=6, T_rprj3=7, T_interp=8, T_norm2=9, T_last=9; public boolean timeron=false; public Timer timer = new Timer(); public MGBase(){} public MGBase(char clss,int np,boolean serial){ CLASS=clss; num_threads=np; nx = new int[maxlevel]; ny = new int[maxlevel]; nz = new int[maxlevel]; ir = new int[maxlevel]; m1 = new int[maxlevel]; m2 = new int[maxlevel]; m3 = new int[maxlevel]; switch( CLASS ){ case 'S': nx_default=32; ny_default=32; nz_default=32; nit_default=4; lm=5; lt_default=5; ndim1 = 5; ndim2 = 5; ndim3 = 5; lt=lt_default; nit = nit_default; nx[lt-1] = nx_default; ny[lt-1] = ny_default; nz[lt-1] = nz_default; break; case 'W': nx_default=64; ny_default=64; nz_default=64; nit_default=40; lm=6; lt_default=6; ndim1 = 6; ndim2 = 6; ndim3 = 6; lt=lt_default; nit = nit_default; nx[lt-1] = nx_default; ny[lt-1] = ny_default; nz[lt-1] = nz_default; break; case 'A': nx_default=256; ny_default=256; nz_default=256; nit_default=4; lm=8; lt_default=8; ndim1 = 8; ndim2 = 8; ndim3 = 8; lt=lt_default; nit = nit_default; nx[lt-1] = nx_default; ny[lt-1] = ny_default; nz[lt-1] = nz_default; break; case 'B': nx_default=256; ny_default=256; nz_default=256; nit_default=20; lm=8; lt_default=8; ndim1 = 8; ndim2 = 8; ndim3 = 8; lt=lt_default; nit = nit_default; nx[lt-1] = nx_default; ny[lt-1] = ny_default; nz[lt-1] = nz_default; break; case 'C': nx_default=512; ny_default=512; nz_default=512; nit_default=20; lm=9; lt_default=9; ndim1 = 9; ndim2 = 9; ndim3 = 9; lt=lt_default; nit = nit_default; nx[lt-1] = nx_default; ny[lt-1] = ny_default; nz[lt-1] = nz_default; break; } nm=2+(1<