Nodes of different colours represent the following:
Solid arrows point from a parent (sub)module to the submodule which is descended from it. Dashed arrows point from a module being used to the module or program unit using it. Where possible, edges connecting nodes are given different colours to make them easier to distinguish in large graphs.
Nodes of different colours represent the following:
Solid arrows point from a procedure to one which it calls. Dashed arrows point from an interface to procedures which implement that interface. This could include the module procedures in a generic interface or the implementation in a submodule of an interface in a parent module. Where possible, edges connecting nodes are given different colours to make them easier to distinguish in large graphs.
Nodes of different colours represent the following:
Solid arrows point from a procedure to one which it calls. Dashed arrows point from an interface to procedures which implement that interface. This could include the module procedures in a generic interface or the implementation in a submodule of an interface in a parent module. Where possible, edges connecting nodes are given different colours to make them easier to distinguish in large graphs.
SUBROUTINE CheckThreading
! SUBROUTINE INFORMATION:
! AUTHOR Linda Lawrie
! DATE WRITTEN April 2012
! MODIFIED na
! RE-ENGINEERED na
! PURPOSE OF THIS SUBROUTINE:
! Check number of threads available versus number of surfaces, etc.
! METHODOLOGY EMPLOYED:
! Check Max Threads (OMP_NUM_THREADS) = MaxNumberOfThreads, iEnvSetThreads
! Check EP Max Threads (EP_OMP_NUM_THREADS) = iepEnvSetThreads
! Check if IDF input (ProgramControl) = iIDFSetThreads
! Check # active sims (cntActv) = inumActiveSims [report only?]
! REFERENCES:
! na
! USE STATEMENTS:
USE DataSystemVariables
USE InputProcessor, ONLY: GetNumObjectsFound, GetObjectItem
USE DataIPShortCuts
USE General, ONLY: RoundSigDigits
#if defined(_OPENMP) && defined(HBIRE_USE_OMP)
use omp_lib, ONLY: omp_get_max_threads,omp_get_num_threads,omp_set_num_threads
#endif
IMPLICIT NONE ! Enforce explicit typing of all variables in this routine
! SUBROUTINE ARGUMENT DEFINITIONS:
! na
! SUBROUTINE PARAMETER DEFINITIONS:
CHARACTER(len=*), PARAMETER :: Blank=' '
! INTERFACE BLOCK SPECIFICATIONS:
! na
! DERIVED TYPE DEFINITIONS:
! na
! SUBROUTINE LOCAL VARIABLE DECLARATIONS:
CHARACTER(len=10) :: cEnvValue
INTEGER :: ios
INTEGER :: TotHTSurfs ! Number of BuildingSurface:Detailed items to obtain
INTEGER :: TotDetailedWalls ! Number of Wall:Detailed items to obtain
INTEGER :: TotDetailedRoofs ! Number of RoofCeiling:Detailed items to obtain
INTEGER :: TotDetailedFloors ! Number of Floor:Detailed items to obtain
INTEGER :: TotHTSubs ! Number of FenestrationSurface:Detailed items to obtain
INTEGER :: TotIntMass ! Number of InternalMass items to obtain
! Simple Surfaces (Rectangular)
INTEGER :: TotRectExtWalls ! Number of Exterior Walls to obtain
INTEGER :: TotRectIntWalls ! Number of Adiabatic Walls to obtain
INTEGER :: TotRectIZWalls ! Number of Interzone Walls to obtain
INTEGER :: TotRectUGWalls ! Number of Underground to obtain
INTEGER :: TotRectRoofs ! Number of Roofs to obtain
INTEGER :: TotRectCeilings ! Number of Adiabatic Ceilings to obtain
INTEGER :: TotRectIZCeilings ! Number of Interzone Ceilings to obtain
INTEGER :: TotRectGCFloors ! Number of Floors with Ground Contact to obtain
INTEGER :: TotRectIntFloors ! Number of Adiabatic Walls to obtain
INTEGER :: TotRectIZFloors ! Number of Interzone Floors to obtain
INTEGER :: TotRectWindows
INTEGER :: TotRectDoors
INTEGER :: TotRectGlazedDoors
INTEGER :: TotRectIZWindows
INTEGER :: TotRectIZDoors
INTEGER :: TotRectIZGlazedDoors
INTEGER :: iIDFsetThreadsInput
INTEGER :: NumAlphas
INTEGER :: NumNumbers
! Figure out how many surfaces there are.
TotHTSurfs =GetNumObjectsFound('BuildingSurface:Detailed')
TotDetailedWalls =GetNumObjectsFound('Wall:Detailed')
TotDetailedRoofs =GetNumObjectsFound('RoofCeiling:Detailed')
TotDetailedFloors =GetNumObjectsFound('Floor:Detailed')
TotHTSubs =GetNumObjectsFound('FenestrationSurface:Detailed')
TotIntMass =GetNumObjectsFound('InternalMass')
TotRectWindows =GetNumObjectsFound('Window')
TotRectDoors =GetNumObjectsFound('Door')
TotRectGlazedDoors =GetNumObjectsFound('GlazedDoor')
TotRectIZWindows =GetNumObjectsFound('Window:Interzone')
TotRectIZDoors =GetNumObjectsFound('Door:Interzone')
TotRectIZGlazedDoors =GetNumObjectsFound('GlazedDoor:Interzone')
TotRectExtWalls =GetNumObjectsFound('Wall:Exterior')
TotRectIntWalls =GetNumObjectsFound('Wall:Adiabatic')
TotRectIZWalls =GetNumObjectsFound('Wall:Interzone')
TotRectUGWalls =GetNumObjectsFound('Wall:Underground')
TotRectRoofs =GetNumObjectsFound('Roof')
TotRectCeilings =GetNumObjectsFound('Ceiling:Adiabatic')
TotRectIZCeilings =GetNumObjectsFound('Ceiling:Interzone')
TotRectGCFloors =GetNumObjectsFound('Floor:GroundContact')
TotRectIntFloors =GetNumObjectsFound('Floor:Adiabatic ')
TotRectIZFloors =GetNumObjectsFound('Floor:Interzone')
iNominalTotSurfaces=TotHTSurfs + TotDetailedWalls + TotDetailedRoofs + TotDetailedFloors + &
TotHTSubs + TotIntMass + TotRectWindows + TotRectDoors + TotRectGlazedDoors + TotRectIZWindows + &
TotRectIZDoors + TotRectIZGlazedDoors + TotRectExtWalls + TotRectIntWalls + TotRectIZWalls + &
TotRectUGWalls + TotRectRoofs + TotRectCeilings + TotRectIZCeilings + TotRectGCFloors + &
TotRectIntFloors + TotRectIZFloors
#ifdef HBIRE_USE_OMP
MaxNumberOfThreads=MAXTHREADS()
Threading=.true.
cEnvValue=' '
CALL Get_Environment_Variable(cNumThreads,cEnvValue)
IF (cEnvValue /= Blank) THEN
lEnvSetThreadsInput=.true.
READ(cEnvValue,*,IOSTAT=ios) iEnvSetThreads
IF (ios /= 0) iEnvSetThreads=MaxNumberOfThreads
IF (iEnvSetThreads == 0) iEnvSetThreads=MaxNumberOfThreads
ENDIF
cEnvValue=' '
CALL Get_Environment_Variable(cepNumThreads,cEnvValue)
IF (cEnvValue /= Blank) THEN
lepSetThreadsInput=.true.
READ(cEnvValue,*,IOSTAT=ios) iepEnvSetThreads
IF (ios /= 0) iepEnvSetThreads=MaxNumberOfThreads
IF (iepEnvSetThreads == 0) iepEnvSetThreads=MaxNumberOfThreads
ENDIF
cCurrentModuleObject='ProgramControl'
IF (GetNumObjectsFound(cCurrentModuleObject) > 0) THEN
CALL GetObjectItem(cCurrentModuleObject,1,cAlphaArgs,NumAlphas,rNumericArgs,NumNumbers,ios, &
AlphaBlank=lAlphaFieldBlanks,NumBlank=lNumericFieldBlanks, &
AlphaFieldnames=cAlphaFieldNames,NumericFieldNames=cNumericFieldNames)
iIDFsetThreads=INT(rNumericArgs(1))
lIDFsetThreadsInput=.true.
IF (iIDFsetThreads <= 0) THEN
iIDFsetThreads=MaxNumberOfThreads
IF (lEnvSetThreadsInput) iIDFsetThreads=iEnvSetThreads
IF (lepSetThreadsInput) iIDFsetThreads=iepEnvSetThreads
ENDIF
IF (iIDFSetThreads > MaxNumberOfThreads) THEN
CALL ShowWarningError('CheckThreading: Your chosen number of threads=['//trim(RoundSigDigits(iIDFSetThreads))// &
'] is greater than the maximum number of threads=['//trim(RoundSigDigits(MaxNumberOfThreads))//'].')
CALL ShowContinueError('...execution time for this run may be degraded.')
ENDIF
ENDIF
IF (iNominalTotSurfaces <= 30) THEN
NumberIntRadThreads=1
IF (lEnvSetThreadsInput) NumberIntRadThreads=iEnvSetThreads
IF (lepSetThreadsInput) NumberIntRadThreads=iepEnvSetThreads
IF (lIDFSetThreadsInput) NumberIntRadThreads=iIDFSetThreads
ELSE
NumberIntRadThreads=MaxNumberOfThreads
IF (lEnvSetThreadsInput) NumberIntRadThreads=iEnvSetThreads
IF (lepSetThreadsInput) NumberIntRadThreads=iepEnvSetThreads
IF (lIDFSetThreadsInput) NumberIntRadThreads=iIDFSetThreads
ENDIF
#else
Threading=.false.
cCurrentModuleObject='ProgramControl'
IF (GetNumObjectsFound(cCurrentModuleObject) > 0) THEN
CALL GetObjectItem(cCurrentModuleObject,1,cAlphaArgs,NumAlphas,rNumericArgs,NumNumbers,ios, &
AlphaBlank=lAlphaFieldBlanks,NumBlank=lNumericFieldBlanks, &
AlphaFieldnames=cAlphaFieldNames,NumericFieldNames=cNumericFieldNames)
iIDFsetThreadsInput=INT(rNumericArgs(1))
IF (iIDFsetThreads > 1) THEN
CALL ShowWarningError('CheckThreading: '//trim(cCurrentModuleObject)//' is not available in this version.')
CALL ShowContinueError('...user requested ['//trim(RoundSigDigits(iIDFsetThreadsInput))//'] threads.')
ENDIF
ENDIF
MaxNumberOfThreads=1
#endif
! just reporting
cEnvValue=' '
CALL Get_Environment_Variable(cNumActiveSims,cEnvValue)
IF (cEnvValue /= Blank) THEN
lnumActiveSims=.true.
READ(cEnvValue,*,IOSTAT=ios) inumActiveSims
ENDIF
RETURN
END SUBROUTINE CheckThreading