Determining running timing problem

Just wanted to roughly time my run time. All I can get is zero from either timcpu, cpu_time, system_clock, or clock. Using PGI VF in Visual Studio 2008 on Win7 64-bit. Code is below and the call to submain typically takes a couple minutes for the case being exercised. I wonder if I have a setting wrong in VS2008.


program macro3d
implicit none

real start_time, end_time, cputime, conversion
c integer(kind=8) count, count_rate, count_max

data conversion/1.e-9/
c
c call timcpu(start_time)
call cpu_time(start_time)
write(6,20) start_time
c
call submain
c
c call timcpu(end_time)
call cpu_time(end_time)
write(6,30) end_time
c
cputime = (end_time - start_time)
write(6,100) cputime, cputime/60., cputime/3600.
write(74,100) cputime, cputime/60., cputime/3600.
c
20 format(’ start time =‘,e16.9)
30 format(’ end time =‘,e16.9)
100 format(//,’ Total CPU time is’,1pe16.9,’ sec =‘,1pe14.7,
& ’ min =’,1pe12.5,’ hr’)

stop
end

Hi deeppow,

The granularity of the Window’s system timer is quite poor, roughly 1 second. So anything smaller then a second will be zero.

  • Mat

Thanks Mat but as I noted the subroutine between the 2 timing calls takes a couple minutes. It isn’t a granularity issue.

I have a separate Intel Fortran compiler and this works fine on it. I suspect I must have something setup wrong in my PGI VS2008 settings but don’t see what that might be.

I suspect I must have something setup wrong in my PGI VS2008 settings but don’t see what that might be.

Possible but I don’t what since timing routines just hook into the Windows timers. Can you post the code for “submain”? I put a call to sleep in it’s place and the timers we correct.

  • Mat

Submain is pretty simple too. It is solve where the work is done.

dk submain
subroutine submain
implicit none
c
c
*****************************************************************
c *
c s u b m a i n *
c *
c******************************************************************
c

include ‘constant.h’
include ‘paramset.h’

real(kind=8) dzi(nlevm)
c
c read in code input from file “macro3d.inp”
c
call input (dzi)
c
c solve for the specified problem
c
call solve (dzi)
c
return
end

INCLUDE files
constant.h

c
real(kind=8) zero, one, two, half, pi, grav

parameter (zero = 0.0, one = 1.0, two = 2.0, half = 0.5)
parameter (pi = 3.1415926535897932, grav = 9.807)
c
c zero the number 0, [real]
c one the number 1, [real]
c two the number 2, [real]
c half the fraction 1/2, [real]
c pi the number 3.141593…, [real]
c grav gravitational constant in si units 9.807…, [real]
c

parameter.h
c
integer npolym, nlevm, ncnmax, ncnmaxp2
integer nelemm, ndrymax
parameter (npolym=2503, nlevm=11, ncnmax=13, ncnmaxp2=ncnmax+2)

parameter (nelemm = npolym * nlevm)
parameter (ndrymax = 180)
c
c npolym maximum number of radial nodes per level, [integer]
c nlevm maximum number of axial levels, [integer]
c nelemm maximum number of nodes (npolym*nlevm), [integer]
c ndrymax maximum number of sites or dry spots, [integer]
c

By the way, here is compiler command line:

-Bstatic -Mbackslash -Mbounds -Mchkptr -Mchkstk -I"F:\Macro3d\Macro3d_PGI\Include Files" -I"d:\program files\pgi\win64\12.4\include" -I"D:\Program Files\PGI\Microsoft Open Tools 10\include" -I"D:\Program Files\PGI\Microsoft Open Tools 10\PlatformSDK\include" -fastsse -Ktrap=fp -tp=nehalem-64 -Minform=warn -Minfo=ftn,mp

Looks like there are some missing bits (input and solve routines as well as the input workload) so I can’t recreate the test. Mind zipping up all the necessary files and sending it to PGI Customer Service (trs@pgroup.com) and ask them to forward it to me?

  • Mat

Mat, I’ll do that.

I have a problem with the web site in that I can’t change my profile so it’ll tell me when a reply has been posted. (Want my email address but no where to put it into the profile.) I’ve sent a message to the webmaster but no reply, I’m not sure how often he/she checks messages. Currently I have to load the forum back into my browser to check to see if you’ve replied.

Sorry to ask. It is straight forward to do login etc. but a pain in the a$$.

Have sent the whole code to support. No further distribution please.

I can’t change my profile so it’ll tell me when a reply has been posted.

I don’t think he enabled this feature. Though, I’ll talk with him to see what can be done.

No further distribution please.

Understood.


For what ever reason, the CPU time I get seems correct. I’m not sure why you would be getting zeros. Is your timing section running below 1 second?

AMD Bulldozer system running Win Server 2008

Total CPU time is 3.121400070E+01 sec = 5.2023339E-01 min = 8.67056E-03 hr

Intel Sandy-Bridge System running Win7 SP1.

Total CPU time is 1.582100010E+01 sec = 2.6368335E-01 min = 4.39472E-03 hr

  • Mat

This is what I get for my system with Sandy-Bridge, Win7 SP1 + recent updates, Intel compiler, Visual Studio 2008

Total CPU time is 4.754910480E+01 sec = 7.9248508E-01 min = 1.32081E-02 hr

Hi Deeppow,

Can you try removing optimization (i.e. change -fastsse to -O0)? My best guess at this point is that the section being timed is dropping below 1 second (mines at 1.5 seconds) and removing optimization will slow it down enough to be timed.

  • Mat

Within VS I have to run “debugging” optimization, same as O0 I’m sure.

Same result, all zeros.

I’m wondering if there is somehow a communication problem across my storage devices. No sure why that would happen.

When I initially installed Dave (in tech support) said to install the PGI compiler on C-drive. I had already installed it on D-drive. He wasn’t sure that would work but it appears to work.

My application/drive configuration is
Win7 on C-drive
VS 2008, PGI and Intel compilers on D-drive
the code is on F-drive

I have no idea why that should affect this issue but I’m grasping at straws.

Is there and environmental variable that might be needed?

I high doubt the drive would have anything to do with it. I compiled your code from a network drive.

I have no idea why that should affect this issue but I’m grasping at straws.

Same here.

Is there and environmental variable that might be needed?

Not that I’m aware of. I’m not setting anything special.

I think next step is to swap binaries. If my binary still fails on your system or yours works on my, then it’s most likely environmental. Otherwise, we need to track down what’s different between our builds.

  • Mat

I am having a similar issue, though I am just using the command line compile under Win7-64bit. The simple test program times in at about 19 sec under gfortran. Using your 12.4 compiler, it takes a bit over 3 seconds, but the timing routines, whether system_clock or cpu_time, report 0.000 sec. This is regardless of optimization used. However, when I run the program through pgcollect, the reported time appears correct at about 3.4 sec (give or take a few random milliseconds). Just a bit more info for you to work with.

-alan

Mat,
Posted on several Windows7 forums but didn’t get any concrete answers other than reinstall the OS and reinstall one app at a time to test. That is a viable path forward but would take me days so I put the issue aside.

I’ve just reached the point of deciding to use the profiling tools and when I switched that compiler option on, my original timing started working. Something associated with that switch makes it work. Of course turn the profiler off and my timings don’t work.

Don’t know if that is of any use or not.

Alan,
I would think that that little variation (within 12.4 ± profiler) could easily occur from run to run due to the system sharing its activities differently from one time to the next.


-ralph