Comments (7)
Discussion of the I/O API M3UTILIO module and how to convert existing code
https://cmascenter.org/ioapi/documentation/all_versions/html/M3UTILIO.html
from smoke.
SMOKE v5.0 compiled successfully with Carlie's modified tmpbeis4.f
Have not checked how fast SMOKE run with the update
from smoke.
Summary of Carlie's updates to tmpbeis4.f:
- Reconcile ALLOCATE statements. For example, lines 793 - 805 in original tmpbeis4.f
IF( PX_VERSION ) THEN
ALLOCATE( SOILM( NCOLS, NROWS ), STAT=IOS )
CALL CHECKMEM( IOS, 'SOILM', PROGNAME )
ALLOCATE( SOILT( NCOLS, NROWS ), STAT=IOS )
CALL CHECKMEM( IOS, 'SOILT', PROGNAME )
ALLOCATE( SOILT2( NCOLS, NROWS ), STAT=IOS )
CALL CHECKMEM( IOS, 'SOILT2', PROGNAME )
ALLOCATE( ISLTYP( NCOLS, NROWS ), STAT=IOS )
CALL CHECKMEM( IOS, 'ISLTYP', PROGNAME )
END IF
was modified to (lines 524 - 528 in updated tmpbeis4.f):
IF (PX_VERSION) THEN ! line 480
....
ALLOCATE( SOILM( NCOLS, NROWS ),
& SOILT( NCOLS, NROWS ),
& SOILT2( NCOLS, NROWS ),
& ISLTYP( NCOLS, NROWS ), STAT=IOS )
CALL CHECKMEM( IOS, 'SOILM...ISLTYP', PROGNAME )
- Re-arrange loop structure for better execution efficiency. For example, lines 1030 in original tmpbeis4.f:
DO I = 1, NCOLS
DO J = 1, NROWS
C............................. If switch equal to 0 use winter normalized emissions
IF( SWITCH_FILE ) THEN
IF( SWITCH( I,J ) == 0 ) THEN
SEMIS( I, J, 1:NSEF ) =
& AVGEMIS( I, J, 1:NSEF , NWINTER )
.........
was modified to (~ line 1048 in updated tmpbeis4.f. Note how I and J loop was switched, and also a reminder that Fortran is column-major):
DO J = 1, NROWS
DO I = 1, NCOLS
IF( SWITCH( I,J ) == 0 ) THEN
SEMIS( I, J, 1:NSEF ) =
& AVGEMIS( I, J, 1:NSEF , NWINTER )
.........
- Check for failure when getting environment-variable (e.g., ENVINT). For example, the following check was added for getting environment-variable 'OUTZONE' (line 247 in original tmpbeis4.f)
TZONE = ENVINT( 'OUTZONE', 'Output time zone', 0, IOS )
IF ( IOS .GT. 0 ) THEN
CALL M3EXIT( PROGNAME,0,0, 'Bad env vble "OUTZONE"', 2 )
END IF
-
Introduction of
USE M3UTILIO
statement in place of using INCLUDE IOAPI's include file (e.g., PARMS3.EXT, FDESC3.EXT, IODECL3.EXT) which would simplify downstream variable declarations and cross-module dependency. -
Carlie also added a code block for unit conversion from mole/hr to mole/s (~ lines 1001 - 1010 in updated tmpbeis4.f). This could be a typo since this unit conversion was taken care of elsewhere in later section of tmpbeis4. Furthermore, it is more efficient to just make
MLFAC = MLFAC * HR2SEC
rather than puttingMLFAC
in double loops.
C............ Convert to moles/second if necessary
IF ( UNITTYPE .EQ. 2 ) THEN
DO L = 1, MSPCS
DO K = 1, NSEF
MLFAC( L, K ) = HR2SEC * MLFAC( L, K )
END DO
END DO
END IF
from smoke.
Testing of tmpbeis4 with and without update, surprisingly, did not show improvement in the execution time. Note that the test was conducted on a SMOKE training package over LISTOS domain (25 row x 25 col). Observable improvement in execution time could be expected for larger domain.
Using m3diff tool to compare emis_mole* output files initially showed significantly lower emissions in the output files with updated tmpbeis4. This was later found to be caused by the double unit conversion in the updated tmpbeis4 (item 5 in comment above). After this double unit conversion was removed, differences between the outputs are < 0.1% which are in acceptable range.
from smoke.
from smoke.
Huy, can you consider running this on the full 12US2 or 12US1 domain instead of the 25x25?
…
I'm working on setting up test case based on emission platform 2020ha2 for 12US1 domain. Currently having issue with missing variable SOILT2 in the input met file METCRO2D.
from smoke.
Performance Test with 2020ha2_cb6_20k emission model platform
- tmpbeis4 ran for July 2020 over 12US1 domain
- Three scenarios:
- FULL: incorporate all updates from Carlie to tmpbeis4.f (minus unit conversion which is an error)
- SIMP: Only incorporate loop re-arrangement to follow column-major structure of Fortran
- ORIG: original tempbeis4.f
Results:
Scenarios | Total Run Time | Individual Day Run TIME
FULL | |
1st try | 6:18.69 min | Jul-01: 7 s ; Jul-15: 5 s ; Jul-31: 5 s
2nd try | 6:13.15 min | Jul-01: 5 s ; Jul-15: 5 s ; Jul-31: 5 s
SIMP | |
1st try | 6:15.54 min | Jul-01: 5 s ; Jul-15: 6 s ; Jul-31: 5 s
2nd try | 6:18.04 min | Jul-01: 5 s ; Jul-15: 6 s ; Jul-31: 5 s
ORIG | |
1st try | 8:01.58 min | Jul-01: 10 s ; Jul-15: 9 s ; Jul-31: 7 s
2nd try | 7:30.14 min | Jul-01: 7 s ; Jul-15: 8 s ; Jul-31: 8 s
There is no significant differences in run time between FULL and SIMP, meaning all gained benefit in run time was mainly from the loop re-arrangement. Loop re-arrangement yield about 35% faster in runtime in comparison to ORIG.
Additional information: Modern compiler can transform the code for better efficiency in memory accessing when optimization flag is activated more info here such as -O3
flag which was activated for SMOKE compilation.
from smoke.
Related Issues (20)
- potential updates to CHKGRID subroutine
- SMOKE Array Out of Bound HOT 4
- make SPEED inventory optional HOT 2
- Missing information about the SPDIST speed distribution profile option HOT 2
- Incorrect format statement in subroutine RDMRCLIST
- notes on SMOKE Installation Instructions HOT 6
- Ambiguous definition of EFLAG variable in setoutdate HOT 1
- problems with Smkinven daily area source processing HOT 12
- Gentpro issue for areas without Daylight Saving Time HOT 2
- documentation updates for utility programs HOT 1
- Test inline2d and mrgpt program and see if updates are needed for SMOKE 5.0 User guide HOT 2
- SMOKE Utility Programs Geofac: Mismatch in number of variable issue; Documentation needs update HOT 1
- possible DST ending date bug in I/O API HOT 1
- EGU hourly FF10 processing: HAP calculation error HOT 7
- SMOKE (and IOAPI) compilations with various fortran compilers HOT 1
- miscalculated hourly emissions with SMOKE 5.1 HOT 3
- Assignment of meteorological values inconsistent with CMAQ methods HOT 4
- document that stack parameters <= 0 are treated as missing
- Making Movesmrg to apply adjustment factors by state
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from smoke.