|
Packit Service |
c5cf8c |
! -*- Mode: Fortran; -*-
|
|
Packit Service |
c5cf8c |
!
|
|
Packit Service |
c5cf8c |
!
|
|
Packit Service |
c5cf8c |
! (C) 2012 by Argonne National Laboratory.
|
|
Packit Service |
c5cf8c |
! See COPYRIGHT in top-level directory.
|
|
Packit Service |
c5cf8c |
!
|
|
Packit Service |
c5cf8c |
! This is a MPI-2 version of baseattr2f90.f90 which uses COMM_GET_ATTR
|
|
Packit Service |
c5cf8c |
! instead of ATTR_GET, using an address-sized integer instead of
|
|
Packit Service |
c5cf8c |
! an INTEGER.
|
|
Packit Service |
c5cf8c |
program main
|
|
Packit Service |
c5cf8c |
use mpi
|
|
Packit Service |
c5cf8c |
integer ierr, errs
|
|
Packit Service |
c5cf8c |
logical flag
|
|
Packit Service |
c5cf8c |
integer commsize, commrank
|
|
Packit Service |
c5cf8c |
integer (KIND=MPI_ADDRESS_KIND) value
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
errs = 0
|
|
Packit Service |
c5cf8c |
call mtest_init( ierr )
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
call mpi_comm_size( MPI_COMM_WORLD, commsize, ierr )
|
|
Packit Service |
c5cf8c |
call mpi_comm_rank( MPI_COMM_WORLD, commrank, ierr )
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
call mpi_comm_get_attr( MPI_COMM_WORLD, MPI_TAG_UB, value, &
|
|
Packit Service |
c5cf8c |
& flag, ierr )
|
|
Packit Service |
c5cf8c |
if (.not. flag) then
|
|
Packit Service |
c5cf8c |
errs = errs + 1
|
|
Packit Service |
c5cf8c |
print *, "Could not get TAG_UB"
|
|
Packit Service |
c5cf8c |
else
|
|
Packit Service |
c5cf8c |
if (value .lt. 32767) then
|
|
Packit Service |
c5cf8c |
errs = errs + 1
|
|
Packit Service |
c5cf8c |
print *, "Got too-small value (", value, ") for TAG_UB"
|
|
Packit Service |
c5cf8c |
endif
|
|
Packit Service |
c5cf8c |
endif
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
call mpi_comm_get_attr( MPI_COMM_WORLD, MPI_HOST, value, flag&
|
|
Packit Service |
c5cf8c |
&, ierr )
|
|
Packit Service |
c5cf8c |
if (.not. flag) then
|
|
Packit Service |
c5cf8c |
errs = errs + 1
|
|
Packit Service |
c5cf8c |
print *, "Could not get HOST"
|
|
Packit Service |
c5cf8c |
else
|
|
Packit Service |
c5cf8c |
if ((value .lt. 0 .or. value .ge. commsize) .and. value .ne. &
|
|
Packit Service |
c5cf8c |
& MPI_PROC_NULL) then
|
|
Packit Service |
c5cf8c |
errs = errs + 1
|
|
Packit Service |
c5cf8c |
print *, "Got invalid value ", value, " for HOST"
|
|
Packit Service |
c5cf8c |
endif
|
|
Packit Service |
c5cf8c |
endif
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
call mpi_comm_get_attr( MPI_COMM_WORLD, MPI_IO, value, flag,&
|
|
Packit Service |
c5cf8c |
& ierr )
|
|
Packit Service |
c5cf8c |
if (.not. flag) then
|
|
Packit Service |
c5cf8c |
errs = errs + 1
|
|
Packit Service |
c5cf8c |
print *, "Could not get IO"
|
|
Packit Service |
c5cf8c |
else
|
|
Packit Service |
c5cf8c |
if ((value .lt. 0 .or. value .ge. commsize) .and. value .ne. &
|
|
Packit Service |
c5cf8c |
& MPI_ANY_SOURCE .and. value .ne. MPI_PROC_NULL) then
|
|
Packit Service |
c5cf8c |
errs = errs + 1
|
|
Packit Service |
c5cf8c |
print *, "Got invalid value ", value, " for IO"
|
|
Packit Service |
c5cf8c |
endif
|
|
Packit Service |
c5cf8c |
endif
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
call mpi_comm_get_attr( MPI_COMM_WORLD, MPI_WTIME_IS_GLOBAL,&
|
|
Packit Service |
c5cf8c |
& value, flag, ierr )
|
|
Packit Service |
c5cf8c |
if (flag) then
|
|
Packit Service |
c5cf8c |
! Wtime need not be set
|
|
Packit Service |
c5cf8c |
if (value .lt. 0 .or. value .gt. 1) then
|
|
Packit Service |
c5cf8c |
errs = errs + 1
|
|
Packit Service |
c5cf8c |
print *, "Invalid value for WTIME_IS_GLOBAL (got ", value, &
|
|
Packit Service |
c5cf8c |
& ")"
|
|
Packit Service |
c5cf8c |
endif
|
|
Packit Service |
c5cf8c |
endif
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
call mpi_comm_get_attr( MPI_COMM_WORLD, MPI_APPNUM, value,&
|
|
Packit Service |
c5cf8c |
& flag, ierr )
|
|
Packit Service |
c5cf8c |
! appnum need not be set
|
|
Packit Service |
c5cf8c |
if (flag) then
|
|
Packit Service |
c5cf8c |
if (value .lt. 0) then
|
|
Packit Service |
c5cf8c |
errs = errs + 1
|
|
Packit Service |
c5cf8c |
print *, "MPI_APPNUM is defined as ", value, &
|
|
Packit Service |
c5cf8c |
& " but must be nonnegative"
|
|
Packit Service |
c5cf8c |
endif
|
|
Packit Service |
c5cf8c |
endif
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
call mpi_comm_get_attr( MPI_COMM_WORLD, MPI_UNIVERSE_SIZE,&
|
|
Packit Service |
c5cf8c |
& value, flag, ierr )
|
|
Packit Service |
c5cf8c |
! MPI_UNIVERSE_SIZE need not be set
|
|
Packit Service |
c5cf8c |
if (flag) then
|
|
Packit Service |
c5cf8c |
if (value .lt. commsize) then
|
|
Packit Service |
c5cf8c |
errs = errs + 1
|
|
Packit Service |
c5cf8c |
print *, "MPI_UNIVERSE_SIZE = ", value, &
|
|
Packit Service |
c5cf8c |
& ", less than comm world (", commsize, ")"
|
|
Packit Service |
c5cf8c |
endif
|
|
Packit Service |
c5cf8c |
endif
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
call mpi_comm_get_attr( MPI_COMM_WORLD, MPI_LASTUSEDCODE,&
|
|
Packit Service |
c5cf8c |
& value, flag, ierr )
|
|
Packit Service |
c5cf8c |
! Last used code must be defined and >= MPI_ERR_LASTCODE
|
|
Packit Service |
c5cf8c |
if (flag) then
|
|
Packit Service |
c5cf8c |
if (value .lt. MPI_ERR_LASTCODE) then
|
|
Packit Service |
c5cf8c |
errs = errs + 1
|
|
Packit Service |
c5cf8c |
print *, "MPI_LASTUSEDCODE points to an integer (", &
|
|
Packit Service |
c5cf8c |
& MPI_ERR_LASTCODE, ") smaller than MPI_ERR_LASTCODE (", &
|
|
Packit Service |
c5cf8c |
& value, ")"
|
|
Packit Service |
c5cf8c |
endif
|
|
Packit Service |
c5cf8c |
else
|
|
Packit Service |
c5cf8c |
errs = errs + 1
|
|
Packit Service |
c5cf8c |
print *, "MPI_LASTUSECODE is not defined"
|
|
Packit Service |
c5cf8c |
endif
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
call MTEST_Finalize( errs )
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
end
|