Skip to content

Commit

Permalink
Small optimizations for large petCounts.
Browse files Browse the repository at this point in the history
  • Loading branch information
theurich committed Sep 25, 2024
1 parent 491caf3 commit 3f94d1b
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/Infrastructure/VM/src/ESMCI_VM.C
Original file line number Diff line number Diff line change
Expand Up @@ -140,13 +140,18 @@ static bool esmfFinalized = false;
#undef ESMC_METHOD
#define ESMC_METHOD "ESMCI::VMKeyCompare()"
static bool VMKeyCompare(unsigned char *vmKey1, unsigned char *vmKey2){
if (vmKey1==vmKey2) return true; // quick return for identical pointers
#if 1
return std::memcmp(vmKey1, vmKey2, vmKeyWidth) == 0;
#else
int i;
for (i=0; i<vmKeyWidth; i++)
if (vmKey1[i] != vmKey2[i]){
break;
}
if (i==vmKeyWidth) return true;
return false;
#endif
}

#undef ESMC_METHOD
Expand Down
8 changes: 8 additions & 0 deletions src/Superstructure/StateReconcile/src/ESMF_StateReconcile.F90
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,12 @@ subroutine ESMF_StateReconcile(state, vm, rc)
rcToReturn=rc)) return
end if

#if 0
! cleaner timings below, eliminating issue due to different times PETs enter
! BUT: only enable this for testing purposes
call ESMF_VMBarrier(localvm, rc=localrc)
#endif

! Determine whether there is anything to be Reconciled at all.
! If not then return as quickly as possible

Expand Down Expand Up @@ -534,6 +540,8 @@ recursive subroutine StateReconcileIsNoopLoc(stateR, isNoopLoc, rc)
#endif
if (.not.isNoopLoc) exit ! exit for .false.

vmId = vmIdItem ! more likely to hit pointer comparison this way

enddo

deallocate(itemNameList)
Expand Down

0 comments on commit 3f94d1b

Please sign in to comment.