Module mpiOther ! "Other" means no argument precision nor scalar options. ! ! hdk - 20 May 2008 ! Implicit none ! About 15 significant decimal digits. Integer, PARAMETER :: DPSim = SELECTED_REAL_KIND(Kind(1.d0)) Integer, Parameter :: MPI_ADDRESS_KIND = 4 ! MPI global variables and data types. Integer, Parameter :: MPI_SUCCESS = 0 Integer, Parameter :: MPI_STATUS_SIZE = 1 Integer, Parameter :: MPI_SOURCE = 1 Integer, Parameter :: MPI_ANY_SOURCE = 1 Integer, Parameter :: MPI_TAG = 1 Integer, Parameter :: MPI_ANY_TAG = 1 Integer, Parameter :: MPI_COMM_WORLD = 1 Integer, Parameter :: MPI_UNDEFINED = 3 Integer, Parameter :: MPI_COMM_NULL = 0 Integer :: MPI_REQUEST_NULL = 0 Logical :: MPI_INIT_FLAG = .FALSE. Integer, Parameter :: MPI_SUM = 1 Integer, Parameter :: MPI_PROD = 2 Integer, Parameter :: MPI_MAX = 3 Integer, Parameter :: MPI_IDENT = 1 Integer, Parameter :: MPI_CONGRUENT = 2 Integer, Parameter :: MPI_SIMILAR = 3 Integer, Parameter :: MPI_UNEQUAL = 4 Integer, Parameter :: MPI_INTEGER = 1 Real, parameter :: MPI_REAL = 2.0 Double Precision, parameter :: MPI_DOUBLE_PRECISION = 3.D0 Complex, parameter :: MPI_COMPLEX = 4.0 Character :: MPI_CHARACTER = " " contains Subroutine MPI_Init( ierr ) ! MPI_Init initializes the MPI library. ! It must be the first MPI routine called. Integer, Intent(out) :: ierr MPI_INIT_FLAG = .TRUE. ierr=0 End Subroutine MPI_Init Subroutine MPI_Initialized ( flag, ierr ) ! MPI_Initialized reports whether MPI has been initialized by a ! call to MPI_Init. Integer, Intent(out) :: ierr Logical, Intent(out) :: flag flag = MPI_INIT_FLAG ierr = 0 End Subroutine MPI_Initialized Subroutine MPI_Finalize ( ierr ) ! MPI_Finalize shuts down the MPI library. ! It must be the last MPI routine called. Integer, Intent(out) :: ierr if (.not. MPI_INIT_FLAG) then write(*,*) "$$ MPI_Finalize called before MPI_Init." stop endif MPI_INIT_FLAG = .FALSE. ierr=0 End Subroutine MPI_Finalize Subroutine MPI_Attr_delete ( communicator, keyval, ierr ) ! MPI_Attr_delete deletes an attribute that had been associated with ! a communicator. Integer, Intent(in) :: communicator, keyval Integer, Intent(out) :: ierr Integer :: testi testi = communicator testi = keyval ierr = 0 End Subroutine MPI_Attr_delete Subroutine MPI_Attr_get ( communicator, keyval, attribute_val, & flag, ierr ) ! MPI_Attr_get retrieves an attribute value by key. Integer, Intent(in) :: communicator, keyval Integer, Intent(out) :: attribute_val, ierr Logical, Intent(out) :: flag Integer :: testi testi = communicator testi = keyval attribute_val = 1 flag = .FALSE. ierr = 0 End Subroutine MPI_Attr_get Subroutine MPI_Attr_put ( communicator, keyval, attribute_val, ierr ) ! MPI_Attr_put stores an attribute value by key. Integer, Intent(in) :: communicator, keyval, attribute_val Integer, Intent(out) :: ierr Integer :: testi testi = communicator testi = keyval testi = attribute_val ierr = 0 End Subroutine MPI_Attr_put Subroutine MPI_Barrier( communicator, ierr ) ! MPI_Barrier forces all processes within the communicator to wait ! until they have all reached the barrier. Integer, Intent(in) :: communicator Integer, Intent(out) :: ierr Integer :: testi testi = communicator ierr=0 End Subroutine MPI_Barrier Subroutine MPI_Abort ( communicator, icode, ierr ) ! MPI_Abort shuts down all the processes in a given communicator ! and returns an error code to the invoking environment. Integer, intent(in):: communicator, icode Integer, intent(out) :: ierr Integer :: testi testi = communicator testi = icode ierr = 0 End Subroutine MPI_Abort Subroutine MPI_Cancel ( request, ierr ) ! MPI_Cancel marks the operation associated with a request for ! cancellation. Integer, Intent(in) :: request Integer, Intent(out) :: ierr Integer :: testi testi = request ierr = 0 End Subroutine MPI_Cancel Subroutine MPI_Cart_coords ( communicator, rank, maxdims, coords, & ierr ) ! MPI_Cart_coords returns the Cartesian "coordinates" of any process ! given its rank. Integer, Intent(in) :: communicator, rank, maxdims Integer, Intent(out) :: coords(:), ierr Integer :: testi testi = communicator testi = rank testi = maxdims if(maxdims < 0) then write(*,*) "MPI_Cart_coords: maxdims < 0; maxdims=",maxdims stop endif coords = 1 ierr = 0 End Subroutine MPI_Cart_coords Subroutine MPI_Cart_create ( old_communicator, ndims, dims, & periodic, reorder, new_communicator, ierr ) ! MPI_Cart_create creates a communicator for a Cartesian topology. Integer, Intent(in) :: old_communicator, ndims, dims(ndims) Logical, Intent(in) :: periodic(ndims), reorder Integer, Intent(out) :: new_communicator, ierr Integer :: testi, I Logical :: testl testi = old_communicator testi = ndims if (ndims < 0) then write(*,*) "$$ MPI_Cart_create: ndims<0; ndims = ",ndims stop endif do I=1,ndims testi = dims(I) testl = periodic(I) end do testl = reorder new_communicator = old_communicator ierr = 0 End Subroutine MPI_Cart_create Subroutine MPI_Cart_shift ( communicator, dim, shift, & source, destination, ierr ) ! MPI_Cart_shift finds the destination and source for shifts in a ! Cartesian topology. Integer, Intent(in) :: communicator, dim, shift Integer, Intent(out) :: source, destination, ierr Integer :: testi testi = communicator testi = shift testi = dim source = 1 destination = 2 ierr = 0 End Subroutine MPI_Cart_shift Subroutine MPI_Cart_get ( communicator, maxdims, dims, & periodic, coords, ierr ) ! MPI_Cart_get returns the "coordinates" of the calling process ! within the Cartesian topology. Integer, Intent(in) :: communicator, maxdims Integer, Intent(out) :: dims(maxdims), coords(maxdims), ierr Logical, Intent(out) :: periodic(maxdims) Integer :: testi, I testi = communicator testi = maxdims if (maxdims < 0) then write(*,*) "$$ MPI_Dims_get: maxdims<0; maxdims = ",maxdims stop endif do I = 1,maxdims periodic(I) = .TRUE. dims(I) = 1 coords(I) = 2 end do ierr = 0 End Subroutine MPI_Cart_get Subroutine MPI_Cart_rank ( communicator, coords, rank, ierr ) ! MPI_Cart_rank returns the rank of the calling process within the ! Cartesian topology. Integer, Intent(in) :: coords(:), communicator Integer, Intent(out) :: rank, ierr Integer :: testi, I testi = communicator do I =1,Size(coords) testi = coords(I) end do rank = 1 ierr = 0 End Subroutine MPI_Cart_rank Subroutine MPI_Cart_sub ( old_communicator, free_coords, & new_communicator, ierr ) ! MPI_Cart_sub partitions a Cartesian grid into grids of lower ! dimension. Integer, Intent(in) :: old_communicator, new_communicator Logical, Intent(in) :: free_coords(:) Integer, Intent(out) :: ierr Integer :: testi, I Logical :: testl testi = old_communicator testi = new_communicator do I=1,Size(free_coords) testl = free_coords(I) end do ierr = 0 End Subroutine MPI_Cart_sub Subroutine MPI_Dims_create ( num_procs, ndims, dims, ierr ) ! MPI_Dims_create is used to set up a balanced Cartesian grid with ! any number of dimensions. Integer, Intent(in) :: ndims, num_procs Integer, Intent(inout) :: dims(ndims) Integer, Intent(out) :: ierr Integer :: testi, I testi = num_procs testi = ndims if (ndims < 0) then write(*,*) "$$ MPI_Dims_create: ndims<0; ndims = ",ndims stop endif do I = 1,ndims if (dims(I) < 0) then write(*,*) "$$ MPI_Dims_create: dims(I)<0; for I=",I endif if (dims(I) == 0) dims(I) = 1 end do ierr = 0 End Subroutine MPI_Dims_create Subroutine MPI_Error_string ( errorcode, string, llen, ierr ) ! Returns the error string of length len for errorcode. Integer, Intent(in) :: errorcode Character(*), Intent(out) :: string Integer, Intent(out) :: llen, ierr Integer :: testi testi = errorcode string = 'es' llen = 2 ierr = 0 End Subroutine MPI_Error_string Subroutine MPI_Group_compare ( group1, group2, rresult, ierr ) ! MPI_Group_compare compares two groups. Integer, Intent(in) :: group1, group2 Integer, Intent(out) :: rresult, ierr Integer :: testi testi = group1 testi = group2 rresult = MPI_IDENT ierr = 0 End Subroutine MPI_Group_compare Subroutine MPI_Group_difference ( group1, group2, new_group, ierr ) ! MPI_Group_difference creates a new group of processes from those ! which are in group1 but not in group2. Integer, Intent(in) :: group1, group2 Integer, Intent(out) :: new_group, ierr Integer :: testi testi = group1 testi = group2 new_group = 1 ierr = 0 End Subroutine MPI_Group_difference Subroutine MPI_Group_excl ( old_group, n, exclude, & new_group, ierr ) ! MPI_Group_excl creates a new group of processes from an old group ! by exclusion. Integer, Intent(in) :: old_group, n, exclude(n) Integer, Intent(out) :: new_group, ierr Integer :: testi, I testi = old_group testi = n if (n < 0) then write(*,*) "$$ MPI_Group_excl: n<0; n = ",n stop endif do I=1,n testi=exclude(I) end Do new_group = 1 ierr = 0 end Subroutine MPI_Group_excl Subroutine MPI_Group_free ( group, ierr ) ! MPI_Group_free "frees" a group, that is, ends the association ! between a set of processes and a group identifier. Integer, Intent(in) :: group Integer, Intent(out) :: ierr Integer :: testi testi = group ierr = 0 End Subroutine MPI_Group_free Subroutine MPI_Group_incl ( old_group, n, iinclude, new_group, & ierr ) ! MPI_Group_incl creates a new group of processes from an old group ! by inclusion. Integer, Intent(in) :: old_group, n, iinclude(n) Integer, Intent(out) :: new_group, ierr Integer :: testi, I testi = n if (n < 0) then write(*,*) "$$ MPI_Group_incl: n<0; n = ",n stop endif do I=1,n testi=iinclude(I) end Do new_group = 1 ierr = 0 End Subroutine MPI_Group_incl Subroutine MPI_Group_intersection ( group1, group2, new_group, & ierr ) ! MPI_Group_intersection creates a new group of processes from the ! intersection of two groups. Integer, Intent(in) :: group1, group2 Integer, Intent(out) :: new_group, ierr Integer :: testi testi = group1 testi = group2 new_group = 1 ierr = 0 End Subroutine MPI_Group_intersection Subroutine MPI_Group_rank ( group, rank, ierr ) ! MPI_Group_rank returns the rank of the calling process in a group. Integer, Intent(in) :: group Integer, Intent(out) :: rank, ierr Integer :: testi testi = group rank = 1 ierr = 0 End Subroutine MPI_Group_rank Subroutine MPI_Group_size ( group, ssize, ierr ) ! MPI_Group_size returns the number of processes in a group. Integer, Intent(in) :: group Integer, Intent(out) :: ssize, ierr Integer :: testi testi = group ssize = 1 ierr = 0 End Subroutine MPI_Group_size Subroutine MPI_Group_union ( group1, group2, new_group, & ierr ) ! MPI_Group_union creates a new group of processes from the union of ! two groups. Integer, Intent(in) :: group1, group2 Integer, Intent(out) :: new_group, ierr Integer :: testi testi = group1 testi = group2 new_group = 1 ierr = 0 End Subroutine MPI_Group_union Subroutine MPI_Comm_compare ( communicator1, communicator2, & rresult, ierr ) ! MPI_Comm_compare compares two communicators. Integer, Intent(in) :: communicator1, communicator2 Integer, Intent(out) :: rresult, ierr Integer :: testi testi = communicator1 testi = communicator2 rresult = MPI_IDENT ierr = 0 End Subroutine MPI_Comm_compare Subroutine MPI_Comm_create ( old_communicator, group, & new_communicator, ierr ) ! MPI_Comm_create creates a new communicator from a given group of ! processes. Integer, Intent(in) :: old_communicator, group Integer :: testi Integer, Intent(out) :: ierr, new_communicator testi = old_communicator testi = group new_communicator = 1 ierr = 0 End Subroutine MPI_Comm_create Subroutine MPI_Comm_dup ( old_communicator, new_communicator, ierr ) ! MPI_Comm_dup makes a new communicator which has the same ! attributes as an already existing communicator. Integer, Intent(in) :: old_communicator Integer, Intent(out) :: new_communicator, ierr new_communicator = old_communicator ierr = 0 End Subroutine MPI_Comm_dup Subroutine MPI_Comm_free ( communicator, ierr ) ! MPI_Comm_free "frees" a communicator, that is, ends the ! association between a group of processes and a communicator ! identifier. Integer, Intent(in) :: communicator Integer, Intent(out) :: ierr Integer :: testi testi = communicator ierr = 0 End Subroutine MPI_Comm_free Subroutine MPI_Comm_group ( communicator, group, ierr ) ! MPI_Comm_group creates a communicator for a given group of ! processes. Integer, Intent(in) :: communicator Integer, Intent(out) :: ierr, group Integer :: testi testi = communicator group = 1 ierr = 0 End Subroutine MPI_Comm_group Subroutine MPI_Comm_rank ( communicator, id, ierr ) ! MPI_Comm_rank reports the rank of the calling process. Integer, Intent(in) :: communicator Integer, Intent(out) :: id, ierr Integer :: testi testi = communicator id = 0 ierr = 0 End Subroutine MPI_Comm_rank Subroutine MPI_Comm_size ( communicator, num_procs, ierr ) ! MPI_Comm_size reports the number of processes in a communicator. Integer, Intent(in) :: communicator Integer, Intent(out) :: num_procs, ierr Integer :: testi testi = communicator num_procs = 2 ierr = 0 End Subroutine MPI_Comm_size Subroutine MPI_Keyval_create ( copy_fn, delete_fn, key_ptr, & extra_arg, ierr ) ! MPI_Keyval_create creates a key (or handle) for a new attribute ! to be associated with a communicator. Integer, Intent(in) :: extra_arg External :: copy_fn, delete_fn Integer, Intent(out) :: key_ptr, ierr Integer :: testi testi = extra_arg key_ptr = 1 ierr = 0 End Subroutine MPI_Keyval_create Subroutine MPI_Keyval_free ( key_ptr, ierr ) ! MPI_Keyval_frees up (deletes) an attribute key. Integer, Intent(inout):: key_ptr Integer, Intent(out) :: ierr Integer :: testi testi = key_ptr key_ptr = 0 ierr = 0 End Subroutine MPI_Keyval_free Subroutine MPI_Comm_split ( old_communicator, split_key, & rank_key, new_communicator, ierr ) ! MPI_Comm_split splits up a communicator, creating a number of ! communicators with the same ID, but with different values of ! a "split key". Integer, Intent(in) :: old_communicator, split_key, rank_key Integer, Intent(out) :: new_communicator, ierr Integer :: testi testi = old_communicator testi = split_key testi = rank_key new_communicator = old_communicator ierr = 0 End Subroutine MPI_Comm_split Subroutine MPI_Op_create ( op_fun, commutes, op_id, ierr ) ! MPI_Op_create allows the user to get an ID for a new reduction ! operation, which must be associative. External :: op_fun Logical, Intent(in) :: commutes Integer, Intent(out) :: op_id, ierr Integer :: testi Logical :: testl testl = commutes op_id = 1 ierr = 0 End Subroutine MPI_Op_create Subroutine MPI_Op_free ( op_id, ierr ) ! MPI_Op_free frees the memory associated with a user-defined ! reduction operation. Integer, Intent(in) :: op_id Integer, Intent(out) :: ierr Integer :: testi testi = op_id ierr = 0 End Subroutine MPI_Op_free Subroutine MPI_Iprobe ( source, tag, comm, flag, sstatus, ierr ) ! Checks for incoming messages without actually receiving them. Integer, Intent(in) :: source, tag, comm Logical, Intent(out) :: flag Integer, Intent(inout) :: sstatus(:) Integer, Intent(out) :: ierr Integer :: testi, I testi = source testi = tag if (source < 0 ) then write(*,*) "$$ MPI_Iprobe: source<0; source = ",source stop endif if (tag < 0 ) then write(*,*) "$$ MPI_Iprobe: tag<0; tag = ",tag stop endif testi = comm do I = 1,Size(sstatus) testi = sstatus(I) sstatus(I) = 1 end do flag = .FALSE. ierr = 0 End Subroutine MPI_Iprobe Subroutine MPI_Probe ( sender, tag, communicator, sstatus, ierr ) ! MPI_Probe allows you to check whether a message has been sent, and ! is ready to be received, without actually receiving it yet. Integer, Intent(in) :: sender, tag, communicator Integer, Intent(out) :: sstatus(:), ierr Integer :: testi testi = sender testi = tag testi = communicator sstatus = 1 ierr = 0 End Subroutine MPI_Probe Subroutine MPI_Get_processor_name ( name, length, ierr ) ! Returns Processor Name as "mpiSim". CHARACTER*(*), Intent(out) :: name Integer, Intent(out) :: ierr, length name = "mpiSim" Length = 6 ierr = 0 End Subroutine MPI_Get_processor_name Subroutine MPI_Get_version (version, subversion, ierr) ! Returns Integer Version and Subverion numbers. Integer, Intent(out) :: version, subversion, ierr version = 1 subversion = 0 ierr = 0 End Subroutine MPI_Get_version Subroutine MPI_Request_free ( request, ierr ) ! MPI_Request_free releases the memory associated with a request. Integer, Intent(inout) :: request Integer, Intent(out) :: ierr Integer :: testi testi = request request = MPI_REQUEST_NULL ierr = 0 End Subroutine MPI_Request_free Subroutine MPI_Test ( request, flag, sstatus, ierr ) ! MPI_Test tests to see if a particular I/O request has been ! completed. Integer, Intent(in) :: request Integer, Intent(out) :: sstatus(:), ierr Logical, Intent(out) :: flag Integer :: testi testi = request flag = .TRUE. sstatus = 1 ierr = 0 End Subroutine MPI_Test Subroutine MPI_Testall ( count, requests, flag, statuses, ierr ) ! MPI_Testall tests to see if all of a set of I/O requests have been ! completed. Integer, Intent(in) :: count, requests(count) Integer, Intent(out) :: statuses(:,:), ierr Logical, Intent(out) :: flag Integer :: testi, I, J, S2 testi = count S2 = Size(statuses,2) if (count < 0 .or. count > S2) then write(*,*) & "$$ MPI_Testall: count<0 or >2nd dimension ",S2, & "; count = ",count stop endif do I=1,count testi = requests(I) do J=1,Size(statuses,1) statuses(J,I) = 1 end do end do flag = .TRUE. ierr = 0 End Subroutine MPI_Testall Subroutine MPI_Testany (count, requests, index, flag, sstatus, ierr) ! Tests for the completion of any nonblocking operation. Integer, Intent(in) :: count Integer, Intent(inout) :: requests(:), sstatus(:) Integer, Intent(out) :: index, ierr Logical, Intent(out) :: flag Integer :: testi, I testi = count if (count < 0 ) then write(*,*) "$$ MPI_Testany: count<0; count = ",count stop endif do I = 1,Size(requests) testi = requests(I) requests(I) = 1 end do do I=1,Size(sstatus) testi = sstatus(I) sstatus(I) = 1 end do flag = .TRUE. index = 1 ierr = 0 End Subroutine MPI_Testany Subroutine MPI_Wait ( request, sstatus, ierr ) ! MPI_Wait waits for an I/O request to complete. Integer, Intent(in) :: request Integer, Intent(inout) :: sstatus(:) Integer, Intent(out) :: ierr Integer :: testi, I testi = request do I=1,Size(sstatus) sstatus(I) = 1 end do ierr = 0 End Subroutine MPI_Wait Subroutine MPI_Waitany ( count, request_array, index, & status_array, ierr ) ! MPI_Waitall waits until any one I/O request has completed. Integer, Intent(in) :: count, request_array(count) Integer, Intent(inout) :: status_array(:,:) Integer, Intent(out) :: ierr, index Integer :: testi, I, J, S2 testi = count index = 1 S2 = Size(status_array,2) if (count < 0 .or. count > S2) then write(*,*) & "$$ MPI_Waitany: count<0 or > 2nd dimension ",S2, & "; count = ",count stop endif do I=1,count testi = request_array(I) do J=1,Size(status_array,1) status_array(J,I) = 1 end do end do ierr = 0 End Subroutine MPI_Waitany Subroutine MPI_Waitall ( count, request_array, status_array, ierr ) ! MPI_Waitall waits until all I/O requests have completed. Integer, Intent(in) :: count Integer, Intent(in) :: request_array(count) Integer, Intent(inout) :: status_array(:,:) Integer, Intent(out) :: ierr Integer :: testi, I, J, S2 testi = count S2 = Size(status_array,2) if (count < 0 .or. count> S2) then write(*,*) & "$$ MPI_Waitall: count<0 or > 2nd dimension ",S2, & "; count = ",count stop endif do I=1,count testi = request_array(I) do J=1,Size(status_array,1) status_array(J,I) = 1 end do end do ierr = 0 End Subroutine MPI_Waitall Function MPI_Wtime ( ) result(wall_clock_seconds) ! MPI_Wtime returns the current reading of the real time clock ! in seconds. Double Precision :: wall_clock_seconds integer, dimension(8) :: time call Date_and_Time( VALUES = time ) wall_clock_seconds = time(5)*3600 + time(6)*60 + time(7) End Function MPI_Wtime Function MPI_Wtick ( ) result(seconds) ! MPI_Wtick returns the time, in seconds, between succesive ! ticks of the real time clock. Double Precision :: seconds Real :: Tick Integer :: pulses, PPS Call System_Clock(COUNT=Pulses,COUNT_RATE=PPS) Tick = REAL(Pulses,DPSim)/PPS ! DPSim is defined in mpiOther. seconds = Tick End Function MPI_Wtick Subroutine MPI_Type_commit ( datatype, ierr) ! MPI_Type_commit is used to "register" a new datatype. Integer, Intent(in) :: datatype Integer, Intent(out) :: ierr Integer :: testi testi = datatype ierr = 0 End Subroutine MPI_Type_commit Subroutine MPI_Type_struct ( count, blocklengths, displacements, & old_datatypes, new_datatype, ierr ) ! MPI_Type_struct creates a new datatype by indexing (blocks of) ! elements of data of varying datatypes. Integer, Intent(in) :: count, blocklengths(count) Integer, Intent(in) :: displacements(count) Integer, Intent(in) :: old_datatypes(count) Integer, Intent(out) :: new_datatype, ierr Integer :: testi, I testi = count if (count < 0) then write(*,*) & "$$ MPI_Type_struct estany: count<0; count ",count stop endif do I=1,count testi = blocklengths(I) testi = displacements(I) testi = old_datatypes(I) end do new_datatype = MPI_ADDRESS_KIND ierr = 0 End Subroutine MPI_Type_struct End Module mpiOther Module mpiInt ! Integer Data and Datatype and Scalar(_IS) arguments. Interface MPI_Allreduce Module Procedure MPI_Allreduce_I End Interface Interface MPI_Allreduce Module Procedure MPI_Allreduce_IS End Interface Interface MPI_Bcast Module Procedure MPI_Bcast_I End Interface Interface MPI_Bcast Module Procedure MPI_Bcast_IS End Interface Interface MPI_Bsend Module Procedure MPI_Bsend_I End Interface Interface MPI_Bsend Module Procedure MPI_Bsend_IS End Interface Interface MPI_Buffer_attach Module Procedure MPI_Buffer_attach_I End Interface Interface MPI_Buffer_detach Module Procedure MPI_Buffer_detach_I End Interface Interface MPI_Get_count Module Procedure MPI_Get_count_I End Interface Interface MPI_Get_elements Module Procedure MPI_Get_elements_I End Interface Interface MPI_Get_elements Module Procedure MPI_Get_elements_IS End Interface Interface MPI_Gather Module Procedure MPI_Gather_I End Interface Interface MPI_Gather Module Procedure MPI_Gather_IS End Interface Interface MPI_Address Module Procedure MPI_Address_I End Interface Interface MPI_Get_address Module Procedure MPI_Get_address_I End Interface Interface MPI_Scatter Module Procedure MPI_Scatter_I End Interface Interface MPI_Pack Module Procedure MPI_Pack_I End Interface Interface MPI_Unpack Module Procedure MPI_Unpack_I End Interface Interface MPI_Pack_size Module Procedure MPI_Pack_size_I End Interface Interface MPI_Recv Module Procedure MPI_Recv_I End Interface Interface MPI_Recv Module Procedure MPI_Recv_IS End Interface Interface MPI_Irecv Module Procedure MPI_Irecv_I End Interface Interface MPI_Irecv Module Procedure MPI_Irecv_IS End Interface Interface MPI_Receive Module Procedure MPI_Receive_I End Interface Interface MPI_Send Module Procedure MPI_Send_I End Interface Interface MPI_Send Module Procedure MPI_Send_IS End Interface Interface MPI_Isend Module Procedure MPI_Isend_I End Interface Interface MPI_Isend Module Procedure MPI_Isend_IS End Interface Interface MPI_Issend Module Procedure MPI_Issend_I End Interface Interface MPI_Issend Module Procedure MPI_Issend_IS End Interface Interface MPI_Ssend Module Procedure MPI_Ssend_I End Interface Interface MPI_Ssend Module Procedure MPI_Ssend_IS End Interface Interface MPI_Reduce Module Procedure MPI_Reduce_I End Interface Interface MPI_Reduce Module Procedure MPI_Reduce_IS End Interface contains Subroutine MPI_Allreduce_I ( a,b, count, & datatype, operation, communicator, ierr ) ! MPI_Allreduce carries out a reduction operation (such as sum, ! maximum, or product), with all processes receiving the result. Integer, Intent(in) :: count, communicator, operation Integer, Intent(in) :: a(count), datatype Integer, Intent(out) :: b(count) Integer, Intent(out) :: ierr Integer :: testi, I testi = datatype testi = operation testi = communicator testi = count if (count < 0) then write(*,*) "$$ MPI_Allreduce_I: count<0; count = ",count stop endif Do I=1,count b(I)=a(I) Enddo ierr=0 End Subroutine MPI_Allreduce_I Subroutine MPI_Allreduce_IS ( a,b, count, & datatype, operation, communicator, ierr ) ! MPI_Allreduce carries out a reduction operation (such as sum, ! maximum, or product), with all processes receiving the result. Integer, Intent(in) :: count, communicator, operation Integer, Intent(in) :: a, datatype Integer, Intent(out) :: b Integer, Intent(out) :: ierr Integer :: testi testi = datatype testi = operation testi = communicator testi = count if (count < 0) then write(*,*) "$$ MPI_Allreduce_IS: count<0; count = ",count stop endif if (count > 1) then write(*,*) "$$ MPI_Allreduce_IS: count>1; count = ",count stop endif b=a ierr=0 End Subroutine MPI_Allreduce_IS Subroutine MPI_Bcast_I ( ddata, count, datatype, sender, & communicator, ierr ) ! MPI_Bcast broadcasts data from one process to all others within a ! communicator. Integer, Intent(in) :: count, sender, communicator Integer, Intent(in) :: ddata(count), datatype Integer, Intent (out) :: ierr Integer :: testi, I testi=count if (count < 0) then write(*,*) "$$ MPI_Bcast_I: count<0; count = ",count stop endif do I=1,count testi = ddata(I) end do testi = datatype testi = sender testi = communicator ierr = 0 End Subroutine MPI_Bcast_I Subroutine MPI_Bcast_IS ( ddata, count, datatype, sender, & communicator, ierr ) Integer, Intent(in) :: ddata, count, datatype Integer, Intent(in) :: sender, communicator Integer, Intent(out) :: ierr Integer :: testi testi = count if (count < 0) then write(*,*) "$$ MPI_Bcast_IS: count<0; count = ",count stop endif if (count > 1) then write(*,*) "$$ MPI_Bcast_IS: count>1; count = ",count stop endif testi = ddata testi = datatype testi = sender testi = communicator ierr = 0 End Subroutine MPI_Bcast_IS Subroutine MPI_Bsend_I ( ddata, count, datatype, receiver, tag, & communicator, ierr ) ! MPI_Bsend sends data from one process to another within a ! communicator, using buffering. Integer, Intent(in) :: count, receiver, tag, communicator Integer, Intent(in) :: ddata(count), datatype Integer, Intent(out) :: ierr Integer :: testi, I testi = count if (count < 0) then write(*,*) "$$ MPI_Bsend_I: count<0; count = ",count stop endif testi = receiver testi = tag testi = communicator testi = datatype do I=1,count testi = ddata(I) end do ierr = 0 End Subroutine MPI_Bsend_I Subroutine MPI_Bsend_IS ( ddata, count, datatype, receiver, tag, & communicator, ierr ) ! MPI_Bsend sends data from one process to another within a ! communicator, using buffering. Integer, Intent(in) :: count, receiver, tag, communicator Integer, Intent(in) :: ddata, datatype Integer, Intent(out) :: ierr Integer :: testi testi = count if (count < 0) then write(*,*) "$$ MPI_Bsend_IS: count<0; count = ",count stop endif if (count > 1) then write(*,*) "$$ MPI_Bsend_IS: count>1; count = ",count stop endif testi = receiver testi = tag testi = communicator testi = datatype testi = ddata ierr = 0 End Subroutine MPI_Bsend_IS Subroutine MPI_Buffer_attach_I ( buffer, bsize, ierr ) ! MPI_Buffer_attach sets up a buffer for data transmission via ! MPI_Bsend. Integer, Intent(in) :: buffer(:) Integer, Intent(in) :: bsize Integer, Intent(out) :: ierr Integer :: testi testi = bsize if (bsize < 0 ) then write(*,*) "$$ MPI_Buffer_attach_I: bsize<0;", & " bsize = ", bsize stop endif if (bsize < Size(buffer)*4 ) then write(*,*) "$$ MPI_Buffer_attach_I: ", & "bsize<4*Size(buffer); bsize= ", bsize, & ", Size(buffer) = ", Size(buffer) stop endif ierr = 0 End Subroutine MPI_Buffer_attach_I Subroutine MPI_Buffer_detach_I ( buffer, bsize, ierr ) ! MPI_Buffer_detach frees up the memory associated with a buffer ! that had been set up by a call to MPI_Buffer_attach. Integer, Intent(out) :: buffer(:) Integer, Intent(out) :: bsize Integer, Intent(out) :: ierr buffer = 1 bsize = 1 ierr = 0 End Subroutine MPI_Buffer_detach_I Subroutine MPI_Get_count_I ( sstatus, datatype, count, ierr ) ! MPI_Get_count reports the actual number of items transmitted in a ! communication. Integer, Intent(in) :: sstatus(:), datatype Integer, Intent(out) :: ierr, count Integer :: I, testi count = 1 do I=1,Size(sstatus) testi = sstatus(I) end do testi = datatype ierr = 0 End Subroutine MPI_Get_count_I Subroutine MPI_Get_elements_I ( sstatus, datatype, count, ierr) ! Returns the number of basic elements in a message. Integer, Intent(in) :: sstatus(:) Integer, Intent(in) :: datatype Integer, Intent(out) :: count, ierr Integer :: testi, I do I=1,Size(sstatus) testi = sstatus(I) end do testi = datatype count = 1 ierr = 0 End Subroutine MPI_Get_elements_I Subroutine MPI_Get_elements_IS ( sstatus, datatype, count, ierr ) ! Returns the number of basic elements in a message. Integer, Intent(in) :: sstatus Integer, Intent(in) :: datatype Integer, Intent(out) :: count, ierr Integer :: testi testi = sstatus testi = datatype count = 1 ierr = 0 End Subroutine MPI_Get_elements_IS Subroutine MPI_Gather_I ( send_data, send_count, send_datatype, & recv_data, recv_count, recv_datatype, & root, communicator, ierr ) ! MPI_Gather gathers data from all the processes in a communicator. Integer, Intent(in) :: send_count, recv_count Integer, Intent(in) :: root, communicator Integer, Intent(in) :: send_data(send_count) Integer, Intent(in) :: send_datatype, recv_datatype Integer, Intent(out) :: recv_data(:) Integer, Intent(out) :: ierr Integer :: testi, I testi = send_count testi = recv_count testi = root testi = communicator testi = send_datatype testi = recv_datatype if (send_count < 0) then write(*,*) "$$ MPI_Gather_I: send_count<0; = ",send_count stop endif do I=1,send_count testi = send_data(I) end do if (recv_count < 0 .or. recv_count > Size(recv_data)) then write(*,*) "$$ MPI_Gather_I: recv_count<0; or " write(*,*) "$$ MPI_Gather_I: recv_count>Size(recv_data)." write(*,*) "recv_count = ",recv_count write(*,*) "Size(recv_data) = ", Size(recv_data) stop endif do I=1,Size(recv_data) recv_data(I) = 1 end do ierr = 0 End Subroutine MPI_Gather_I Subroutine MPI_Gather_IS ( send_data, send_count, send_datatype, & recv_data, recv_count, recv_datatype, & root, communicator, ierr ) ! MPI_Gather gathers data from all the processes in a communicator. Integer, Intent(in) :: send_count, recv_count Integer, Intent(in) :: root, communicator Integer, Intent(in) :: send_data Integer, Intent(in) :: send_datatype, recv_datatype Integer, Intent(out) :: recv_data(:) Integer, Intent(out) :: ierr Integer :: testi, I testi = send_count testi = recv_count testi = root testi = communicator testi = send_datatype testi = recv_datatype if (send_count < 0) then write(*,*) "$$ MPI_Gather_IS: send_count<0; = ",send_count stop endif if (send_count > 1) then write(*,*) "$$ MPI_Gather_IS: send_count>1; = ",send_count stop endif testi = send_data if (recv_count < 0 .or. recv_count > Size(recv_data)) then write(*,*) "$$ MPI_Gather_IS: recv_count<0; or " write(*,*) "$$ MPI_Gather_IS: recv_count>Size(recv_data)." write(*,*) "recv_count = ",recv_count write(*,*) "Size(recv_data) = ", Size(recv_data) stop endif do I=1,Size(recv_data) recv_data(I) = 1 end do ierr = 0 End Subroutine MPI_Gather_IS Subroutine MPI_Address_I ( ddata, address, ierr ) ! MPI_Address returns the address of an item of data. Integer, Intent(in) :: ddata(:) Integer, Intent(out) :: address, ierr Integer :: testi, I do I=1,Size(ddata) testi = ddata(I) end do address = 4 ierr = 0 End Subroutine MPI_Address_I Subroutine MPI_Get_address_I ( ddata, address, ierr ) ! MPI_Get_address is a synonym for MPI_Address. Integer, Intent(in) :: ddata(:) Integer, Intent(out) :: address, ierr Integer :: testi, I do I=1,Size(ddata) testi = ddata(I) end do address = 4 ierr = 0 End Subroutine MPI_Get_address_I Subroutine MPI_Scatter_I ( send_data, send_count, send_datatype, & recv_data, recv_count, recv_datatype, & root, communicator, ierr ) ! MPI_Scatter distributes data from one process to all processes. Integer, Intent(in) :: send_count, recv_count Integer, Intent(in) :: root, communicator Integer, Intent(in) :: send_data(:) Integer, Intent(in) :: send_datatype, recv_datatype Integer, Intent(out) :: recv_data(:) Integer, Intent(out) :: ierr Integer :: testi, I testi = send_count testi = recv_count testi = root testi = communicator testi = send_datatype testi = recv_datatype if (send_count < 0 .or. send_count > Size(send_data)) then write(*,*) "$$ MPI_Scatter_I: send_count<0; or " write(*,*) "$$ MPI_Scatter_I: send_count>Size(send_data)." write(*,*) "send_count = ",send_count write(*,*) "Size(send_data) = ", Size(send_data) stop endif do I=1,Size(send_data) testi = send_data(I) end do if (recv_count < 0 .or. recv_count > Size(recv_data)) then write(*,*) "$$ MPI_Scatter_I: recv_count<0; or " write(*,*) "$$ MPI_Scatter_I: recv_count>Size(recv_data)." write(*,*) "recv_count = ",recv_count write(*,*) "Size(recv_data) = ", Size(recv_data) stop endif do I=1,Size(recv_data) recv_data(I) = 1 end do ierr = 0 End Subroutine MPI_Scatter_I Subroutine MPI_Pack_I ( ddata, count, datatype, & buffer, buffer_size, & buffer_position, communicator, ierr ) ! MPI_Pack packs data into a buffer. Integer, parameter :: bytes_per_word = 4 Integer, Intent(in) :: count, buffer_size, communicator Integer, Intent(in) :: datatype, ddata(count) Integer, Intent(out) :: buffer(:) Integer, Intent(inout) :: buffer_position Integer, Intent(out) :: ierr Integer :: testi, I, start_word testi = datatype testi = communicator testi = count if (count < 0) then write(*,*) "$$ MPI_Pack_I: count<0; count = ",count stop endif do I=1,count testr = ddata(I) end do testi = buffer_size if (buffer_size < 0) then write(*,*) "$$ MPI_Pack_I: buffer_size < 0 = ", & buffer_size stop endif testi = buffer_position if (buffer_position < 0 .or. & buffer_position/bytes_per_word > buffer_size) then write(*,*) "$$ MPI_Pack_I: buffer_position<0 = ", & "or > buffer_size; buffer_position =", & buffer_position, " buffer_size=", buffer_size stop endif ! if the buffer's dimension in bytes in the calling program ! is >= buffer_size less position, then buffer will hold the ! packed data. if (bytes_per_word*Size(buffer) < buffer_size ) then write(*,*) & "$$ MPI_Pack_I: buffer_size is larger than dimension ", & "of buffer; buffer_size= ", buffer_size write(*,*) "buffer_position = ", buffer_position write(*,*) "buffer dimension in caller=", Size(buffer) stop endif start_word = buffer_position/bytes_per_word do I=1,count buffer(I + start_word) = ddata(I) buffer_position = buffer_position + bytes_per_word end do ierr = 0 End Subroutine MPI_Pack_I Subroutine MPI_Unpack_I ( buffer, buffer_size, buffer_position, & ddata, count, datatype, communicator, ierr ) ! MPI_Unpack unpacks data from a buffer. Integer, parameter :: bytes_per_word = 4 Integer, Intent(in) :: count, buffer_size, communicator Integer, Intent(in) :: datatype, buffer(:) Integer, Intent(out) :: ddata(count) Integer, Intent(inout) :: buffer_position Integer, Intent(out) :: ierr Integer :: testi, I, start_word testi = datatype testi = communicator testi = count if (count < 0) then write(*,*) "$$ MPI_Unpack_I: count<0; count = ",count stop endif testi = buffer_size if (buffer_size < 0) then write(*,*) "$$ MPI_Unpack_I: buffer_size < 0 = ", & buffer_size stop endif testi = buffer_position if (buffer_position < 0 .or. & buffer_position/bytes_per_word > buffer_size) then write(*,*) "$$ MPI_Pack_I: buffer_position<0 = ", & "or > buffer_size; buffer_position =", & buffer_position, " buffer_size=", buffer_size stop endif if (bytes_per_word*Size(buffer) < buffer_size) then write(*,*) & "$$ MPI_Unpack_I: buffer_size is larger than dimension ", & "of buffer; buffer_size= ", buffer_size write(*,*) "buffer_position = ", buffer_position write(*,*) "buffer dimension in caller=", Size(buffer) stop endif start_word = buffer_position/bytes_per_word - count do I=1,count ddata(I) = buffer(I + start_word) end do buffer_position = buffer_position - bytes_per_word*count ierr = 0 End Subroutine MPI_Unpack_I Subroutine MPI_Pack_size_I ( count, datatype, communicator, ssize, & ierr ) ! MPI_Pack_size reports the size of the buffer needed to hold a set ! of packed data. Integer, Intent(in) :: count, communicator Integer, Intent(in) :: datatype Integer, Intent(out) :: ssize, ierr Integer :: testi testi = count if (count < 0) then write(*,*) "$$ MPI_Pack_size_I: count<0; count = ",count stop endif testi = datatype testi = communicator ssize = 4*count ierr = 0 End Subroutine MPI_Pack_size_I Subroutine MPI_Recv_I ( ddata, count, datatype, sender, tag, & communicator, sstatus, ierr ) ! MPI_Recv receives data from another process within a communicator. Integer, Intent(in) :: count, datatype, sender, tag Integer, Intent(in) :: communicator ! In FORTRAN a single status object is an array of integers. Integer, Intent(out) :: ddata(count), sstatus(:), ierr Integer :: testi, I testi = count testi = datatype testi = sender testi = tag testi = communicator sstatus = 1 if (count < 0) then write(*,*) "$$ MPI_Recv_I: count<0; count = ",count stop endif do I=1,count ddata(I) = 1 end do ierr = 0 End Subroutine MPI_Recv_I Subroutine MPI_Recv_IS ( ddata, count, datatype, sender, tag, & communicator, sstatus, ierr ) ! MPI_Recv receives data from another process within a communicator. Integer, Intent(in) :: count, datatype, sender, tag Integer, Intent(in) :: communicator ! In FORTRAN a single status object is an array of integers. Integer, Intent(out) :: ddata, sstatus(:), ierr Integer :: testi testi = count if (count > 1) then write(*,*) "$$ MPI_Recv_IS: count>1; count = ",count stop endif if ( count < 0) then write(*,*) "$$ MPI_Recv_IS: count<0; count = ",count stop endif testi = datatype testi = sender sstatus = 1 testi = tag testi = communicator ddata = 1 ierr = 0 End Subroutine MPI_Recv_IS Subroutine MPI_Irecv_I ( ddata, count, datatype, sender, tag, & communicator, request, ierr ) ! MPI_Irecv receives data from another process within a communicator. Integer, Intent(in) :: count, datatype, sender, tag Integer, Intent(in) :: communicator Integer, Intent(out) :: ddata(count), request(:), ierr Integer :: testi, I testi = count testi = datatype testi = sender testi = tag testi = communicator request = 1 if (count < 0) then write(*,*) "$$ MPI_Irecv_I: count<0; count = ",count stop endif do I=1,count ddata(I) = 1 end do ierr = 0 End Subroutine MPI_Irecv_I Subroutine MPI_Irecv_IS ( ddata, count, datatype, sender, tag, & communicator, request, ierr ) ! MPI_Irecv receives data from another process within a communicator. Integer, Intent(in) :: count, datatype, sender, tag Integer, Intent(in) :: communicator Integer, Intent(out) :: ddata, request(:), ierr Integer :: testi testi = count if (count < 0) then write(*,*) "$$ MPI_Irecv_IS: count<0; count = ",count stop endif if (count > 1) then write(*,*) "$$ MPI_Irecv_IS: count>1; count = ",count stop endif ddata = 1 testi = datatype testi = sender request = 1 testi = tag testi = communicator ddata = 1 ierr = 0 End Subroutine MPI_Irecv_IS Subroutine MPI_Receive_I ( ddata, count, datatype, sender, tag, & communicator, request, ierr ) ! MPI_Receive is not listed; probably a misnomer for mpi_recv. Integer, Intent(in) :: count, ddata(count), datatype Integer, Intent(in) :: tag, communicator, sender(:) Integer, Intent(out) :: request(:), ierr Integer :: testi, I testi = count testi = datatype do I=1,Size(sender) testi = sender(I) end do testi = tag testi = communicator request = 1 if (count < 0) then write(*,*) "$$ MPI_Receive_I: count<0; count = ",count stop endif do I=1,count testi = ddata(I) end do ierr = 0 End Subroutine MPI_Receive_I Subroutine MPI_Send_I ( ddata, count, datatype, receiver, tag, & communicator, ierr ) ! MPI_Send sends data from one process to another within a ! communicator. Integer, Intent(in) :: count, ddata(count), datatype Integer, Intent(in) :: tag, communicator, receiver Integer, Intent(out) :: ierr Integer :: testi, I testi = count testi = datatype testi = receiver testi = tag testi = communicator if (count < 0) then write(*,*) "$$ MPI_Send_I: count<0; count = ",count stop endif do I=1,count testi = ddata(I) end do testi = receiver ierr = 0 End Subroutine MPI_Send_I Subroutine MPI_Send_IS ( ddata, count, datatype, receiver, tag, & communicator, ierr ) ! MPI_Send sends data from one process to another within a ! communicator. Integer, Intent(in) :: count, ddata, datatype, receiver, tag Integer, Intent(in) :: communicator Integer, Intent(out) :: ierr Integer :: testi testi = count if (count < 0) then write(*,*) "$$ MPI_Send_IS: count<0; count = ",count stop endif if (count > 1) then write(*,*) "$$ MPI_Send_IS: count>1; count = ",count stop endif testi = datatype testi = receiver testi = tag testi = communicator testi = ddata ierr = 0 End Subroutine MPI_Send_IS subroutine MPI_Isend_I ( ddata, count, datatype, receiver, tag, & communicator, request, ierr ) ! MPI_Isend is a nonblocking send of data. Integer, Intent(in) :: count, ddata(count), datatype Integer, Intent(in) :: tag, communicator, receiver Integer, Intent(out) :: ierr, request Integer :: testi, I testi = count testi = datatype testi = receiver testi = tag testi = communicator if (count < 0) then write(*,*) "$$ MPI_Send_I: count<0; count = ",count stop endif do I=1,count testi = ddata(I) end do testi = receiver request = 1 ierr = 0 End Subroutine MPI_Isend_I Subroutine MPI_Isend_IS ( ddata, count, datatype, receiver, tag, & communicator, request, ierr ) ! MPI_Isend is a nonblocking send of data. Integer, Intent(in) :: count, ddata, datatype, receiver, tag Integer, Intent(in) :: communicator Integer, Intent(out) :: ierr, request Integer :: testi testi = count if (count < 0) then write(*,*) "$$ MPI_Isend_IS: count<0; count = ",count stop endif if (count > 1) then write(*,*) "$$ MPI_Isend_IS: count>1; count = ",count stop endif testi = datatype testi = receiver testi = tag testi = communicator testi = ddata request = 1 ierr = 0 End Subroutine MPI_Isend_IS Subroutine MPI_Issend_I ( ddata, count, datatype, receiver, tag, & communicator, request, ierr ) ! MPI_Issend is a synchronous non-blocking send of data. Integer, Intent(in) :: count, datatype, receiver, tag Integer, Intent(in) :: communicator Integer, Intent(out) :: request, ierr Integer, Intent(in) :: ddata(count) Integer :: testi, I testi = count testi = datatype testi = receiver testi = tag testi = communicator if (count < 0) then write(*,*) "$$ MPI_Issend_I: count<0; count = ",count stop endif do I=1,count testi = ddata(I) end do testi = receiver request = 1 ierr = 0 End Subroutine MPI_Issend_I Subroutine MPI_Issend_IS ( ddata, count, datatype, receiver, tag, & communicator, request, ierr ) ! MPI_Issend is a synchronous non-blocking send of data. Integer, Intent(in) :: count, datatype, receiver, tag Integer, Intent(in) :: communicator Integer, Intent(out) :: request, ierr Integer, Intent(in) :: ddata Integer :: testi testi = count if (count < 0) then write(*,*) "$$ MPI_Issend_IS: count<0; count = ",count stop endif if (count > 1) then write(*,*) "$$ MPI_Issend_IS: count>1; count = ",count stop endif testi = datatype testi = receiver testi = tag testi = communicator testi = ddata testi = receiver request = 1 ierr = 0 End Subroutine MPI_Issend_IS Subroutine MPI_Ssend_I ( ddata, count, datatype, receiver, tag, & communicator, ierr ) ! MPI_Ssend sends data from one process to another within a ! communicator, in synchronous blocking mode. Integer, Intent(in) :: count, datatype, receiver, tag Integer, Intent(in) :: communicator Integer, Intent(in) :: ddata(count) Integer, Intent(out) :: ierr Integer :: testi, I testi = count testi = datatype testi = receiver testi = tag testi = communicator if (count < 0) then write(*,*) "$$ MPI_Ssend_I: count<0; count = ",count stop endif do I=1,count testi = ddata(I) end do testi = receiver ierr = 0 End Subroutine MPI_Ssend_I Subroutine MPI_Ssend_IS ( ddata, count, datatype, receiver, tag, & communicator, ierr ) ! MPI_Ssend sends data from one process to another within a ! communicator, in synchronous blocking mode. Integer, Intent(in) :: count, datatype, receiver, tag Integer, Intent(in) :: communicator Integer, Intent(in) :: ddata Integer, Intent(out) :: ierr Integer :: testi testi = count testi = datatype testi = receiver testi = tag testi = communicator if (count < 0) then write(*,*) "$$ MPI_Ssend_IS: count<0; count = ",count stop endif if (count > 1) then write(*,*) "$$ MPI_Ssend_IS: count>0; count = ",count stop endif testi = ddata testi = receiver ierr = 0 End Subroutine MPI_Ssend_IS Subroutine MPI_Reduce_I ( local_data, global_data, count, & datatype, operation, receiver, communicator, ierr ) ! MPI_Reduce carries out a reduction operation (such as sum, maximum, ! or product). Integer, Intent(in) :: count, local_data(count), datatype Integer, Intent(in) :: operation, receiver, communicator Integer, Intent(out) :: global_data, ierr Integer :: testi, I testi = count testi = datatype testi = receiver testi = communicator if (count < 0) then write(*,*) "$$ MPI_Reduce_I: count<0; count = ",count stop endif do I=1,count testi = local_data(I) end do testi = operation global_data = SUM(local_data) ierr = 0 End Subroutine MPI_Reduce_I Subroutine MPI_Reduce_IS ( local_data, global_data, count, & datatype, operation, receiver, communicator, ierr ) ! MPI_Reduce carries out a reduction operation (such as sum, maximum, ! or product). Integer, Intent(in) :: count, local_data, datatype Integer, Intent(in) :: operation, receiver, communicator Integer, Intent(out) :: global_data, ierr Integer testi testi = count if (count < 0) then write(*,*) "$$ MPI_Reduce_IS: count<0; count = ",count stop endif if (count > 1) then write(*,*) "$$ MPI_Reduce_IS: count>1; count = ",count stop endif testi = datatype testi = receiver testi = communicator testi = local_data testi = operation global_data = local_data ierr = 0 End Subroutine MPI_Reduce_IS End Module mpiInt Module mpiReal ! Real Data and Datatype and real scalar(_RS) arguments. Interface MPI_Allreduce Module Procedure MPI_Allreduce_R End Interface Interface MPI_Allreduce Module Procedure MPI_Allreduce_RS End Interface Interface MPI_Bcast Module Procedure MPI_Bcast_R End Interface Interface MPI_Bcast Module Procedure MPI_Bcast_RS End Interface Interface MPI_Bsend Module Procedure MPI_Bsend_R End Interface Interface MPI_Bsend Module Procedure MPI_Bsend_RS End Interface Interface MPI_Buffer_attach Module Procedure MPI_Buffer_attach_R End Interface Interface MPI_Buffer_detach Module Procedure MPI_Buffer_detach_R End Interface Interface MPI_Get_count Module Procedure MPI_Get_count_R End Interface Interface MPI_Get_elements Module Procedure MPI_Get_elements_R End Interface Interface MPI_Get_elements Module Procedure MPI_Get_elements_RS End Interface Interface MPI_Gather Module Procedure MPI_Gather_R End Interface Interface MPI_Address Module Procedure MPI_Address_R End Interface Interface MPI_Get_address Module Procedure MPI_Get_address_R End Interface Interface MPI_Scatter Module Procedure MPI_Scatter_R End Interface Interface MPI_Pack Module Procedure MPI_Pack_R End Interface Interface MPI_Unpack Module Procedure MPI_Unpack_R End Interface Interface MPI_Pack_size Module Procedure MPI_Pack_size_R End Interface Interface MPI_Recv Module Procedure MPI_Recv_R End Interface Interface MPI_Recv Module Procedure MPI_Recv_RS End Interface Interface MPI_Irecv Module Procedure MPI_Irecv_R End Interface Interface MPI_Irecv Module Procedure MPI_Irecv_RS End Interface Interface MPI_Receive Module Procedure MPI_Receive_R End Interface Interface MPI_Send Module Procedure MPI_Send_R End Interface Interface MPI_Send Module Procedure MPI_Send_RS End Interface Interface MPI_Isend Module Procedure MPI_Isend_R End Interface Interface MPI_Isend Module Procedure MPI_Isend_RS End Interface Interface MPI_Issend Module Procedure MPI_Issend_R End Interface Interface MPI_Issend Module Procedure MPI_Issend_RS End Interface Interface MPI_Ssend Module Procedure MPI_Ssend_RS End Interface Interface MPI_Ssend Module Procedure MPI_Ssend_R End Interface Interface MPI_Reduce Module Procedure MPI_Reduce_R End Interface Interface MPI_Reduce Module Procedure MPI_Reduce_RS End Interface contains Subroutine MPI_Allreduce_R ( a,b, count, & datatype, operation, communicator, ierr ) ! MPI_Allreduce carries out a reduction operation (such as sum, ! maximum, or product), with all processes receiving the result. Integer, Intent(in) :: count, communicator, operation Real, Intent(in) :: a(count), datatype Real, Intent(out) :: b(count) Integer, Intent(out) :: ierr Integer :: testi, I Real :: testr testr = datatype testi = operation testi = communicator testi = count if (count < 0) then write(*,*) "$$ MPI_Allreduce_R: count<0; count = ",count stop endif Do I=1,count b(I)=a(I) Enddo ierr=0 End Subroutine MPI_Allreduce_R Subroutine MPI_Allreduce_RS ( a,b, count, & datatype, operation, communicator, ierr ) ! MPI_Allreduce carries out a reduction operation (such as sum, ! maximum, or product), with all processes receiving the result. Integer, Intent(in) :: count, Communicator, operation Real, Intent(in) :: a, datatype Real, Intent(out) :: b Integer, Intent(out) :: ierr Integer :: testi Real :: testr testr = datatype testi = operation testi = communicator testi = count if (count < 0) then write(*,*) "$$ MPI_Allreduce_RS: count<0; count = ",count stop endif if (count > 1) then write(*,*) "$$ MPI_Allreduce_RS: count>1; count = ",count stop endif b = a ierr=0 End Subroutine MPI_Allreduce_RS Subroutine MPI_Bcast_R ( ddata, count, datatype, sender, & communicator, ierr ) ! MPI_Bcast broadcasts data from one process to all others within a ! communicator. Integer, Intent(in) :: count, sender, communicator Real, Intent(in) :: ddata(count), datatype Integer, Intent(out) :: ierr Integer :: testi, I Real :: testr testi=count if (count < 0) then write(*,*) "$$ MPI_Bcast_R: count<0; count = ",count stop endif do I=1,count testr = ddata(I) end do testr = datatype testi = sender testi = communicator ierr = 0 End Subroutine MPI_Bcast_R Subroutine MPI_Bcast_RS ( ddata, count, datatype, sender, & communicator, ierr ) ! MPI_Bcast broadcasts data from one process to all others within a ! communicator. Integer, Intent(in) :: count, sender, communicator Real, Intent(in) :: ddata, datatype Integer, Intent(out) :: ierr Integer :: testi Real :: testr testi=count if (count < 0) then write(*,*) "$$ MPI_Bcast_RS: count<0; count = ",count stop endif if (count > 1) then write(*,*) "$$ MPI_Bcast_RS: count>1; count = ",count stop endif testr = ddata testr = datatype testi = sender testi = communicator ierr = 0 End Subroutine MPI_Bcast_RS Subroutine MPI_Bsend_R ( ddata, count, datatype, receiver, tag, & communicator, ierr ) ! MPI_Bsend sends data from one process to another within a ! communicator, using buffering. Integer, Intent(in) :: count, receiver, tag, communicator Real, Intent(in) :: ddata(count), datatype Integer, Intent(out) :: ierr Integer :: testi, I Real :: testr testi = count if (count < 0 ) then write(*,*) "$$ MPI_Bsend_R: count<0; count = ",count stop endif testi = receiver testi = tag testi = communicator testr = datatype do I=1,count testr = ddata(I) end do ierr = 0 End Subroutine MPI_Bsend_R Subroutine MPI_Bsend_RS ( ddata, count, datatype, receiver, tag, & communicator, ierr ) ! MPI_Bsend sends data from one process to another within a ! communicator, using buffering. Integer, Intent(in) :: count, receiver, tag, communicator Real, Intent(in) :: ddata, datatype Integer, Intent(out) :: ierr Integer :: testi Real :: testr testi = count if (count < 0 ) then write(*,*) "$$ MPI_Bsend_RS: count<0; count = ",count stop endif if (count > 1 ) then write(*,*) "$$ MPI_Bsend_RS: count>1; count = ",count stop endif testi = receiver testi = tag testi = communicator testr = datatype testr = ddata ierr = 0 End Subroutine MPI_Bsend_RS Subroutine MPI_Buffer_attach_R ( buffer, bsize, ierr ) ! MPI_Buffer_attach sets up a buffer for data transmission via ! MPI_Bsend. Real, Intent(in) :: buffer(:) Integer, Intent(in) :: bsize Integer, Intent(out) :: ierr Integer :: testi testi = bsize if (bsize < 0 ) then write(*,*) "$$ MPI_Buffer_attach_R: bsize<0;", & " bsize = ",bsize stop endif if (bsize < Size(buffer)*4 ) then write(*,*) "$$ MPI_Buffer_attach_R: ", & "bsize<4*Size(buffer); bsize= ", bsize, & ", Size(buffer) = ", Size(buffer) stop endif ierr = 0 End Subroutine MPI_Buffer_attach_R Subroutine MPI_Buffer_detach_R ( buffer, bsize, ierr ) ! MPI_Buffer_detach frees up the memory associated with a buffer ! that had been set up by a call to MPI_Buffer_attach. Real, Intent(out) :: buffer(:) Integer, Intent(out) :: bsize Integer, Intent(out) :: ierr buffer = 1.0 bsize = 1 ierr = 0 End Subroutine MPI_Buffer_detach_R Subroutine MPI_Get_count_R ( sstatus, datatype, count, ierr ) ! MPI_Get_count reports the actual number of items transmitted in a ! communication. Real, Intent(in) :: datatype Integer, Intent(in) :: sstatus(:) Integer, Intent(out):: ierr, count Real :: testr Integer :: I, testi count = 1 do I=1,Size(sstatus) testi = sstatus(I) end do testr = datatype ierr = 0 End Subroutine MPI_Get_count_R Subroutine MPI_Get_elements_R ( sstatus, datatype, count, ierr ) ! Returns the number of basic elements in a message. Integer, Intent(in) :: sstatus(:) Real, Intent(in) :: datatype Integer, Intent(out) :: count, ierr Integer :: testi, I Real :: testr do I=1,Size(sstatus) testi = sstatus(I) end do testr = datatype count = 1 ierr = 0 End Subroutine MPI_Get_elements_R Subroutine MPI_Get_elements_RS ( sstatus, datatype, count, ierr ) ! Returns the number of basic elements in a message. Integer, Intent(in) :: sstatus Real, Intent(in) :: datatype Integer, Intent(out) :: count, ierr Integer :: testi Real :: testr testi = sstatus testr = datatype count = 1 ierr = 0 End Subroutine MPI_Get_elements_RS Subroutine MPI_Address_R ( ddata, address, ierr ) ! MPI_Address returns the address of an item of data. Real, Intent(in) :: ddata(:) Integer, Intent(out) :: address, ierr Real :: testr Integer :: I do I=1,Size(ddata) testr = ddata(I) end do address = 4 ierr = 0 End Subroutine MPI_Address_R Subroutine MPI_Get_address_R ( ddata, address, ierr ) ! MPI_Get_address is a synonym for MPI_Address. Real, Intent(in) :: ddata(:) Integer, Intent(out) :: address, ierr Real :: testr Integer :: I do I=1,Size(ddata) testr = ddata(I) end do address = 4 ierr = 0 End Subroutine MPI_Get_address_R Subroutine MPI_Gather_R ( send_data, send_count, send_datatype, & recv_data, recv_count, recv_datatype, & root, communicator, ierr ) ! MPI_Gather gathers data from all the processes in a communicator. Integer, Intent(in) :: send_count, recv_count Integer, Intent(in) :: root, communicator Real, Intent(in) :: send_data(send_count) Real, Intent(in) :: send_datatype, recv_datatype Real, Intent(out) :: recv_data(:) Integer, Intent(out) :: ierr Integer :: testi, I Real :: testr testi = send_count testi = recv_count testi = root testi = communicator testr = send_datatype testr = recv_datatype if (send_count < 0) then write(*,*) "$$ MPI_Gather_R: send_count<0; = ",send_count stop endif do I=1,send_count testr = send_data(I) end do if (recv_count < 0 .or. recv_count > Size(recv_data)) then write(*,*) "$$ MPI_Gather_R: recv_count<0; or " write(*,*) "$$ MPI_Gather_R: recv_count>Size(recv_data)." write(*,*) "recv_count = ",recv_count write(*,*) "Size(recv_data) = ", Size(recv_data) stop endif do I=1,Size(recv_data) recv_data(I) = 1 end do ierr = 0 End Subroutine MPI_Gather_R Subroutine MPI_Scatter_R ( send_data, send_count, send_datatype, & recv_data, recv_count, recv_datatype, & root, communicator, ierr ) ! MPI_Scatter distributes data from one process to all processes Integer, Intent(in) :: send_count, recv_count Integer, Intent(in) :: root, communicator Real, Intent(in) :: send_data(:) Real, Intent(in) :: send_datatype, recv_datatype Real, Intent(out) :: recv_data(:) Integer, Intent(out) :: ierr Integer :: testi, I Real :: testr testi = send_count testi = recv_count testi = root testi = communicator testr = send_datatype testr = recv_datatype if (send_count < 0 .or. send_count > Size(send_data)) then write(*,*) "$$ MPI_Scatter_R: send_count<0; or " write(*,*) "$$ MPI_Scatter_R: send_count>Size(send_data)." write(*,*) "send_count = ",send_count write(*,*) "Size(send_data) = ", Size(send_data) stop endif do I=1,Size(send_data) testr = send_data(I) end do if (recv_count < 0 .or. recv_count > Size(recv_data)) then write(*,*) "$$ MPI_Scatter_R: recv_count<0; or " write(*,*) "$$ MPI_Scatter_R: recv_count>Size(recv_data)." write(*,*) "recv_count = ",recv_count write(*,*) "Size(recv_data) = ", Size(recv_data) stop endif do I=1,Size(recv_data) recv_data(I) = 1 end do ierr = 0 End Subroutine MPI_Scatter_R Subroutine MPI_Pack_R ( ddata, count, datatype, buffer, & buffer_size, & buffer_position, communicator, ierr ) ! MPI_Pack packs data into a buffer. Integer, parameter :: bytes_per_word = 4 Integer, Intent(in) :: count, buffer_size, communicator Real, Intent(in) :: datatype, ddata(count) Real, Intent(out) :: buffer(:) Integer, Intent(inout) :: buffer_position Integer, Intent(out) :: ierr Integer :: testi, I, start_word Real :: testr testr = datatype testi = communicator testi = count if (count < 0) then write(*,*) "$$ MPI_Pack_R: count<0; count = ",count stop endif do I=1,count testr = ddata(I) end do testi = buffer_size if (buffer_size < 0) then write(*,*) "$$ MPI_Pack_R: buffer_size < 0 = ", & buffer_size stop endif testi = buffer_position if (buffer_position < 0 .or. & buffer_position/bytes_per_word > buffer_size) then write(*,*) "$$ MPI_Pack_R: buffer_position<0 = ", & "or > buffer_size; buffer_position =", & buffer_position, " buffer_size=", buffer_size stop endif ! if the buffer's dimension in bytes in the calling program ! is >= buffer_size less position, then buffer will hold the ! packed data. if (bytes_per_word*Size(buffer) < buffer_size ) then write(*,*) & "$$ MPI_Pack_R: buffer_size is larger than dimension ", & "of buffer; buffer_size= ", buffer_size write(*,*) "buffer_position = ", buffer_position write(*,*) "buffer dimension in caller=", Size(buffer) stop endif start_word = buffer_position/bytes_per_word do I=1,count buffer(I + start_word) = ddata(I) buffer_position = buffer_position + bytes_per_word end do ierr = 0 End Subroutine MPI_Pack_R Subroutine MPI_Unpack_R ( buffer, buffer_size, buffer_position, & ddata, count, datatype, communicator, ierr ) ! MPI_Unpack unpacks data from a buffer. Integer, parameter :: bytes_per_word = 4 Integer, Intent(in) :: count, buffer_size, communicator Real, Intent(in) :: datatype, buffer(:) Real, Intent(out) :: ddata(count) Integer, Intent(inout) :: buffer_position Integer, Intent(out) :: ierr Integer :: testi, I, start_word real :: testr testr = datatype testi = communicator testi = count if (count < 0) then write(*,*) "$$ MPI_Unpack_R: count<0; count = ",count stop endif testi = buffer_size if (buffer_size < 0) then write(*,*) "$$ MPI_Unpack_R: buffer_size < 0 = ", & buffer_size stop endif testi = buffer_position if (buffer_position < 0 .or. & buffer_position/bytes_per_word > buffer_size) then write(*,*) "$$ MPI_Pack_R: buffer_position<0 = ", & "or > buffer_size; buffer_position =", & buffer_position, " buffer_size=", buffer_size stop endif if (bytes_per_word*Size(buffer) < buffer_size) then write(*,*) & "$$ MPI_Unpack_R: buffer_size is larger than dimension ", & "of buffer; buffer_size= ", buffer_size write(*,*) "buffer_position = ", buffer_position write(*,*) "buffer dimension in caller=", Size(buffer) stop endif start_word = buffer_position/bytes_per_word - count do I=1,count ddata(I) = buffer(I + start_word) end do buffer_position = buffer_position - bytes_per_word*count ierr = 0 End Subroutine MPI_Unpack_R Subroutine MPI_Pack_size_R ( count, datatype, communicator, ssize, & ierr ) ! MPI_Pack_size reports the size of the buffer needed to hold a set ! of packed data. Integer, Intent(in) :: count, communicator Real, Intent(in) :: datatype Integer, Intent(out) :: ssize, ierr Integer :: testi Real :: testr testi = count if (count < 0) then write(*,*) "$$ MPI_Pack_size_R: count<0; count = ",count stop endif testr = datatype testi = communicator ssize = 4*count ierr = 0 End Subroutine MPI_Pack_size_R Subroutine MPI_Recv_R ( ddata, count, datatype, sender, tag, & communicator, sstatus, ierr ) ! MPI_Recv receives data from another process within a communicator. Integer, Intent(in) :: count, sender, tag Integer, Intent(in) :: communicator Real, Intent(in) :: datatype Real, Intent(out) :: ddata(count) ! In FORTRAN a single status object is an array of integers. Integer, Intent(out) :: sstatus(:), ierr Real :: testr Integer :: testi, I testi = count testr = datatype testi = sender testi = tag testi = communicator sstatus = 1 if (count < 0) then write(*,*) "$$ MPI_Recv_R: count<0; count = ",count stop endif do I=1,count ddata(I) = 1.0 end do ierr = 0 End Subroutine MPI_Recv_R Subroutine MPI_Recv_RS ( ddata, count, datatype, sender, tag, & communicator, sstatus, ierr ) ! MPI_Recv receives data from another process within a communicator. Integer, Intent(in) :: count, sender, tag Integer, Intent(in) :: communicator Real, Intent(in) :: datatype Real, Intent(out) :: ddata ! In FORTRAN a single status object is an array of integers. Integer, Intent(out) :: sstatus(:), ierr Real :: testr Integer :: testi testi = count if (count > 1) then write(*,*) "$$ MPI_Recv_RS: count>1; count = ",count stop endif if ( count < 0) then write(*,*) "$$ MPI_Recv_RS: count<0; count = ",count stop endif testr = datatype testi = sender testi = tag testi = communicator sstatus = 1 ddata = 1.0 ierr = 0 End Subroutine MPI_Recv_RS Subroutine MPI_Irecv_R ( ddata, count, datatype, sender, tag, & communicator, request, ierr ) ! MPI_Irecv receives data from another process within a communicator. Integer, Intent(in) :: count, sender, tag Integer, Intent(in) :: communicator Real, Intent(in) :: datatype Real, Intent(out) :: ddata(count) Integer, Intent(out) :: request(:), ierr Real :: testr Integer :: testi, I testi = count testr = datatype testi = sender testi = tag testi = communicator request = 1 if (count < 0) then write(*,*) "$$ MPI_Irecv_R: count<0; count = ",count stop endif do I=1,count ddata(I) = 1.0 end do ierr = 0 End Subroutine MPI_Irecv_R Subroutine MPI_Irecv_RS ( ddata, count, datatype, sender, tag, & communicator, request, ierr ) ! MPI_Irecv receives data from another process within a communicator. Integer, Intent(in) :: count, sender, tag Integer, Intent(in) :: communicator Real, Intent(in) :: datatype Real, Intent(out) :: ddata Integer, Intent(out) :: request(:), ierr Real :: testr Integer :: testi testi = count if (count < 0) then write(*,*) "$$ MPI_Irecv_RS: count<0; count = ",count stop endif ! if (count > 1) then ! write(*,*) "$$ MPI_Irecv_RS: count>1; count = ",count ! stop ! endif testr = datatype testi = sender testi = tag testi = communicator request = 1 ddata = 1.0 ierr = 0 End Subroutine MPI_Irecv_RS Subroutine MPI_Receive_R ( ddata, count, datatype, sender, tag, & communicator, sstatus, ierr ) ! MPI_Receive is a non-standard version of MPI_Recv. Integer, Intent(in):: count, sender(:), tag Integer, Intent(in):: communicator Real, Intent(in) :: ddata(count), datatype Integer, Intent(out) :: sstatus(:), ierr Integer :: testi, I Real :: testr testi = count testr = datatype do I=1,Size(sender) testi = sender(I) end do testi = tag testi = communicator sstatus = 1 if (count < 0) then write(*,*) "$$ MPI_Receive_R: count<0; count = ",count stop endif do I=1,count testr = ddata(I) end do ierr = 0 End Subroutine MPI_Receive_R Subroutine MPI_Send_R ( ddata, count, datatype, receiver, tag, & communicator, ierr ) ! MPI_Send sends data from one process to another within a ! communicator. Integer, Intent(in) :: count, receiver, tag, communicator Real, Intent(in) :: ddata(count), datatype Integer, Intent(out) :: ierr Integer :: testi, I Real :: testr testi = count testr = datatype testi = receiver testi = tag testi = communicator testi = receiver if (count < 0) then write(*,*) "$$ MPI_Send_R: count<0; count = ",count stop endif do I=1,count testr = ddata(I) end do ierr = 0 End Subroutine MPI_Send_R Subroutine MPI_Send_RS ( ddata, count, datatype, receiver, tag, & communicator, ierr ) ! MPI_Send sends data from one process to another within a ! communicator. Integer, Intent(in) :: count, receiver, tag, communicator Real, Intent(in) :: ddata, datatype Integer, Intent(out) :: ierr Integer :: testi Real :: testr testi = count if (count < 0) then write(*,*) "$$ MPI_Send_RS: count<0; count = ",count stop endif if (count > 1) then write(*,*) "$$ MPI_Send_RS: count>1; count = ",count stop endif testr = datatype testi = receiver testi = tag testi = communicator testr = ddata ierr = 0 End Subroutine MPI_Send_RS Subroutine MPI_Isend_R ( ddata, count, datatype, receiver, tag, & communicator, request, ierr ) ! MPI_Isend is a nonblocking send of data. Integer, Intent(in) :: count, receiver, tag, communicator Real, Intent(in) :: ddata(count), datatype Integer, Intent(out) :: ierr, request(:) Integer :: testi, I Real :: testr testi = count testr = datatype testi = receiver testi = tag testi = communicator testi = receiver if (count < 0) then write(*,*) "$$ MPI_Send_R: count<0; count = ",count stop endif do I=1,count testr = ddata(I) end do request = 1 ierr = 0 End Subroutine MPI_Isend_R Subroutine MPI_Isend_RS ( ddata, count, datatype, receiver, tag, & communicator, request, ierr ) ! MPI_Isend is a nonblocking send of data. Integer, Intent(in) :: count, receiver, tag, communicator Real, Intent(in) :: ddata, datatype Integer, Intent(out) :: ierr, request(:) Integer :: testi Real :: testr testi = count if (count < 0) then write(*,*) "$$ MPI_Isend_RS: count<0; count = ",count stop endif if (count > 1) then write(*,*) "$$ MPI_Isend_RS: count>1; count = ",count stop endif testr = datatype testi = receiver testi = tag testi = communicator testr = ddata request = 1 ierr = 0 End Subroutine MPI_Isend_RS Subroutine MPI_Issend_R ( ddata, count, datatype, receiver, tag, & communicator, request, ierr ) ! MPI_Issend is a synchronous non-blocking send of data. Integer, Intent(in) :: count, datatype, receiver, tag Integer, Intent(in) :: communicator Integer, Intent(out) :: request, ierr Real, Intent(in) :: ddata(count) Real :: testr Integer :: testi, I testi = count if (count < 0) then write(*,*) "$$ MPI_Issend_R: count<0; count = ",count stop endif testi = datatype testi = receiver testi = tag testi = communicator do I=1,count testr = ddata(I) end do testi = receiver request = 1 ierr = 0 End Subroutine MPI_Issend_R Subroutine MPI_Issend_RS ( ddata, count, datatype, receiver, tag, & communicator, request, ierr ) ! MPI_Issend is a synchronous non-blocking send of data. Integer, Intent(in) :: count, datatype, receiver, tag Integer, Intent(in) :: communicator Integer, Intent(out) :: request, ierr Real, Intent(in) :: ddata Real :: testr Integer :: testi testi = count if (count < 0) then write(*,*) "$$ MPI_Issend_RS: count<0; count = ",count stop endif if (count > 1) then write(*,*) "$$ MPI_Issend_RS: count>1; count = ",count stop endif testi = datatype testi = receiver testi = tag testi = communicator testr = ddata testi = receiver request = 1 ierr = 0 End Subroutine MPI_Issend_RS Subroutine MPI_Ssend_R ( ddata, count, datatype, receiver, tag, & communicator, ierr ) ! MPI_Ssend sends data from one process to another within a ! communicator, in synchronous blocking mode. Integer, Intent(in) :: count, datatype, receiver, tag Integer, Intent(in) :: communicator Real, Intent(in) :: ddata(count) Integer, Intent(out) :: ierr Integer :: testi, I Real :: testr testi = count testi = datatype testi = receiver testi = tag testi = communicator if (count < 0) then write(*,*) "$$ MPI_Ssend_R: count<0; count = ",count stop endif do I=1,count testr = ddata(I) end do testi = receiver ierr = 0 End Subroutine MPI_Ssend_R Subroutine MPI_Ssend_RS ( ddata, count, datatype, receiver, tag, & communicator, ierr ) ! MPI_Ssend sends data from one process to another within a ! communicator, in synchronous blocking mode. Integer, Intent(in) :: count, datatype, receiver, tag Integer, Intent(in) :: communicator Real, Intent(in) :: ddata Integer, Intent(out) :: ierr Integer :: testi Real :: testr testi = count if (count < 0) then write(*,*) "$$ MPI_Ssend_RS: count<0; count = ",count stop endif if (count > 1) then write(*,*) "$$ MPI_Ssend_RS: count>1; count = ",count stop endif testi = datatype testi = receiver testi = tag testi = communicator testr = ddata testi = receiver ierr = 0 End Subroutine MPI_Ssend_RS Subroutine MPI_Reduce_R ( local_data, global_data, count, & datatype, operation, receiver, communicator, ierr ) ! MPI_Reduce carries out a reduction operation (such as sum, maximum, ! or product). Integer, Intent(in) :: count, operation, receiver Integer, Intent(in) :: communicator Real, Intent(in) :: local_data(count), datatype Real, Intent(out) :: global_data Integer, Intent(out) :: ierr Integer :: testi, I Real :: testr testi = count testr = datatype testi = receiver testi = communicator if (count < 0) then write(*,*) "$$ MPI_Reduce_R: count<0; count = ",count stop endif do I=1,count testr = local_data(I) end do testi = operation ! Temporarily assumes operation is Sum. global_data = SUM(local_data) ierr = 0 End Subroutine MPI_Reduce_R Subroutine MPI_Reduce_RS ( local_data, global_data, count, & datatype, operation, receiver, communicator, ierr ) ! MPI_Reduce carries out a reduction operation (such as sum, maximum, ! or product). Integer, Intent(in) :: count, operation, receiver Integer, Intent(in) :: communicator Real, Intent(in) :: local_data, datatype Real, Intent(out) :: global_data Integer, Intent(out) :: ierr Integer :: testi Real :: testr testi = count if (count < 0) then write(*,*) "$$ MPI_Reduce_RS: count<0; count = ",count stop endif if (count > 1) then write(*,*) "$$ MPI_Reduce_RS: count>1; count = ",count stop endif testr = datatype testi = receiver testi = communicator testr = local_data testi = operation ! Temporarily assumes operation is Sum. global_data = local_data ierr = 0 End Subroutine MPI_Reduce_RS End Module mpiReal Module mpiDP ! Double Precision Data and Datatype and Scalar(_DS) arguments. Interface MPI_Allreduce Module Procedure MPI_Allreduce_D End Interface Interface MPI_Allreduce Module Procedure MPI_Allreduce_DS End Interface Interface MPI_Bcast Module Procedure MPI_Bcast_D End Interface Interface MPI_Bcast Module Procedure MPI_Bcast_DS End Interface Interface MPI_Bsend Module Procedure MPI_Bsend_D End Interface Interface MPI_Bsend Module Procedure MPI_Bsend_DS End Interface Interface MPI_Buffer_attach Module Procedure MPI_Buffer_attach_D End Interface Interface MPI_Buffer_detach Module Procedure MPI_Buffer_detach_D End Interface Interface MPI_Get_count Module Procedure MPI_Get_count_D End Interface Interface MPI_Get_elements Module Procedure MPI_Get_elements_D End Interface Interface MPI_Get_elements Module Procedure MPI_Get_elements_DS End Interface Interface MPI_Gather Module Procedure MPI_Gather_D End Interface Interface MPI_Address Module Procedure MPI_Address_D End Interface Interface MPI_Get_address Module Procedure MPI_Get_address_D End Interface Interface MPI_Scatter Module Procedure MPI_Scatter_D End Interface Interface MPI_Pack Module Procedure MPI_Pack_D End Interface Interface MPI_Unpack Module Procedure MPI_Unpack_D End Interface Interface MPI_Pack_size Module Procedure MPI_Pack_size_D End Interface Interface MPI_Recv Module Procedure MPI_Recv_D End Interface Interface MPI_Recv Module Procedure MPI_Recv_DS End Interface Interface MPI_Irecv Module Procedure MPI_Irecv_D End Interface Interface MPI_Irecv Module Procedure MPI_Irecv_DS End Interface Interface MPI_Receive Module Procedure MPI_Receive_D End Interface Interface MPI_Send Module Procedure MPI_Send_D End Interface Interface MPI_Send Module Procedure MPI_Send_DS End Interface Interface MPI_Isend Module Procedure MPI_Isend_D End Interface Interface MPI_Isend Module Procedure MPI_Isend_DS End Interface Interface MPI_Issend Module Procedure MPI_Issend_D End Interface Interface MPI_Issend Module Procedure MPI_Issend_DS End Interface Interface MPI_Ssend Module Procedure MPI_Ssend_D End Interface Interface MPI_Ssend Module Procedure MPI_Ssend_DS End Interface Interface MPI_Reduce Module Procedure MPI_Reduce_D End Interface Interface MPI_Reduce Module Procedure MPI_Reduce_DS End Interface contains Subroutine MPI_Allreduce_D ( a,b, count, & datatype, operation, communicator, ierr ) ! MPI_Allreduce carries out a reduction operation (such as sum, ! maximum, or product), with all processes receiving the result. Integer, Intent(in) :: count, communicator, operation Double Precision, Intent(in) :: a(count), datatype Double Precision, Intent(out) :: b(count) Integer, Intent(out) :: ierr Integer :: testi, I Real :: testr testr = datatype testi = operation testi = communicator testi = count if (count < 0) then write(*,*) "$$ MPI_Allreduce_D: count<0; count = ",count stop endif Do I=1,count b(I)=a(I) Enddo ierr=0 End Subroutine MPI_Allreduce_D Subroutine MPI_Allreduce_DS ( a,b, count, & datatype, operation, communicator, ierr ) ! MPI_Allreduce carries out a reduction operation (such as sum, ! maximum, or product), with all processes receiving the result. Integer, Intent(in) :: count, communicator, operation Double Precision, Intent(in) :: a, datatype Double Precision, Intent(out) :: b Integer, Intent(out) :: ierr Integer :: testi Double Precision :: testr testr = datatype testi = operation testi = communicator testi = count if (count < 0) then write(*,*) "$$ MPI_Allreduce_DS: count<0; count = ",count stop endif if (count > 1) then write(*,*) "$$ MPI_Allreduce_DS: count>1; count = ",count stop endif b=a ierr=0 End Subroutine MPI_Allreduce_DS Subroutine MPI_Bcast_D ( ddata, count, datatype, sender, & communicator, ierr ) ! MPI_Bcast broadcasts data from one process to all others within a ! communicator. Integer, Intent(in) :: count, sender, communicator Double Precision, Intent(in) :: ddata(count), datatype Integer, Intent(out) :: ierr Integer :: testi, I Double Precision :: testr testi=count if (count < 0) then write(*,*) "$$ MPI_Bcast_D: count<0; count = ",count stop endif do I=1,count testr = ddata(I) end do testr = datatype testi = sender testi = communicator ierr = 0 End Subroutine MPI_Bcast_D Subroutine MPI_Bcast_DS ( ddata, count, datatype, sender, & communicator, ierr ) ! MPI_Bcast broadcasts data from one process to all others within a ! communicator. Integer, Intent(in) :: count, sender, communicator Double Precision, Intent(in) :: ddata, datatype Integer, Intent(out) :: ierr Integer :: testi Double Precision :: testr testi=count if (count < 0) then write(*,*) "$$ MPI_Bcast_DS: count<0; count = ",count stop endif if (count > 1) then write(*,*) "$$ MPI_Bcast_DS: count>1; count = ",count stop endif testr = ddata testr = datatype testi = sender testi = communicator ierr = 0 End Subroutine MPI_Bcast_DS Subroutine MPI_Bsend_D ( ddata, count, datatype, receiver, tag, & communicator, ierr ) ! MPI_Bsend sends data from one process to another within a ! communicator, using buffering. Integer, Intent(in) :: count, receiver, tag, communicator Double Precision, Intent(in) :: ddata(count), datatype Integer, Intent(out) :: ierr Integer :: testi, I Double Precision :: testr testi = count if (count < 0 ) then write(*,*) "$$ MPI_Bsend_D: count<0; count = ",count stop endif testi = receiver testi = tag testi = communicator testr = datatype do I=1,count testr = ddata(I) end do ierr = 0 End Subroutine MPI_Bsend_D Subroutine MPI_Bsend_DS ( ddata, count, datatype, receiver, tag, & communicator, ierr ) ! MPI_Bsend sends data from one process to another within a ! communicator, using buffering. Integer, Intent(in) :: count, receiver, tag, communicator Double Precision, Intent(in) :: ddata, datatype Integer, Intent(out) :: ierr Integer :: testi Double Precision :: testr testi = count if (count < 0 ) then write(*,*) "$$ MPI_Bsend_DS: count<0; count = ",count stop endif if (count > 1 ) then write(*,*) "$$ MPI_Bsend_DS: count>1; count = ",count stop endif testi = receiver testi = tag testi = communicator testr = datatype testr = ddata ierr = 0 End Subroutine MPI_Bsend_DS Subroutine MPI_Buffer_attach_D ( buffer, bsize, ierr ) ! MPI_Buffer_attach sets up a buffer for data transmission via ! MPI_Bsend. Double Precision, Intent(in) :: buffer(:) Integer, Intent(in) :: bsize Integer, Intent(out) :: ierr Integer :: testi testi = bsize if (bsize < 0 ) then write(*,*) "$$ MPI_Buffer_attach_D: bsize<0;", & " bsize = ",bsize stop endif if (bsize < Size(buffer)*8 ) then write(*,*) "$$ MPI_Buffer_attach_D: ", & "bsize<8*Size(buffer); bsize= ", bsize, & ", Size(buffer) = ", Size(buffer) stop endif ierr = 0 End Subroutine MPI_Buffer_attach_D Subroutine MPI_Buffer_detach_D ( buffer, bsize, ierr ) ! MPI_Buffer_detach frees up the memory associated with a buffer ! that had been set up by a call to MPI_Buffer_attach. Double Precision, Intent(out) :: buffer(:) Integer, Intent(out) :: bsize Integer, Intent(out) :: ierr buffer = 1.D0 bsize = 1 ierr = 0 End Subroutine MPI_Buffer_detach_D Subroutine MPI_Get_count_D ( sstatus, datatype, count, ierr ) ! MPI_Get_count reports the actual number of items transmitted in a ! communication. Double Precision, Intent(in) :: datatype Integer, Intent(in) :: sstatus(:) Integer, Intent(out) :: count, ierr Integer :: I, testi Double Precision :: testr count = 1 do I=1,Size(sstatus) testi = sstatus(I) end do testr = datatype ierr = 0 End Subroutine MPI_Get_count_D Subroutine MPI_Get_elements_D ( sstatus, datatype, count, ierr ) ! Returns the number of basic elements in a message. Integer, Intent(in) :: sstatus(:) Double Precision, Intent(in) :: datatype Integer, Intent(out) :: count, ierr Integer :: testi, I Double Precision :: testr do I=1,Size(sstatus) testi = sstatus(I) end do testr = datatype count = 1 ierr = 0 End Subroutine MPI_Get_elements_D Subroutine MPI_Get_elements_DS ( sstatus, datatype, count, ierr ) ! Returns the number of basic elements in a message. Integer, Intent(in) :: sstatus Double Precision, Intent(in) :: datatype Integer, Intent(out) :: count, ierr Integer :: testi Double Precision :: testr testi = sstatus testr = datatype count = 1 ierr = 0 End Subroutine MPI_Get_elements_DS Subroutine MPI_Gather_D ( send_data, send_count, send_datatype, & recv_data, recv_count, recv_datatype, & root, communicator, ierr ) ! MPI_Gather gathers data from all the processes in a communicator. Integer, Intent(in) :: send_count, recv_count Integer, Intent(in) :: root, communicator Double Precision, Intent(in) :: send_data(send_count) Double Precision, Intent(in) :: send_datatype, recv_datatype Double Precision, Intent(out) :: recv_data(:) Integer, Intent(out) :: ierr Integer :: testi, I Double Precision :: testr testi = send_count testi = recv_count testi = root testi = communicator testr = send_datatype testr = recv_datatype if (send_count < 0) then write(*,*) "$$ MPI_Gather_D: send_count<0; = ",send_count stop endif do I=1,send_count testr = send_data(I) end do if (recv_count < 0 .or. recv_count > Size(recv_data)) then write(*,*) "$$ MPI_Gather_D: recv_count<0; or " write(*,*) "$$ MPI_Gather_D: recv_count>Size(recv_data)." write(*,*) "recv_count = ",recv_count write(*,*) "Size(recv_data) = ", Size(recv_data) stop endif do I=1,Size(recv_data) recv_data(I) = 1 end do ierr = 0 End Subroutine MPI_Gather_D Subroutine MPI_Address_D ( ddata, address, ierr ) ! MPI_Address returns the address of an item of data. Double Precision, Intent(in) :: ddata(:) Integer, Intent(out) :: address, ierr Integer :: I Double Precision :: testr Do I=1,Size(ddata) testr = ddata(I) end do address = 4 ierr = 0 End Subroutine MPI_Address_D Subroutine MPI_Get_address_D ( ddata, address, ierr ) ! MPI_Get_address is a synonym for MPI_Address. Double Precision, Intent(in) :: ddata(:) Integer, Intent(out) :: address, ierr Integer :: I Double Precision :: testr Do I=1,Size(ddata) testr = ddata(I) end do address = 4 ierr = 0 End Subroutine MPI_Get_address_D Subroutine MPI_Scatter_D ( send_data, send_count, send_datatype, & recv_data, recv_count, recv_datatype, & root, communicator, ierr ) ! MPI_Scatter distributes data from one process to all processes. Integer, Intent(in) :: send_count, recv_count Integer, Intent(in) :: root, communicator Double Precision, Intent(in) :: send_data(:) Double Precision, Intent(in) :: send_datatype, recv_datatype Double Precision, Intent(out) :: recv_data(:) Integer, Intent(out) :: ierr Integer :: testi, I Double Precision :: testr testi = send_count testi = recv_count testi = root testi = communicator testr = send_datatype testr = recv_datatype if (send_count < 0 .or. send_count > Size(send_data)) then write(*,*) "$$ MPI_Scatter_D: send_count<0; or " write(*,*) "$$ MPI_Scatter_D: send_count>Size(send_data)." write(*,*) "send_count = ",send_count write(*,*) "Size(send_data) = ", Size(send_data) stop endif do I=1,Size(send_data) testr = send_data(I) end do if (recv_count < 0 .or. recv_count > Size(recv_data)) then write(*,*) "$$ MPI_Scatter_D: recv_count<0; or " write(*,*) "$$ MPI_Scatter_D: recv_count>Size(recv_data)." write(*,*) "recv_count = ",recv_count write(*,*) "Size(recv_data) = ", Size(recv_data) stop endif do I=1,Size(recv_data) recv_data(I) = 1 end do ierr = 0 End Subroutine MPI_Scatter_D Subroutine MPI_Pack_D ( ddata, count, datatype, & buffer, buffer_size, & buffer_position, communicator, ierr ) ! MPI_Pack packs data into a buffer. Integer, parameter :: bytes_per_word = 8 Integer, Intent(in) :: count, buffer_size, communicator Double Precision, Intent(in) :: datatype, ddata(count) Double Precision, Intent(out) :: buffer(:) Integer, Intent(inout) :: buffer_position Integer, Intent(out) :: ierr Integer :: testi, I, start_word Double Precision :: testr testr = datatype testi = communicator testi = count if (count < 0) then write(*,*) "$$ MPI_Pack_D: count<0; count = ",count stop endif do I=1,count testr = ddata(I) end do testi = buffer_size if (buffer_size < 0) then write(*,*) "$$ MPI_Pack_D: buffer_size < 0 = ", & buffer_size stop endif testi = buffer_position if (buffer_position < 0 .or. & buffer_position/bytes_per_word > buffer_size) then write(*,*) "$$ MPI_Pack_D: buffer_position<0 = ", & "or > buffer_size; buffer_position =", & buffer_position, " buffer_size=", buffer_size stop endif ! if the buffer's dimension in bytes in the calling program ! is >= buffer_size less position, then buffer will hold the ! packed data. if (bytes_per_word*Size(buffer) < buffer_size ) then write(*,*) & "$$ MPI_Pack_D: buffer_size is larger than dimension ", & "of buffer; buffer_size= ", buffer_size write(*,*) "buffer_position = ", buffer_position write(*,*) "buffer dimension in caller=", Size(buffer) stop endif start_word = buffer_position/bytes_per_word do I=1,count buffer(I + start_word) = ddata(I) buffer_position = buffer_position + bytes_per_word end do ierr = 0 End Subroutine MPI_Pack_D Subroutine MPI_Unpack_D ( buffer, buffer_size, buffer_position, & ddata, count, datatype, communicator, ierr ) ! MPI_Unpack unpacks data from a buffer. Integer, parameter :: bytes_per_word = 8 Integer, Intent(in) :: count, buffer_size, communicator Double Precision, Intent(in) :: datatype, buffer(:) Double Precision, Intent(out) :: ddata(count) Integer, Intent(inout) :: buffer_position Integer, Intent(out) :: ierr Integer :: testi, I, start_word testr = datatype testi = communicator testi = count if (count < 0) then write(*,*) "$$ MPI_Unpack_D: count<0; count = ",count stop endif testi = buffer_size if (buffer_size < 0) then write(*,*) "$$ MPI_Unpack_D: buffer_size < 0 = ", & buffer_size stop endif testi = buffer_position if (buffer_position < 0 .or. & buffer_position/bytes_per_word > buffer_size) then write(*,*) "$$ MPI_Pack_D: buffer_position<0 = ", & "or > buffer_size; buffer_position =", & buffer_position, " buffer_size=", buffer_size stop endif if (bytes_per_word*Size(buffer) < buffer_size) then write(*,*) & "$$ MPI_Unpack_D: buffer_size is larger than dimension ", & "of buffer; buffer_size= ", buffer_size write(*,*) "buffer_position = ", buffer_position write(*,*) "buffer dimension in caller=", Size(buffer) stop endif start_word = buffer_position/bytes_per_word - count do I=1,count ddata(I) = buffer(I + start_word) end do buffer_position = buffer_position - bytes_per_word*count ierr = 0 End Subroutine MPI_Unpack_D Subroutine MPI_Pack_size_D ( count, datatype, communicator, ssize, & ierr ) ! MPI_Pack_size reports the size of the buffer needed to hold a set ! of packed data. Integer, Intent(in) :: count, communicator Double Precision, Intent(in) :: datatype Integer, Intent(out) :: ssize, ierr Integer :: testi Double Precision :: testr testi = count if (count < 0) then write(*,*) "$$ MPI_Pack_size_D: count<0; count = ",count stop endif testr = datatype testi = communicator ssize = 8*count ierr = 0 End Subroutine MPI_Pack_size_D Subroutine MPI_Recv_D ( ddata, count, datatype, sender, tag, & communicator, sstatus, ierr ) ! MPI_Recv receives data from another process within a communicator. Integer, Intent(in) :: count, sender, tag, communicator ! In FORTRAN a single status object is an array of integers. Integer, Intent(out) :: sstatus(:), ierr Double Precision, Intent(out) :: ddata(count) Double Precision, Intent(in) :: datatype Double Precision :: testr Integer :: testi, I testi = count testr = datatype testi = sender testi = tag testi = communicator sstatus = 1 if (count < 0) then write(*,*) "$$ MPI_Recv_D: count<0; count = ",count stop endif do I=1,count ddata(I) = 1.0D0 end do ierr = 0 End Subroutine MPI_Recv_D Subroutine MPI_Recv_DS ( ddata, count, datatype, sender, tag, & communicator, sstatus, ierr ) ! MPI_Recv receives data from another process within a communicator. Integer, Intent(in) :: count, sender, tag, communicator Double Precision, Intent(out) :: ddata Double Precision, Intent(in) :: datatype ! In FORTRAN a single status object is an array of integers. Integer, Intent(out):: sstatus(:), ierr Integer :: testi Double Precision :: testr testi = count if (count > 1) then write(*,*) "$$ MPI_Recv_DS: count>1; count = ",count stop endif if ( count < 0) then write(*,*) "$$ MPI_Recv_DS: count<0; count = ",count stop endif testr = datatype testi = sender testi = tag testi = communicator sstatus = 1 ddata = 1.0D0 ierr = 0 End Subroutine MPI_Recv_DS Subroutine MPI_Irecv_D ( ddata, count, datatype, sender, tag, & communicator, request, ierr ) ! MPI_Irecv receives data from another process within a communicator. Integer, Intent(in) :: count, sender, tag, communicator Integer, Intent(out) :: request(:), ierr Double Precision, Intent(out) :: ddata(count) Double Precision, Intent(in) :: datatype Double Precision :: testr Integer :: testi, I testi = count testr = datatype testi = sender testi = tag testi = communicator request = 1 if (count < 0) then write(*,*) "$$ MPI_Irecv_D: count<0; count = ",count stop endif do I=1,count ddata(I) = 1.0D0 end do ierr = 0 End Subroutine MPI_Irecv_D Subroutine MPI_Irecv_DS ( ddata, count, datatype, sender, tag, & communicator, request, ierr ) ! MPI_Irecv receives data from another process within a communicator. Integer, Intent(in) :: count, sender, tag, communicator Double Precision, Intent(out) :: ddata Double Precision, Intent(in) :: datatype Integer, Intent(out):: request(:), ierr Integer :: testi Double Precision :: testr testi = count if (count > 1) then write(*,*) "$$ MPI_Irecv_DS: count>1; count = ",count stop endif if ( count < 0) then write(*,*) "$$ MPI_Irecv_DS: count<0; count = ",count stop endif testr = datatype testi = sender testi = tag testi = communicator request = 1 ddata = 1.0D0 ierr = 0 End Subroutine MPI_Irecv_DS Subroutine MPI_Receive_D ( ddata, count, datatype, sender, tag, & communicator, sstatus, ierr ) ! MPI_Receive is not listed; probably a misnomer for mpi_recv. Integer, Intent(in) :: count, tag, communicator, sstatus(:) Double Precision, Intent(in) :: ddata(count), datatype Integer, Intent(out) :: sender(:), ierr Double Precision :: testr Integer :: testi, I testi = count testr = datatype sender = 1 testi = tag testi = communicator if (count < 0) then write(*,*) "$$ MPI_Receive_D: count<0; count = ",count stop endif do I=1,Size(sstatus) testi = sstatus(I) end do do I=1,count testr = ddata(I) end do ierr = 0 End Subroutine MPI_Receive_D Subroutine MPI_Send_D ( ddata, count, datatype, receiver, tag, & communicator, ierr ) ! MPI_Send sends data from one process to another within a ! communicator. Integer, Intent(in) :: count, receiver, tag, communicator Double Precision, Intent(in) :: ddata(count), datatype Integer, Intent(out) :: ierr Double Precision :: testr Integer :: testi, I testi = count testr = datatype testi = receiver testi = tag testi = communicator testi = receiver if (count < 0) then write(*,*) "$$ MPI_Send_D: count<0; count = ",count stop endif do I=1,count testr = ddata(I) end do ierr = 0 End Subroutine MPI_Send_D Subroutine MPI_Send_DS ( ddata, count, datatype, receiver, tag, & communicator, ierr ) ! MPI_Send sends data from one process to another within a ! communicator. Integer, Intent(in) :: count, receiver, tag, communicator Double Precision, Intent(in) :: ddata, datatype Integer, Intent(out) :: ierr Integer :: testi Double Precision :: testr testi = count if (count > 1) then write(*,*) "$$ MPI_Send_DS: count>1; count = ",count stop endif if ( count < 0) then write(*,*) "$$ MPI_Send_DS: count<0; count = ",count stop endif testr = datatype testi = receiver testi = tag testi = communicator testi = receiver testr = ddata ierr = 0 End Subroutine MPI_Send_DS Subroutine MPI_Isend_D ( ddata, count, datatype, receiver, tag, & communicator, request, ierr ) ! MPI_Isend is a nonblocking send of data. Integer, Intent(in) :: count, receiver, tag, communicator Double Precision, Intent(in) :: ddata(count), datatype Integer, Intent(out) :: ierr, request(:) Integer :: testi, I Double Precision :: testr testi = count testr = datatype testi = receiver testi = tag testi = communicator testi = receiver if (count < 0) then write(*,*) "$$ MPI_Send_R: count<0; count = ",count stop endif do I=1,count testr = ddata(I) end do request = 1 ierr = 0 End Subroutine MPI_Isend_D Subroutine MPI_Isend_DS ( ddata, count, datatype, receiver, tag, & communicator, request, ierr ) ! MPI_Isend is a nonblocking send of data. Integer, Intent(in) :: count, receiver, tag, communicator Double Precision, Intent(in) :: ddata, datatype Integer, Intent(out) :: ierr, request(:) Integer :: testi Double Precision :: testr testi = count if (count < 0) then write(*,*) "$$ MPI_Isend_DS: count<0; count = ",count stop endif if (count > 1) then write(*,*) "$$ MPI_Isend_DS: count>1; count = ",count stop endif testr = datatype testi = receiver testi = tag testi = communicator testr = ddata request = 1 ierr = 0 End Subroutine MPI_Isend_DS Subroutine MPI_Issend_D ( ddata, count, datatype, receiver, tag, & communicator, request, ierr ) ! MPI_Issend is a synchronous non-blocking send of data. Integer, Intent(in) :: count, datatype, receiver, tag Integer, Intent(in) :: communicator Integer, Intent(out) :: request, ierr Double Precision, Intent(in) :: ddata(count) Double Precision :: testr Integer :: testi, I testi = count testi = datatype testi = receiver testi = tag testi = communicator if (count < 0) then write(*,*) "$$ MPI_Issend_D: count<0; count = ",count stop endif do I=1,count testr = ddata(I) end do testi = receiver request = 1 ierr = 0 End Subroutine MPI_Issend_D Subroutine MPI_Issend_DS ( ddata, count, datatype, receiver, tag, & communicator, request, ierr ) ! MPI_Issend is a synchronous non-blocking send of data. Integer, Intent(in) :: count, datatype, receiver, tag Integer, Intent(in) :: communicator Integer, Intent(out) :: request, ierr Double Precision, Intent(in) :: ddata Double Precision :: testr Integer :: testi testi = count if (count < 0) then write(*,*) "$$ MPI_Issend_DS: count<0; count = ",count stop endif if (count > 1) then write(*,*) "$$ MPI_Issend_DS: count>1; count = ",count stop endif testi = datatype testi = receiver testi = tag testi = communicator testr = ddata testi = receiver request = 1 ierr = 0 End Subroutine MPI_Issend_DS Subroutine MPI_Ssend_D ( ddata, count, datatype, receiver, tag, & communicator, ierr ) ! MPI_Ssend sends data from one process to another within a ! communicator, in synchronous blocking mode. Integer, Intent(in) :: count, datatype, receiver, tag Integer, Intent(in) :: communicator Double Precision, Intent(in) :: ddata(count) Integer, Intent(out) :: ierr Integer :: testi, I Double Precision :: testr testi = count testi = datatype testi = receiver testi = tag testi = communicator if (count < 0) then write(*,*) "$$ MPI_Ssend_D: count<0; count = ",count stop endif do I=1,count testr = ddata(I) end do testi = receiver ierr = 0 End Subroutine MPI_Ssend_D Subroutine MPI_Ssend_DS ( ddata, count, datatype, receiver, tag, & communicator, ierr ) ! MPI_Ssend sends data from one process to another within a ! communicator, in synchronous blocking mode. Integer, Intent(in) :: count, datatype, receiver, tag Integer, Intent(in) :: communicator Double Precision, Intent(in) :: ddata Integer, Intent(out) :: ierr Integer :: testi Double Precision :: testr testi = count if (count < 0) then write(*,*) "$$ MPI_Ssend_DS: count<0; count = ",count stop endif if (count > 1) then write(*,*) "$$ MPI_Ssend_DS: count>1; count = ",count stop endif testi = datatype testi = receiver testi = tag testi = communicator testr = ddata testi = receiver ierr = 0 End Subroutine MPI_Ssend_DS Subroutine MPI_Reduce_D ( local_data, global_data, count, & datatype, operation, receiver, communicator, ierr ) ! MPI_Reduce carries out a reduction operation (such as sum, maximum, ! or product). Integer, Intent(in) :: count, operation, receiver Integer, Intent(in) :: communicator Double Precision, Intent(in) :: local_data(count), datatype Double Precision, Intent(out) :: global_data Integer, Intent(out) :: ierr Double Precision testr Integer :: I, testi testi = count testr = datatype testi = receiver testi = communicator if (count < 0) then write(*,*) "$$ MPI_Reduce_D: count<0; count = ",count stop endif do I=1,count testr = local_data(I) end do testi = operation ! Temporarily assumes operation is Sum. global_data = SUM(local_data) ierr = 0 End Subroutine MPI_Reduce_D Subroutine MPI_Reduce_DS ( local_data, global_data, count, & datatype, operation, receiver, communicator, ierr ) ! MPI_Reduce carries out a reduction operation (such as sum, maximum, ! or product). Integer, Intent(in):: count, receiver, operation Integer, Intent(in):: communicator Double Precision, Intent(in) :: local_data, datatype Double Precision, Intent(out) :: global_data Integer, Intent(out) :: ierr Double Precision :: testr Integer :: testi testi = count if (count < 0) then write(*,*) "$$ MPI_Reduce_DS: count<0; count = ",count stop endif if (count > 1) then write(*,*) "$$ MPI_Reduce_DS: count>1; count = ",count stop endif testr = datatype testi = receiver testi = communicator testr = local_data testi = operation global_data = local_data ierr = 0 End Subroutine MPI_Reduce_DS End Module mpiDP Module mpiChar ! Character Data and Datatype and scalar(_CS) arguments. Interface MPI_Bcast Module Procedure MPI_Bcast_C End Interface Interface MPI_Address Module Procedure MPI_Address_C End Interface Interface MPI_Get_address Module Procedure MPI_Get_address_C End Interface Interface MPI_Get_elements Module Procedure MPI_Get_elements_C End Interface Interface MPI_Get_elements Module Procedure MPI_Get_elements_CS End Interface Interface MPI_Irecv Module Procedure MPI_Irecv_C End Interface Interface MPI_Isend Module Procedure MPI_Isend_C End Interface Interface MPI_Recv Module Procedure MPI_Recv_C End Interface Interface MPI_Send Module Procedure MPI_Send_C End Interface contains Subroutine MPI_Bcast_C ( ddata, count, datatype, sender, & communicator, ierr ) ! MPI_Bcast broadcasts data from one process to all others within a ! communicator. Integer, Intent(in) :: count, sender, communicator Character(*), Intent(in) :: ddata Character, Intent(in) :: datatype Integer, Intent(out) :: ierr Integer :: testi Character :: testc testi=count if (count < 0) then write(*,*) "$$ MPI_Bcast_C: count<0; count = ",count stop endif do I=1,count testc = ddata(I:I) end do testc = datatype testi = sender testi = communicator ierr = 0 End Subroutine MPI_Bcast_C Subroutine MPI_Address_C ( ddata, address, ierr ) ! MPI_Address returns the address of an item of data. Character(*), Intent(in) :: ddata Integer, Intent(out) :: address, ierr Character :: testc testc = ddata(1:1) address = 6 ierr = 0 End Subroutine MPI_Address_C Subroutine MPI_Get_address_C ( ddata, address, ierr ) ! MPI_Get_address is a synonym for MPI_Address. Character(*), Intent(in) :: ddata Integer, Intent(out) :: address, ierr Character :: testc testc = ddata(1:1) address = 6 ierr = 0 End Subroutine MPI_Get_address_C Subroutine MPI_Get_elements_C ( sstatus, datatype, count, ierr ) ! Returns the number of basic elements in a message. Integer, Intent(in) :: sstatus(:) Character, Intent(in) :: datatype Integer, Intent(out) :: count, ierr Integer :: testi, I Character :: testc do I=1,Size(sstatus) testi = sstatus(I) end do testc = datatype count = 1 ierr = 0 End Subroutine MPI_Get_elements_C Subroutine MPI_Get_elements_CS ( sstatus, datatype, count, ierr ) ! Returns the number of basic elements in a message. Integer, Intent(in) :: sstatus Character, Intent(in) :: datatype Integer, Intent(out) :: count, ierr Integer :: testi Character :: testc testi = sstatus testc = datatype count = 1 ierr = 0 End Subroutine MPI_Get_elements_CS Subroutine MPI_Irecv_C ( ddata, count, datatype, sender, tag, & communicator, request, ierr ) ! MPI_Irecv receives data from another process within a communicator. Integer, Intent(in) :: count, sender, tag, communicator Integer, Intent(out) :: request(:), ierr Character(*), Intent(out) :: ddata Character, Intent(in) :: datatype Character :: testc Integer :: testi, I testi = count testc = datatype testi = sender testi = tag testi = communicator request = 1 if (count < 0) then write(*,*) "$$ MPI_Irecv_C: count<0; count = ",count stop endif do I=1,count ddata(I:I) = "x" end do ierr = 0 End Subroutine MPI_Irecv_C Subroutine MPI_Isend_C ( ddata, count, datatype, receiver, tag, & communicator, request, ierr ) ! MPI_Isend is a nonblocking send of data. Integer, Intent(in) :: count, receiver, tag, communicator Character(*), Intent(in) :: ddata Character, Intent(in) :: datatype Integer, Intent(out) :: ierr, request(:) Integer :: testi, I Character :: testc testi = count testc = datatype testi = receiver testi = tag testi = communicator do I=1,count testc = ddata(I:I) end do request = 1 ierr = 0 End Subroutine MPI_Isend_C Subroutine MPI_Recv_C ( ddata, count, datatype, sender, tag, & communicator, sstatus, ierr ) ! MPI_Recv receives data from another process within a communicator. Integer, Intent(in) :: count, sender, tag Character, Intent(in) :: datatype Integer, Intent(in) :: communicator Character(*), Intent(out) :: ddata ! In FORTRAN a single status object is an array of integers. Integer, Intent(out) :: sstatus(:), ierr Integer :: testi, I Character :: testc testi = count testc = datatype testi = sender testi = tag testi = communicator if (count < 0) then write(*,*) "$$ MPI_Recv_C: count<0; count = ",count stop endif do I=1,count ddata(I:I) = 'x' end do sstatus = 1 ierr = 0 End Subroutine MPI_Recv_C Subroutine MPI_Send_C ( ddata, count, datatype, receiver, tag, & communicator, ierr ) ! MPI_Send sends data from one process to another within a ! communicator. Integer, Intent(in) :: count Integer, Intent(in) :: tag, communicator, receiver Character(*), Intent(in):: ddata Character, Intent(in) :: datatype Integer, Intent(out) :: ierr Integer :: testi, I Character :: testc testi = count testc = datatype testi = receiver testi = tag testi = communicator if (count < 0) then write(*,*) "$$ MPI_Send_C: count<0; count = ",count stop endif do I=1,count testc = ddata(I:I) end do testi = receiver ierr = 0 End Subroutine MPI_Send_C End Module mpiChar Module mpiSr ! Every combo of a pair of Data arguments; i.e., Integer& Integer, ! Real & Real, Integer & Real, etc. ! Also RR and DPDP have RRT and DPDPT versions for a different ! type(T) declaration than the corresponding datatype. use mpiOther Interface MPI_Sendrecv Module Procedure MPI_Sendrecv_II End Interface Interface MPI_Sendrecv Module Procedure MPI_Sendrecv_RR End Interface Interface MPI_Sendrecv Module Procedure MPI_Sendrecv_RRT End Interface Interface MPI_Sendrecv Module Procedure MPI_Sendrecv_DPDP End Interface Interface MPI_Sendrecv Module Procedure MPI_Sendrecv_DPDPT End Interface Interface MPI_Sendrecv Module Procedure MPI_Sendrecv_IR End Interface Interface MPI_Sendrecv Module Procedure MPI_Sendrecv_RI End Interface Interface MPI_Sendrecv Module Procedure MPI_Sendrecv_IDP End Interface Interface MPI_Sendrecv Module Procedure MPI_Sendrecv_DPI End Interface Interface MPI_Sendrecv Module Procedure MPI_Sendrecv_RDP End Interface Interface MPI_Sendrecv Module Procedure MPI_Sendrecv_DPR End Interface contains Subroutine MPI_Sendrecv_II ( send_buf, send_count, send_datatype, & receiver, send_tag, recv_buf, recv_count, & recv_datatype, source, recv_tag, & communicator, sstatus, ierr ) ! MPI_Sendrecv sends and receives data between processes, without ! worrying about deadlock from a lack of buffering. Data types may ! be differenet. Integer, Intent(in) :: send_count, recv_count, communicator Integer, Intent(in) :: receiver, send_tag, source, recv_tag Integer, Intent(in) :: send_buf(send_count) Integer, Intent(in) :: send_datatype Integer, Intent(out) :: recv_buf(recv_count) Integer, Intent(in) :: recv_datatype Integer, Intent(out) :: sstatus(:), ierr Integer :: testi, I testi = send_count testi = recv_count testi = communicator testi = receiver testi = send_tag testi = source testi = recv_tag testi = send_datatype testi = recv_datatype if (send_count < 0) then write(*,*) "$$ MPI_Sendrecv_II: send_count<0; = ",send_count stop endif if (recv_count < 0) then write(*,*) "$$ MPI_Sendrecv_II: recv_count<0; = ",recv_count stop endif do I=1,send_count testi = send_buf(I) end do do I=1,recv_count recv_buf(I) = 1 end do do I=1,MPI_STATUS_SIZE sstatus(I) = 1 end do ierr = 0 End Subroutine MPI_Sendrecv_II Subroutine MPI_Sendrecv_RR ( send_buf, send_count, send_datatype, & receiver, send_tag, recv_buf, recv_count, & recv_datatype, source, recv_tag, & communicator, sstatus, ierr ) ! MPI_Sendrecv sends and receives data between processes, without ! worrying about deadlock from a lack of buffering. Data types may ! be differenet. Integer, Intent(in) :: send_count, recv_count, communicator Integer, Intent(in) :: receiver, send_tag, source, recv_tag Real, Intent(in) :: send_buf(send_count) Real, Intent(in) :: send_datatype Real, Intent(out) :: recv_buf(recv_count) Real, Intent(in) :: recv_datatype Integer, Intent(out) :: sstatus(:), ierr Real :: testr Integer :: testi, I testi = send_count testi = recv_count testi = communicator testi = receiver testi = send_tag testi = source testi = recv_tag testr = send_datatype testr = recv_datatype if (send_count < 0) then write(*,*) "$$ MPI_Sendrecv_RR: send_count<0; = ",send_count stop endif if (recv_count < 0) then write(*,*) "$$ MPI_Sendrecv_RR: recv_count<0; = ",recv_count stop endif do I=1,send_count testr = send_buf(I) end do do I=1,recv_count recv_buf(I) = 1 end do do I=1,MPI_STATUS_SIZE sstatus(I) = 1 end do ierr = 0 End Subroutine MPI_Sendrecv_RR Subroutine MPI_Sendrecv_RRT ( send_buf, send_count, send_datatype, & receiver, send_tag, recv_buf, recv_count, & recv_datatype, source, recv_tag, & communicator, sstatus, ierr ) ! MPI_Sendrecv sends and receives data between processes, without ! worrying about deadlock from a lack of buffering. Data types may ! be differenet. Integer, Intent(in) :: send_count, recv_count, communicator Integer, Intent(in) :: receiver, send_tag, source, recv_tag Real, Intent(in) :: send_buf(send_count) Integer, Intent(in) :: send_datatype Real, Intent(out) :: recv_buf(recv_count) Integer, Intent(in) :: recv_datatype Integer, Intent(out) :: sstatus(:), ierr Real :: testr Integer :: testi, I testi = send_count testi = recv_count testi = communicator testi = receiver testi = send_tag testi = source testi = recv_tag testi = send_datatype testi = recv_datatype if (send_count < 0) then write(*,*) "$$ MPI_Sendrecv_RR: send_count<0; = ",send_count stop endif if (recv_count < 0) then write(*,*) "$$ MPI_Sendrecv_RR: recv_count<0; = ",recv_count stop endif do I=1,send_count testr = send_buf(I) end do do I=1,recv_count recv_buf(I) = 1 end do do I=1,MPI_STATUS_SIZE sstatus(I) = 1 end do ierr = 0 End Subroutine MPI_Sendrecv_RRT Subroutine MPI_Sendrecv_DPDPT ( send_buf, send_count, & send_datatype, & receiver, send_tag, recv_buf, recv_count, & recv_datatype, source, recv_tag, & communicator, sstatus, ierr ) ! MPI_Sendrecv sends and receives data between processes, without ! worrying about deadlock from a lack of buffering. Data types(T) may ! be different than corresponding data. Integer, Intent(in) :: send_count, recv_count, communicator Integer, Intent(in) :: receiver, send_tag, source, recv_tag Double Precision, Intent(in) :: send_buf(send_count) Integer, Intent(in) :: send_datatype Double Precision, Intent(out) :: recv_buf(recv_count) Integer, Intent(in) :: recv_datatype Integer, Intent(out) :: sstatus(:), ierr Double Precision :: testr Integer :: testi, I testi = send_count testi = recv_count testi = communicator testi = receiver testi = send_tag testi = source testi = recv_tag testi = send_datatype testi = recv_datatype if (send_count < 0) then write(*,*) "$$ MPI_Sendrecv_DPDP: send_count<0; = ",send_count stop endif if (recv_count < 0) then write(*,*) "$$ MPI_Sendrecv_DPDP: recv_count<0; = ",recv_count stop endif do I=1,send_count testr = send_buf(I) end do do I=1,recv_count recv_buf(I) = 1 end do do I=1,MPI_STATUS_SIZE sstatus(I) = 1 end do ierr = 0 End Subroutine MPI_Sendrecv_DPDPT Subroutine MPI_Sendrecv_DPDP ( send_buf, send_count, send_datatype, & receiver, send_tag, recv_buf, recv_count, & recv_datatype, source, recv_tag, & communicator, sstatus, ierr ) ! MPI_Sendrecv sends and receives data between processes, without ! worrying about deadlock from a lack of buffering. Data types may ! be differenet. Integer, Intent(in) :: send_count, recv_count, communicator Integer, Intent(in) :: receiver, send_tag, source, recv_tag Double Precision, Intent(in) :: send_buf(send_count) Double Precision, Intent(in) :: send_datatype Double Precision, Intent(out) :: recv_buf(recv_count) Double Precision, Intent(in) :: recv_datatype Integer, Intent(out) :: sstatus(:), ierr Double Precision :: testr Integer :: testi, I testi = send_count testi = recv_count testi = communicator testi = receiver testi = send_tag testi = source testi = recv_tag testr = send_datatype testr = recv_datatype if (send_count < 0) then write(*,*) "$$ MPI_Sendrecv_DPDP: send_count<0; = ",send_count stop endif if (recv_count < 0) then write(*,*) "$$ MPI_Sendrecv_DPDP: recv_count<0; = ",recv_count stop endif do I=1,send_count testr = send_buf(I) end do do I=1,recv_count recv_buf(I) = 1 end do do I=1,MPI_STATUS_SIZE sstatus(I) = 1 end do ierr = 0 End Subroutine MPI_Sendrecv_DPDP Subroutine MPI_Sendrecv_IR ( send_buf, send_count, send_datatype, & receiver, send_tag, recv_buf, recv_count, & recv_datatype, source, recv_tag, & communicator, sstatus, ierr ) ! MPI_Sendrecv sends and receives data between processes, without ! worrying about deadlock from a lack of buffering. Data types may ! be differenet. Integer, Intent(in) :: send_count, recv_count, communicator Integer, Intent(in) :: receiver, send_tag, source, recv_tag Integer, Intent(in) :: send_buf(send_count) Integer, Intent(in) :: send_datatype Real, Intent(out) :: recv_buf(recv_count) Real, Intent(in) :: recv_datatype Integer, Intent(out) :: sstatus(:), ierr Integer :: testi, I testi = send_count testi = recv_count testi = communicator testi = receiver testi = send_tag testi = source testi = recv_tag testi = send_datatype testr = recv_datatype if (send_count < 0) then write(*,*) "$$ MPI_Sendrecv_IR: send_count<0; = ",send_count stop endif if (recv_count < 0) then write(*,*) "$$ MPI_Sendrecv_IR: recv_count<0; = ",recv_count stop endif do I=1,send_count testi = send_buf(I) end do do I=1,recv_count recv_buf(I) = 1 end do do I=1,MPI_STATUS_SIZE sstatus(I) = 1 end do ierr = 0 End Subroutine MPI_Sendrecv_IR Subroutine MPI_Sendrecv_RI ( send_buf, send_count, send_datatype, & receiver, send_tag, recv_buf, recv_count, & recv_datatype, source, recv_tag, & communicator, sstatus, ierr ) ! MPI_Sendrecv sends and receives data between processes, without ! worrying about deadlock from a lack of buffering. Data types may ! be differenet. Integer, Intent(in) :: send_count, recv_count, communicator Integer, Intent(in) :: receiver, send_tag, source, recv_tag Real, Intent(in) :: send_buf(send_count) Real, Intent(in) :: send_datatype Integer, Intent(out) :: recv_buf(recv_count) Integer, Intent(in) :: recv_datatype Integer, Intent(out) :: sstatus(:), ierr Real :: testr Integer :: testi, I testi = send_count testi = recv_count testi = communicator testi = receiver testi = send_tag testi = source testi = recv_tag testi = recv_datatype testr = send_datatype if (send_count < 0) then write(*,*) "$$ MPI_Sendrecv_RI: send_count<0; = ",send_count stop endif if (recv_count < 0) then write(*,*) "$$ MPI_Sendrecv_RI: recv_count<0; = ",recv_count stop endif do I=1,send_count testr = send_buf(I) end do do I=1,recv_count recv_buf(I) = 1 end do do I=1,MPI_STATUS_SIZE sstatus(I) = 1 end do ierr = 0 End Subroutine MPI_Sendrecv_RI Subroutine MPI_Sendrecv_IDP ( send_buf, send_count, send_datatype, & receiver, send_tag, recv_buf, recv_count, & recv_datatype, source, recv_tag, & communicator, sstatus, ierr ) ! MPI_Sendrecv sends and receives data between processes, without ! worrying about deadlock from a lack of buffering. Data types may ! be differenet. Integer, Intent(in) :: send_count, recv_count, communicator Integer, Intent(in) :: receiver, send_tag, source, recv_tag Integer, Intent(in) :: send_buf(send_count) Integer, Intent(in) :: send_datatype Double Precision, Intent(out) :: recv_buf(recv_count) Double Precision, Intent(in) :: recv_datatype Integer, Intent(out) :: sstatus(:), ierr Integer :: testi, I testi = send_count testi = recv_count testi = communicator testi = receiver testi = send_tag testi = source testi = recv_tag testi = send_datatype testr = recv_datatype if (send_count < 0) then write(*,*) "$$ MPI_Sendrecv_IDP: send_count<0; = ",send_count stop endif if (recv_count < 0) then write(*,*) "$$ MPI_Sendrecv_IDP: recv_count<0; = ",recv_count stop endif do I=1,send_count testi = send_buf(I) end do do I=1,recv_count recv_buf(I) = 1 end do do I=1,MPI_STATUS_SIZE sstatus(I) = 1 end do ierr = 0 End Subroutine MPI_Sendrecv_IDP Subroutine MPI_Sendrecv_DPI ( send_buf, send_count, send_datatype, & receiver, send_tag, recv_buf, recv_count, & recv_datatype, source, recv_tag, & communicator, sstatus, ierr ) ! MPI_Sendrecv sends and receives data between processes, without ! worrying about deadlock from a lack of buffering. Data types may ! be differenet. Integer, Intent(in) :: send_count, recv_count, communicator Integer, Intent(in) :: receiver, send_tag, source, recv_tag Double Precision, Intent(in) :: send_buf(send_count) Double Precision, Intent(in) :: send_datatype Integer, Intent(out) :: recv_buf(recv_count) Integer, Intent(in) :: recv_datatype Integer, Intent(out) :: sstatus(:), ierr Double Precision :: testr Integer :: testi, I testi = send_count testi = recv_count testi = communicator testi = receiver testi = send_tag testi = source testi = recv_tag testi = recv_datatype testr = send_datatype if (send_count < 0) then write(*,*) "$$ MPI_Sendrecv_DPI: send_count<0; = ",send_count stop endif if (recv_count < 0) then write(*,*) "$$ MPI_Sendrecv_DPI: recv_count<0; = ",recv_count stop endif do I=1,send_count testr = send_buf(I) end do do I=1,recv_count recv_buf(I) = 1 end do do I=1,MPI_STATUS_SIZE sstatus(I) = 1 end do ierr = 0 End Subroutine MPI_Sendrecv_DPI Subroutine MPI_Sendrecv_RDP ( send_buf, send_count, send_datatype, & receiver, send_tag, recv_buf, recv_count, & recv_datatype, source, recv_tag, & communicator, sstatus, ierr ) ! MPI_Sendrecv sends and receives data between processes, without ! worrying about deadlock from a lack of buffering. Data types may ! be differenet. Integer, Intent(in) :: send_count, recv_count, communicator Integer, Intent(in) :: receiver, send_tag, source, recv_tag Real, Intent(in) :: send_buf(send_count) Real, Intent(in) :: send_datatype Double Precision, Intent(out) :: recv_buf(recv_count) Double Precision, Intent(in) :: recv_datatype Integer, Intent(out) :: sstatus(:), ierr Integer :: testi, I Double Precision :: testr testi = send_count testi = recv_count testi = communicator testi = receiver testi = send_tag testi = source testi = recv_tag testr = recv_datatype testr = send_datatype if (send_count < 0) then write(*,*) "$$ MPI_Sendrecv_RDP: send_count<0; = ",send_count stop endif if (recv_count < 0) then write(*,*) "$$ MPI_Sendrecv_RDP: recv_count<0; = ",recv_count stop endif do I=1,send_count testr = send_buf(I) end do do I=1,recv_count recv_buf(I) = 1 end do do I=1,MPI_STATUS_SIZE sstatus(I) = 1 end do ierr = 0 End Subroutine MPI_Sendrecv_RDP Subroutine MPI_Sendrecv_DPR ( send_buf, send_count, send_datatype, & receiver, send_tag, recv_buf, recv_count, & recv_datatype, source, recv_tag, & communicator, sstatus, ierr ) ! MPI_Sendrecv sends and receives data between processes, without ! worrying about deadlock from a lack of buffering. Data types may ! be differenet. Integer, Intent(in) :: send_count, recv_count, communicator Integer, Intent(in) :: receiver, send_tag, source, recv_tag Double Precision, Intent(in) :: send_buf(send_count) Double Precision, Intent(in) :: send_datatype Real, Intent(out) :: recv_buf(recv_count) Real, Intent(in) :: recv_datatype Integer, Intent(out) :: sstatus(:), ierr Double Precision :: testr Integer :: testi, I testi = send_count testi = recv_count testi = communicator testi = receiver testi = send_tag testi = source testi = recv_tag testr = recv_datatype testr = send_datatype if (send_count < 0) then write(*,*) "$$ MPI_Sendrecv_DPR: send_count<0; = ",send_count stop endif if (recv_count < 0) then write(*,*) "$$ MPI_Sendrecv_DPR: recv_count<0; = ",recv_count stop endif do I=1,send_count testr = send_buf(I) end do do I=1,recv_count recv_buf(I) = 1 end do do I=1,MPI_STATUS_SIZE sstatus(I) = 1 end do ierr = 0 End Subroutine MPI_Sendrecv_DPR End Module mpiSr Module mpiRealT ! Real Data and Integer datatype arguments including Scalar(S). ! Also _RRT and _DPDPT versions where datatype is a different type(T) ! declaration than the corresponding data. Interface MPI_Allreduce Module Procedure MPI_Allreduce_RT End Interface Interface MPI_Allreduce Module Procedure MPI_Allreduce_RST End Interface Interface MPI_Bcast Module Procedure MPI_Bcast_RT End Interface Interface MPI_Bcast Module Procedure MPI_Bcast_RST End Interface Interface MPI_Bsend Module Procedure MPI_Bsend_RT End Interface Interface MPI_Bsend Module Procedure MPI_Bsend_RST End Interface Interface MPI_Gather Module Procedure MPI_Gather_RT End Interface Interface MPI_Scatter Module Procedure MPI_Scatter_RT End Interface Interface MPI_Pack Module Procedure MPI_Pack_RT End Interface Interface MPI_Unpack Module Procedure MPI_Unpack_RT End Interface Interface MPI_Recv Module Procedure MPI_Recv_RT End Interface Interface MPI_Recv Module Procedure MPI_Recv_RST End Interface Interface MPI_Irecv Module Procedure MPI_Irecv_RT End Interface Interface MPI_Irecv Module Procedure MPI_Irecv_RST End Interface Interface MPI_Receive Module Procedure MPI_Receive_RT End Interface Interface MPI_Send Module Procedure MPI_Send_RT End Interface Interface MPI_Send Module Procedure MPI_Send_RST End Interface Interface MPI_Isend Module Procedure MPI_Isend_RT End Interface Interface MPI_Isend Module Procedure MPI_Isend_RST End Interface Interface MPI_Reduce Module Procedure MPI_Reduce_RT End Interface Interface MPI_Reduce Module Procedure MPI_Reduce_RST End Interface contains Subroutine MPI_Allreduce_RT ( a,b, count, & datatype, operation, communicator, ierr ) ! MPI_Allreduce carries out a reduction operation (such as sum, ! maximum, or product), with all processes receiving the result. Integer, Intent(in) :: count, communicator, operation Real, Intent(in) :: a(count) Integer, Intent(in) :: datatype Real, Intent(out) :: b(count) Integer, Intent(out) :: ierr Integer :: testi, I testi = datatype testi = operation testi = communicator testi = count if (count < 0) then write(*,*) "$$ MPI_Allreduce_RT: count<0; count = ",count stop endif Do I=1,count b(I)=a(I) Enddo ierr=0 End Subroutine MPI_Allreduce_RT Subroutine MPI_Allreduce_RST ( a,b, count, & datatype, operation, communicator, ierr ) ! MPI_Allreduce carries out a reduction operation (such as sum, ! maximum, or product), with all processes receiving the result. Integer, Intent(in) :: count, Communicator, operation Real, Intent(in) :: a Integer, Intent(in) :: datatype Real, Intent(out) :: b Integer, Intent(out) :: ierr Integer :: testi testi = datatype testi = operation testi = communicator testi = count if (count < 0) then write(*,*) "$$ MPI_Allreduce_RST: count<0; count = ",count stop endif if (count > 1) then write(*,*) "$$ MPI_Allreduce_RST: count>1; count = ",count stop endif b = a ierr=0 End Subroutine MPI_Allreduce_RST Subroutine MPI_Bcast_RT ( ddata, count, datatype, sender, & communicator, ierr ) ! MPI_Bcast broadcasts data from one process to all others within a ! communicator. Integer, Intent(in) :: count, sender, communicator Real, Intent(in) :: ddata(count) Integer, Intent(in) :: datatype Integer, Intent(out) :: ierr Integer :: testi, I Real :: testr testi=count if (count < 0) then write(*,*) "$$ MPI_Bcast_RT: count<0; count = ",count stop endif do I=1,count testr = ddata(I) end do testi = datatype testi = sender testi = communicator ierr = 0 End Subroutine MPI_Bcast_RT Subroutine MPI_Bcast_RST ( ddata, count, datatype, sender, & communicator, ierr ) ! MPI_Bcast broadcasts data from one process to all others within a ! communicator. Integer, Intent(in) :: count, sender, communicator Real, Intent(in) :: ddata Integer, Intent(in) :: datatype Integer, Intent(out) :: ierr Integer :: testi Real :: testr testi=count if (count < 0) then write(*,*) "$$ MPI_Bcast_RT: count<0; count = ",count stop endif if (count > 1) then write(*,*) "$$ MPI_Bcast_RT: count>1; count = ",count stop endif testr = ddata testi = datatype testi = sender testi = communicator ierr = 0 End Subroutine MPI_Bcast_RST Subroutine MPI_Bsend_RT ( ddata, count, datatype, receiver, tag, & communicator, ierr ) ! MPI_Bsend sends data from one process to another within a ! communicator, using buffering. Integer, Intent(in) :: count, receiver, tag, communicator Real, Intent(in) :: ddata(count) Integer, Intent(in) :: datatype Integer, Intent(out) :: ierr Integer :: testi, I Real :: testr testi = count if (count < 0 ) then write(*,*) "$$ MPI_Bsend_R: count<0; count = ",count stop endif testi = receiver testi = tag testi = communicator testi = datatype do I=1,count testr = ddata(I) end do ierr = 0 End Subroutine MPI_Bsend_RT Subroutine MPI_Bsend_RST ( ddata, count, datatype, receiver, tag, & communicator, ierr ) ! MPI_Bsend sends data from one process to another within a ! communicator, using buffering. Integer, Intent(in) :: count, receiver, tag, communicator Real, Intent(in) :: ddata Integer, Intent(in) :: datatype Integer, Intent(out) :: ierr Integer :: testi Real :: testr testi = count if (count < 0 ) then write(*,*) "$$ MPI_Bsend_RST: count<0; count = ",count stop endif if (count > 1 ) then write(*,*) "$$ MPI_Bsend_RST: count>1; count = ",count stop endif testi = receiver testi = tag testi = communicator testi = datatype testr = ddata ierr = 0 End Subroutine MPI_Bsend_RST Subroutine MPI_Gather_RT ( send_data, send_count, send_datatype, & recv_data, recv_count, recv_datatype, & root, communicator, ierr ) ! MPI_Gather gathers data from all the processes in a communicator. Integer, Intent(in) :: send_count, recv_count Integer, Intent(in) :: root, communicator Real, Intent(in) :: send_data(send_count) Integer, Intent(in) :: send_datatype, recv_datatype Real, Intent(out) :: recv_data(:) Integer, Intent(out) :: ierr Integer :: testi, I Real :: testr testi = send_count testi = recv_count testi = root testi = communicator testi = send_datatype testi = recv_datatype if (send_count < 0) then write(*,*) "$$ MPI_Gather_RT: send_count<0; = ",send_count stop endif do I=1,send_count testr = send_data(I) end do if (recv_count < 0 .or. recv_count > Size(recv_data)) then write(*,*) "$$ MPI_Gather_RT: recv_count<0; or " write(*,*) "$$ MPI_Gather_RT: recv_count>Size(recv_data)." write(*,*) "recv_count = ",recv_count write(*,*) "Size(recv_data) = ", Size(recv_data) stop endif do I=1,Size(recv_data) recv_data(I) = 1 end do ierr = 0 End Subroutine MPI_Gather_RT Subroutine MPI_Scatter_RT ( send_data, send_count, send_datatype, & recv_data, recv_count, recv_datatype, & root, communicator, ierr ) ! MPI_Scatter distributes data from one process to all processes. Integer, Intent(in) :: send_count, recv_count Integer, Intent(in) :: root, communicator Real, Intent(in) :: send_data(:) Integer, Intent(in) :: send_datatype, recv_datatype Real, Intent(out) :: recv_data(:) Integer, Intent(out) :: ierr Integer :: testi, I Real :: testr testi = send_count testi = recv_count testi = root testi = communicator testi = send_datatype testi = recv_datatype if (send_count < 0 .or. send_count > Size(send_data)) then write(*,*) "$$ MPI_Scatter_RT: send_count<0; or " write(*,*) "$$ MPI_Scatter_RT: send_count>Size(send_data)." write(*,*) "send_count = ",send_count write(*,*) "Size(send_data) = ", Size(send_data) stop endif do I=1,Size(send_data) testr = send_data(I) end do if (recv_count < 0 .or. recv_count > Size(recv_data)) then write(*,*) "$$ MPI_Scatter_RT: recv_count<0; or " write(*,*) "$$ MPI_Scatter_RT: recv_count>Size(recv_data)." write(*,*) "recv_count = ",recv_count write(*,*) "Size(recv_data) = ", Size(recv_data) stop endif do I=1,Size(recv_data) recv_data(I) = 1 end do ierr = 0 End Subroutine MPI_Scatter_RT Subroutine MPI_Pack_RT ( ddata, count, datatype, buffer, & buffer_size, & buffer_position, communicator, ierr ) ! MPI_Pack packs data into a buffer. Integer, parameter :: bytes_per_word = 4 Integer, Intent(in) :: count, buffer_size, communicator Real, Intent(in) :: ddata(count) Integer, Intent(in) :: datatype Real, Intent(out) :: buffer(:) Integer, Intent(inout) :: buffer_position Integer, Intent(out) :: ierr Integer :: testi, I, start_word Real :: testr testi = datatype testi = communicator testi = count if (count < 0) then write(*,*) "$$ MPI_Pack_RT: count<0; count = ",count stop endif do I=1,count testr = ddata(I) end do testi = buffer_size if (buffer_size < 0) then write(*,*) "$$ MPI_Pack_RT: buffer_size < 0 = ", & buffer_size stop endif testi = buffer_position if (buffer_position < 0 .or. & buffer_position/bytes_per_word > buffer_size) then write(*,*) "$$ MPI_Pack_RT: buffer_position<0 = ", & "or > buffer_size; buffer_position =", & buffer_position, " buffer_size=", buffer_size stop endif ! if the buffer's dimension in bytes in the calling program ! is >= buffer_size less position, then buffer will hold the ! packed data. if (bytes_per_word*Size(buffer) < buffer_size ) then write(*,*) & "$$ MPI_Pack_RT: buffer_size is larger than dimension ", & "of buffer; buffer_size= ", buffer_size write(*,*) "buffer_position = ", buffer_position write(*,*) "buffer dimension in caller=", Size(buffer) stop endif start_word = buffer_position/bytes_per_word do I=1,count buffer(I + start_word) = ddata(I) buffer_position = buffer_position + bytes_per_word end do ierr = 0 End Subroutine MPI_Pack_RT Subroutine MPI_Unpack_RT ( buffer, buffer_size, buffer_position, & ddata, count, datatype, communicator, ierr ) ! MPI_Unpack unpacks data from a buffer. Integer, parameter :: bytes_per_word = 4 Integer, Intent(in) :: count, buffer_size, communicator Real, Intent(in) :: buffer(:) Integer, Intent(in) :: datatype Real, Intent(out) :: ddata(count) Integer, Intent(inout) :: buffer_position Integer, Intent(out) :: ierr Integer :: testi, I, start_word real :: testr testi = datatype testi = communicator testi = count if (count < 0) then write(*,*) "$$ MPI_Unpack_RT: count<0; count = ",count stop endif testi = buffer_size if (buffer_size < 0) then write(*,*) "$$ MPI_Unpack_RT: buffer_size < 0 = ", & buffer_size stop endif testi = buffer_position if (buffer_position < 0 .or. & buffer_position/bytes_per_word > buffer_size) then write(*,*) "$$ MPI_Pack_RT: buffer_position<0 = ", & "or > buffer_size; buffer_position =", & buffer_position, " buffer_size=", buffer_size stop endif if (bytes_per_word*Size(buffer) < buffer_size) then write(*,*) & "$$ MPI_Unpack_RT: buffer_size is larger than dimension ", & "of buffer; buffer_size= ", buffer_size write(*,*) "buffer_position = ", buffer_position write(*,*) "buffer dimension in caller=", Size(buffer) stop endif start_word = buffer_position/bytes_per_word - count do I=1,count ddata(I) = buffer(I + start_word) end do buffer_position = buffer_position - bytes_per_word*count ierr = 0 End Subroutine MPI_Unpack_RT Subroutine MPI_Recv_RT ( ddata, count, datatype, sender, tag, & communicator, sstatus, ierr ) ! MPI_Recv receives data from another process within a communicator. Integer, Intent(in) :: count, sender, tag Integer, Intent(in) :: communicator Integer, Intent(in) :: datatype Real, Intent(out) :: ddata(count) ! In FORTRAN a single status object is an array of integers. Integer, Intent(out) :: sstatus(:), ierr Integer :: testi, I testi = count testi = datatype testi = sender testi = tag testi = communicator sstatus = 1 if (count < 0) then write(*,*) "$$ MPI_Recv_RT: count<0; count = ",count stop endif do I=1,count ddata(I) = 1.0 end do ierr = 0 End Subroutine MPI_Recv_RT Subroutine MPI_Recv_RST ( ddata, count, datatype, sender, tag, & communicator, sstatus, ierr ) ! MPI_Recv receives data from another process within a communicator. Integer, Intent(in) :: count, sender, tag Integer, Intent(in) :: communicator Integer, Intent(in) :: datatype Real, Intent(out) :: ddata ! In FORTRAN a single status object is an array of integers. Integer, Intent(out) :: sstatus(:), ierr Integer :: testi testi = count if (count < 0) then write(*,*) "$$ MPI_Recv_RST: count<0; count = ",count stop endif if (count > 1) then write(*,*) "$$ MPI_Recv_RST: count>1; count = ",count stop endif testi = datatype testi = sender testi = tag testi = communicator sstatus = 1 ddata = 1.0 ierr = 0 End Subroutine MPI_Recv_RST Subroutine MPI_Irecv_RT ( ddata, count, datatype, sender, tag, & communicator, request, ierr ) ! MPI_Irecv receives data from another process within a communicator. Integer, Intent(in) :: count, sender, tag Integer, Intent(in) :: communicator Integer, Intent(in) :: datatype Real, Intent(out) :: ddata(count) Integer, Intent(out) :: request(:), ierr Integer :: testi, I testi = count testi = datatype testi = sender testi = tag testi = communicator request = 1 if (count < 0) then write(*,*) "$$ MPI_Irecv_RT: count<0; count = ",count stop endif do I=1,count ddata(I) = 1.0 end do ierr = 0 End Subroutine MPI_Irecv_RT Subroutine MPI_Irecv_RST ( ddata, count, datatype, sender, tag, & communicator, request, ierr ) ! MPI_Irecv receives data from another process within a communicator. Integer, Intent(in) :: count, sender, tag Integer, Intent(in) :: communicator Integer, Intent(in) :: datatype Real, Intent(out) :: ddata Integer, Intent(out) :: request(:), ierr Integer :: testi testi = count if (count < 0) then write(*,*) "$$ MPI_Irecv_RST: count<0; count = ",count stop endif if (count > 1) then write(*,*) "$$ MPI_Irecv_RST: count>1; count = ",count stop endif testi = datatype testi = sender testi = tag testi = communicator request = 1 ddata = 1.0 ierr = 0 End Subroutine MPI_Irecv_RST Subroutine MPI_Receive_RT ( ddata, count, datatype, sender, tag, & communicator, sstatus, ierr ) ! MPI_Receive is a non-standard version of MPI_Recv. Integer, Intent(in):: count, sender(:), tag Integer, Intent(in):: communicator Real, Intent(in) :: ddata(count) Integer, Intent(in) :: datatype Integer, Intent(out) :: sstatus(:), ierr Integer :: testi, I Real :: testr testi = count testi = datatype do I=1,Size(sender) testi = sender(I) end do testi = tag testi = communicator sstatus = 1 if (count < 0) then write(*,*) "$$ MPI_Receive_RT: count<0; count = ",count stop endif do I=1,count testr = ddata(I) end do ierr = 0 End Subroutine MPI_Receive_RT Subroutine MPI_Send_RT ( ddata, count, datatype, receiver, tag, & communicator, ierr ) ! MPI_Send sends data from one process to another within a ! communicator. Integer, Intent(in) :: count, receiver, tag, communicator Real, Intent(in) :: ddata(count) Integer, Intent(in) :: datatype Integer, Intent(out) :: ierr Integer :: testi, I Real :: testr testi = count testi = datatype testi = receiver testi = tag testi = communicator testi = receiver if (count < 0) then write(*,*) "$$ MPI_Send_RT: count<0; count = ",count stop endif do I=1,count testr = ddata(I) end do ierr = 0 End Subroutine MPI_Send_RT Subroutine MPI_Send_RST ( ddata, count, datatype, receiver, tag, & communicator, ierr ) ! MPI_Send sends data from one process to another within a ! communicator. Integer, Intent(in) :: count, receiver, tag, communicator Real, Intent(in) :: ddata Integer, Intent(in) :: datatype Integer, Intent(out) :: ierr Integer :: testi Real :: testr testi = count if (count < 0) then write(*,*) "$$ MPI_Send_RST: count<0; count = ",count stop endif if (count > 1) then write(*,*) "$$ MPI_Send_RST: count>1; count = ",count stop endif testi = datatype testi = receiver testi = tag testi = communicator testr = ddata ierr = 0 End Subroutine MPI_Send_RST Subroutine MPI_Isend_RT ( ddata, count, datatype, receiver, tag, & communicator, request, ierr ) ! MPI_Isend is a nonblocking send of data. Integer, Intent(in) :: count, receiver, tag, communicator Real, Intent(in) :: ddata(count) Integer, Intent(in) :: datatype Integer, Intent(out) :: ierr, request(:) Integer :: testi, I Real :: testr testi = count testi = datatype testi = receiver testi = tag testi = communicator testi = receiver if (count < 0) then write(*,*) "$$ MPI_Send_RT: count<0; count = ",count stop endif do I=1,count testr = ddata(I) end do request = 1 ierr = 0 End Subroutine MPI_Isend_RT Subroutine MPI_Isend_RST ( ddata, count, datatype, receiver, tag, & communicator, request, ierr ) ! MPI_Isend is a nonblocking send of data. Integer, Intent(in) :: count, receiver, tag, communicator Real, Intent(in) :: ddata Integer, Intent(in) :: datatype Integer, Intent(out) :: ierr, request(:) Integer :: testi Real :: testr testi = count if (count < 0) then write(*,*) "$$ MPI_Isend_RST: count<0; count = ",count stop endif if (count > 1) then write(*,*) "$$ MPI_Isend_RST: count>1; count = ",count stop endif testi = datatype testi = receiver testi = tag testi = communicator testr = ddata request = 1 ierr = 0 End Subroutine MPI_Isend_RST Subroutine MPI_Reduce_RT ( local_data, global_data, count, & datatype, operation, receiver, communicator, ierr ) ! MPI_Reduce carries out a reduction operation (such as sum, maximum, ! or product). Integer, Intent(in) :: count, operation, receiver Integer, Intent(in) :: communicator Real, Intent(in) :: local_data(count) Integer, Intent(in) :: datatype Real, Intent(out) :: global_data Integer, Intent(out) :: ierr Integer :: testi, I Real :: testr testi = count testi = datatype testi = receiver testi = communicator if (count < 0) then write(*,*) "$$ MPI_Reduce_RT: count<0; count = ",count stop endif do I=1,count testr = local_data(I) end do testi = operation ! Temporarily assumes operation is Sum. global_data = SUM(local_data) ierr = 0 End Subroutine MPI_Reduce_RT Subroutine MPI_Reduce_RST ( local_data, global_data, count, & datatype, operation, receiver, communicator, ierr ) ! MPI_Reduce carries out a reduction operation (such as sum, maximum, ! or product). Integer, Intent(in) :: count, operation, receiver Integer, Intent(in) :: communicator Real, Intent(in) :: local_data Integer, Intent(in) :: datatype Real, Intent(out) :: global_data Integer, Intent(out) :: ierr Integer :: testi Real :: testr testi = count if (count < 0) then write(*,*) "$$ MPI_Reduce_RST: count<0; count = ",count stop endif if (count > 1) then write(*,*) "$$ MPI_Reduce_RST: count>1; count = ",count stop endif testi = datatype testi = receiver testi = communicator testr = local_data testi = operation ! Temporarily assumes operation is Sum. global_data = local_data ierr = 0 End Subroutine MPI_Reduce_RST End Module mpiRealT Module mpiDPT ! Double Precision Data, Integer DataType and Scalar(_DS) arguments. Interface MPI_Allreduce Module Procedure MPI_Allreduce_DT End Interface Interface MPI_Allreduce Module Procedure MPI_Allreduce_DST End Interface Interface MPI_Bcast Module Procedure MPI_Bcast_DT End Interface Interface MPI_Bcast Module Procedure MPI_Bcast_DST End Interface Interface MPI_Bsend Module Procedure MPI_Bsend_DT End Interface Interface MPI_Bsend Module Procedure MPI_Bsend_DST End Interface Interface MPI_Gather Module Procedure MPI_Gather_DT End Interface Interface MPI_Scatter Module Procedure MPI_Scatter_DT End Interface Interface MPI_Pack Module Procedure MPI_Pack_DT End Interface Interface MPI_Unpack Module Procedure MPI_Unpack_DT End Interface Interface MPI_Recv Module Procedure MPI_Recv_DT End Interface Interface MPI_Recv Module Procedure MPI_Recv_DST End Interface Interface MPI_Irecv Module Procedure MPI_Irecv_DT End Interface Interface MPI_Irecv Module Procedure MPI_Irecv_DST End Interface Interface MPI_Receive Module Procedure MPI_Receive_DT End Interface Interface MPI_Send Module Procedure MPI_Send_DT End Interface Interface MPI_Send Module Procedure MPI_Send_DST End Interface Interface MPI_Isend Module Procedure MPI_Isend_DT End Interface Interface MPI_Isend Module Procedure MPI_Isend_DST End Interface Interface MPI_Reduce Module Procedure MPI_Reduce_DT End Interface Interface MPI_Reduce Module Procedure MPI_Reduce_DST End Interface contains Subroutine MPI_Allreduce_DT ( a,b, count, & datatype, operation, communicator, ierr ) ! MPI_Allreduce carries out a reduction operation (such as sum, ! maximum, or product), with all processes receiving the result. Integer, Intent(in) :: count, communicator, operation Double Precision, Intent(in) :: a(count) Integer, Intent(in) :: datatype Double Precision, Intent(out) :: b(count) Integer, Intent(out) :: ierr Integer :: testi, I testi = datatype testi = operation testi = communicator testi = count if (count < 0) then write(*,*) "$$ MPI_Allreduce_DT: count<0; count = ",count stop endif Do I=1,count b(I)=a(I) Enddo ierr=0 End Subroutine MPI_Allreduce_DT Subroutine MPI_Allreduce_DST ( a,b, count, & datatype, operation, communicator, ierr ) ! MPI_Allreduce carries out a reduction operation (such as sum, ! maximum, or product), with all processes receiving the result. Integer, Intent(in) :: count, communicator, operation Double Precision, Intent(in) :: a Integer, Intent(in) :: datatype Double Precision, Intent(out) :: b Integer, Intent(out) :: ierr Integer :: testi testi = datatype testi = operation testi = communicator testi = count if (count < 0) then write(*,*) "$$ MPI_Allreduce_DST: count<0; count = ",count stop endif if (count > 1) then write(*,*) "$$ MPI_Allreduce_DST: count>1; count = ",count stop endif b=a ierr=0 End Subroutine MPI_Allreduce_DST Subroutine MPI_Bcast_DT ( ddata, count, datatype, sender, & communicator, ierr ) ! MPI_Bcast broadcasts data from one process to all others within a ! communicator. Integer, Intent(in) :: count, sender, communicator Double Precision, Intent(in) :: ddata(count) Integer, Intent(in) :: datatype Integer, Intent(out) :: ierr Integer :: testi, I Double Precision :: testr testi=count if (count < 0) then write(*,*) "$$ MPI_Bcast_DT: count<0; count = ",count stop endif do I=1,count testr = ddata(I) end do testi = datatype testi = sender testi = communicator ierr = 0 End Subroutine MPI_Bcast_DT Subroutine MPI_Bcast_DST ( ddata, count, datatype, sender, & communicator, ierr ) ! MPI_Bcast broadcasts data from one process to all others within a ! communicator. Integer, Intent(in) :: count, sender, communicator Double Precision, Intent(in) :: ddata Integer, Intent(in) :: datatype Integer, Intent(out) :: ierr Integer :: testi Double Precision :: testr testi=count if (count < 0) then write(*,*) "$$ MPI_Bcast_DST: count<0; count = ",count stop endif if (count > 1) then write(*,*) "$$ MPI_Bcast_DST: count>1; count = ",count stop endif testr = ddata testi = datatype testi = sender testi = communicator ierr = 0 End Subroutine MPI_Bcast_DST Subroutine MPI_Bsend_DT ( ddata, count, datatype, receiver, tag, & communicator, ierr ) ! MPI_Bsend sends data from one process to another within a ! communicator, using buffering. Integer, Intent(in) :: count, receiver, tag, communicator Double Precision, Intent(in) :: ddata(count) Integer, Intent(in) :: datatype Integer, Intent(out) :: ierr Integer :: testi, I Double Precision :: testr testi = count if (count < 0 ) then write(*,*) "$$ MPI_Bsend_DT: count<0; count = ",count stop endif testi = receiver testi = tag testi = communicator testi = datatype do I=1,count testr = ddata(I) end do ierr = 0 End Subroutine MPI_Bsend_DT Subroutine MPI_Bsend_DST ( ddata, count, datatype, receiver, tag, & communicator, ierr ) ! MPI_Bsend sends data from one process to another within a ! communicator, using buffering. Integer, Intent(in) :: count, receiver, tag, communicator Double Precision, Intent(in) :: ddata Integer, Intent(in) :: datatype Integer, Intent(out) :: ierr Integer :: testi Double Precision :: testr testi = count if (count < 0 ) then write(*,*) "$$ MPI_Bsend_DST: count<0; count = ",count stop endif if (count > 1) then write(*,*) "$$ MPI_Bsend_DST: count>1; count = ",count stop endif testi = receiver testi = tag testi = communicator testi = datatype testr = ddata ierr = 0 End Subroutine MPI_Bsend_DST Subroutine MPI_Gather_DT ( send_data, send_count, send_datatype, & recv_data, recv_count, recv_datatype, & root, communicator, ierr ) ! MPI_Gather gathers data from all the processes in a communicator. Integer, Intent(in) :: send_count, recv_count Integer, Intent(in) :: root, communicator Double Precision, Intent(in) :: send_data(send_count) Integer, Intent(in) :: send_datatype, recv_datatype Double Precision, Intent(out) :: recv_data(:) Integer, Intent(out) :: ierr Integer :: testi, I Double Precision :: testr testi = send_count testi = recv_count testi = root testi = communicator testi = send_datatype testi = recv_datatype if (send_count < 0) then write(*,*) "$$ MPI_Gather_DT: send_count<0; = ",send_count stop endif do I=1,send_count testr = send_data(I) end do if (recv_count < 0 .or. recv_count > Size(recv_data)) then write(*,*) "$$ MPI_Gather_DT: recv_count<0; or " write(*,*) "$$ MPI_Gather_DT: recv_count>Size(recv_data)." write(*,*) "recv_count = ",recv_count write(*,*) "Size(recv_data) = ", Size(recv_data) stop endif do I=1,Size(recv_data) recv_data(I) = 1 end do ierr = 0 End Subroutine MPI_Gather_DT Subroutine MPI_Scatter_DT ( send_data, send_count, send_datatype, & recv_data, recv_count, recv_datatype, & root, communicator, ierr ) ! MPI_Scatter distributes data from one process to all processes. Integer, Intent(in) :: send_count, recv_count Integer, Intent(in) :: root, communicator Double Precision, Intent(in) :: send_data(:) Integer, Intent(in) :: send_datatype, recv_datatype Double Precision, Intent(out) :: recv_data(:) Integer, Intent(out) :: ierr Integer :: testi, I Double Precision :: testr testi = send_count testi = recv_count testi = root testi = communicator testi = send_datatype testi = recv_datatype if (send_count < 0 .or. send_count > Size(send_data)) then write(*,*) "$$ MPI_Scatter_DT: send_count<0; or " write(*,*) "$$ MPI_Scatter_DT: send_count>Size(send_data)." write(*,*) "send_count = ",send_count write(*,*) "Size(send_data) = ", Size(send_data) stop endif do I=1,Size(send_data) testr = send_data(I) end do if (recv_count < 0 .or. recv_count > Size(recv_data)) then write(*,*) "$$ MPI_Scatter_DT: recv_count<0; or " write(*,*) "$$ MPI_Scatter_DT: recv_count>Size(recv_data)." write(*,*) "recv_count = ",recv_count write(*,*) "Size(recv_data) = ", Size(recv_data) stop endif do I=1,Size(recv_data) recv_data(I) = 1 end do ierr = 0 End Subroutine MPI_Scatter_DT Subroutine MPI_Pack_DT ( ddata, count, datatype, buffer, & buffer_size, & buffer_position, communicator, ierr ) ! MPI_Pack packs data into a buffer. Integer, parameter :: bytes_per_word = 8 Integer, Intent(in) :: count, buffer_size, communicator Double Precision, Intent(in) :: ddata(count) Integer, Intent(in) :: datatype Double Precision, Intent(out) :: buffer(:) Integer, Intent(inout) :: buffer_position Integer, Intent(out) :: ierr Integer :: testi, I, start_word Double Precision :: testr testi = datatype testi = communicator testi = count if (count < 0) then write(*,*) "$$ MPI_Pack_DT: count<0; count = ",count stop endif do I=1,count testr = ddata(I) end do testi = buffer_size if (buffer_size < 0) then write(*,*) "$$ MPI_Pack_DT: buffer_size < 0 = ", & buffer_size stop endif testi = buffer_position if (buffer_position < 0 .or. & buffer_position/bytes_per_word > buffer_size) then write(*,*) "$$ MPI_Pack_DT: buffer_position<0 = ", & "or > buffer_size; buffer_position =", & buffer_position, " buffer_size=", buffer_size stop endif ! if the buffer's dimension in bytes in the calling program ! is >= buffer_size less position, then buffer will hold the ! packed data. if (bytes_per_word*Size(buffer) < buffer_size ) then write(*,*) & "$$ MPI_Pack_DT: buffer_size is larger than dimension ", & "of buffer; buffer_size= ", buffer_size write(*,*) "buffer_position = ", buffer_position write(*,*) "buffer dimension in caller=", Size(buffer) stop endif start_word = buffer_position/bytes_per_word do I=1,count buffer(I + start_word) = ddata(I) buffer_position = buffer_position + bytes_per_word end do ierr = 0 End Subroutine MPI_Pack_DT Subroutine MPI_Unpack_DT ( buffer, buffer_size, buffer_position, & ddata, count, datatype, communicator, ierr ) ! MPI_Unpack unpacks data from a buffer. Integer, parameter :: bytes_per_word = 8 Integer, Intent(in) :: count, buffer_size, communicator Double Precision, Intent(in) :: buffer(:) Integer, Intent(in) :: datatype Double Precision, Intent(out) :: ddata(count) Integer, Intent(inout) :: buffer_position Integer, Intent(out) :: ierr Integer :: testi, I, start_word testi = datatype testi = communicator testi = count if (count < 0) then write(*,*) "$$ MPI_Unpack_DT: count<0; count = ",count stop endif testi = buffer_size if (buffer_size < 0) then write(*,*) "$$ MPI_Unpack_DT: buffer_size < 0 = ", & buffer_size stop endif testi = buffer_position if (buffer_position < 0 .or. & buffer_position/bytes_per_word > buffer_size) then write(*,*) "$$ MPI_Pack_DT: buffer_position<0 = ", & "or > buffer_size; buffer_position =", & buffer_position, " buffer_size=", buffer_size stop endif if (bytes_per_word*Size(buffer) < buffer_size) then write(*,*) & "$$ MPI_Unpack_DT: buffer_size is larger than dimension ", & "of buffer; buffer_size= ", buffer_size write(*,*) "buffer_position = ", buffer_position write(*,*) "buffer dimension in caller=", Size(buffer) stop endif start_word = buffer_position/bytes_per_word - count do I=1,count ddata(I) = buffer(I + start_word) end do buffer_position = buffer_position - bytes_per_word*count ierr = 0 End Subroutine MPI_Unpack_DT Subroutine MPI_Recv_DT ( ddata, count, datatype, sender, tag, & communicator, sstatus, ierr ) ! MPI_Recv receives data from another process within a communicator. Integer, Intent(in) :: count, sender, tag, communicator ! In FORTRAN a single status object is an array of integers. Integer, Intent(out) :: sstatus(:), ierr Double Precision, Intent(out) :: ddata(count) Integer, Intent(in) :: datatype Integer :: testi, I testi = count testi = datatype testi = sender testi = tag testi = communicator sstatus = 1 if (count < 0) then write(*,*) "$$ MPI_Recv_DT: count<0; count = ",count stop endif do I=1,count ddata(I) = 1.0D0 end do ierr = 0 End Subroutine MPI_Recv_DT Subroutine MPI_Recv_DST ( ddata, count, datatype, sender, tag, & communicator, sstatus, ierr ) ! MPI_Recv receives data from another process within a communicator. Integer, Intent(in) :: count, sender, tag, communicator Double Precision, Intent(out) :: ddata Integer, Intent(in) :: datatype ! In FORTRAN a single status object is an array of integers. Integer, Intent(out):: sstatus(:), ierr Integer :: testi testi = count if (count < 0) then write(*,*) "$$ MPI_Recv_DST: count<0; count = ",count stop endif if (count > 1) then write(*,*) "$$ MPI_Recv_DST: count>1; count = ",count stop endif testi = datatype testi = sender testi = tag testi = communicator sstatus = 1 ddata = 1.0D0 ierr = 0 End Subroutine MPI_Recv_DST Subroutine MPI_Irecv_DT ( ddata, count, datatype, sender, tag, & communicator, request, ierr ) ! MPI_Irecv receives data from another process within a communicator. Integer, Intent(in) :: count, sender, tag, communicator Integer, Intent(out) :: request(:), ierr Double Precision, Intent(out) :: ddata(count) Integer, Intent(in) :: datatype Integer :: testi, I testi = count if (count < 0) then write(*,*) "$$ MPI_Irecv_DT: count<0; count = ",count stop endif testi = datatype testi = sender testi = tag testi = communicator request = 1 do I=1,count ddata(I) = 1.0D0 end do ierr = 0 End Subroutine MPI_Irecv_DT Subroutine MPI_Irecv_DST ( ddata, count, datatype, sender, tag, & communicator, request, ierr ) ! MPI_Irecv receives data from another process within a communicator. Integer, Intent(in) :: count, sender, tag, communicator Double Precision, Intent(out) :: ddata Integer, Intent(in) :: datatype Integer, Intent(out):: request(:), ierr Integer :: testi if (count < 0) then write(*,*) "$$ MPI_Irecv_DST: count<0; count = ",count stop endif if (count > 1) then write(*,*) "$$ MPI_Irecv_DST: count>1; count = ",count stop endif testi = count testi = datatype testi = sender testi = tag testi = communicator request = 1 ddata = 1.0D0 ierr = 0 End Subroutine MPI_Irecv_DST Subroutine MPI_Receive_DT ( ddata, count, datatype, sender, tag, & communicator, sstatus, ierr ) ! MPI_Receive is not listed; probably a misnomer for mpi_recv. Integer, Intent(in) :: count, tag, communicator, sstatus(:) Double Precision, Intent(in) :: ddata(count) Integer, Intent(in) :: datatype Integer, Intent(out) :: sender(:), ierr Double Precision :: testr Integer :: testi, I testi = count testi = datatype sender = 1 testi = tag testi = communicator if (count < 0) then write(*,*) "$$ MPI_Receive_DT: count<0; count = ",count stop endif do I=1,Size(sstatus) testi = sstatus(I) end do do I=1,count testr = ddata(I) end do ierr = 0 End Subroutine MPI_Receive_DT Subroutine MPI_Send_DT ( ddata, count, datatype, receiver, tag, & communicator, ierr ) ! MPI_Send sends data from one process to another within a ! communicator. Integer, Intent(in) :: count, receiver, tag, communicator Double Precision, Intent(in) :: ddata(count) Integer, Intent(in) :: datatype Integer, Intent(out) :: ierr Double Precision :: testr Integer :: testi, I testi = count testi = datatype testi = receiver testi = tag testi = communicator testi = receiver if (count < 0) then write(*,*) "$$ MPI_Send_DT: count<0; count = ",count stop endif do I=1,count testr = ddata(I) end do ierr = 0 End Subroutine MPI_Send_DT Subroutine MPI_Send_DST ( ddata, count, datatype, receiver, tag, & communicator, ierr ) ! MPI_Send sends data from one process to another within a ! communicator. Integer, Intent(in) :: count, receiver, tag, communicator Double Precision, Intent(in) :: ddata Integer, Intent(in) :: datatype Integer, Intent(out) :: ierr Integer :: testi Double Precision :: testr testi = count if (count < 0) then write(*,*) "$$ MPI_Send_DST: count<0; count = ",count stop endif if (count > 1) then write(*,*) "$$ MPI_Send_DST: count>1; count = ",count stop endif testi = datatype testi = receiver testi = tag testi = communicator testi = receiver testr = ddata ierr = 0 End Subroutine MPI_Send_DST Subroutine MPI_Isend_DT ( ddata, count, datatype, receiver, tag, & communicator, request, ierr ) ! MPI_Isend is a nonblocking send of data. Integer, Intent(in) :: count, receiver, tag, communicator Double Precision, Intent(in) :: ddata(count) Integer, Intent(in) :: datatype Integer, Intent(out) :: ierr, request(:) Integer :: testi, I Double Precision :: testr testi = count testi = datatype testi = receiver testi = tag testi = communicator testi = receiver if (count < 0) then write(*,*) "$$ MPI_Send_R: count<0; count = ",count stop endif do I=1,count testr = ddata(I) end do request = 1 ierr = 0 End Subroutine MPI_Isend_DT Subroutine MPI_Isend_DST ( ddata, count, datatype, receiver, tag, & communicator, request, ierr ) ! MPI_Isend is a nonblocking send of data. Integer, Intent(in) :: count, receiver, tag, communicator Double Precision, Intent(in) :: ddata Integer, Intent(in) :: datatype Integer, Intent(out) :: ierr, request(:) Integer :: testi Double Precision :: testr testi = count if (count < 0) then write(*,*) "$$ MPI_Isend_DST: count<0; count = ",count stop endif if (count > 1) then write(*,*) "$$ MPI_Isend_DST: count>1; count = ",count stop endif testi = datatype testi = receiver testi = tag testi = communicator testr = ddata request = 1 ierr = 0 End Subroutine MPI_Isend_DST Subroutine MPI_Reduce_DT ( local_data, global_data, count, & datatype, operation, receiver, communicator, ierr ) ! MPI_Reduce carries out a reduction operation (such as sum, maximum, ! or product). Integer, Intent(in) :: count, operation, receiver Integer, Intent(in) :: communicator Double Precision, Intent(in) :: local_data(count) Integer, Intent(in) :: datatype Double Precision, Intent(out) :: global_data Integer, Intent(out) :: ierr Double Precision testr Integer :: I, testi testi = count testi = datatype testi = receiver testi = communicator if (count < 0) then write(*,*) "$$ MPI_Reduce_DT: count<0; count = ",count stop endif do I=1,count testr = local_data(I) end do testi = operation ! Temporarily assumes operation is Sum. global_data = SUM(local_data) ierr = 0 End Subroutine MPI_Reduce_DT Subroutine MPI_Reduce_DST ( local_data, global_data, count, & datatype, operation, receiver, communicator, ierr ) ! MPI_Reduce carries out a reduction operation (such as sum, maximum, ! or product). Integer, Intent(in):: count, receiver, operation Integer, Intent(in):: communicator Double Precision, Intent(in) :: local_data Integer, Intent(in) :: datatype Double Precision, Intent(out) :: global_data Integer, Intent(out) :: ierr Double Precision :: testr Integer :: testi testi = count if (count < 0) then write(*,*) "$$ MPI_Reduce_DST: count<0; count = ",count stop endif if (count > 1) then write(*,*) "$$ MPI_Reduce_DST: count>1; count = ",count stop endif testi = datatype testi = receiver testi = communicator testr = local_data testi = operation global_data = local_data ierr = 0 End Subroutine MPI_Reduce_DST End Module mpiDPT Receive_DT: count<0; count = ",count stop endif do I=1,Size(sstatus) testi = sstatus(I) end do do I=1,count testr = ddata(I) end do ierr = 0 End Subroutine MPI_Receive_DT Subroutine MPI_Send_DT ( ddata, count, datatype, receiver, tag, & communicator, ierr ) ! MPI_Send sends data from one process to another within a ! communicator. Integer, Intent(in) :: count, receiver, tag, communicator Double Precision, Intent(in) :: ddata(count) Integer, Intent(in) :: datatype Integer, Intent(out) :: ierr Double Precision :: testr Integer :: testi, I testi = count testi = datatype testi = receiver testi = tag testi = communicator testi = receiver if (count < 0) then write(*,*) "$$ MPI_Send_DT: count<0; count = ",count stop endif do I=1,count testr = ddata(I) end do ierr = 0 End Subroutine MPI_Send_DT Subroutine MPI_Send_DST ( ddata, count, datatype, receiver, tag, & communicator, ierr ) ! MPI_Send sends data from one process to another within a ! communicator. Integer, Intent(in) :: count, receiver, tag, communicator Double Precision, Intent(in) :: ddata Integer, Intent(in) :: datatype Integer, Intent(out) :: ierr Integer :: testi Double Precision :: testr testi = count if (count < 0) then write(*,*) "$$ MPI_Send_DST: count<0; count = ",count stop endif if (count > 1) then write(*,*) "$$ MPI_Send_DST: count>1; count = ",count stop endif testi = datatype testi = receiver testi = tag testi = communicator testi = receiver testr = ddata ierr = 0 End Subroutine MPI_Send_DST Subroutine MPI_Isend_DT ( ddata, count, datatype, receiver, tag, & communicator, request, ierr ) ! MPI_Isend is a nonblocking send of data. Integer, Intent(in) :: count, receiver, tag, communicator Double Precision, Intent(in) :: ddata(count) Integer, Intent(in) :: datatype Integer, Intent(out) :: ierr, request(:) Integer :: testi, I Double Precision :: testr testi = count testi = datatype testi = receiver testi = tag testi = communicator testi = receiver if (count < 0) then write(*,*) "$$ MPI_Send_R: count<0; count = ",count stop endif do I=1,count testr = ddata(I) end do request = 1 ierr = 0 End Subroutine MPI_Isend_DT Subroutine MPI_Isend_DST ( ddata, count, datatype, receiver, tag, & communicator, request, ierr ) ! MPI_Isend is a nonblocking send of data. Integer, Intent(in) :: count, receiver, tag, communicator Double Precision, Intent(in) :: ddata Integer, Intent(in) :: datatype Integer, Intent(out) :: ierr, request(:) Integer :: testi Double Precision :: testr testi = count if (count < 0) then write(*,*) "$$ MPI_Isend_DST: count<0; count = ",count stop endif if (count > 1) then write(*,*) "$$ MPI_Isend_DST: count>1; count = ",count stop endif testi = datatype testi = receiver testi = tag testi = communicator testr = ddata request = 1 ierr = 0 End Subroutine MPI_Isend_DST Subroutine MPI_Reduce_DT ( local_data, global_data, count, & datatype, operation, receiver, communicator, ierr ) ! MPI_Reduce carries out a reduction operation (such as sum, maximum, ! or product). Integer, Intent(in) :: count, operation, receiver Integer, Intent(in) :: communicator Double Precision, Intent(in) :: local_data(count) Integer, Intent(in) :: datatype Double Precision, Intent(out) :: global_data Integer, Intent(out) :: ierr Double Precision testr Integer :: I, testi testi = count testi = datatype testi = receiver testi = communicator if (count < 0) then write(*,*) "$$ MPI_Reduce_DT: count<0; count = ",count stop endif do I=1,count testr = local_data(I) end do testi = operation ! Temporarily assumes operation is Sum. global_data = SUM(local_data) ierr = 0 End Subroutine MPI_Reduce_DT Subroutine MPI_Reduce_DST ( local_data, global_data, count, & datatype, operation, receiver, communicator, ierr ) ! MPI_Reduce carries out a reduction operation (such as sum, maximum, ! or product). Integer, Intent(in):: count, receiver, operation Integer, Intent(in):: communicator Double Precision, Intent(in) :: local_data Integer, Intent(in) :: datatype Double Precision, Intent(out) :: global_data Integer, Intent(out) :: ierr Double Precision :: testr Integer :: testi testi = count if (count < 0) then write(*,*) "$$ MPI_Reduce_DST: count<0; count = ",count stop endif if (count > 1) then write(*,*) "$$ MPI_Reduce_DST: count>1; count = ",count stop endif testi = datatype testi = receiver testi = communicator testr = local_data testi = operation global_data = local_data ierr = 0 End Subroutine MPI_Reduce_DST End Module mpiDPT