HPL_pwarn.c 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145
  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. #ifdef STDC_HEADERS
  57. void HPL_pwarn
  58. (
  59. FILE * STREAM,
  60. int LINE,
  61. const char * SRNAME,
  62. const char * FORM,
  63. ...
  64. )
  65. #else
  66. void HPL_pwarn( va_alist )
  67. va_dcl
  68. #endif
  69. {
  70. /*
  71. * Purpose
  72. * =======
  73. *
  74. * HPL_pwarn displays an error message.
  75. *
  76. *
  77. * Arguments
  78. * =========
  79. *
  80. * STREAM (local input) FILE *
  81. * On entry, STREAM specifies the output stream.
  82. *
  83. * LINE (local input) int
  84. * On entry, LINE specifies the line number in the file where
  85. * the error has occured. When LINE is not a positive line
  86. * number, it is ignored.
  87. *
  88. * SRNAME (local input) const char *
  89. * On entry, SRNAME should be the name of the routine calling
  90. * this error handler.
  91. *
  92. * FORM (local input) const char *
  93. * On entry, FORM specifies the format, i.e., how the subsequent
  94. * arguments are converted for output.
  95. *
  96. * (local input) ...
  97. * On entry, ... is the list of arguments to be printed within
  98. * the format string.
  99. *
  100. * ---------------------------------------------------------------------
  101. */
  102. /*
  103. * .. Local Variables ..
  104. */
  105. va_list argptr;
  106. int rank;
  107. char cline[128];
  108. #ifndef STDC_HEADERS
  109. FILE * STREAM;
  110. int LINE;
  111. char * FORM, * SRNAME;
  112. #endif
  113. /* ..
  114. * .. Executable Statements ..
  115. */
  116. #ifdef STDC_HEADERS
  117. va_start( argptr, FORM );
  118. #else
  119. va_start( argptr );
  120. STREAM = va_arg( argptr, FILE * );
  121. LINE = va_arg( argptr, int );
  122. SRNAME = va_arg( argptr, char * );
  123. FORM = va_arg( argptr, char * );
  124. #endif
  125. (void) vsprintf( cline, FORM, argptr );
  126. va_end( argptr );
  127. MPI_Comm_rank( MPI_COMM_WORLD, &rank );
  128. /*
  129. * Display an error message
  130. */
  131. if( LINE <= 0 )
  132. HPL_fprintf( STREAM, "%s %s %d, %s %s:\n>>> %s <<<\n\n",
  133. "HPL ERROR", "from process #", rank, "in function",
  134. SRNAME, cline );
  135. else
  136. HPL_fprintf( STREAM, "%s %s %d, %s %d %s %s:\n>>> %s <<<\n\n",
  137. "HPL ERROR", "from process #", rank, "on line", LINE,
  138. "of function", SRNAME, cline );
  139. /*
  140. * End of HPL_pwarn
  141. */
  142. }