ccm_warning
ccm_print_warning
ccm_clear_warning ccm_error

CCM error reporting routines

Routine:

ccm_warning

Purpose:

Sets error information that can be accessed by ccm_print_warning. Optionally, prints the warning to standard out.

Minimal calling sequence:

NA

Required Arguments:

NA

Call with all Optional Arguments:

NA

Notes:

Ccm_warning is not designed to be callable by users. It is called by other routines within the module. This documentation is to show minimum information that is to be set when calling the ccm_warning routine.

Ccm_warning sets:

If the global variable ccm_auto_print is set to .true. (the default set by ccm_init) then this information is printed to standard out. If ccm_auto_print is .false. then the information is made available to the routine ccm_print_warning.




Routine:

ccm_print_warning

Purpose:

Prints error information generated by ccm_warning.

Minimal calling sequence:

call ccm_print_warning()

Required Arguments:

NONE

Call with all Optional Arguments:

call ccm_print_warning(file_number)
file_number :: integer,intent (in)
File number to which the output is sent. If not present, sent to standard out.



Routine:

ccm_clear_warning

Purpose:

Clears error information generated by ccm_warning.

Minimal calling sequence:

call ccm_clear_warning()

Required Arguments:

NONE

Call with all Optional Arguments:

call ccm_clear_warning()

This call clears the buffers that hold error messages. It might be desirable to call this routine after calling ccm_print_warning.




Routine:

ccm_error

Purpose:

Prints an error message to standard out and causes the program to exit.

Minimal calling sequence:

NA

Required Arguments:

NA

Call with all Optional Arguments:

NA

Notes:

Ccm_error is not designed to be callable by users. It is called by other routines within the module. This documentation is to show minimum information that is to be set when calling the ccm_error routine. Ccm_error prints:

Example:


program ccm_warning_x1
    use ccm
    implicit none
    real :: xin(1),yin(1,1)
    real :: xout
    integer :: ierr,myid,numprocs
    call ccm_init(myid,numprocs)
    if(myid .eq. 0)then
        xin=1
        yin=1
    endif
    call ccm_testing(set_test=ccm_checksize)
    ccm_auto_print=.false.
    call ccm_scatter(xin,xout,the_err=ierr)
    if(myid .eq. 0 .and. ierr .ne. 0)call ccm_print_warning()
    call ccm_barrier(2.0)
    if(myid .eq. 0)then
        ccm_auto_print=.true.
        write(*,*)"calling scatter again with ccm_auto_print = ",ccm_auto_print
    endif
    call ccm_scatter(yin,xout)
    call ccm_close()
end program

Example output on 4 processors


[ccm_home:~/ccm/source] % ccm_time_x1
 Warning from collective communications module
 routine: scatter and data type  real single precision
 input array on root too small:  1
 needs to be number of processors * size of input
 rank of input data:  1
 rank of input data:  0
 calling scatter again with ccm_auto_print =  T
 Warning from collective communications module
  routine: scatter and data type  real single precision
  input array on root too small:  1
  needs to be number of processors * size of input
  rank of input data:  2
  rank of input data:  0
[ccm_home:~/ccm/source] % 

The call to ccm_init initializes the communication package. We call ccm_testing with set_test=ccm_checksize so that the communications routines will check array sizes. Ccm_auto_print is set to false to suppress the automatic printings of warnings. Ccm_scatter is called with an input array of size 1. This generates a warning that is detected by checking "the_err." The program calls ccm_print_warning to pring the warning message. The message can be sent to a file by specifing a file number for ccm_print_warning. Next ccm_auto_print is set to true on task 0 to get warnings automatically printed by that task. Ccm_scatter is called again. Note for this warning message the rank of the input array is shown to be 2. The call to ccm_close closes the package.

Error conditions:

NONE
Back to API and user's guide