\hypertarget{interfacemom__coms_1_1efp__sum__across__pes}{}\section{mom\+\_\+coms\+:\+:efp\+\_\+sum\+\_\+across\+\_\+pes Interface Reference}
\label{interfacemom__coms_1_1efp__sum__across__pes}\index{mom\+\_\+coms\+::efp\+\_\+sum\+\_\+across\+\_\+pes@{mom\+\_\+coms\+::efp\+\_\+sum\+\_\+across\+\_\+pes}}


\subsection{Detailed Description}
Sum a value or 1-\/d array of values across processors, returning the sums in place. 

Definition at line 64 of file M\+O\+M\+\_\+coms.\+F90.

\subsection*{Private functions}
\begin{DoxyCompactItemize}
\item 
subroutine \mbox{\hyperlink{interfacemom__coms_1_1efp__sum__across__pes_ac17cd77a331ded080c75c9a99df5220d}{efp\+\_\+list\+\_\+sum\+\_\+across\+\_\+pes}} (E\+F\+Ps, nval, errors)
\begin{DoxyCompactList}\small\item\em This subroutine does a sum across P\+Es of a list of E\+FP variables, returning the sums in place, with all overflows carried. \end{DoxyCompactList}\item 
subroutine \mbox{\hyperlink{interfacemom__coms_1_1efp__sum__across__pes_a1c7e1a93b9abf3c27d8bc7530b587754}{efp\+\_\+val\+\_\+sum\+\_\+across\+\_\+pes}} (E\+FP, error)
\begin{DoxyCompactList}\small\item\em This subroutine does a sum across P\+Es of an E\+FP variable, returning the sums in place, with all overflows carried. \end{DoxyCompactList}\end{DoxyCompactItemize}


\subsection{Detailed Description}
Sum a value or 1-\/d array of values across processors, returning the sums in place. 

Definition at line 64 of file M\+O\+M\+\_\+coms.\+F90.



\subsection{Functions and subroutines}
\mbox{\Hypertarget{interfacemom__coms_1_1efp__sum__across__pes_ac17cd77a331ded080c75c9a99df5220d}\label{interfacemom__coms_1_1efp__sum__across__pes_ac17cd77a331ded080c75c9a99df5220d}} 
\index{mom\+\_\+coms\+::efp\+\_\+sum\+\_\+across\+\_\+pes@{mom\+\_\+coms\+::efp\+\_\+sum\+\_\+across\+\_\+pes}!efp\+\_\+list\+\_\+sum\+\_\+across\+\_\+pes@{efp\+\_\+list\+\_\+sum\+\_\+across\+\_\+pes}}
\index{efp\+\_\+list\+\_\+sum\+\_\+across\+\_\+pes@{efp\+\_\+list\+\_\+sum\+\_\+across\+\_\+pes}!mom\+\_\+coms\+::efp\+\_\+sum\+\_\+across\+\_\+pes@{mom\+\_\+coms\+::efp\+\_\+sum\+\_\+across\+\_\+pes}}
\subsubsection{\texorpdfstring{efp\+\_\+list\+\_\+sum\+\_\+across\+\_\+pes()}{efp\_list\_sum\_across\_pes()}}
{\footnotesize\ttfamily subroutine mom\+\_\+coms\+::efp\+\_\+sum\+\_\+across\+\_\+pes\+::efp\+\_\+list\+\_\+sum\+\_\+across\+\_\+pes (\begin{DoxyParamCaption}\item[{type(\mbox{\hyperlink{structmom__coms_1_1efp__type}{efp\+\_\+type}}), dimension(\+:), intent(inout)}]{E\+F\+Ps,  }\item[{integer, intent(in)}]{nval,  }\item[{logical, dimension(\+:), intent(out), optional}]{errors }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [private]}}



This subroutine does a sum across P\+Es of a list of E\+FP variables, returning the sums in place, with all overflows carried. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\tt in,out}  & {\em efps} & The list of extended fixed point numbers\\
\hline
\mbox{\tt in}  & {\em nval} & The number of values being summed.\\
\hline
\mbox{\tt out}  & {\em errors} & A list of error flags for each sum \\
\hline
\end{DoxyParams}


Definition at line 789 of file M\+O\+M\+\_\+coms.\+F90.


