ccm_alltoall

CCM alltoall

Routine:

ccm_alltoall

Purpose:

Send data from each task to all other tasks in a parallel application. Xout is overwritten on all tasks.

Minimal calling sequence:

call ccm_alltoall(xin,xout)

Required Arguments:

xin :: integer, real, double precision, complex, logical, character array,intent (inout)
The values in xin will be distributed from every task to every other task in the parallel application. Each task will send size(xin)/num_procs values.
xout :: integer, real, double precision, complex, logical, character scaler or array,intent (inout)
The values distributed from each task will be placed in xout. Each task will get size(xout)/num_procs values. Size(xin) must be equal to size(xout).

Call with all Optional Arguments:

call ccm_alltoall(xin,xout,the_err)
the_err :: integer, intent (out)
Error code 0 = success, != 0 failure.
See Specifying Optional Arguments for the syntax for using optional arguments.

Notes:

Xin and xout can be any intrinsic Fortran data type: integer, real, double precision, complex, logical or, character. Both must be arrays.

First example:


program ccm_alltoall_x1
    use ccm
    implicit none
    integer :: myid,numprocs,igot,i,j
    integer ,allocatable :: to_send(:),to_get(:)
    real local_time,global_time
    call ccm_init(myid,numprocs)
    allocate(to_send(0:numprocs-1),to_get(0:numprocs-1))
    do i=0,numprocs-1
       to_send(i)=myid+i
    enddo
    call ccm_alltoall(to_send,to_get)
    write(*,*)"for i= ",myid," igot= ",to_get
    call ccm_close()
end program

Example output on 4 processors


[ccm_host:~/ccm/source]% ccm_alltoall_x1
 for i=   0  igot=   0  1  2  3
 for i=   1  igot=   1  2  3  4
 for i=   2  igot=   2  3  4  5
 for i=   3  igot=   3  4  5  6
[ccm_host:~/ccm/source] % 

The call to ccm_init initializes the communication package. Each task fills its copy of the array to_send. The program exchanges values using the ccm_alltoall call and print them. The call to ccm_close closes the communication package.

Error conditions:


If the error checking level is set to ccm_checksize the following error condition(s) are checked: These conditions may lead to a Underling communications error if not detected.
Back to API and user's guide