Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
Announcements
FPGA community forums and blogs have moved to the Altera Community. Existing Intel Community members can sign in with their current credentials.
29308 Discussions

Error using the inquiry function MCLOCK

samba_ba
Beginner
761 Views
Hello,

I want to use the function MCLOCK to know the timing of my program.
Here is the peace of code :

integer time_I, time_First, time_Final

time_I = MCLOCK()

On compilation it gives me the error :
"Error: This name does not have a type, and must have an explicit type"

Do you know why?
Anybody knows what to do ?

Thanks
Samba.

0 Kudos
5 Replies
samba_ba
Beginner
761 Views
I just forget to say that I am a new Fortran user
0 Kudos
TimP
Honored Contributor III
761 Views
If you have set
IMPLICIT NONE
(which is good practice) you will need to declare MCLOCK explicitly, either with an old-fashioned
INTEGER MCLOCK
or with an interface block.
If you did not set IMPLICIT NONE, you are probably being caught by the empty argument, which should have been accepted with the interface block. You could add an argument, and simply not use it.
IMO, the interface block ought to be provided if you
USE IFPORT
As that doesn't appear to be the case, I think a problem report on premier.intel.com would be in order. ifort ought to be set up to make your case "just work" when you follow the documentation.
0 Kudos
samba_ba
Beginner
761 Views
Hi Tim,
THank for your quick reply.
Actually I set IMPLICIT NONE at the beginning of the program.
I am using Intel Fortran 9.1.
I just saw the report of Steve Lionel about explicit interface.
I try to use the following explicit interface declaration :
INTERFACE
FUNCTION MCLOCK ()
INTEGER ::MCLOCK
END FUNCTION
END INTERFACE

But it does not seem to work.
Any suggestion on the way to declare the interface and where in the program ir should be declared?

Thanks,
Samba.
0 Kudos
Steven_L_Intel1
Employee
761 Views

This is a compiler bug. You should not have to declare MCLOCK which is an intrinsic function. Oddly, even adding an INTEGER declaration doesn't help. Using an INTERFACE would be wrong as that means it is an external routine.

I'll report this to the developers. I suggest using the standard intrinsic SYSTEM_CLOCK or perhaps CPU_TIME as an alternative.

0 Kudos
samba_ba
Beginner
761 Views
Thank you Steve.
I'll try to find an alternative
0 Kudos
Reply