ccm_init

CCM initialization

Routine:

ccm_init

Purpose:

Initialize the CCM package.

Minimal calling sequence:

call ccm_init()

Required Arguments:

NONE

Call with all Optional Arguments:

call ccm_init(my_id,num_procs,info,the_error)
my_id :: integer, intent (out)
A unique number for each task in a parallel application, 0 to num_procs-1
num_procs :: integer, intent (out)
Number of tasks in a parallel application.
info :: logical, intent (in)
If true, print to standard output information about the implementation details of the collective communications module. The exact content of the message is implementation dependent but must contain at least the standard data sizes.
the_error :: integer, intent (out)
Error code 0 - success, != 0 failure.
See Specifying Optional Arguments for the syntax for using optional arguments.

Notes:

Ccm_init must be called before any other routines from the API. If there is another communication package in use, such as MPI, then the initialization routine for that package needs to be called first. Ccm_init must be called by every process once and only once. It is a fatal error to call ccm_init a second time.

First Example:


program ccm_init_x1
    use ccm
    integer time_info_array(8),hour,min,sec,millisec
    call ccm_init()
    call date_and_time(values=time_info_array)
    hour=time_info_array(5)
    min=time_info_array(6)
    sec=time_info_array(7)
    millisec=time_info_array(8)
    write(*,fmt="(""hello at "",i2.2,"":"",i2.2,"":"",i2.2,""."",i3.3)") &
        hour,min,sec,millisec
    call ccm_close()
end program

Example output on 4 processors


[ccm_home:~/ccm/source] % ccm_init_x1
hello at 13:59:39.411
hello at 13:59:39.414
hello at 13:59:39.416
hello at 13:59:39.417
[ccm_home:~/ccm/source] % 

The call to ccm_init initializes the communication package. Each task gets and prints the time. The call to ccm_close closes the communication package.



Second Example:


program ccm_init_x2
    use ccm
    integer time_info_array(8),hour,min,sec,millisec
    integer :: my_id,num_procs,the_error
    logical :: info
    info=.true.
    call ccm_init(my_id,numprocs,info,the_error)
    if(the_error .ne. 0)then
        write(*,*)"error = ",the_error
         call ccm_close()
         stop
    endif
    call date_and_time(values=time_info_array)
    hour=time_info_array(5)
    min=time_info_array(6)
    sec=time_info_array(7)
    millisec=time_info_array(8)
    write(*,fmt="(""from "",i5,"" of "",i5,"" hello at "",i2.2,"":"",i2.2,"":"",i2.2,""."",i3.3)") &
        my_id,numprocs,hour,min,sec,millisec
    call ccm_close()
end program

Example output on 4 processors


[ccm_home:~/ccm/source] % ccm_init_x1
 Collective Communications Module
   MPI reference implementation
real size =         4
complex size =      4
double size =       8
integer size =      4
character size =    1
logical size =      4
myint size =        4 integer(default) size =    4
myreal size =       4 real(b4) size =            4
mydouble size =     8 real(b8) size =            8
mycomplex size =    8 complex(c4) size =         8
mydpcomp size =    16 complex(c8) size =        16
from     0 of     4 hello at 13:59:41.458
from     2 of     4 hello at 13:59:41.453
from     1 of     4 hello at 13:59:41.454
from     3 of     4 hello at 13:59:41.466
[ccm_home:~/ccm/source] % 

The call to ccm_init initializes the communication package with "info" set to true. This causes task 0 to print information about the CCM implementation. Numprocs contains the total number of tasks and my_id contains a unique id for each task, 0 to numprocs-1. The program prints these values along with the time. The call to ccm_close closes the communication package.

Error conditions:


Back to API and user's guide