1 / 20

Serial Run-time Error Detection and the Fortran Standard

Serial Run-time Error Detection and the Fortran Standard. Glenn Luecke Professor of Mathematics, and Director, High Performance Computing Group Iowa State University February 2006. Outline. HPCS’s for run-time error detection HPCS’s plan for serial run-time error detection

Download Presentation

Serial Run-time Error Detection and the Fortran Standard

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Serial Run-time Error Detectionand the Fortran Standard Glenn Luecke Professor of Mathematics, and Director, High Performance Computing Group Iowa State University February 2006

  2. Outline • HPCS’s for run-time error detection • HPCS’s plan for serial run-time error detection • Iowa State’s serial run-time error detection tests • Examples • Conclusions and future plans

  3. HPCS’s Plan for Run-Time Error Detection • Detecting and providing quality error messages for run-time errors will greatly enhance productivity for those using HPC systems. • Phase 1: serial run-time errors http://rted.public.iastate.edu/ • Phase 2: parallel MPI run-time errors • Phase 3: parallel OpenMP run-time errors • Languages: Fortran, C, and C++

  4. HPCS’s plan for Serial RTED • For each run-time error and for Fortran, C and C++ develop programs that contain run-time errors. • For each test the expected error message, file name, and line number where the error occurred will be given. • A script will be provided to easily run all tests and compare actual messages with expected messages and assign a grade of A, B, C, D, or F to each test. • Prefer a simple compiler option that will turn on run-time error checking, e.g. –debug. • Before purchasing new machines, DoD may require a specified GPA.

  5. Serial Run-time Errors • uninitialized variables • overflows, underflows, and divide by zero • incorrect argument data types and incorrect number of arguments in a procedure • non-conforming use of Fortran 90 arrays • errors with strings • out-of-bounds indexing of statically and dynamically allocated arrays • out-of-bounds pointer references • memory allocation and deallocation errors • file I/O errors • memory leaks • other errors, including new features in Fortran 95

  6. Grading Error Messages • Grade A: gave a detailed error message that allows for the quick fixing of the error. • Grade B: gave more information than C and less than A, depends on each test. • Grade C: gave the correct error name, line number where the error occurred, and the name of the file where error occurred. • Grade D: gave the correct error name and line number where error occurred. • Grade F: did not detect an error or gave an incorrect error name or gave no (or incorrect) line number

  7. Evaluating Error Messages • For each test and for each grade a Perl grading file has been created. • Error messages are reduced to a canonical form for easy comparison replacing selected phrases with standard phrases. Blanks, hex addresses, and integers longer than 3 are removed to avoid false matches. • Grading scripts are applied to the canonical form of error messages to automatically grade them. • http://rted.public.iastate.edu

  8. Results for Fortran (1552 tests) • Cray Unicos/mp (X1) Cray 5.5 Grade: 1.66 • SUN Solaris 10SunONE with bcheck Grade: 1.22 • SUN Solaris 10 SunONE Grade: 1.20 • IBM AIX XLF Grade: 0.82 • SGI IRIX 6.5 MipsPro Grade: 0.71 • Cray Unicos/lc (XT3) PGI 6.0 Grade: 0.67 • RedHat Linux 8.0 Intel 7.1 Grade: 0.61 • RedHat Linux 8.0 GNU Grade: 0.0

  9. Results for C (716 tests) • RedHat Linux 8.0 Intel 7.1 + ensure++ Grade: 1.82 • SUN Solaris 10 SunONE with bcheck Grade: 0.40 • Cray Unicos/mp (X1) Cray 5.5 Grade: 0.28 • Cray Unicos/lc (XT3) PGI 6.0 Grade: 0.23 • SGI IRIX 6.5 MipsPro Grade: 0.11 • RedHat Linux 8.0 GNU Grade: 0.0 • SUN Solaris 10 SunONE Grade: 0.0 • RedHat Linux 8.0 Intel 7.1 Grade: 0.0 • IBM AIX XLC Grade: 0.0

  10. Results for C++ (716 + 427 tests) • RedHat Linux 8.0 Intel 7.1 + ensure++ Grade: 1.75 • SUN Solaris 10 SunONE with bcheck Grade: 0.45 • Cray Unicos/mp (X1) Cray 5.5 Grade: 0.38 • Cray Unicos/lc (XT3) PGI 6.0 Grade: 0.18 • SGI IRIX 6.5 MipsPro Grade: 0.11 • RedHat Linux 8.0 GNU Grade: 0.0 • SUN Solaris 10 SunONE Grade: 0.0 • RedHat Linux 8.0 Intel 7.1 Grade: 0.0 • IBM AIX XLC Grade: 0.0

  11. Uninitialized Variable Example !-------------file name: F_A_3_1_a_d.f90 --------------- 34 program main 35 implicit none 36 double precision :: var, expr 37 double precision :: fct1 38 double precision :: pi 39 integer :: flag 40 41 pi = 4.0*atan(1.0) 42 flag = int(sin(pi*2.0)) 43 var = 10.d0 44 expr = 1.d0 45 expr = fct1(flag) 46 print *,'var',var,' expr',expr 47 end program main 48 49 double precision function fct1(flag) 50 implicit none 51 integer, intent(in) :: flag 52 double precision :: tmp ! DECLARE 53 54 if (flag == 1) then 55 tmp = 15.0 56 endif 57 fct1 = tmp**2 + 5 ! read the uninitialized variable. ERROR 58 return 59 end function fct1

  12. Error messages for uninitialized variables • Current situation • Many compilers report nothing: grade F • Example 1 (incorrect error message): grade F Floating Exception Abort • Example 2 (message is okay, line number correct, file name missing): grade D Run-Time Error: Unassigned variable In Procedure: fct1 Diagnostics Entered From Real Functionfct1 Line 57 • Grade A error message: ERROR: uninitialized variable At line 57 column 10 of subprogram ‘fct1' in file 'F_A_3_1_a_d.f90' variable 'tmp' is uninitialized. The double precision variable is declared in subprogram ‘fct1' line 52 in file 'F_A_3_1_a_d.f90'.

  13. Out-of-bounds array access example !-------- file name: F_F_3_1_3_a_d_s.f90----------- 1 subroutine sub(arr,var,n) 2 implicit none 3 integer,intent(in) :: n 4 double precision, intent(inout):: arr(n,*), var 5 6 integer :: I,J, bounds 7 double precision :: tmp 8 call random_number(tmp) 9 if (tmp*arr(1,1)<0.d0) then 10 i=1 11 else 12 i=n+1 13 end if 14 j = 1 15 var = arr(i,j) ! read out of bounds ERROR 16 print *,arr(1,1) 17 return 18 end subroutine sub ! --------- file name: F_F_3_1_3_a_d.f90 -------- 29 program tests 30 implicit none 31 integer,parameter :: N=10, m=20 32 double precision :: arr(n,m), var 33 integer :: i,j,indx 34 do j=1,m 35 do i=1,n 36 arr(i,j) = dble(i*j) 37 end do 38 end do 39 var = 0.d0 40 call sub(arr,var,n) 41 print *,var, arr(1,1) 42 end program tests

  14. Error messages for out-of-bounds array access • Current situation • Example 1 ( missing file name, subscript value, and dimension information): grade D Run-Time Error: Array bounds exceeded In Procedure: sub Diagnostics Entered From Subroutine sub Line 15 Entered From MAIN PROGRAM Line 40 • Example 2 (missing dimension information): grade C ****** FORTRAN RUN-TIME SYSTEM ****** Subscript out of range. Location: line 15 column 12 of 'F_F_3_1_3_a_d_s.f90‘ Subscript number 1 has value 11 in array 'ARR‘ Abort • Example 3 (missing line number for array declaration): grade B WARNING Subscript 11 is out of range for dimension 1 for array 'ARR‘ at line 15 in file 'F_F_3_1_3_a_d_s.f90' with bounds 1:10. • Grade A error message: ERROR: out of bounds At line 15 column 12 of subprogram 'sub' in file 'F_F_3_1_3_a_d_s.f90' subscript value 11 is out of bounds for dimension 1 of array 'arr' with bounds 1:10 declared in subprogram 'sub'line 4 in file 'F_F_3_1_3_a_d_s.f90'.

  15. Incorrect number of arguments !-------file name: F_C_1_1_a_s.f90------------- 1 subroutine sub1(arr,n,flag,aout,bout) ! CALLED ERROR 2 implicit none 3 integer, intent(in) :: n, flag 4 double precision, intent(inout) :: arr(*) 5 double precision, intent(inout) :: aout, bout 6 7 integer :: iloc 8 9 if (flag == 1) then 10 do iloc = 1,n 11 arr(iloc) = arr(iloc)+log(dble(iloc)) 12 end do 13 end if 14 iloc = n 15 aout = arr(iloc-n/2) 16 bout = aout/dble(n) 17 end subroutine sub1 !-------file name: F_C_1_1_a.f90------------- 31 program tests 32 implicit none 33 double precision :: pi 34 double precision, allocatable :: array(:) 35 integer :: n,i,flag 36 double precision :: var 37 38 pi = 4.0*atan(1.0) 39 flag = int(cos(pi))*(-1) 40 n = sin(pi*0.1)*100 41 allocate(array(N)) 42 do i=1,n 43 array(i) = cos(dble(i)/dble(n)*pi) 44 end do 45 46 call sub1(array,n,flag,var) ! CALLING ERROR 47 48 print *, var, flag 49 deallocate(array) 50 end program tests

  16. Error messages for incorrect number of arguments • Current state of the affair • Many compilers report nothing: Grade F • Example 1 (missing file name and the number of arguments): Grade D Run-Time Error: Not enough arguments specified Diagnostics Entered From MAIN PROGRAM Line 46 End of diagnostics • Example 2 ( missing file name): Grade D For the entry 'SUB1', called from 'TESTS' at line 46: Number of arguments for call, 4, does not equal expected number of arguments 5. • An example of good error message: Grade A ERROR: incorrect number of arguments For the entry 'SUB1' defined in line 1 of file 'F_C_1_1_a_s.f90', called from 'TESTS' at line 46 of file 'F_C_1_1_a.f90', the actual number of arguments, 4, does not equal the expected number of arguments, 5.

  17. Current Status for Detecting Serial Run-Time Errors • Most compilers/run-time systems provide little or no detection of run-time errors. • Currently, there is little incentive to develop such tools. • DoD is considering requiring a certain GPA. • We are submitting a proposal to the Fortran standards committee requiring RTED as part of the standard. • Iowa State’s serial RTED tests provide a good way of evaluating the quality of the compiler and run-time system for detecting run-time errors.

  18. Proposal In the Fortran standard, the term “processor” means the combination of a Fortran compiler and the computing system that executes the code. It is important for Fortran to not only have syntax that allows for easy program development but to also facilitate rapid detection and correction of program errors. A processor is said to conform to the Fortran standard when it has the capability of detecting run-time errors and provides a correct error message containing the file name and line number where the error occurred. To aid in producing a processor that conforms to the Fortran standard for run-time error detections, run-time error tests can be found at http://rted.public.iastate.edu. These tests include tests for the following run-time errors:

  19. Proposal – page 2 • uninitialized variables • overflows, underflows, and divide by zero • incorrect argument data types and incorrect number of arguments in a procedure • non-conforming use of Fortran 90 arrays • errors with strings • out-of-bounds indexing of statically and dynamically allocated arrays • out-of-bounds pointer references • memory allocation and deallocation errors • memory leaks

  20. Conclusions and Future Plans • Detection and quality reporting of run-time errors will greatly enhance productivity. • We are proposing that RTED be part of the Fortran standard. • The run-time error tests being developed at Iowa State are a good evaluation method. • We plan to propose to the C and C++ standards committees to include RTED in their standard.

More Related