\hypertarget{namespacemom__write__cputime}{}\section{mom\+\_\+write\+\_\+cputime Module Reference}
\label{namespacemom__write__cputime}\index{mom\+\_\+write\+\_\+cputime@{mom\+\_\+write\+\_\+cputime}}


\subsection{Detailed Description}
A module to monitor the overall C\+PU time used by M\+O\+M6 and project when to stop the model. 

By Robert Hallberg, May 2006.

This file contains the subroutine (write\+\_\+cputime) that writes the summed C\+PU time across all processors to an output file. In addition, write\+\_\+cputime estimates how many more time steps can be taken before 95\% of the available C\+PU time is used, so that the model can be checkpointed at that time. \subsection*{Data Types}
\begin{DoxyCompactItemize}
\item 
type \hyperlink{structmom__write__cputime_1_1write__cputime__cs}{write\+\_\+cputime\+\_\+cs}
\begin{DoxyCompactList}\small\item\em A control structure that regulates the writing of C\+PU time. \end{DoxyCompactList}\end{DoxyCompactItemize}
\subsection*{Functions/\+Subroutines}
\begin{DoxyCompactItemize}
\item 
subroutine, public \hyperlink{namespacemom__write__cputime_aa95b991e5550816440480e52a61a50ee}{write\+\_\+cputime\+\_\+start\+\_\+clock} (CS)
\begin{DoxyCompactList}\small\item\em Evaluate the C\+PU time returned by S\+Y\+S\+T\+E\+M\+\_\+\+C\+L\+O\+CK at the start of a run. \end{DoxyCompactList}\item 
subroutine, public \hyperlink{namespacemom__write__cputime_a0228cbfaec6f37997e2fd42124d87fda}{mom\+\_\+write\+\_\+cputime\+\_\+init} (param\+\_\+file, directory, Input\+\_\+start\+\_\+time, CS)
\begin{DoxyCompactList}\small\item\em Initialize the M\+O\+M\+\_\+write\+\_\+cputime module. \end{DoxyCompactList}\item 
subroutine, public \hyperlink{namespacemom__write__cputime_a9e65987c6c974dd7c1c5021239f7df90}{mom\+\_\+write\+\_\+cputime\+\_\+end} (CS)
\begin{DoxyCompactList}\small\item\em Close the M\+O\+M\+\_\+write\+\_\+cputime module. \end{DoxyCompactList}\item 
subroutine, public \hyperlink{namespacemom__write__cputime_a4a996420163b5e4985b83ba03652b69d}{write\+\_\+cputime} (day, n, CS, nmax, call\+\_\+end)
\begin{DoxyCompactList}\small\item\em This subroutine assesses how much C\+PU time the model has taken and determines how long the model should be run before it saves a restart file and stops itself. Optionally this may also be used to trigger this module\textquotesingle{}s end routine. \end{DoxyCompactList}\end{DoxyCompactItemize}
\subsection*{Variables}
\begin{DoxyCompactItemize}
\item 
\mbox{\Hypertarget{namespacemom__write__cputime_a37ecb378297ff61d70e35b0b295a214e}\label{namespacemom__write__cputime_a37ecb378297ff61d70e35b0b295a214e}} 
integer \hyperlink{namespacemom__write__cputime_a37ecb378297ff61d70e35b0b295a214e}{clocks\+\_\+per\+\_\+sec} = 1000
\begin{DoxyCompactList}\small\item\em The number of clock cycles per second, used by the system clock. \end{DoxyCompactList}\item 
\mbox{\Hypertarget{namespacemom__write__cputime_a6ac4322a83898c01ec5e8e2ffc22f7cd}\label{namespacemom__write__cputime_a6ac4322a83898c01ec5e8e2ffc22f7cd}} 
integer \hyperlink{namespacemom__write__cputime_a6ac4322a83898c01ec5e8e2ffc22f7cd}{max\+\_\+ticks} = 1000
\begin{DoxyCompactList}\small\item\em The number of ticks per second, used by the system clock. \end{DoxyCompactList}\end{DoxyCompactItemize}


\subsection{Function/\+Subroutine Documentation}
\mbox{\Hypertarget{namespacemom__write__cputime_a9e65987c6c974dd7c1c5021239f7df90}\label{namespacemom__write__cputime_a9e65987c6c974dd7c1c5021239f7df90}} 
\index{mom\+\_\+write\+\_\+cputime@{mom\+\_\+write\+\_\+cputime}!mom\+\_\+write\+\_\+cputime\+\_\+end@{mom\+\_\+write\+\_\+cputime\+\_\+end}}
\index{mom\+\_\+write\+\_\+cputime\+\_\+end@{mom\+\_\+write\+\_\+cputime\+\_\+end}!mom\+\_\+write\+\_\+cputime@{mom\+\_\+write\+\_\+cputime}}
\subsubsection{\texorpdfstring{mom\+\_\+write\+\_\+cputime\+\_\+end()}{mom\_write\_cputime\_end()}}
{\footnotesize\ttfamily subroutine, public mom\+\_\+write\+\_\+cputime\+::mom\+\_\+write\+\_\+cputime\+\_\+end (\begin{DoxyParamCaption}\item[{type(\hyperlink{structmom__write__cputime_1_1write__cputime__cs}{write\+\_\+cputime\+\_\+cs}), pointer}]{CS }\end{DoxyParamCaption})}



Close the M\+O\+M\+\_\+write\+\_\+cputime module. 


\begin{DoxyParams}{Parameters}
{\em cs} & The control structure set up by a previous call to M\+O\+M\+\_\+write\+\_\+cputime\+\_\+init. \\
\hline
\end{DoxyParams}


Definition at line 106 of file M\+O\+M\+\_\+write\+\_\+cputime.\+F90.


\begin{DoxyCode}
106   \textcolor{keywordtype}{type}(write\_cputime\_cs), \textcolor{keywordtype}{pointer}    :: cs\textcolor{comment}{    !< The control structure set up by a previous}
107 \textcolor{comment}{                                              !! call to MOM\_write\_cputime\_init.}
108 
109   \textcolor{keywordflow}{if} (.not.\textcolor{keyword}{associated}(cs)) \textcolor{keywordflow}{return}
110 
111   \textcolor{comment}{! Flush and close the output files.}
112   \textcolor{keywordflow}{if} (is\_root\_pe() .and. cs%fileCPU\_ascii > 0) \textcolor{keywordflow}{then}
113     \textcolor{keyword}{call }flush(cs%fileCPU\_ascii)
114     \textcolor{keyword}{call }close\_file(cs%fileCPU\_ascii)
115 \textcolor{keywordflow}{  endif}
116 
117   \textcolor{keyword}{deallocate}(cs)
118 
\end{DoxyCode}
\mbox{\Hypertarget{namespacemom__write__cputime_a0228cbfaec6f37997e2fd42124d87fda}\label{namespacemom__write__cputime_a0228cbfaec6f37997e2fd42124d87fda}} 
\index{mom\+\_\+write\+\_\+cputime@{mom\+\_\+write\+\_\+cputime}!mom\+\_\+write\+\_\+cputime\+\_\+init@{mom\+\_\+write\+\_\+cputime\+\_\+init}}
\index{mom\+\_\+write\+\_\+cputime\+\_\+init@{mom\+\_\+write\+\_\+cputime\+\_\+init}!mom\+\_\+write\+\_\+cputime@{mom\+\_\+write\+\_\+cputime}}
\subsubsection{\texorpdfstring{mom\+\_\+write\+\_\+cputime\+\_\+init()}{mom\_write\_cputime\_init()}}
{\footnotesize\ttfamily subroutine, public mom\+\_\+write\+\_\+cputime\+::mom\+\_\+write\+\_\+cputime\+\_\+init (\begin{DoxyParamCaption}\item[{type(param\+\_\+file\+\_\+type), intent(in)}]{param\+\_\+file,  }\item[{character(len=$\ast$), intent(in)}]{directory,  }\item[{type(time\+\_\+type), intent(in)}]{Input\+\_\+start\+\_\+time,  }\item[{type(\hyperlink{structmom__write__cputime_1_1write__cputime__cs}{write\+\_\+cputime\+\_\+cs}), pointer}]{CS }\end{DoxyParamCaption})}



Initialize the M\+O\+M\+\_\+write\+\_\+cputime module. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\tt in}  & {\em param\+\_\+file} & A structure to parse for run-\/time parameters\\
\hline
\mbox{\tt in}  & {\em directory} & The directory where the C\+PU time file goes.\\
\hline
\mbox{\tt in}  & {\em input\+\_\+start\+\_\+time} & The start model time of the simulation.\\
\hline
 & {\em cs} & A pointer that may be set to point to the control structure for this module. \\
\hline
\end{DoxyParams}


