HPL_pddriver.c 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287
  1. /*
  2. * -- High Performance Computing Linpack Benchmark (HPL)
  3. * HPL - 2.0 - September 10, 2008
  4. * Antoine P. Petitet
  5. * University of Tennessee, Knoxville
  6. * Innovative Computing Laboratory
  7. * (C) Copyright 2000-2008 All Rights Reserved
  8. *
  9. * -- Copyright notice and Licensing terms:
  10. *
  11. * Redistribution and use in source and binary forms, with or without
  12. * modification, are permitted provided that the following conditions
  13. * are met:
  14. *
  15. * 1. Redistributions of source code must retain the above copyright
  16. * notice, this list of conditions and the following disclaimer.
  17. *
  18. * 2. Redistributions in binary form must reproduce the above copyright
  19. * notice, this list of conditions, and the following disclaimer in the
  20. * documentation and/or other materials provided with the distribution.
  21. *
  22. * 3. All advertising materials mentioning features or use of this
  23. * software must display the following acknowledgement:
  24. * This product includes software developed at the University of
  25. * Tennessee, Knoxville, Innovative Computing Laboratory.
  26. *
  27. * 4. The name of the University, the name of the Laboratory, or the
  28. * names of its contributors may not be used to endorse or promote
  29. * products derived from this software without specific written
  30. * permission.
  31. *
  32. * -- Disclaimer:
  33. *
  34. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  35. * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  36. * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
  37. * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE UNIVERSITY
  38. * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  39. * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
  40. * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
  41. * DATA OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
  42. * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  43. * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
  44. * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  45. * ---------------------------------------------------------------------
  46. */
  47. /*
  48. * Include files
  49. */
  50. #include "hpl.h"
  51. #include "RCCE.h"
  52. int MPI_Send(void *, int, int, int, int, RCCE_COMM);
  53. int MPI_Recv(void *, int, int, int, int, RCCE_COMM, int *);
  54. int MPI_Comm_size(RCCE_COMM, int *);
  55. int MPI_Comm_rank(RCCE_COMM, int *);
  56. int MPI_Init(int *, char ***);
  57. int MPI_Finalize(void);
  58. int RCCE_APP(int argc, char **argv) {
  59. /*
  60. * Purpose
  61. * =======
  62. *
  63. * main is the main driver program for testing the HPL routines.
  64. * This program is driven by a short data file named "HPL.dat".
  65. *
  66. * ---------------------------------------------------------------------
  67. */
  68. /*
  69. * .. Local Variables ..
  70. */
  71. int nval [HPL_MAX_PARAM],
  72. nbval [HPL_MAX_PARAM],
  73. pval [HPL_MAX_PARAM],
  74. qval [HPL_MAX_PARAM],
  75. nbmval[HPL_MAX_PARAM],
  76. ndvval[HPL_MAX_PARAM],
  77. ndhval[HPL_MAX_PARAM];
  78. HPL_T_FACT pfaval[HPL_MAX_PARAM],
  79. rfaval[HPL_MAX_PARAM];
  80. HPL_T_TOP topval[HPL_MAX_PARAM];
  81. HPL_T_grid grid;
  82. HPL_T_palg algo;
  83. HPL_T_test test;
  84. int L1notran, Unotran, align, equil, in, inb,
  85. inbm, indh, indv, ipfa, ipq, irfa, itop,
  86. mycol, myrow, ns, nbs, nbms, ndhs, ndvs,
  87. npcol, npfs, npqs, nprow, nrfs, ntps,
  88. rank, size, tswap;
  89. HPL_T_ORDER pmapping;
  90. HPL_T_FACT rpfa;
  91. HPL_T_SWAP fswap;
  92. /* ..
  93. * .. Executable Statements ..
  94. */
  95. if(MPI_Init( &argc, &argv )) exit(0);
  96. #ifdef HPL_CALL_VSIPL
  97. vsip_init((void*)0);
  98. #endif
  99. MPI_Comm_rank( MPI_COMM_WORLD, &rank );
  100. MPI_Comm_size( MPI_COMM_WORLD, &size );
  101. // RCCE_debug_set(RCCE_DEBUG_ALL);
  102. // RCCE_debug_unset(RCCE_DEBUG_SYNCH);
  103. /*
  104. * Read and check validity of test parameters from input file
  105. *
  106. * HPL Version 1.0, Linpack benchmark input file
  107. * Your message here
  108. * HPL.out output file name (if any)
  109. * 6 device out (6=stdout,7=stderr,file)
  110. * 4 # of problems sizes (N)
  111. * 29 30 34 35 Ns
  112. * 4 # of NBs
  113. * 1 2 3 4 NBs
  114. * 0 PMAP process mapping (0=Row-,1=Column-major)
  115. * 3 # of process grids (P x Q)
  116. * 2 1 4 Ps
  117. * 2 4 1 Qs
  118. * 16.0 threshold
  119. * 3 # of panel fact
  120. * 0 1 2 PFACTs (0=left, 1=Crout, 2=Right)
  121. * 2 # of recursive stopping criterium
  122. * 2 4 NBMINs (>= 1)
  123. * 1 # of panels in recursion
  124. * 2 NDIVs
  125. * 3 # of recursive panel fact.
  126. * 0 1 2 RFACTs (0=left, 1=Crout, 2=Right)
  127. * 1 # of broadcast
  128. * 0 BCASTs (0=1rg,1=1rM,2=2rg,3=2rM,4=Lng,5=LnM)
  129. * 1 # of lookahead depth
  130. * 0 DEPTHs (>=0)
  131. * 2 SWAP (0=bin-exch,1=long,2=mix)
  132. * 4 swapping threshold
  133. * 0 L1 in (0=transposed,1=no-transposed) form
  134. * 0 U in (0=transposed,1=no-transposed) form
  135. * 1 Equilibration (0=no,1=yes)
  136. * 8 memory alignment in double (> 0)
  137. */
  138. HPL_pdinfo( &test, &ns, nval, &nbs, nbval, &pmapping, &npqs, pval, qval,
  139. &npfs, pfaval, &nbms, nbmval, &ndvs, ndvval, &nrfs, rfaval,
  140. &ntps, topval, &ndhs, ndhval, &fswap, &tswap, &L1notran,
  141. &Unotran, &equil, &align );
  142. /*
  143. * Loop over different process grids - Define process grid. Go to bottom
  144. * of process grid loop if this case does not use my process.
  145. */
  146. for( ipq = 0; ipq < npqs; ipq++ )
  147. {
  148. (void) HPL_grid_init( MPI_COMM_WORLD, pmapping, pval[ipq], qval[ipq],
  149. &grid );
  150. (void) HPL_grid_info( &grid, &nprow, &npcol, &myrow, &mycol );
  151. if( ( myrow < 0 ) || ( myrow >= nprow ) ||
  152. ( mycol < 0 ) || ( mycol >= npcol ) ) goto label_end_of_npqs;
  153. for( in = 0; in < ns; in++ )
  154. { /* Loop over various problem sizes */
  155. for( inb = 0; inb < nbs; inb++ )
  156. { /* Loop over various blocking factors */
  157. for( indh = 0; indh < ndhs; indh++ )
  158. { /* Loop over various lookahead depths */
  159. for( itop = 0; itop < ntps; itop++ )
  160. { /* Loop over various broadcast topologies */
  161. for( irfa = 0; irfa < nrfs; irfa++ )
  162. { /* Loop over various recursive factorizations */
  163. for( ipfa = 0; ipfa < npfs; ipfa++ )
  164. { /* Loop over various panel factorizations */
  165. for( inbm = 0; inbm < nbms; inbm++ )
  166. { /* Loop over various recursive stopping criteria */
  167. for( indv = 0; indv < ndvs; indv++ )
  168. { /* Loop over various # of panels in recursion */
  169. /*
  170. * Set up the algorithm parameters
  171. */
  172. algo.btopo = topval[itop]; algo.depth = ndhval[indh];
  173. algo.nbmin = nbmval[inbm]; algo.nbdiv = ndvval[indv];
  174. algo.pfact = rpfa = pfaval[ipfa];
  175. if( L1notran != 0 )
  176. {
  177. if( rpfa == HPL_LEFT_LOOKING ) algo.pffun = HPL_pdpanllN;
  178. else if( rpfa == HPL_CROUT ) algo.pffun = HPL_pdpancrN;
  179. else algo.pffun = HPL_pdpanrlN;
  180. algo.rfact = rpfa = rfaval[irfa];
  181. if( rpfa == HPL_LEFT_LOOKING ) algo.rffun = HPL_pdrpanllN;
  182. else if( rpfa == HPL_CROUT ) algo.rffun = HPL_pdrpancrN;
  183. else algo.rffun = HPL_pdrpanrlN;
  184. if( Unotran != 0 ) algo.upfun = HPL_pdupdateNN;
  185. else algo.upfun = HPL_pdupdateNT;
  186. }
  187. else
  188. {
  189. if( rpfa == HPL_LEFT_LOOKING ) algo.pffun = HPL_pdpanllT;
  190. else if( rpfa == HPL_CROUT ) algo.pffun = HPL_pdpancrT;
  191. else algo.pffun = HPL_pdpanrlT;
  192. algo.rfact = rpfa = rfaval[irfa];
  193. if( rpfa == HPL_LEFT_LOOKING ) algo.rffun = HPL_pdrpanllT;
  194. else if( rpfa == HPL_CROUT ) algo.rffun = HPL_pdrpancrT;
  195. else algo.rffun = HPL_pdrpanrlT;
  196. if( Unotran != 0 ) algo.upfun = HPL_pdupdateTN;
  197. else algo.upfun = HPL_pdupdateTT;
  198. }
  199. algo.fswap = fswap; algo.fsthr = tswap;
  200. algo.equil = equil; algo.align = align;
  201. HPL_pdtest( &test, &grid, &algo, nval[in], nbval[inb] );
  202. }
  203. }
  204. }
  205. }
  206. }
  207. }
  208. }
  209. }
  210. (void) HPL_grid_exit( &grid );
  211. label_end_of_npqs: ;
  212. }
  213. /*
  214. * Print ending messages, close output file, exit.
  215. */
  216. if( rank == 0 )
  217. {
  218. test.ktest = test.kpass + test.kfail + test.kskip;
  219. #ifndef HPL_DETAILED_TIMING
  220. HPL_fprintf( test.outfp, "%s%s\n",
  221. "========================================",
  222. "========================================" );
  223. #else
  224. if( test.thrsh > HPL_rzero )
  225. HPL_fprintf( test.outfp, "%s%s\n",
  226. "========================================",
  227. "========================================" );
  228. #endif
  229. HPL_fprintf( test.outfp, "\n%s %6d %s\n", "Finished", test.ktest,
  230. "tests with the following results:" );
  231. if( test.thrsh > HPL_rzero )
  232. {
  233. HPL_fprintf( test.outfp, " %6d %s\n", test.kpass,
  234. "tests completed and passed residual checks," );
  235. HPL_fprintf( test.outfp, " %6d %s\n", test.kfail,
  236. "tests completed and failed residual checks," );
  237. HPL_fprintf( test.outfp, " %6d %s\n", test.kskip,
  238. "tests skipped because of illegal input values." );
  239. }
  240. else
  241. {
  242. HPL_fprintf( test.outfp, " %6d %s\n", test.kpass,
  243. "tests completed without checking," );
  244. HPL_fprintf( test.outfp, " %6d %s\n", test.kskip,
  245. "tests skipped because of illegal input values." );
  246. }
  247. HPL_fprintf( test.outfp, "%s%s\n",
  248. "----------------------------------------",
  249. "----------------------------------------" );
  250. HPL_fprintf( test.outfp, "\nEnd of Tests.\n" );
  251. HPL_fprintf( test.outfp, "%s%s\n",
  252. "========================================",
  253. "========================================" );
  254. if( ( test.outfp != stdout ) && ( test.outfp != stderr ) )
  255. (void) fclose( test.outfp );
  256. }
  257. #ifdef HPL_CALL_VSIPL
  258. vsip_finalize((void*)0);
  259. #endif
  260. MPI_Finalize();
  261. return( 0 );
  262. /*
  263. * End of main
  264. */
  265. }