lu.c 8.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191
  1. #include "applu.h"
  2. #include <string.h>
  3. #include "applu_macros.h"
  4. double test_u();
  5. double test_rsd();
  6. //!-------------------------------------------------------------------------!
  7. //! !
  8. //! N A S P A R A L L E L B E N C H M A R K S 3.3 !
  9. //! !
  10. //! L U !
  11. //! !
  12. //!-------------------------------------------------------------------------!
  13. //! !
  14. //! This benchmark is part of the NAS Parallel Benchmark 3.3 suite. !
  15. //! It is described in NAS Technical Reports 95-020 and 02-007 !
  16. //! !
  17. //! Permission to use, copy, distribute and modify this software !
  18. //! for any purpose with or without fee is hereby granted. We !
  19. //! request, however, that all derived work reference the NAS !
  20. //! Parallel Benchmarks 3.3. This software is provided "as is" !
  21. //! without express or implied warranty. !
  22. //! !
  23. //! Information on NPB 3.3, including the technical report, the !
  24. //! original specifications, source code, results and information !
  25. //! on how to submit new results, is available at: !
  26. //! !
  27. //! http://www.nas.nasa.gov/Software/NPB/ !
  28. //! !
  29. //! Send comments or suggestions to npb@nas.nasa.gov !
  30. //! !
  31. //! NAS Parallel Benchmarks Group !
  32. //! NASA Ames Research Center !
  33. //! Mail Stop: T27A-1 !
  34. //! Moffett Field, CA 94035-1000 !
  35. //! !
  36. //! E-mail: npb@nas.nasa.gov !
  37. //! Fax: (650) 604-3957 !
  38. //! !
  39. //!-------------------------------------------------------------------------!
  40. //c---------------------------------------------------------------------
  41. //c
  42. //c Authors: S. Weeratunga
  43. //c V. Venkatakrishnan
  44. //c E. Barszcz
  45. //c M. Yarrow
  46. //c C-version: Rob Van der Wijngaart, Intel Corporation
  47. //c
  48. //c---------------------------------------------------------------------
  49. //
  50. // Copyright 2010 Intel Corporation
  51. //
  52. // Licensed under the Apache License, Version 2.0 (the "License");
  53. // you may not use this file except in compliance with the License.
  54. // You may obtain a copy of the License at
  55. //
  56. // http://www.apache.org/licenses/LICENSE-2.0
  57. //
  58. // Unless required by applicable law or agreed to in writing, software
  59. // distributed under the License is distributed on an "AS IS" BASIS,
  60. // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  61. // See the License for the specific language governing permissions and
  62. // limitations under the License.
  63. //
  64. int RCCE_APP(int argc, char **argv){
  65. //c---------------------------------------------------------------------
  66. //c
  67. //c driver for the performance evaluation of the solver for
  68. //c five coupled parabolic/elliptic partial differential equations.
  69. //c
  70. //c---------------------------------------------------------------------
  71. char class;
  72. double mflops;
  73. int ierr, i, j, k, mm, iverified;
  74. //c---------------------------------------------------------------------
  75. //c initialize communications
  76. //c---------------------------------------------------------------------
  77. init_comm(&argc, &argv);
  78. // RCCE_debug_set(RCCE_DEBUG_SYNCH);
  79. //c---------------------------------------------------------------------
  80. //c read input data
  81. //c---------------------------------------------------------------------
  82. read_input();
  83. //c---------------------------------------------------------------------
  84. //c set up processor grid
  85. //c---------------------------------------------------------------------
  86. proc_grid();
  87. //c---------------------------------------------------------------------
  88. //c determine the neighbors
  89. //c---------------------------------------------------------------------
  90. neighbors();
  91. //c---------------------------------------------------------------------
  92. //c set up sub-domain sizes
  93. //c---------------------------------------------------------------------
  94. subdomain();
  95. //c---------------------------------------------------------------------
  96. //c set up coefficients
  97. //c---------------------------------------------------------------------
  98. setcoeff();
  99. //c---------------------------------------------------------------------
  100. //c set the boundary values for dependent variables
  101. //c---------------------------------------------------------------------
  102. setbv();
  103. //c---------------------------------------------------------------------
  104. //c set the initial values for dependent variables
  105. //c---------------------------------------------------------------------
  106. setiv();
  107. //c---------------------------------------------------------------------
  108. //c compute the forcing term based on prescribed exact solution
  109. //c---------------------------------------------------------------------
  110. erhs();
  111. ////c---------------------------------------------------------------------
  112. ////c perform one SSOR iteration to touch all data and program pages
  113. ////c---------------------------------------------------------------------
  114. ssor(1);
  115. //
  116. ////c---------------------------------------------------------------------
  117. ////c reset the boundary and initial values
  118. ////c---------------------------------------------------------------------
  119. setbv();
  120. setiv();
  121. //
  122. ////c---------------------------------------------------------------------
  123. ////c perform the SSOR iterations
  124. ////c---------------------------------------------------------------------
  125. ssor(itmax);
  126. ////c---------------------------------------------------------------------
  127. ////c compute the solution error
  128. ////c---------------------------------------------------------------------
  129. error();
  130. ////c---------------------------------------------------------------------
  131. ////c compute the surface integral
  132. ////c---------------------------------------------------------------------
  133. pintgr();
  134. //
  135. ////c---------------------------------------------------------------------
  136. ////c verification test
  137. ////c---------------------------------------------------------------------
  138. if (id ==0) {
  139. verify( rsdnm, errnm, &frc, &class );
  140. mflops = (double)(itmax)*(1984.77*(double)( nx0 )
  141. *(double)( ny0 )
  142. *(double)( nz0 )
  143. -10923.3*((double)( nx0+ny0+nz0 )/3.)*((double)( nx0+ny0+nz0 )/3.)
  144. +27770.9* (double)( nx0+ny0+nz0 )/3.
  145. -144010.)
  146. / (maxtime*1000000.);
  147. print_results("LU", &class, &nx0,
  148. &ny0, &nz0, &itmax, &nnodes_compiled,
  149. &num, &maxtime, &mflops, " floating point", &iverified,
  150. NPBVERSION, COMPILETIME, CS1, CS2, CS3, CS4, CS5, CS6);
  151. // FILE *perf_file;
  152. // char name[50] = "/shared/DEMOS/RCCE/NPB_LU/perf.";
  153. // char postfix[50];
  154. // sprintf(postfix, "%d", nnodes_compiled);
  155. // strcat(name, postfix);
  156. // perf_file = fopen(name,"w");
  157. // fprintf(perf_file, "%d", (int)mflops);
  158. // fclose(perf_file);
  159. }
  160. RCCE_finalize();
  161. return(0);
  162. }