\hypertarget{interfacemom__coms_1_1efp__sum__across__pes}{}\doxysection{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}}


\doxysubsection{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.

\doxysubsection*{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}


\doxysubsection{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.



\doxysubsection{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}}
\doxysubsubsection{\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{\texttt{ in,out}}  & {\em efps} & The list of extended fixed point numbers \\
\hline
\mbox{\texttt{ in}}  & {\em nval} & The number of values being summed. \\
\hline
\mbox{\texttt{ out}}  & {\em errors} & A list of error flags for each sum \\
\hline
\end{DoxyParams}


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


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


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


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