Skip to content

Performance improvement CheckBlankModules#378

Merged
jhs507 merged 1 commit intomasterfrom
perf_CheckBlank_9July2022
Jul 11, 2022
Merged

Performance improvement CheckBlankModules#378
jhs507 merged 1 commit intomasterfrom
perf_CheckBlank_9July2022

Conversation

@lawfordp2017
Copy link
Collaborator

This routine seems to be providing no functionality but iterates over every CRHM variable and is called twice for every module on every time step.

Performance on one core of my CPU with Kevin's project file (see #372) is given below.

ORIGINAL
real 3m15.966s
user 2m9.290s
sys 1m6.573s

CORRECTED
real 2m39.832s
user 1m34.995s
sys 1m4.760s

This routine seems to be providing no functionality but iterates over every CRHM variable and is called twice for every module on every time step.

Performance on one core of my CPU with Kevin's project file (see #372) is given below.

ORIGINAL
real    3m15.966s
user    2m9.290s
sys     1m6.573s

CORRECTED
real    2m39.832s
user    1m34.995s
sys     1m4.760s
@loganxingfang
Copy link
Collaborator

Hi Peter,

From the Borland CRHM CRHMmain.cpp that Tom coded, see the link from the source code file CRHMmain.cpp

https://github.com/srlabUsask/crhmcode/blob/master/borland_source/CRHMmain.cpp

From Line 1019 to 1034:
if(p->GroupCnt && ((ClassMacro*) p)->ObsModule) // only execute if group has an obs module
((ClassMacro*) p)->ObsModule->pre_run();

    p->ReadObs(Reset);
    Reset = false;

// Simple project for module obs. For group always when !CRHMStatus otherwise only selected groups

    CheckBlankModule(Sender);

    if(!p->isGroup || !Global::CRHMStatus || (Global::CRHMStatus & 1 && Global::ModuleBitSet[Global::CurrentModuleRun])){

      p->run();
    }

    CheckBlankModule(Sender);

There are two calls of CheckBlankModule; maybe one call is for p from the module in group prj file, and the other call is for p from module obs in simple prj file.

@jhs507
Copy link
Collaborator

jhs507 commented Jul 11, 2022

I had noticed these calls but never looked at the method before. The method CheckBlankModule iterates over the map of variables but does not do anything. The code is functionally identical in the Borland code and the CRHMcode version. I think it is safe to remove and save our processors some cycles.


void CRHMmain::CheckBlankModule() {

	MapVar::iterator itVar;
	ClassVar * thisVar;

	for (itVar = Global::MapVars.begin(); itVar != Global::MapVars.end(); itVar++) {
		thisVar = (*itVar).second;
		string s = thisVar->name;
	}
}

@jhs507 jhs507 merged commit 3b9cfe7 into master Jul 11, 2022
@lawfordp2017
Copy link
Collaborator Author

okay, thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request performance

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants