m_mall.F90 45 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669
  1. !~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  2. ! NASA/GSFC, Data Assimilation Office, Code 910.3, GEOS/DAS !
  3. !-----------------------------------------------------------------------
  4. ! CVS m_mall.F90,v 1.5 2004-04-21 22:54:47 jacob Exp
  5. ! CVS MCT_2_8_0
  6. !-----------------------------------------------------------------------
  7. !BOP
  8. !
  9. ! !MODULE: m_mall - A bookkeeper of user allocated memories
  10. !
  11. ! !DESCRIPTION:
  12. !
  13. ! !INTERFACE:
  14. module m_mall
  15. implicit none
  16. private ! except
  17. public :: mall_ci
  18. public :: mall_co
  19. public :: mall_mci
  20. public :: mall_mco
  21. public :: mall_flush
  22. public :: mall_reset
  23. ! mall_ activity controls
  24. public :: mall_ison
  25. public :: mall_set
  26. interface mall_ci; module procedure ci_; end interface
  27. interface mall_co; module procedure co_; end interface
  28. interface mall_mci; module procedure &
  29. ciI0_, &
  30. ciI1_, &
  31. ciI2_, &
  32. ciI3_, &
  33. ciR0_, &
  34. ciR1_, &
  35. ciR2_, &
  36. ciR3_, &
  37. ciD0_, &
  38. ciD1_, &
  39. ciD2_, &
  40. ciD3_, &
  41. ciL0_, &
  42. ciL1_, &
  43. ciL2_, &
  44. ciL3_, &
  45. ciC0_, &
  46. ciC1_, &
  47. ciC2_, &
  48. ciC3_
  49. end interface
  50. interface mall_mco; module procedure &
  51. coI0_, &
  52. coI1_, &
  53. coI2_, &
  54. coI3_, &
  55. coR0_, &
  56. coR1_, &
  57. coR2_, &
  58. coR3_, &
  59. coD0_, &
  60. coD1_, &
  61. coD2_, &
  62. coD3_, &
  63. coL0_, &
  64. coL1_, &
  65. coL2_, &
  66. coL3_, &
  67. coC0_, &
  68. coC1_, &
  69. coC2_, &
  70. coC3_
  71. end interface
  72. interface mall_flush; module procedure flush_; end interface
  73. interface mall_reset; module procedure reset_; end interface
  74. interface mall_ison; module procedure ison_; end interface
  75. interface mall_set; module procedure set_; end interface
  76. ! !REVISION HISTORY:
  77. ! 13Feb98 - Jing Guo <guo@thunder> - initial prototype/prolog/code
  78. !EOP
  79. !_______________________________________________________________________
  80. character(len=*),parameter :: myname='MCT(MPEU)::m_mall'
  81. #if SYSUNICOS || SYSIRIX64 || _R8_
  82. integer,parameter :: NBYTE_PER_WORD = 8
  83. #else
  84. integer,parameter :: NBYTE_PER_WORD = 4
  85. #endif
  86. integer,parameter :: NSZ= 32
  87. integer,parameter :: MXL=250
  88. integer, save :: nreset = 0 ! number of reset_() calls
  89. logical, save :: started = .false. ! the module is in use
  90. integer, save :: n_ =0 ! number of accouting bins.
  91. character(len=NSZ),dimension(MXL),save :: name_
  92. ! integer, dimension(1) :: mall
  93. ! names of the accouting bins
  94. logical,save :: mall_on=.false. ! mall activity switch
  95. integer,save :: mci
  96. integer,dimension(MXL),save :: mci_ ! maximum ci_() calls
  97. integer,save :: nci
  98. integer,dimension(MXL),save :: nci_ ! net ci_() calls
  99. integer,save :: hwm
  100. integer,dimension(MXL),save :: hwm_ ! high-water-mark of allocate()
  101. integer,save :: nwm
  102. integer,dimension(MXL),save :: nwm_ ! net-water-mark of allocate()
  103. contains
  104. !~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  105. ! NASA/GSFC, Data Assimilation Office, Code 910.3, GEOS/DAS !
  106. !BOP -------------------------------------------------------------------
  107. !
  108. ! !IROUTINE: ison_ -
  109. !
  110. ! !DESCRIPTION:
  111. !
  112. ! !INTERFACE:
  113. function ison_()
  114. implicit none
  115. logical :: ison_
  116. ! !REVISION HISTORY:
  117. ! 25Oct99 - Jing Guo <guo@dao.gsfc.nasa.gov>
  118. ! - initial prototype/prolog/code
  119. !EOP ___________________________________________________________________
  120. character(len=*),parameter :: myname_=myname//'::ison_'
  121. ison_=mall_on
  122. end function ison_
  123. !~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  124. ! NASA/GSFC, Data Assimilation Office, Code 910.3, GEOS/DAS !
  125. !BOP -------------------------------------------------------------------
  126. !
  127. ! !IROUTINE: set_ - set the switch on
  128. !
  129. ! !DESCRIPTION:
  130. !
  131. ! !INTERFACE:
  132. subroutine set_(on)
  133. implicit none
  134. logical,optional,intent(in) :: on
  135. ! !REVISION HISTORY:
  136. ! 25Oct99 - Jing Guo <guo@dao.gsfc.nasa.gov>
  137. ! - initial prototype/prolog/code
  138. !EOP ___________________________________________________________________
  139. character(len=*),parameter :: myname_=myname//'::set_'
  140. mall_on=.true.
  141. if(present(on)) mall_on=on
  142. end subroutine set_
  143. !~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  144. ! NASA/GSFC, Data Assimilation Office, Code 910.3, GEOS/DAS !
  145. !BOP -------------------------------------------------------------------
  146. !
  147. ! !IROUTINE: ciI0_ - check in as an integer scalar
  148. !
  149. ! !DESCRIPTION:
  150. !
  151. ! !INTERFACE:
  152. subroutine ciI0_(marg,thread)
  153. implicit none
  154. integer,intent(in) :: marg
  155. character(len=*),intent(in) :: thread
  156. ! !REVISION HISTORY:
  157. ! 21Oct99 - Jing Guo <guo@dao.gsfc.nasa.gov>
  158. ! - initial prototype/prolog/code
  159. !EOP ___________________________________________________________________
  160. character(len=*),parameter :: myname_=myname//'::ciI0_'
  161. if(mall_on) call ci_(1,thread)
  162. end subroutine ciI0_
  163. !~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  164. ! NASA/GSFC, Data Assimilation Office, Code 910.3, GEOS/DAS !
  165. !BOP -------------------------------------------------------------------
  166. !
  167. ! !IROUTINE: ciI1_ - check in as an integer rank 1 array
  168. !
  169. ! !DESCRIPTION:
  170. !
  171. ! !INTERFACE:
  172. subroutine ciI1_(marg,thread)
  173. implicit none
  174. integer,dimension(:),intent(in) :: marg
  175. character(len=*),intent(in) :: thread
  176. ! !REVISION HISTORY:
  177. ! 21Oct99 - Jing Guo <guo@dao.gsfc.nasa.gov>
  178. ! - initial prototype/prolog/code
  179. !EOP ___________________________________________________________________
  180. character(len=*),parameter :: myname_=myname//'::ciI1_'
  181. if(mall_on) call ci_(size(marg),thread)
  182. end subroutine ciI1_
  183. !~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  184. ! NASA/GSFC, Data Assimilation Office, Code 910.3, GEOS/DAS !
  185. !BOP -------------------------------------------------------------------
  186. !
  187. ! !IROUTINE: ciI2_ - check in as an integer rank 2 array
  188. !
  189. ! !DESCRIPTION:
  190. !
  191. ! !INTERFACE:
  192. subroutine ciI2_(marg,thread)
  193. implicit none
  194. integer,dimension(:,:),intent(in) :: marg
  195. character(len=*),intent(in) :: thread
  196. ! !REVISION HISTORY:
  197. ! 21Oct99 - Jing Guo <guo@dao.gsfc.nasa.gov>
  198. ! - initial prototype/prolog/code
  199. !EOP ___________________________________________________________________
  200. character(len=*),parameter :: myname_=myname//'::ciI2_'
  201. if(mall_on) call ci_(size(marg),thread)
  202. end subroutine ciI2_
  203. !~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  204. ! NASA/GSFC, Data Assimilation Office, Code 910.3, GEOS/DAS !
  205. !BOP -------------------------------------------------------------------
  206. !
  207. ! !IROUTINE: ciI3_ - check in as an integer rank 3 array
  208. !
  209. ! !DESCRIPTION:
  210. !
  211. ! !INTERFACE:
  212. subroutine ciI3_(marg,thread)
  213. implicit none
  214. integer,dimension(:,:,:),intent(in) :: marg
  215. character(len=*),intent(in) :: thread
  216. ! !REVISION HISTORY:
  217. ! 21Oct99 - Jing Guo <guo@dao.gsfc.nasa.gov>
  218. ! - initial prototype/prolog/code
  219. !EOP ___________________________________________________________________
  220. character(len=*),parameter :: myname_=myname//'::ciI3_'
  221. if(mall_on) call ci_(size(marg),thread)
  222. end subroutine ciI3_
  223. !~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  224. ! NASA/GSFC, Data Assimilation Office, Code 910.3, GEOS/DAS !
  225. !BOP -------------------------------------------------------------------
  226. !
  227. ! !IROUTINE: ciR0_ - check in as a real(SP) scalar
  228. !
  229. ! !DESCRIPTION:
  230. !
  231. ! !INTERFACE:
  232. subroutine ciR0_(marg,thread)
  233. use m_realkinds, only : SP
  234. implicit none
  235. real(SP),intent(in) :: marg
  236. character(len=*),intent(in) :: thread
  237. ! !REVISION HISTORY:
  238. ! 21Oct99 - Jing Guo <guo@dao.gsfc.nasa.gov>
  239. ! - initial prototype/prolog/code
  240. !EOP ___________________________________________________________________
  241. character(len=*),parameter :: myname_=myname//'::ciR0_'
  242. if(mall_on) call ci_(1,thread)
  243. end subroutine ciR0_
  244. !~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  245. ! NASA/GSFC, Data Assimilation Office, Code 910.3, GEOS/DAS !
  246. !BOP -------------------------------------------------------------------
  247. !
  248. ! !IROUTINE: ciR1_ - check in as a real(SP) rank 1 array
  249. !
  250. ! !DESCRIPTION:
  251. !
  252. ! !INTERFACE:
  253. subroutine ciR1_(marg,thread)
  254. use m_realkinds, only : SP
  255. implicit none
  256. real(SP),dimension(:),intent(in) :: marg
  257. character(len=*),intent(in) :: thread
  258. ! !REVISION HISTORY:
  259. ! 21Oct99 - Jing Guo <guo@dao.gsfc.nasa.gov>
  260. ! - initial prototype/prolog/code
  261. !EOP ___________________________________________________________________
  262. character(len=*),parameter :: myname_=myname//'::ciR1_'
  263. if(mall_on) call ci_(size(marg),thread)
  264. end subroutine ciR1_
  265. !~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  266. ! NASA/GSFC, Data Assimilation Office, Code 910.3, GEOS/DAS !
  267. !BOP -------------------------------------------------------------------
  268. !
  269. ! !IROUTINE: ciR2_ - check in as a real(SP) rank 2 array
  270. !
  271. ! !DESCRIPTION:
  272. !
  273. ! !INTERFACE:
  274. subroutine ciR2_(marg,thread)
  275. use m_realkinds, only : SP
  276. implicit none
  277. real(SP),dimension(:,:),intent(in) :: marg
  278. character(len=*),intent(in) :: thread
  279. ! !REVISION HISTORY:
  280. ! 21Oct99 - Jing Guo <guo@dao.gsfc.nasa.gov>
  281. ! - initial prototype/prolog/code
  282. !EOP ___________________________________________________________________
  283. character(len=*),parameter :: myname_=myname//'::ciR2_'
  284. if(mall_on) call ci_(size(marg),thread)
  285. end subroutine ciR2_
  286. !~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  287. ! NASA/GSFC, Data Assimilation Office, Code 910.3, GEOS/DAS !
  288. !BOP -------------------------------------------------------------------
  289. !
  290. ! !IROUTINE: ciR3_ - check in as a real(SP) rank 3 array
  291. !
  292. ! !DESCRIPTION:
  293. !
  294. ! !INTERFACE:
  295. subroutine ciR3_(marg,thread)
  296. use m_realkinds, only : SP
  297. implicit none
  298. real(SP),dimension(:,:,:),intent(in) :: marg
  299. character(len=*),intent(in) :: thread
  300. ! !REVISION HISTORY:
  301. ! 21Oct99 - Jing Guo <guo@dao.gsfc.nasa.gov>
  302. ! - initial prototype/prolog/code
  303. !EOP ___________________________________________________________________
  304. character(len=*),parameter :: myname_=myname//'::ciR3_'
  305. if(mall_on) call ci_(size(marg),thread)
  306. end subroutine ciR3_
  307. !~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  308. ! NASA/GSFC, Data Assimilation Office, Code 910.3, GEOS/DAS !
  309. !BOP -------------------------------------------------------------------
  310. !
  311. ! !IROUTINE: ciD0_ - check in as a real(DP) scalar
  312. !
  313. ! !DESCRIPTION:
  314. !
  315. ! !INTERFACE:
  316. subroutine ciD0_(marg,thread)
  317. use m_realkinds, only : DP
  318. implicit none
  319. real(DP),intent(in) :: marg
  320. character(len=*),intent(in) :: thread
  321. ! !REVISION HISTORY:
  322. ! 21Oct99 - Jing Guo <guo@dao.gsfc.nasa.gov>
  323. ! - initial prototype/prolog/code
  324. !EOP ___________________________________________________________________
  325. character(len=*),parameter :: myname_=myname//'::ciD0_'
  326. if(mall_on) call ci_(2,thread)
  327. end subroutine ciD0_
  328. !~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  329. ! NASA/GSFC, Data Assimilation Office, Code 910.3, GEOS/DAS !
  330. !BOP -------------------------------------------------------------------
  331. !
  332. ! !IROUTINE: ciD1_ - check in as a real(DP) rank 1 array
  333. !
  334. ! !DESCRIPTION:
  335. !
  336. ! !INTERFACE:
  337. subroutine ciD1_(marg,thread)
  338. use m_realkinds, only : DP
  339. implicit none
  340. real(DP),dimension(:),intent(in) :: marg
  341. character(len=*),intent(in) :: thread
  342. ! !REVISION HISTORY:
  343. ! 21Oct99 - Jing Guo <guo@dao.gsfc.nasa.gov>
  344. ! - initial prototype/prolog/code
  345. !EOP ___________________________________________________________________
  346. character(len=*),parameter :: myname_=myname//'::ciD1_'
  347. if(mall_on) call ci_(2*size(marg),thread)
  348. end subroutine ciD1_
  349. !~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  350. ! NASA/GSFC, Data Assimilation Office, Code 910.3, GEOS/DAS !
  351. !BOP -------------------------------------------------------------------
  352. !
  353. ! !IROUTINE: ciD2_ - check in as a real(DP) rank 2 array
  354. !
  355. ! !DESCRIPTION:
  356. !
  357. ! !INTERFACE:
  358. subroutine ciD2_(marg,thread)
  359. use m_realkinds, only : DP
  360. implicit none
  361. real(DP),dimension(:,:),intent(in) :: marg
  362. character(len=*),intent(in) :: thread
  363. ! !REVISION HISTORY:
  364. ! 21Oct99 - Jing Guo <guo@dao.gsfc.nasa.gov>
  365. ! - initial prototype/prolog/code
  366. !EOP ___________________________________________________________________
  367. character(len=*),parameter :: myname_=myname//'::ciD2_'
  368. if(mall_on) call ci_(2*size(marg),thread)
  369. end subroutine ciD2_
  370. !~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  371. ! NASA/GSFC, Data Assimilation Office, Code 910.3, GEOS/DAS !
  372. !BOP -------------------------------------------------------------------
  373. !
  374. ! !IROUTINE: ciD3_ - check in as a real(DP) rank 3 array
  375. !
  376. ! !DESCRIPTION:
  377. !
  378. ! !INTERFACE:
  379. subroutine ciD3_(marg,thread)
  380. use m_realkinds, only : DP
  381. implicit none
  382. real(DP),dimension(:,:,:),intent(in) :: marg
  383. character(len=*),intent(in) :: thread
  384. ! !REVISION HISTORY:
  385. ! 21Oct99 - Jing Guo <guo@dao.gsfc.nasa.gov>
  386. ! - initial prototype/prolog/code
  387. !EOP ___________________________________________________________________
  388. character(len=*),parameter :: myname_=myname//'::ciD3_'
  389. if(mall_on) call ci_(2*size(marg),thread)
  390. end subroutine ciD3_
  391. !~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  392. ! NASA/GSFC, Data Assimilation Office, Code 910.3, GEOS/DAS !
  393. !BOP -------------------------------------------------------------------
  394. !
  395. ! !IROUTINE: ciL0_ - check in as a logical scalar
  396. !
  397. ! !DESCRIPTION:
  398. !
  399. ! !INTERFACE:
  400. subroutine ciL0_(marg,thread)
  401. implicit none
  402. logical,intent(in) :: marg
  403. character(len=*),intent(in) :: thread
  404. ! !REVISION HISTORY:
  405. ! 21Oct99 - Jing Guo <guo@dao.gsfc.nasa.gov>
  406. ! - initial prototype/prolog/code
  407. !EOP ___________________________________________________________________
  408. character(len=*),parameter :: myname_=myname//'::ciL0_'
  409. if(mall_on) call ci_(1,thread)
  410. end subroutine ciL0_
  411. !~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  412. ! NASA/GSFC, Data Assimilation Office, Code 910.3, GEOS/DAS !
  413. !BOP -------------------------------------------------------------------
  414. !
  415. ! !IROUTINE: ciL1_ - check in as a logical rank 1 array
  416. !
  417. ! !DESCRIPTION:
  418. !
  419. ! !INTERFACE:
  420. subroutine ciL1_(marg,thread)
  421. implicit none
  422. logical,dimension(:),intent(in) :: marg
  423. character(len=*),intent(in) :: thread
  424. ! !REVISION HISTORY:
  425. ! 21Oct99 - Jing Guo <guo@dao.gsfc.nasa.gov>
  426. ! - initial prototype/prolog/code
  427. !EOP ___________________________________________________________________
  428. character(len=*),parameter :: myname_=myname//'::ciL1_'
  429. if(mall_on) call ci_(size(marg),thread)
  430. end subroutine ciL1_
  431. !~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  432. ! NASA/GSFC, Data Assimilation Office, Code 910.3, GEOS/DAS !
  433. !BOP -------------------------------------------------------------------
  434. !
  435. ! !IROUTINE: ciL2_ - check in as a logical rank 2 array
  436. !
  437. ! !DESCRIPTION:
  438. !
  439. ! !INTERFACE:
  440. subroutine ciL2_(marg,thread)
  441. implicit none
  442. logical,dimension(:,:),intent(in) :: marg
  443. character(len=*),intent(in) :: thread
  444. ! !REVISION HISTORY:
  445. ! 21Oct99 - Jing Guo <guo@dao.gsfc.nasa.gov>
  446. ! - initial prototype/prolog/code
  447. !EOP ___________________________________________________________________
  448. character(len=*),parameter :: myname_=myname//'::ciL2_'
  449. if(mall_on) call ci_(size(marg),thread)
  450. end subroutine ciL2_
  451. !~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  452. ! NASA/GSFC, Data Assimilation Office, Code 910.3, GEOS/DAS !
  453. !BOP -------------------------------------------------------------------
  454. !
  455. ! !IROUTINE: ciL3_ - check in as a logical rank 3 array
  456. !
  457. ! !DESCRIPTION:
  458. !
  459. ! !INTERFACE:
  460. subroutine ciL3_(marg,thread)
  461. implicit none
  462. logical,dimension(:,:,:),intent(in) :: marg
  463. character(len=*),intent(in) :: thread
  464. ! !REVISION HISTORY:
  465. ! 21Oct99 - Jing Guo <guo@dao.gsfc.nasa.gov>
  466. ! - initial prototype/prolog/code
  467. !EOP ___________________________________________________________________
  468. character(len=*),parameter :: myname_=myname//'::ciL3_'
  469. if(mall_on) call ci_(size(marg),thread)
  470. end subroutine ciL3_
  471. !~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  472. ! NASA/GSFC, Data Assimilation Office, Code 910.3, GEOS/DAS !
  473. !BOP -------------------------------------------------------------------
  474. !
  475. ! !IROUTINE: ciC0_ - check in as a character scalar
  476. !
  477. ! !DESCRIPTION:
  478. !
  479. ! !INTERFACE:
  480. subroutine ciC0_(marg,thread)
  481. implicit none
  482. character(len=*),intent(in) :: marg
  483. character(len=*),intent(in) :: thread
  484. ! !REVISION HISTORY:
  485. ! 21Oct99 - Jing Guo <guo@dao.gsfc.nasa.gov>
  486. ! - initial prototype/prolog/code
  487. !EOP ___________________________________________________________________
  488. character(len=*),parameter :: myname_=myname//'::ciC0_'
  489. integer :: nw
  490. if(.not.mall_on) return
  491. nw=(len(marg)+NBYTE_PER_WORD-1)/NBYTE_PER_WORD
  492. call ci_(nw,thread)
  493. end subroutine ciC0_
  494. !~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  495. ! NASA/GSFC, Data Assimilation Office, Code 910.3, GEOS/DAS !
  496. !BOP -------------------------------------------------------------------
  497. !
  498. ! !IROUTINE: ciC1_ - check in as a character rank 1 array
  499. !
  500. ! !DESCRIPTION:
  501. !
  502. ! !INTERFACE:
  503. subroutine ciC1_(marg,thread)
  504. implicit none
  505. character(len=*),dimension(:),intent(in) :: marg
  506. character(len=*),intent(in) :: thread
  507. ! !REVISION HISTORY:
  508. ! 21Oct99 - Jing Guo <guo@dao.gsfc.nasa.gov>
  509. ! - initial prototype/prolog/code
  510. !EOP ___________________________________________________________________
  511. character(len=*),parameter :: myname_=myname//'::ciC1_'
  512. integer :: nw
  513. if(.not.mall_on) return
  514. nw=(len(marg(1))+NBYTE_PER_WORD-1)/NBYTE_PER_WORD
  515. call ci_(size(marg)*nw,thread)
  516. end subroutine ciC1_
  517. !~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  518. ! NASA/GSFC, Data Assimilation Office, Code 910.3, GEOS/DAS !
  519. !BOP -------------------------------------------------------------------
  520. !
  521. ! !IROUTINE: ciC2_ - check in as a character rank 2 array
  522. !
  523. ! !DESCRIPTION:
  524. !
  525. ! !INTERFACE:
  526. subroutine ciC2_(marg,thread)
  527. implicit none
  528. character(len=*),dimension(:,:),intent(in) :: marg
  529. character(len=*),intent(in) :: thread
  530. ! !REVISION HISTORY:
  531. ! 21Oct99 - Jing Guo <guo@dao.gsfc.nasa.gov>
  532. ! - initial prototype/prolog/code
  533. !EOP ___________________________________________________________________
  534. character(len=*),parameter :: myname_=myname//'::ciC2_'
  535. integer :: nw
  536. if(.not.mall_on) return
  537. nw=(len(marg(1,1))+NBYTE_PER_WORD-1)/NBYTE_PER_WORD
  538. call ci_(size(marg)*nw,thread)
  539. end subroutine ciC2_
  540. !~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  541. ! NASA/GSFC, Data Assimilation Office, Code 910.3, GEOS/DAS !
  542. !BOP -------------------------------------------------------------------
  543. !
  544. ! !IROUTINE: ciC3_ - check in as a character rank 3 array
  545. !
  546. ! !DESCRIPTION:
  547. !
  548. ! !INTERFACE:
  549. subroutine ciC3_(marg,thread)
  550. implicit none
  551. character(len=*),dimension(:,:,:),intent(in) :: marg
  552. character(len=*),intent(in) :: thread
  553. ! !REVISION HISTORY:
  554. ! 21Oct99 - Jing Guo <guo@dao.gsfc.nasa.gov>
  555. ! - initial prototype/prolog/code
  556. !EOP ___________________________________________________________________
  557. character(len=*),parameter :: myname_=myname//'::ciC3_'
  558. integer :: nw
  559. if(.not.mall_on) return
  560. nw=(len(marg(1,1,1))+NBYTE_PER_WORD-1)/NBYTE_PER_WORD
  561. call ci_(size(marg)*nw,thread)
  562. end subroutine ciC3_
  563. !~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  564. ! NASA/GSFC, Data Assimilation Office, Code 910.3, GEOS/DAS !
  565. !-----------------------------------------------------------------------
  566. !BOP
  567. !
  568. ! !IROUTINE: ci_ - check-in allocate activity
  569. !
  570. ! !DESCRIPTION:
  571. !
  572. ! !INTERFACE:
  573. subroutine ci_(nword,thread)
  574. use m_stdio, only : stderr
  575. use m_die, only : die
  576. implicit none
  577. integer,intent(in) :: nword
  578. character(len=*),intent(in) :: thread
  579. ! !REVISION HISTORY:
  580. ! 13Feb98 - Jing Guo <guo@thunder> - initial prototype/prolog/code
  581. !EOP
  582. !_______________________________________________________________________
  583. character(len=*),parameter :: myname_=myname//'::ci_'
  584. integer :: ith
  585. if(.not.mall_on) return
  586. if(nword < 0) then
  587. write(stderr,'(2a,i4)') myname_, &
  588. ': invalide argument, nword = ',nword
  589. call die(myname_)
  590. endif
  591. ith=lookup_(thread)
  592. ! update the account
  593. nci_(ith)=nci_(ith)+1
  594. mci_(ith)=mci_(ith)+1
  595. nwm_(ith)=nwm_(ith)+nword
  596. if(hwm_(ith).lt.nwm_(ith)) hwm_(ith)=nwm_(ith)
  597. ! update the total budget
  598. nci=nci+1
  599. mci=mci+1
  600. nwm=nwm+nword
  601. if(hwm.lt.nwm) hwm=nwm
  602. end subroutine ci_
  603. !~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  604. ! NASA/GSFC, Data Assimilation Office, Code 910.3, GEOS/DAS !
  605. !BOP -------------------------------------------------------------------
  606. !
  607. ! !IROUTINE: coI0_ - check in as an integer scalar
  608. !
  609. ! !DESCRIPTION:
  610. !
  611. ! !INTERFACE:
  612. subroutine coI0_(marg,thread)
  613. implicit none
  614. integer,intent(in) :: marg
  615. character(len=*),intent(in) :: thread
  616. ! !REVISION HISTORY:
  617. ! 21Oct99 - Jing Guo <guo@dao.gsfc.nasa.gov>
  618. ! - initial prototype/prolog/code
  619. !EOP ___________________________________________________________________
  620. character(len=*),parameter :: myname_=myname//'::coI0_'
  621. if(mall_on) call co_(1,thread)
  622. end subroutine coI0_
  623. !~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  624. ! NASA/GSFC, Data Assimilation Office, Code 910.3, GEOS/DAS !
  625. !BOP -------------------------------------------------------------------
  626. !
  627. ! !IROUTINE: coI1_ - check in as an integer rank 1 array
  628. !
  629. ! !DESCRIPTION:
  630. !
  631. ! !INTERFACE:
  632. subroutine coI1_(marg,thread)
  633. implicit none
  634. integer,dimension(:),intent(in) :: marg
  635. character(len=*),intent(in) :: thread
  636. ! !REVISION HISTORY:
  637. ! 21Oct99 - Jing Guo <guo@dao.gsfc.nasa.gov>
  638. ! - initial prototype/prolog/code
  639. !EOP ___________________________________________________________________
  640. character(len=*),parameter :: myname_=myname//'::coI1_'
  641. if(mall_on) call co_(size(marg),thread)
  642. end subroutine coI1_
  643. !~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  644. ! NASA/GSFC, Data Assimilation Office, Code 910.3, GEOS/DAS !
  645. !BOP -------------------------------------------------------------------
  646. !
  647. ! !IROUTINE: coI2_ - check in as an integer rank 2 array
  648. !
  649. ! !DESCRIPTION:
  650. !
  651. ! !INTERFACE:
  652. subroutine coI2_(marg,thread)
  653. implicit none
  654. integer,dimension(:,:),intent(in) :: marg
  655. character(len=*),intent(in) :: thread
  656. ! !REVISION HISTORY:
  657. ! 21Oct99 - Jing Guo <guo@dao.gsfc.nasa.gov>
  658. ! - initial prototype/prolog/code
  659. !EOP ___________________________________________________________________
  660. character(len=*),parameter :: myname_=myname//'::coI2_'
  661. if(mall_on) call co_(size(marg),thread)
  662. end subroutine coI2_
  663. !~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  664. ! NASA/GSFC, Data Assimilation Office, Code 910.3, GEOS/DAS !
  665. !BOP -------------------------------------------------------------------
  666. !
  667. ! !IROUTINE: coI3_ - check in as an integer rank 3 array
  668. !
  669. ! !DESCRIPTION:
  670. !
  671. ! !INTERFACE:
  672. subroutine coI3_(marg,thread)
  673. implicit none
  674. integer,dimension(:,:,:),intent(in) :: marg
  675. character(len=*),intent(in) :: thread
  676. ! !REVISION HISTORY:
  677. ! 21Oct99 - Jing Guo <guo@dao.gsfc.nasa.gov>
  678. ! - initial prototype/prolog/code
  679. !EOP ___________________________________________________________________
  680. character(len=*),parameter :: myname_=myname//'::coI3_'
  681. if(mall_on) call co_(size(marg),thread)
  682. end subroutine coI3_
  683. !~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  684. ! NASA/GSFC, Data Assimilation Office, Code 910.3, GEOS/DAS !
  685. !BOP -------------------------------------------------------------------
  686. !
  687. ! !IROUTINE: coR0_ - check in as a real(SP) scalar
  688. !
  689. ! !DESCRIPTION:
  690. !
  691. ! !INTERFACE:
  692. subroutine coR0_(marg,thread)
  693. use m_realkinds, only : SP
  694. implicit none
  695. real(SP),intent(in) :: marg
  696. character(len=*),intent(in) :: thread
  697. ! !REVISION HISTORY:
  698. ! 21Oct99 - Jing Guo <guo@dao.gsfc.nasa.gov>
  699. ! - initial prototype/prolog/code
  700. !EOP ___________________________________________________________________
  701. character(len=*),parameter :: myname_=myname//'::coR0_'
  702. if(mall_on) call co_(1,thread)
  703. end subroutine coR0_
  704. !~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  705. ! NASA/GSFC, Data Assimilation Office, Code 910.3, GEOS/DAS !
  706. !BOP -------------------------------------------------------------------
  707. !
  708. ! !IROUTINE: coR1_ - check in as a real(SP) rank 1 array
  709. !
  710. ! !DESCRIPTION:
  711. !
  712. ! !INTERFACE:
  713. subroutine coR1_(marg,thread)
  714. use m_realkinds, only : SP
  715. implicit none
  716. real(SP),dimension(:),intent(in) :: marg
  717. character(len=*),intent(in) :: thread
  718. ! !REVISION HISTORY:
  719. ! 21Oct99 - Jing Guo <guo@dao.gsfc.nasa.gov>
  720. ! - initial prototype/prolog/code
  721. !EOP ___________________________________________________________________
  722. character(len=*),parameter :: myname_=myname//'::coR1_'
  723. if(mall_on) call co_(size(marg),thread)
  724. end subroutine coR1_
  725. !~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  726. ! NASA/GSFC, Data Assimilation Office, Code 910.3, GEOS/DAS !
  727. !BOP -------------------------------------------------------------------
  728. !
  729. ! !IROUTINE: coR2_ - check in as a real(SP) rank 2 array
  730. !
  731. ! !DESCRIPTION:
  732. !
  733. ! !INTERFACE:
  734. subroutine coR2_(marg,thread)
  735. use m_realkinds, only : SP
  736. implicit none
  737. real(SP),dimension(:,:),intent(in) :: marg
  738. character(len=*),intent(in) :: thread
  739. ! !REVISION HISTORY:
  740. ! 21Oct99 - Jing Guo <guo@dao.gsfc.nasa.gov>
  741. ! - initial prototype/prolog/code
  742. !EOP ___________________________________________________________________
  743. character(len=*),parameter :: myname_=myname//'::coR2_'
  744. if(mall_on) call co_(size(marg),thread)
  745. end subroutine coR2_
  746. !~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  747. ! NASA/GSFC, Data Assimilation Office, Code 910.3, GEOS/DAS !
  748. !BOP -------------------------------------------------------------------
  749. !
  750. ! !IROUTINE: coR3_ - check in as a real(SP) rank 3 array
  751. !
  752. ! !DESCRIPTION:
  753. !
  754. ! !INTERFACE:
  755. subroutine coR3_(marg,thread)
  756. use m_realkinds, only : SP
  757. implicit none
  758. real(SP),dimension(:,:,:),intent(in) :: marg
  759. character(len=*),intent(in) :: thread
  760. ! !REVISION HISTORY:
  761. ! 21Oct99 - Jing Guo <guo@dao.gsfc.nasa.gov>
  762. ! - initial prototype/prolog/code
  763. !EOP ___________________________________________________________________
  764. character(len=*),parameter :: myname_=myname//'::coR3_'
  765. if(mall_on) call co_(size(marg),thread)
  766. end subroutine coR3_
  767. !~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  768. ! NASA/GSFC, Data Assimilation Office, Code 910.3, GEOS/DAS !
  769. !BOP -------------------------------------------------------------------
  770. !
  771. ! !IROUTINE: coD0_ - check in as a real(DP) scalar
  772. !
  773. ! !DESCRIPTION:
  774. !
  775. ! !INTERFACE:
  776. subroutine coD0_(marg,thread)
  777. use m_realkinds, only : DP
  778. implicit none
  779. real(DP),intent(in) :: marg
  780. character(len=*),intent(in) :: thread
  781. ! !REVISION HISTORY:
  782. ! 21Oct99 - Jing Guo <guo@dao.gsfc.nasa.gov>
  783. ! - initial prototype/prolog/code
  784. !EOP ___________________________________________________________________
  785. character(len=*),parameter :: myname_=myname//'::coD0_'
  786. if(mall_on) call co_(2,thread)
  787. end subroutine coD0_
  788. !~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  789. ! NASA/GSFC, Data Assimilation Office, Code 910.3, GEOS/DAS !
  790. !BOP -------------------------------------------------------------------
  791. !
  792. ! !IROUTINE: coD1_ - check in as a real(DP) rank 1 array
  793. !
  794. ! !DESCRIPTION:
  795. !
  796. ! !INTERFACE:
  797. subroutine coD1_(marg,thread)
  798. use m_realkinds, only : DP
  799. implicit none
  800. real(DP),dimension(:),intent(in) :: marg
  801. character(len=*),intent(in) :: thread
  802. ! !REVISION HISTORY:
  803. ! 21Oct99 - Jing Guo <guo@dao.gsfc.nasa.gov>
  804. ! - initial prototype/prolog/code
  805. !EOP ___________________________________________________________________
  806. character(len=*),parameter :: myname_=myname//'::coD1_'
  807. if(mall_on) call co_(2*size(marg),thread)
  808. end subroutine coD1_
  809. !~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  810. ! NASA/GSFC, Data Assimilation Office, Code 910.3, GEOS/DAS !
  811. !BOP -------------------------------------------------------------------
  812. !
  813. ! !IROUTINE: coD2_ - check in as a real(DP) rank 2 array
  814. !
  815. ! !DESCRIPTION:
  816. !
  817. ! !INTERFACE:
  818. subroutine coD2_(marg,thread)
  819. use m_realkinds, only : DP
  820. implicit none
  821. real(DP),dimension(:,:),intent(in) :: marg
  822. character(len=*),intent(in) :: thread
  823. ! !REVISION HISTORY:
  824. ! 21Oct99 - Jing Guo <guo@dao.gsfc.nasa.gov>
  825. ! - initial prototype/prolog/code
  826. !EOP ___________________________________________________________________
  827. character(len=*),parameter :: myname_=myname//'::coD2_'
  828. if(mall_on) call co_(2*size(marg),thread)
  829. end subroutine coD2_
  830. !~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  831. ! NASA/GSFC, Data Assimilation Office, Code 910.3, GEOS/DAS !
  832. !BOP -------------------------------------------------------------------
  833. !
  834. ! !IROUTINE: coD3_ - check in as a real(DP) rank 3 array
  835. !
  836. ! !DESCRIPTION:
  837. !
  838. ! !INTERFACE:
  839. subroutine coD3_(marg,thread)
  840. use m_realkinds, only : DP
  841. implicit none
  842. real(DP),dimension(:,:,:),intent(in) :: marg
  843. character(len=*),intent(in) :: thread
  844. ! !REVISION HISTORY:
  845. ! 21Oct99 - Jing Guo <guo@dao.gsfc.nasa.gov>
  846. ! - initial prototype/prolog/code
  847. !EOP ___________________________________________________________________
  848. character(len=*),parameter :: myname_=myname//'::coD3_'
  849. if(mall_on) call co_(2*size(marg),thread)
  850. end subroutine coD3_
  851. !~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  852. ! NASA/GSFC, Data Assimilation Office, Code 910.3, GEOS/DAS !
  853. !BOP -------------------------------------------------------------------
  854. !
  855. ! !IROUTINE: coL0_ - check in as a logical scalar
  856. !
  857. ! !DESCRIPTION:
  858. !
  859. ! !INTERFACE:
  860. subroutine coL0_(marg,thread)
  861. implicit none
  862. logical,intent(in) :: marg
  863. character(len=*),intent(in) :: thread
  864. ! !REVISION HISTORY:
  865. ! 21Oct99 - Jing Guo <guo@dao.gsfc.nasa.gov>
  866. ! - initial prototype/prolog/code
  867. !EOP ___________________________________________________________________
  868. character(len=*),parameter :: myname_=myname//'::coL0_'
  869. if(mall_on) call co_(1,thread)
  870. end subroutine coL0_
  871. !~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  872. ! NASA/GSFC, Data Assimilation Office, Code 910.3, GEOS/DAS !
  873. !BOP -------------------------------------------------------------------
  874. !
  875. ! !IROUTINE: coL1_ - check in as a logical rank 1 array
  876. !
  877. ! !DESCRIPTION:
  878. !
  879. ! !INTERFACE:
  880. subroutine coL1_(marg,thread)
  881. implicit none
  882. logical,dimension(:),intent(in) :: marg
  883. character(len=*),intent(in) :: thread
  884. ! !REVISION HISTORY:
  885. ! 21Oct99 - Jing Guo <guo@dao.gsfc.nasa.gov>
  886. ! - initial prototype/prolog/code
  887. !EOP ___________________________________________________________________
  888. character(len=*),parameter :: myname_=myname//'::coL1_'
  889. if(mall_on) call co_(size(marg),thread)
  890. end subroutine coL1_
  891. !~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  892. ! NASA/GSFC, Data Assimilation Office, Code 910.3, GEOS/DAS !
  893. !BOP -------------------------------------------------------------------
  894. !
  895. ! !IROUTINE: coL2_ - check in as a logical rank 2 array
  896. !
  897. ! !DESCRIPTION:
  898. !
  899. ! !INTERFACE:
  900. subroutine coL2_(marg,thread)
  901. implicit none
  902. logical,dimension(:,:),intent(in) :: marg
  903. character(len=*),intent(in) :: thread
  904. ! !REVISION HISTORY:
  905. ! 21Oct99 - Jing Guo <guo@dao.gsfc.nasa.gov>
  906. ! - initial prototype/prolog/code
  907. !EOP ___________________________________________________________________
  908. character(len=*),parameter :: myname_=myname//'::coL2_'
  909. if(mall_on) call co_(size(marg),thread)
  910. end subroutine coL2_
  911. !~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  912. ! NASA/GSFC, Data Assimilation Office, Code 910.3, GEOS/DAS !
  913. !BOP -------------------------------------------------------------------
  914. !
  915. ! !IROUTINE: coL3_ - check in as a logical rank 3 array
  916. !
  917. ! !DESCRIPTION:
  918. !
  919. ! !INTERFACE:
  920. subroutine coL3_(marg,thread)
  921. implicit none
  922. logical,dimension(:,:,:),intent(in) :: marg
  923. character(len=*),intent(in) :: thread
  924. ! !REVISION HISTORY:
  925. ! 21Oct99 - Jing Guo <guo@dao.gsfc.nasa.gov>
  926. ! - initial prototype/prolog/code
  927. !EOP ___________________________________________________________________
  928. character(len=*),parameter :: myname_=myname//'::coL3_'
  929. if(mall_on) call co_(size(marg),thread)
  930. end subroutine coL3_
  931. !~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  932. ! NASA/GSFC, Data Assimilation Office, Code 910.3, GEOS/DAS !
  933. !BOP -------------------------------------------------------------------
  934. !
  935. ! !IROUTINE: coC0_ - check in as a character scalar
  936. !
  937. ! !DESCRIPTION:
  938. !
  939. ! !INTERFACE:
  940. subroutine coC0_(marg,thread)
  941. implicit none
  942. character(len=*),intent(in) :: marg
  943. character(len=*),intent(in) :: thread
  944. ! !REVISION HISTORY:
  945. ! 21Oct99 - Jing Guo <guo@dao.gsfc.nasa.gov>
  946. ! - initial prototype/prolog/code
  947. !EOP ___________________________________________________________________
  948. character(len=*),parameter :: myname_=myname//'::coC0_'
  949. integer :: nw
  950. if(.not.mall_on) return
  951. nw=(len(marg)+NBYTE_PER_WORD-1)/NBYTE_PER_WORD
  952. call co_(nw,thread)
  953. end subroutine coC0_
  954. !~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  955. ! NASA/GSFC, Data Assimilation Office, Code 910.3, GEOS/DAS !
  956. !BOP -------------------------------------------------------------------
  957. !
  958. ! !IROUTINE: coC1_ - check in as a character rank 1 array
  959. !
  960. ! !DESCRIPTION:
  961. !
  962. ! !INTERFACE:
  963. subroutine coC1_(marg,thread)
  964. implicit none
  965. character(len=*),dimension(:),intent(in) :: marg
  966. character(len=*),intent(in) :: thread
  967. ! !REVISION HISTORY:
  968. ! 21Oct99 - Jing Guo <guo@dao.gsfc.nasa.gov>
  969. ! - initial prototype/prolog/code
  970. !EOP ___________________________________________________________________
  971. character(len=*),parameter :: myname_=myname//'::coC1_'
  972. integer :: nw
  973. if(.not.mall_on) return
  974. nw=(len(marg(1))+NBYTE_PER_WORD-1)/NBYTE_PER_WORD
  975. call co_(size(marg)*nw,thread)
  976. end subroutine coC1_
  977. !~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  978. ! NASA/GSFC, Data Assimilation Office, Code 910.3, GEOS/DAS !
  979. !BOP -------------------------------------------------------------------
  980. !
  981. ! !IROUTINE: coC2_ - check in as a character rank 2 array
  982. !
  983. ! !DESCRIPTION:
  984. !
  985. ! !INTERFACE:
  986. subroutine coC2_(marg,thread)
  987. implicit none
  988. character(len=*),dimension(:,:),intent(in) :: marg
  989. character(len=*),intent(in) :: thread
  990. ! !REVISION HISTORY:
  991. ! 21Oct99 - Jing Guo <guo@dao.gsfc.nasa.gov>
  992. ! - initial prototype/prolog/code
  993. !EOP ___________________________________________________________________
  994. character(len=*),parameter :: myname_=myname//'::coC2_'
  995. integer :: nw
  996. if(.not.mall_on) return
  997. nw=(len(marg(1,1))+NBYTE_PER_WORD-1)/NBYTE_PER_WORD
  998. call co_(size(marg)*nw,thread)
  999. end subroutine coC2_
  1000. !~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1001. ! NASA/GSFC, Data Assimilation Office, Code 910.3, GEOS/DAS !
  1002. !BOP -------------------------------------------------------------------
  1003. !
  1004. ! !IROUTINE: coC3_ - check in as a character rank 3 array
  1005. !
  1006. ! !DESCRIPTION:
  1007. !
  1008. ! !INTERFACE:
  1009. subroutine coC3_(marg,thread)
  1010. implicit none
  1011. character(len=*),dimension(:,:,:),intent(in) :: marg
  1012. character(len=*),intent(in) :: thread
  1013. ! !REVISION HISTORY:
  1014. ! 21Oct99 - Jing Guo <guo@dao.gsfc.nasa.gov>
  1015. ! - initial prototype/prolog/code
  1016. !EOP ___________________________________________________________________
  1017. character(len=*),parameter :: myname_=myname//'::coC3_'
  1018. integer :: nw
  1019. if(.not.mall_on) return
  1020. nw=(len(marg(1,1,1))+NBYTE_PER_WORD-1)/NBYTE_PER_WORD
  1021. call co_(size(marg)*nw,thread)
  1022. end subroutine coC3_
  1023. !~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1024. ! NASA/GSFC, Data Assimilation Office, Code 910.3, GEOS/DAS !
  1025. !-----------------------------------------------------------------------
  1026. !BOP
  1027. !
  1028. ! !IROUTINE: co_ - check-out allocate activity
  1029. !
  1030. ! !DESCRIPTION:
  1031. !
  1032. ! !INTERFACE:
  1033. subroutine co_(nword,thread)
  1034. use m_stdio, only : stderr
  1035. use m_die, only : die
  1036. implicit none
  1037. integer,intent(in) :: nword
  1038. character(len=*),intent(in) :: thread
  1039. ! !REVISION HISTORY:
  1040. ! 13Feb98 - Jing Guo <guo@thunder> - initial prototype/prolog/code
  1041. !EOP
  1042. !_______________________________________________________________________
  1043. character(len=*),parameter :: myname_=myname//'::co_'
  1044. integer :: ith
  1045. if(.not.mall_on) return
  1046. if(nword < 0) then
  1047. write(stderr,'(2a,i4)') myname_, &
  1048. ': invalide argument, nword = ',nword
  1049. call die(myname_)
  1050. endif
  1051. ! if the thread is "unknown", it would be treated as a
  1052. ! new thread with net negative memory activity.
  1053. ith=lookup_(thread)
  1054. ! update the account
  1055. nci_(ith)=nci_(ith)-1
  1056. nwm_(ith)=nwm_(ith)-nword
  1057. ! update the total budget
  1058. nci=nci-1
  1059. nwm=nwm-nword
  1060. end subroutine co_
  1061. !~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1062. ! NASA/GSFC, Data Assimilation Office, Code 910.3, GEOS/DAS !
  1063. !-----------------------------------------------------------------------
  1064. !BOP
  1065. !
  1066. ! !IROUTINE: cix_ - handling macro ALLOC_() error
  1067. !
  1068. ! !DESCRIPTION:
  1069. !
  1070. ! !INTERFACE:
  1071. subroutine cix_(thread,stat,fnam,line)
  1072. use m_stdio, only : stderr
  1073. use m_die, only : die
  1074. implicit none
  1075. character(len=*),intent(in) :: thread
  1076. integer,intent(in) :: stat
  1077. character(len=*),intent(in) :: fnam
  1078. integer,intent(in) :: line
  1079. ! !REVISION HISTORY:
  1080. ! 13Feb98 - Jing Guo <guo@thunder> - initial prototype/prolog/code
  1081. !EOP
  1082. !_______________________________________________________________________
  1083. character(len=*),parameter :: myname_=myname//'::cix_'
  1084. write(stderr,'(2a,i4)') trim(thread), &
  1085. ': ALLOC_() error, stat =',stat
  1086. call die('ALLOC_',fnam,line)
  1087. end subroutine cix_
  1088. !~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1089. ! NASA/GSFC, Data Assimilation Office, Code 910.3, GEOS/DAS !
  1090. !-----------------------------------------------------------------------
  1091. !BOP
  1092. !
  1093. ! !IROUTINE: cox_ - handling macro DEALLOC_() error
  1094. !
  1095. ! !DESCRIPTION:
  1096. !
  1097. ! !INTERFACE:
  1098. subroutine cox_(thread,stat,fnam,line)
  1099. use m_stdio, only : stderr
  1100. use m_die, only : die
  1101. implicit none
  1102. character(len=*),intent(in) :: thread
  1103. integer,intent(in) :: stat
  1104. character(len=*),intent(in) :: fnam
  1105. integer,intent(in) :: line
  1106. ! !REVISION HISTORY:
  1107. ! 13Feb98 - Jing Guo <guo@thunder> - initial prototype/prolog/code
  1108. !EOP
  1109. !_______________________________________________________________________
  1110. character(len=*),parameter :: myname_=myname//'::cox_'
  1111. write(stderr,'(2a,i4)') trim(thread), &
  1112. ': DEALLOC_() error, stat =',stat
  1113. call die('DEALLOC_',fnam,line)
  1114. end subroutine cox_
  1115. !~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1116. ! NASA/GSFC, Data Assimilation Office, Code 910.3, GEOS/DAS !
  1117. !-----------------------------------------------------------------------
  1118. !BOP
  1119. !
  1120. ! !IROUTINE: flush_ - balancing the up-to-date ci/co calls
  1121. !
  1122. ! !DESCRIPTION:
  1123. !
  1124. ! !INTERFACE:
  1125. subroutine flush_(lu)
  1126. use m_stdio, only : stderr
  1127. use m_ioutil, only : luflush
  1128. use m_die, only : die
  1129. implicit none
  1130. integer,intent(in) :: lu
  1131. ! !REVISION HISTORY:
  1132. ! 17Feb98 - Jing Guo <guo@thunder> - initial prototype/prolog/code
  1133. !EOP
  1134. !_______________________________________________________________________
  1135. character(len=*),parameter :: myname_=myname//'::flush_'
  1136. integer,parameter :: lnmax=38
  1137. character(len=max(lnmax,NSZ)) :: name
  1138. character(len=6) :: hwm_wd,nwm_wd
  1139. character(len=1) :: flag_ci,flag_wm
  1140. integer :: i,ier,ln
  1141. if(.not.mall_on) return
  1142. if(.not.started) call reset_()
  1143. write(lu,'(72a/)',iostat=ier) ('_',i=1,72)
  1144. if(ier /= 0) then
  1145. write(stderr,'(2a,i3)') myname_,': can not write(), unit =',lu
  1146. call die(myname_)
  1147. endif
  1148. write(lu,'(a,t39,4(2x,a))',iostat=ier) '[MALL]', &
  1149. 'max-ci','net-ci ','max-wm','net-wm'
  1150. if(ier /= 0) then
  1151. write(stderr,'(2a,i4)') myname_,': can not write(), unit =',lu
  1152. call die(myname_)
  1153. endif
  1154. call luflush(lu)
  1155. !23.|....1....|....2....|....3....|....4....|....5....|....6....|....7..
  1156. !_______________________________________________________________________
  1157. !
  1158. ![MALL] max_ci net-ci max-wm net-wm
  1159. !-----------------------------------------------------------------------
  1160. !total. ...333 ...333* ..333M ..333i*
  1161. !_______________________________________________________________________
  1162. write(lu,'(72a)') ('-',i=1,72)
  1163. do i=1,min(n_,MXL)
  1164. call wcount_(hwm_(i),hwm_wd)
  1165. call wcount_(nwm_(i),nwm_wd)
  1166. flag_ci=' '
  1167. if(nci_(i) /= 0) flag_ci='*'
  1168. flag_wm=' '
  1169. if(nwm_(i) /= 0) flag_wm='*'
  1170. name=name_(i)
  1171. ln=max(len_trim(name),lnmax)
  1172. write(lu,'(a,2(2x,i6),a,2(2x,a6),a)') name(1:ln), &
  1173. mci_(i),nci_(i),flag_ci,hwm_wd,nwm_wd,flag_wm
  1174. end do
  1175. call wcount_(hwm,hwm_wd)
  1176. call wcount_(nwm,nwm_wd)
  1177. flag_ci=' '
  1178. if(nci /= 0) flag_ci='*'
  1179. flag_wm=' '
  1180. if(nwm /= 0) flag_wm='*'
  1181. name='.total.'
  1182. ln=max(len_trim(name),lnmax)
  1183. write(lu,'(a,2(2x,i6),a,2(2x,a6),a)') name(1:ln), &
  1184. mci,nci,flag_ci,hwm_wd,nwm_wd,flag_wm
  1185. write(lu,'(72a/)') ('_',i=1,72)
  1186. if(nreset /= 1) write(lu,'(2a,i3,a)') myname_, &
  1187. ': reset_ ',nreset,' times'
  1188. call luflush(lu)
  1189. end subroutine flush_
  1190. !~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1191. ! NASA/GSFC, Data Assimilation Office, Code 910.3, GEOS/DAS !
  1192. !-----------------------------------------------------------------------
  1193. !BOP
  1194. !
  1195. ! !IROUTINE: wcount_ - generate word count output with unit
  1196. !
  1197. ! !DESCRIPTION:
  1198. !
  1199. ! !INTERFACE:
  1200. subroutine wcount_(wknt,cknt)
  1201. implicit none
  1202. integer, intent(in) :: wknt ! given an integer value
  1203. character(len=6),intent(out) :: cknt ! return a string value
  1204. ! !REVISION HISTORY:
  1205. ! 17Feb98 - Jing Guo <guo@thunder> - initial prototype/prolog/code
  1206. !EOP
  1207. !_______________________________________________________________________
  1208. character(len=*),parameter :: myname_=myname//'::wcount_'
  1209. character(len=1) :: cwd
  1210. integer,parameter :: KWD=1024
  1211. integer,parameter :: MWD=1024*1024
  1212. integer,parameter :: GWD=1024*1024*1024
  1213. integer :: iwd
  1214. if(wknt < 0) then
  1215. cknt='------'
  1216. else
  1217. cwd='i'
  1218. iwd=wknt
  1219. if(iwd > 9999) then
  1220. cwd='K'
  1221. iwd=(wknt+KWD-1)/KWD
  1222. endif
  1223. if(iwd > 9999) then
  1224. cwd='M'
  1225. iwd=(wknt+MWD-1)/MWD
  1226. endif
  1227. if(iwd > 9999) then
  1228. cwd='G'
  1229. iwd=(wknt+GWD-1)/GWD
  1230. endif
  1231. write(cknt,'(i5,a)') iwd,cwd
  1232. endif
  1233. end subroutine wcount_
  1234. !~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1235. ! NASA/GSFC, Data Assimilation Office, Code 910.3, GEOS/DAS !
  1236. !-----------------------------------------------------------------------
  1237. !BOP
  1238. !
  1239. ! !IROUTINE: lookup_ - search/insert a name in a list
  1240. !
  1241. ! !DESCRIPTION:
  1242. !
  1243. ! !INTERFACE:
  1244. function lookup_(thread)
  1245. use m_chars, only : uppercase
  1246. implicit none
  1247. character(len=*),intent(in) :: thread
  1248. integer :: lookup_
  1249. ! !REVISION HISTORY:
  1250. ! 17Feb98 - Jing Guo <guo@thunder> - initial prototype/prolog/code
  1251. !EOP
  1252. !_______________________________________________________________________
  1253. character(len=*),parameter :: myname_=myname//'::lookup_'
  1254. logical :: found
  1255. integer :: ith
  1256. if(.not.started) call reset_()
  1257. !----------------------------------------
  1258. ith=0
  1259. found=.false.
  1260. do while(.not.found .and. ith < min(n_,MXL))
  1261. ith=ith+1
  1262. found= uppercase(thread) == uppercase(name_(ith))
  1263. end do
  1264. if(.not.found) then
  1265. if(n_==0) then
  1266. nci=0
  1267. mci=0
  1268. nwm=0
  1269. hwm=0
  1270. endif
  1271. n_=n_+1
  1272. if(n_ == MXL) then
  1273. ith=MXL
  1274. name_(ith)='.overflow.'
  1275. else
  1276. ith=n_
  1277. name_(ith)=thread
  1278. endif
  1279. nci_(ith)=0
  1280. mci_(ith)=0
  1281. nwm_(ith)=0
  1282. hwm_(ith)=0
  1283. endif
  1284. lookup_=ith
  1285. end function lookup_
  1286. !~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1287. ! NASA/GSFC, Data Assimilation Office, Code 910.3, GEOS/DAS !
  1288. !-----------------------------------------------------------------------
  1289. !BOP
  1290. !
  1291. ! !IROUTINE: reset_ - initialize the module data structure
  1292. !
  1293. ! !DESCRIPTION:
  1294. !
  1295. ! !INTERFACE:
  1296. subroutine reset_()
  1297. implicit none
  1298. ! !REVISION HISTORY:
  1299. ! 16Mar98 - Jing Guo <guo@thunder> - initial prototype/prolog/code
  1300. !EOP
  1301. !_______________________________________________________________________
  1302. character(len=*),parameter :: myname_=myname//'::reset_'
  1303. if(.not.mall_on) return
  1304. nreset=nreset+1
  1305. started=.true.
  1306. name_(1:n_)=' '
  1307. mci_(1:n_)=0
  1308. nci_(1:n_)=0
  1309. hwm_(1:n_)=0
  1310. nwm_(1:n_)=0
  1311. n_ =0
  1312. mci=0
  1313. nci=0
  1314. hwm=0
  1315. nwm=0
  1316. end subroutine reset_
  1317. !=======================================================================
  1318. end module m_mall