1#include "applu.h" 2#include <string.h> 3#include "applu_macros.h" 4#include <barrelfish/barrelfish.h> 5 6double test_u(); 7double test_rsd(); 8 9//!-------------------------------------------------------------------------! 10//! ! 11//! N A S P A R A L L E L B E N C H M A R K S 3.3 ! 12//! ! 13//! L U ! 14//! ! 15//!-------------------------------------------------------------------------! 16//! ! 17//! This benchmark is part of the NAS Parallel Benchmark 3.3 suite. ! 18//! It is described in NAS Technical Reports 95-020 and 02-007 ! 19//! ! 20//! Permission to use, copy, distribute and modify this software ! 21//! for any purpose with or without fee is hereby granted. We ! 22//! request, however, that all derived work reference the NAS ! 23//! Parallel Benchmarks 3.3. This software is provided "as is" ! 24//! without express or implied warranty. ! 25//! ! 26//! Information on NPB 3.3, including the technical report, the ! 27//! original specifications, source code, results and information ! 28//! on how to submit new results, is available at: ! 29//! ! 30//! http://www.nas.nasa.gov/Software/NPB/ ! 31//! ! 32//! Send comments or suggestions to npb@nas.nasa.gov ! 33//! ! 34//! NAS Parallel Benchmarks Group ! 35//! NASA Ames Research Center ! 36//! Mail Stop: T27A-1 ! 37//! Moffett Field, CA 94035-1000 ! 38//! ! 39//! E-mail: npb@nas.nasa.gov ! 40//! Fax: (650) 604-3957 ! 41//! ! 42//!-------------------------------------------------------------------------! 43 44//c--------------------------------------------------------------------- 45//c 46//c Authors: S. Weeratunga 47//c V. Venkatakrishnan 48//c E. Barszcz 49//c M. Yarrow 50//c C-version: Rob Van der Wijngaart, Intel Corporation 51//c 52//c--------------------------------------------------------------------- 53 54 55int LU_main(int argc, char **argv){ 56 57//c--------------------------------------------------------------------- 58//c 59//c driver for the performance evaluation of the solver for 60//c five coupled parabolic/elliptic partial differential equations. 61//c 62//c--------------------------------------------------------------------- 63 64 65 66 char class; 67 double mflops; 68 int ierr, i, j, k, mm, iverified = 1; 69 70//c--------------------------------------------------------------------- 71//c initialize communications 72//c--------------------------------------------------------------------- 73 init_comm(&argc, &argv); 74// RCCE_debug_set(RCCE_DEBUG_SYNCH); 75//c--------------------------------------------------------------------- 76//c read input data 77//c--------------------------------------------------------------------- 78 read_input(); 79 80//c--------------------------------------------------------------------- 81//c set up processor grid 82//c--------------------------------------------------------------------- 83 proc_grid(); 84 85//c--------------------------------------------------------------------- 86//c determine the neighbors 87//c--------------------------------------------------------------------- 88 neighbors(); 89 90//c--------------------------------------------------------------------- 91//c set up sub-domain sizes 92//c--------------------------------------------------------------------- 93 subdomain(); 94 95//c--------------------------------------------------------------------- 96//c set up coefficients 97//c--------------------------------------------------------------------- 98 setcoeff(); 99 100//c--------------------------------------------------------------------- 101//c set the boundary values for dependent variables 102//c--------------------------------------------------------------------- 103 104 setbv(); 105 106//c--------------------------------------------------------------------- 107//c set the initial values for dependent variables 108//c--------------------------------------------------------------------- 109 110 setiv(); 111 112//c--------------------------------------------------------------------- 113//c compute the forcing term based on prescribed exact solution 114//c--------------------------------------------------------------------- 115 erhs(); 116 117////c--------------------------------------------------------------------- 118////c perform one SSOR iteration to touch all data and program pages 119////c--------------------------------------------------------------------- 120 ssor(1); 121 122// 123////c--------------------------------------------------------------------- 124////c reset the boundary and initial values 125////c--------------------------------------------------------------------- 126 setbv(); 127 setiv(); 128// 129////c--------------------------------------------------------------------- 130////c perform the SSOR iterations 131////c--------------------------------------------------------------------- 132 ssor(itmax); 133 134////c--------------------------------------------------------------------- 135////c compute the solution error 136////c--------------------------------------------------------------------- 137 error(); 138 139////c--------------------------------------------------------------------- 140////c compute the surface integral 141////c--------------------------------------------------------------------- 142 pintgr(); 143// 144////c--------------------------------------------------------------------- 145////c verification test 146////c--------------------------------------------------------------------- 147 148 if (id ==0) { 149 verify( rsdnm, errnm, &frc, &class ); 150 mflops = (double)(itmax)*(1984.77*(double)( nx0 ) 151 *(double)( ny0 ) 152 *(double)( nz0 ) 153 -10923.3*((double)( nx0+ny0+nz0 )/3.)*((double)( nx0+ny0+nz0 )/3.) 154 +27770.9* (double)( nx0+ny0+nz0 )/3. 155 -144010.) 156 / (maxtime*1000000.); 157 158 print_results("LU", &class, &nx0, 159 &ny0, &nz0, &itmax, &nnodes_compiled, 160 &num, &maxtime, &mflops, " floating point", &iverified, 161 NPBVERSION, COMPILETIME, CS1, CS2, CS3, CS4, CS5, CS6); 162 163// FILE *perf_file; 164// char name[50] = "/shared/DEMOS/RCCE/NPB_LU/perf."; 165// char postfix[50]; 166// sprintf(postfix, "%d", nnodes_compiled); 167// strcat(name, postfix); 168// perf_file = fopen(name,"w"); 169// fprintf(perf_file, "%d", (int)mflops); 170// fclose(perf_file); 171 } 172 173 RCCE_finalize(); 174 return(0); 175} 176 177/// LU program stack size 178#define LU_STACK_SIZE (1 * 1024 * 1024) 179 180struct args { 181 int argc; 182 char **argv; 183}; 184 185static int lu_bootstrap(void *arg) 186{ 187 errval_t err = thread_detach(thread_self()); 188 assert(err_is_ok(err)); 189 struct args *a = arg; 190 return LU_main(a->argc, a->argv); 191} 192 193int main(int argc, char **argv) 194{ 195 static struct args a; 196 197 a.argc = argc; 198 a.argv = argv; 199 200 thread_create_varstack(lu_bootstrap, &a, LU_STACK_SIZE); 201 thread_exit(0); 202} 203