Definition at line 55 of file M\+O\+M\+\_\+write\+\_\+cputime.\+F90.


\begin{DoxyCode}
55   \textcolor{keywordtype}{type}(param\_file\_type),  \textcolor{keywordtype}{intent(in)} :: param\_file\textcolor{comment}{ !< A structure to parse for run-time parameters}
56   \textcolor{keywordtype}{character(len=*)},       \textcolor{keywordtype}{intent(in)} :: directory\textcolor{comment}{  !< The directory where the CPU time file goes.}
57   \textcolor{keywordtype}{type}(time\_type),        \textcolor{keywordtype}{intent(in)} :: input\_start\_time\textcolor{comment}{ !< The start model time of the simulation.}
58   \textcolor{keywordtype}{type}(write\_cputime\_cs), \textcolor{keywordtype}{pointer}    :: cs\textcolor{comment}{         !< A pointer that may be set to point to the}
59 \textcolor{comment}{                                                   !! control structure for this module.}
60 
61   \textcolor{comment}{! Local variables}
62   \textcolor{keywordtype}{integer} :: new\_cputime   \textcolor{comment}{! The CPU time returned by SYSTEM\_CLOCK}
63   \textcolor{comment}{! This include declares and sets the variable "version".}
64 \textcolor{preprocessor}{# include "version\_variable.h"}
65 \textcolor{preprocessor}{}  \textcolor{keywordtype}{character(len=40)}  :: mdl = \textcolor{stringliteral}{'MOM\_write\_cputime'}  \textcolor{comment}{! This module's name.}
66   \textcolor{keywordtype}{logical} :: all\_default   \textcolor{comment}{! If true, all parameters are using their default values.}
67 
68   \textcolor{keywordflow}{if} (.not.\textcolor{keyword}{associated}(cs)) \textcolor{keywordflow}{then}
69     \textcolor{keyword}{allocate}(cs)
70     \textcolor{keyword}{call }system\_clock(new\_cputime, clocks\_per\_sec, max\_ticks)
71     cs%prev\_cputime = new\_cputime
72 \textcolor{keywordflow}{  endif}
73 
74   \textcolor{comment}{! Read all relevant parameters and write them to the model log.}
75 
76   \textcolor{comment}{! Determine whether all paramters are set to their default values.}
77   \textcolor{keyword}{call }get\_param(param\_file, mdl, \textcolor{stringliteral}{"MAXCPU"}, cs%maxcpu, default=-1.0, do\_not\_log=.true.)
78   \textcolor{keyword}{call }get\_param(param\_file, mdl, \textcolor{stringliteral}{"CPU\_TIME\_FILE"}, cs%CPUfile, default=\textcolor{stringliteral}{"CPU\_stats"}, do\_not\_log=.true.)
79   all\_default = (cs%maxcpu == -1.0) .and. (trim(cs%CPUfile) == trim(\textcolor{stringliteral}{"CPU\_stats"}))
80 
81   \textcolor{keyword}{call }log\_version(param\_file, mdl, version, \textcolor{stringliteral}{""}, all\_default=all\_default)
82   \textcolor{keyword}{call }get\_param(param\_file, mdl, \textcolor{stringliteral}{"MAXCPU"}, cs%maxcpu, &
83                  \textcolor{stringliteral}{"The maximum amount of cpu time per processor for which "}//&
84                  \textcolor{stringliteral}{"MOM should run before saving a restart file and "}//&
85                  \textcolor{stringliteral}{"quitting with a return value that indicates that a "}//&
86                  \textcolor{stringliteral}{"further run is required to complete the simulation. "}//&
87                  \textcolor{stringliteral}{"If automatic restarts are not desired, use a negative "}//&
88                  \textcolor{stringliteral}{"value for MAXCPU.  MAXCPU has units of wall-clock "}//&
89                  \textcolor{stringliteral}{"seconds, so the actual CPU time used is larger by a "}//&
90                  \textcolor{stringliteral}{"factor of the number of processors used."}, &
91                  units=\textcolor{stringliteral}{"wall-clock seconds"}, default=-1.0)
92   \textcolor{keyword}{call }get\_param(param\_file, mdl, \textcolor{stringliteral}{"CPU\_TIME\_FILE"}, cs%CPUfile, &
93                  \textcolor{stringliteral}{"The file into which CPU time is written."},default=\textcolor{stringliteral}{"CPU\_stats"})
94   cs%CPUfile = trim(directory)//trim(cs%CPUfile)
95   \textcolor{keyword}{call }log\_param(param\_file, mdl, \textcolor{stringliteral}{"directory/CPU\_TIME\_FILE"}, cs%CPUfile)
96 \textcolor{preprocessor}{#ifdef STATSLABEL}
97 \textcolor{preprocessor}{}  cs%CPUfile = trim(cs%CPUfile)//\textcolor{stringliteral}{"."}//trim(adjustl(statslabel))
98 \textcolor{preprocessor}{#endif}
99 \textcolor{preprocessor}{}
100   cs%Start\_time = input\_start\_time
101 
\end{DoxyCode}
\mbox{\Hypertarget{namespacemom__write__cputime_a4a996420163b5e4985b83ba03652b69d}\label{namespacemom__write__cputime_a4a996420163b5e4985b83ba03652b69d}} 
\index{mom\+\_\+write\+\_\+cputime@{mom\+\_\+write\+\_\+cputime}!write\+\_\+cputime@{write\+\_\+cputime}}
\index{write\+\_\+cputime@{write\+\_\+cputime}!mom\+\_\+write\+\_\+cputime@{mom\+\_\+write\+\_\+cputime}}
\subsubsection{\texorpdfstring{write\+\_\+cputime()}{write\_cputime()}}
{\footnotesize\ttfamily subroutine, public mom\+\_\+write\+\_\+cputime\+::write\+\_\+cputime (\begin{DoxyParamCaption}\item[{type(time\+\_\+type), intent(inout)}]{day,  }\item[{integer, intent(in)}]{n,  }\item[{type(\hyperlink{structmom__write__cputime_1_1write__cputime__cs}{write\+\_\+cputime\+\_\+cs}), pointer}]{CS,  }\item[{integer, intent(inout), optional}]{nmax,  }\item[{logical, intent(in), optional}]{call\+\_\+end }\end{DoxyParamCaption})}



This subroutine assesses how much C\+PU time the model has taken and determines how long the model should be run before it saves a restart file and stops itself. Optionally this may also be used to trigger this module\textquotesingle{}s end routine. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\tt in,out}  & {\em day} & The current model time.\\
\hline
\mbox{\tt in}  & {\em n} & The time step number of the current execution.\\
\hline
 & {\em cs} & The control structure set up by a previous call to M\+O\+M\+\_\+write\+\_\+cputime\+\_\+init.\\
\hline
\mbox{\tt in,out}  & {\em nmax} & The number of iterations after which to stop so that the simulation will not run out of C\+PU time.\\
\hline
\mbox{\tt in}  & {\em call\+\_\+end} & If true, also call M\+O\+M\+\_\+write\+\_\+cputime\+\_\+end. \\
\hline
\end{DoxyParams}


Definition at line 125 of file M\+O\+M\+\_\+write\+\_\+cputime.\+F90.


\begin{DoxyCode}
125   \textcolor{keywordtype}{type}(time\_type),        \textcolor{keywordtype}{intent(inout)} :: day\textcolor{comment}{  !< The current model time.}
126   \textcolor{keywordtype}{integer},                \textcolor{keywordtype}{intent(in)}    :: n\textcolor{comment}{    !< The time step number of the current execution.}
127   \textcolor{keywordtype}{type}(write\_cputime\_cs), \textcolor{keywordtype}{pointer}       :: cs\textcolor{comment}{   !< The control structure set up by a previous}
128 \textcolor{comment}{                                                !! call to MOM\_write\_cputime\_init.}
129   \textcolor{keywordtype}{integer},      \textcolor{keywordtype}{optional}, \textcolor{keywordtype}{intent(inout)} :: nmax\textcolor{comment}{ !< The number of iterations after which to stop so}
130 \textcolor{comment}{                                                !! that the simulation will not run out of CPU time.}
131   \textcolor{keywordtype}{logical},      \textcolor{keywordtype}{optional}, \textcolor{keywordtype}{intent(in)}    :: call\_end\textcolor{comment}{ !< If true, also call MOM\_write\_cputime\_end.}
132 
133   \textcolor{comment}{! Local variables}
134   \textcolor{keywordtype}{real}    :: d\_cputime     \textcolor{comment}{! The change in CPU time since the last call}
135                            \textcolor{comment}{! this subroutine.}
136   \textcolor{keywordtype}{integer} :: new\_cputime   \textcolor{comment}{! The CPU time returned by SYSTEM\_CLOCK}
137   \textcolor{keywordtype}{real}    :: reday         \textcolor{comment}{! A real version of day.}
138   \textcolor{keywordtype}{character(len=256)} :: mesg  \textcolor{comment}{! The text of an error message}
139   \textcolor{keywordtype}{integer} :: start\_of\_day, num\_days
140 
141   \textcolor{keywordflow}{if} (.not.\textcolor{keyword}{associated}(cs)) \textcolor{keyword}{call }mom\_error(fatal, &
142          \textcolor{stringliteral}{"write\_energy: Module must be initialized before it is used."})
143 
144   \textcolor{keyword}{call }system\_clock(new\_cputime, clocks\_per\_sec, max\_ticks)
145 \textcolor{comment}{!   The following lines extract useful information even if the clock has rolled}
146 \textcolor{comment}{! over, assuming a 32-bit SYSTEM\_CLOCK.  With more bits, rollover is essentially}
147 \textcolor{comment}{! impossible. Negative fluctuations of less than 10 seconds are not interpreted}
148 \textcolor{comment}{! as the clock rolling over.  This should be unnecessary but is sometimes needed}
149 \textcolor{comment}{! on the GFDL SGI/O3k.}
150   \textcolor{keywordflow}{if} (new\_cputime < cs%prev\_cputime-(10.0*clocks\_per\_sec)) \textcolor{keywordflow}{then}
151     d\_cputime = new\_cputime - cs%prev\_cputime + max\_ticks
152   \textcolor{keywordflow}{else}
153     d\_cputime = new\_cputime - cs%prev\_cputime
154 \textcolor{keywordflow}{  endif}
155 
156   \textcolor{keyword}{call }sum\_across\_pes(d\_cputime)
157   \textcolor{keywordflow}{if} (cs%previous\_calls == 0) cs%startup\_cputime = d\_cputime
158 
159   cs%cputime2 = cs%cputime2 + d\_cputime
160 
161   \textcolor{keywordflow}{if} ((cs%previous\_calls >= 1) .and. (cs%maxcpu > 0.0)) \textcolor{keywordflow}{then}
162     \textcolor{comment}{! Determine the slowest rate at which time steps are executed.}
163     \textcolor{keywordflow}{if} ((n > cs%prev\_n) .and. (d\_cputime > 0.0) .and. &
164         ((cs%dn\_dcpu\_min*d\_cputime < (n - cs%prev\_n)) .or. &
165          (cs%dn\_dcpu\_min < 0.0))) &
166       cs%dn\_dcpu\_min = (n - cs%prev\_n) / d\_cputime
167     \textcolor{keywordflow}{if} (\textcolor{keyword}{present}(nmax) .and. (cs%dn\_dcpu\_min >= 0.0)) \textcolor{keywordflow}{then}
168       \textcolor{comment}{! Have the model stop itself after 95% of the CPU time has been used.}
169       nmax = n + int( cs%dn\_dcpu\_min * &
170           (0.95*cs%maxcpu * \textcolor{keywordtype}{REAL}(num\_pes())*clocks\_per\_sec - &
171            (cs%startup\_cputime + cs%cputime2)) )
172 \textcolor{comment}{!     write(mesg,*) "Resetting nmax to ",nmax," at day",reday}
173 \textcolor{comment}{!     call MOM\_mesg(mesg)}
174 \textcolor{keywordflow}{    endif}
175 \textcolor{keywordflow}{  endif}
176   cs%prev\_cputime = new\_cputime ; cs%prev\_n = n
177 
178   \textcolor{keyword}{call }get\_time(day, start\_of\_day, num\_days)
179   reday = \textcolor{keywordtype}{REAL}(num\_days)+ (\textcolor{keywordtype}{REAL}(start\_of\_day)/86400.0)
180 
181   \textcolor{comment}{!  Reopen or create a text output file.}
182   \textcolor{keywordflow}{if} ((cs%previous\_calls == 0) .and. (is\_root\_pe())) \textcolor{keywordflow}{then}
183     \textcolor{keywordflow}{if} (day > cs%Start\_time) \textcolor{keywordflow}{then}
184       \textcolor{keyword}{call }open\_file(cs%fileCPU\_ascii, trim(cs%CPUfile), &
185                      action=append\_file, form=ascii\_file, nohdrs=.true.)
186     \textcolor{keywordflow}{else}
187       \textcolor{keyword}{call }open\_file(cs%fileCPU\_ascii, trim(cs%CPUfile), &
188                      action=writeonly\_file, form=ascii\_file, nohdrs=.true.)
189 \textcolor{keywordflow}{    endif}
190 \textcolor{keywordflow}{  endif}
191 
192   \textcolor{keywordflow}{if} (is\_root\_pe()) \textcolor{keywordflow}{then}
193     \textcolor{keywordflow}{if} (cs%previous\_calls == 0) \textcolor{keywordflow}{then}
194       \textcolor{keyword}{write}(cs%fileCPU\_ascii, &
195         \textcolor{stringliteral}{'("Startup CPU time: ", F12.3, " sec summed across", I5, " PEs.")'}) &
196                             (cs%startup\_cputime / clocks\_per\_sec), num\_pes()
197       \textcolor{keyword}{write}(cs%fileCPU\_ascii,*)\textcolor{stringliteral}{"        Day, Step number,     CPU time, CPU time change"}
198 \textcolor{keywordflow}{    endif}
199     \textcolor{keyword}{write}(cs%fileCPU\_ascii,\textcolor{stringliteral}{'(F12.3,", "I11,", ", F12.3,", ", F12.3)'}) &
200            reday, n, (cs%cputime2 / \textcolor{keywordtype}{real}(clocks\_per\_sec)), &
201            d\_cputime / \textcolor{keywordtype}{real}(clocks\_per\_sec)
202 
203     \textcolor{keyword}{call }flush(cs%fileCPU\_ascii)
204 \textcolor{keywordflow}{  endif}
205   cs%previous\_calls = cs%previous\_calls + 1
206 
207   \textcolor{keywordflow}{if} (\textcolor{keyword}{present}(call\_end)) \textcolor{keywordflow}{then}
208     \textcolor{keywordflow}{if} (call\_end) \textcolor{keyword}{call }mom\_write\_cputime\_end(cs)
209 \textcolor{keywordflow}{  endif}
210 
\end{DoxyCode}
\mbox{\Hypertarget{namespacemom__write__cputime_aa95b991e5550816440480e52a61a50ee}\label{namespacemom__write__cputime_aa95b991e5550816440480e52a61a50ee}} 
\index{mom\+\_\+write\+\_\+cputime@{mom\+\_\+write\+\_\+cputime}!write\+\_\+cputime\+\_\+start\+\_\+clock@{write\+\_\+cputime\+\_\+start\+\_\+clock}}
\index{write\+\_\+cputime\+\_\+start\+\_\+clock@{write\+\_\+cputime\+\_\+start\+\_\+clock}!mom\+\_\+write\+\_\+cputime@{mom\+\_\+write\+\_\+cputime}}
\subsubsection{\texorpdfstring{write\+\_\+cputime\+\_\+start\+\_\+clock()}{write\_cputime\_start\_clock()}}
{\footnotesize\ttfamily subroutine, public mom\+\_\+write\+\_\+cputime\+::write\+\_\+cputime\+\_\+start\+\_\+clock (\begin{DoxyParamCaption}\item[{type(\hyperlink{structmom__write__cputime_1_1write__cputime__cs}{write\+\_\+cputime\+\_\+cs}), pointer}]{CS }\end{DoxyParamCaption})}



Evaluate the C\+PU time returned by S\+Y\+S\+T\+E\+M\+\_\+\+C\+L\+O\+CK at the start of a run. 


\begin{DoxyParams}{Parameters}
{\em cs} & The control structure set up by a previous call to M\+O\+M\+\_\+write\+\_\+cputime\+\_\+init. \\
\hline
\end{DoxyParams}


Definition at line 44 of file M\+O\+M\+\_\+write\+\_\+cputime.\+F90.


\begin{DoxyCode}
44   \textcolor{keywordtype}{type}(write\_cputime\_cs), \textcolor{keywordtype}{pointer} :: cs\textcolor{comment}{ !< The control structure set up by a previous}
45 \textcolor{comment}{                                        !! call to MOM\_write\_cputime\_init.}
46   \textcolor{keywordtype}{integer} :: new\_cputime   \textcolor{comment}{! The CPU time returned by SYSTEM\_CLOCK}
47   \textcolor{keywordflow}{if} (.not.\textcolor{keyword}{associated}(cs)) \textcolor{keyword}{allocate}(cs)
48 
49   \textcolor{keyword}{call }system\_clock(new\_cputime, clocks\_per\_sec, max\_ticks)
50   cs%prev\_cputime = new\_cputime
\end{DoxyCode}