\begin{DoxyCode}
789   \textcolor{keywordtype}{type}(EFP\_type), \textcolor{keywordtype}{dimension(:)}, &
790               \textcolor{keywordtype}{intent(inout)} :: EFPs\textcolor{comment}{   !< The list of extended fixed point numbers}
791 \textcolor{comment}{                                      !! being summed across PEs.}
792   \textcolor{keywordtype}{integer},    \textcolor{keywordtype}{intent(in)}    :: nval\textcolor{comment}{   !< The number of values being summed.}
793   \textcolor{keywordtype}{logical}, \textcolor{keywordtype}{dimension(:)}, &
794            \textcolor{keywordtype}{optional}, \textcolor{keywordtype}{intent(out)}   :: errors\textcolor{comment}{ !< A list of error flags for each sum}
795 
796   \textcolor{comment}{!   This subroutine does a sum across PEs of a list of EFP variables,}
797   \textcolor{comment}{! returning the sums in place, with all overflows carried.}
798 
799   \textcolor{keywordtype}{integer(kind=8)}, \textcolor{keywordtype}{dimension(ni,nval)} :: ints
800   \textcolor{keywordtype}{integer(kind=8)} :: prec\_error
801   \textcolor{keywordtype}{logical} :: error\_found
802   \textcolor{keywordtype}{character(len=256)} :: mesg
803   \textcolor{keywordtype}{integer} :: i, n
804 
805   \textcolor{keywordflow}{if} (num\_pes() > max\_count\_prec) \textcolor{keyword}{call }mom\_error(fatal, &
806     \textcolor{stringliteral}{"reproducing\_sum: Too many processors are being used for the value of "}//&
807     \textcolor{stringliteral}{"prec.  Reduce prec to (2^63-1)/num\_PEs."})
808 
809   prec\_error = (2\_8**62 + (2\_8**62 - 1)) / num\_pes()
810   \textcolor{comment}{! overflow\_error is an overflow error flag for the whole module.}
811   overflow\_error = .false. ; error\_found = .false.
812 
813   \textcolor{keywordflow}{do} i=1,nval ; \textcolor{keywordflow}{do} n=1,ni ; ints(n,i) = efps(i)%v(n) ;\textcolor{keywordflow}{ enddo} ;\textcolor{keywordflow}{ enddo}
814 
815   \textcolor{keyword}{call }sum\_across\_pes(ints(:,:), ni*nval)
816 
817   \textcolor{keywordflow}{if} (\textcolor{keyword}{present}(errors)) errors(:) = .false.
818   \textcolor{keywordflow}{do} i=1,nval
819     overflow\_error = .false.
820     \textcolor{keyword}{call }carry\_overflow(ints(:,i), prec\_error)
821     \textcolor{keywordflow}{do} n=1,ni ; efps(i)%v(n) = ints(n,i) ;\textcolor{keywordflow}{ enddo}
822     \textcolor{keywordflow}{if} (\textcolor{keyword}{present}(errors)) errors(i) = overflow\_error
823     \textcolor{keywordflow}{if} (overflow\_error) \textcolor{keywordflow}{then}
824       \textcolor{keyword}{write} (mesg,\textcolor{stringliteral}{'("EFP\_list\_sum\_across\_PEs error at ",i6," val was ",ES12.6, ", prec\_error = ",ES12.6)'}) 
      &
825              i, efp\_to\_real(efps(i)), \textcolor{keywordtype}{real}(prec\_error)
826       \textcolor{keyword}{call }mom\_error(warning, mesg)
827 \textcolor{keywordflow}{    endif}
828     error\_found = error\_found .or. overflow\_error
829 \textcolor{keywordflow}{  enddo}
830   \textcolor{keywordflow}{if} (error\_found .and. .not.(\textcolor{keyword}{present}(errors))) \textcolor{keywordflow}{then}
831     \textcolor{keyword}{call }mom\_error(fatal, \textcolor{stringliteral}{"Overflow in EFP\_list\_sum\_across\_PEs."})
832 \textcolor{keywordflow}{  endif}
833 
\end{DoxyCode}
\mbox{\Hypertarget{interfacemom__coms_1_1efp__sum__across__pes_a1c7e1a93b9abf3c27d8bc7530b587754}\label{interfacemom__coms_1_1efp__sum__across__pes_a1c7e1a93b9abf3c27d8bc7530b587754}} 
\index{mom\+\_\+coms\+::efp\+\_\+sum\+\_\+across\+\_\+pes@{mom\+\_\+coms\+::efp\+\_\+sum\+\_\+across\+\_\+pes}!efp\+\_\+val\+\_\+sum\+\_\+across\+\_\+pes@{efp\+\_\+val\+\_\+sum\+\_\+across\+\_\+pes}}
\index{efp\+\_\+val\+\_\+sum\+\_\+across\+\_\+pes@{efp\+\_\+val\+\_\+sum\+\_\+across\+\_\+pes}!mom\+\_\+coms\+::efp\+\_\+sum\+\_\+across\+\_\+pes@{mom\+\_\+coms\+::efp\+\_\+sum\+\_\+across\+\_\+pes}}
\subsubsection{\texorpdfstring{efp\+\_\+val\+\_\+sum\+\_\+across\+\_\+pes()}{efp\_val\_sum\_across\_pes()}}
{\footnotesize\ttfamily subroutine mom\+\_\+coms\+::efp\+\_\+sum\+\_\+across\+\_\+pes\+::efp\+\_\+val\+\_\+sum\+\_\+across\+\_\+pes (\begin{DoxyParamCaption}\item[{type(\mbox{\hyperlink{structmom__coms_1_1efp__type}{efp\+\_\+type}}), intent(inout)}]{E\+FP,  }\item[{logical, intent(out), optional}]{error }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [private]}}



