OpenMP performance on Windows 7
John D Campbell
johndcampbell@bigpond.com
Mon Oct 27 02:50:00 GMT 2014
I hope you may be able to advise if this is a known problem:
I have been using gFrotran to test OpenMP and have a few questions and
feedback.
Two questions, which I would like a response (detailed below)
1) Entering !$OMP PARALLEL region has a high overhead.
2) I need to convert Silverfrost Fortran STDCALL syntax to use
ISO_C_BINDING; can you advise suitable reference ?
Regards
John Campbell
1: Openmp
I am using gFortran 4.9.1 on Windows 7, installed with mingw-w64-install.exe
The !$OMP region overhead is about 50 to 55 microseconds.
I have also tested gFortran 4.8.2 on Windows 7, downloaded from
equation.com. The !$OMP region overhead is about 20 microseconds.
>From the OpenMP Forum (openmp.org/forum), I have been told that the !$OMP
region overhead is about 2 microseconds for an lunix install.
Is this 10 to 25 x penalty a known problem of Windows ?
2: Get_Processor_Name
I am trying to write a routine to return the processor name. I have a
version written for Salford/Silverfrost FTN95, but I am not familiar with
the calling convention for gFortran (x64)
Is anyone able to suggest changes to the call convention ?
(this could be a useful addition to the system routines)
character processor_Name*256
call get_processor_name ( processor_Name )
write (*,*) trim ( processor_Name )
end
subroutine get_processor_name ( processor_Name )
character processor_name*(*)
!
STDCALL RegOpenKey 'RegOpenKeyA'(VAL,STRING,REF):INTEGER
STDCALL RegQueryValueEx
'RegQueryValueExA'(VAL,STRING,REF,REF,STRING,REF):INTEGER
STDCALL RegCloseKey 'RegCloseKey'(VAL):INTEGER
!
! From the example I could get the desired result!
!
! What I did not know was the following:
! 80000000 -> HKEY_CLASSES_ROOT
! 80000001 -> HKEY_CURRENT_USER
! 80000002 -> HKEY_LOCAL_MACHINE
! 80000003 -> HKEY_USERS
!
INTEGER,PARAMETER :: HKEY_LOCAL_MACHINE = Z'80000002'
INTEGER,PARAMETER :: BUFSIZE=256
INTEGER hKey,res,cbValue
CHARACTER(LEN=BUFSIZE) processorName
!
cbValue = BUFSIZE
res = RegOpenKey
(HKEY_LOCAL_MACHINE,"HARDWARE\DESCRIPTION\System\CentralProcessor\0",hKey)
IF (res /= 0) then
processor_name = "ERROR:Cannot open registry key"
return
END IF
!
res = RegQueryValueEx
(hKey,"ProcessorNameString",CORE4(0),CORE4(0),processorName,cbValue)
IF (res /= 0) THEN
processor_name = "ERROR:Cannot read processor name"
ELSE
processor_name = processorName
ENDIF
!
res = RegCloseKey (hKey)
!
end subroutine get_processor_name
More information about the Fortran
mailing list