This subroutine does a sum across P\+Es of an E\+FP variable, returning the sums in place, with all overflows carried. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\tt in,out}  & {\em efp} & The extended fixed point numbers being summed across P\+Es.\\
\hline
\mbox{\tt out}  & {\em error} & An error flag for this sum \\
\hline
\end{DoxyParams}


Definition at line 839 of file M\+O\+M\+\_\+coms.\+F90.


\begin{DoxyCode}
839   \textcolor{keywordtype}{type}(EFP\_type),  \textcolor{keywordtype}{intent(inout)} :: EFP\textcolor{comment}{   !< The extended fixed point numbers}
840 \textcolor{comment}{                                          !! being summed across PEs.}
841   \textcolor{keywordtype}{logical}, \textcolor{keywordtype}{optional}, \textcolor{keywordtype}{intent(out)} :: error\textcolor{comment}{ !< An error flag for this sum}
842 
843   \textcolor{comment}{!   This subroutine does a sum across PEs of a list of EFP variables,}
844   \textcolor{comment}{! returning the sums in place, with all overflows carried.}
845 
846   \textcolor{keywordtype}{integer(kind=8)}, \textcolor{keywordtype}{dimension(ni)} :: ints
847   \textcolor{keywordtype}{integer(kind=8)} :: prec\_error
848   \textcolor{keywordtype}{logical} :: error\_found
849   \textcolor{keywordtype}{character(len=256)} :: mesg
850   \textcolor{keywordtype}{integer} :: n
851 
852   \textcolor{keywordflow}{if} (num\_pes() > max\_count\_prec) \textcolor{keyword}{call }mom\_error(fatal, &
853     \textcolor{stringliteral}{"reproducing\_sum: Too many processors are being used for the value of "}//&
854     \textcolor{stringliteral}{"prec.  Reduce prec to (2^63-1)/num\_PEs."})
855 
856   prec\_error = (2\_8**62 + (2\_8**62 - 1)) / num\_pes()
857   \textcolor{comment}{! overflow\_error is an overflow error flag for the whole module.}
858   overflow\_error = .false. ; error\_found = .false.
859 
860   \textcolor{keywordflow}{do} n=1,ni ; ints(n) = efp%v(n) ;\textcolor{keywordflow}{ enddo}
861 
862   \textcolor{keyword}{call }sum\_across\_pes(ints(:), ni)
863 
864   \textcolor{keywordflow}{if} (\textcolor{keyword}{present}(error)) error = .false.
865 
866   overflow\_error = .false.
867   \textcolor{keyword}{call }carry\_overflow(ints(:), prec\_error)
868   \textcolor{keywordflow}{do} n=1,ni ; efp%v(n) = ints(n) ;\textcolor{keywordflow}{ enddo}
869   \textcolor{keywordflow}{if} (\textcolor{keyword}{present}(error)) error = overflow\_error
870   \textcolor{keywordflow}{if} (overflow\_error) \textcolor{keywordflow}{then}
871     \textcolor{keyword}{write} (mesg,\textcolor{stringliteral}{'("EFP\_val\_sum\_across\_PEs error val was ",ES12.6, ", prec\_error = ",ES12.6)'}) &
872            efp\_to\_real(efp), \textcolor{keywordtype}{real}(prec\_error)
873     \textcolor{keyword}{call }mom\_error(warning, mesg)
874 \textcolor{keywordflow}{  endif}
875   error\_found = error\_found .or. overflow\_error
876 
877   \textcolor{keywordflow}{if} (error\_found .and. .not.(\textcolor{keyword}{present}(error))) \textcolor{keywordflow}{then}
878     \textcolor{keyword}{call }mom\_error(fatal, \textcolor{stringliteral}{"Overflow in EFP\_val\_sum\_across\_PEs."})
879 \textcolor{keywordflow}{  endif}
880 
\end{DoxyCode}


The documentation for this interface was generated from the following file\+:\begin{DoxyCompactItemize}
\item 
/home/cermak/src/\+M\+O\+M6.\+devrob/src/framework/M\+O\+M\+\_\+coms.\+F90\end{DoxyCompactItemize}
