Support for Intrinsic EXECUTE_COMMAND_LINE

Support for Intrinsic EXECUTE_COMMAND_LINE

Dear Intel team,

Is there a roadmap for supporting further Fortran 03/08 intrinsics such as EXECUTE_COMMAND_LINE? I am working on a project right now that is supposed to be 100% standard compliant (up to F2008) and I am looking for a way to replace my ifort-only SYSTEM call.

I guess implementing this specific functionality is not a very big deal, particularly compared to other new features that obviously need some more time to make it into all compilers.

Really appreciate your thoughts on this..

10 posts / 0 new
Last post
For more complete information about compiler optimizations, see our Optimization Notice.

My request for this feature is in IPS issue 0000628820.  I suppose it's more complicated than meets the eye.  Last August, a response said it would not be tackled until f2003 support was completed, but I think the current compilers claim that is complete.  I'd guess some additional f2008 function may be planned for late this year.

One of the problems with SYSTEM is that its details vary among compilers, but not enough so that anyone has tried to make an open source replacement targeted to several compilers, as was done with f2kcli.

As it is part of F2008, it's part of that work. I can't say more at this time, but we recognize how useful this routine would be. Our internal tracking ID for the request is DPD200137238.

Retired 12/31/2016

Whilst the EXECUTE_COMMAND_LINE will be standard (portable) Fortran routine the behaviour will not be standard across platforms. It will have some system dependency. When Intel do make this routine you can guarantee that for windows it will just be a front end for something based on the Clib SYSTEM function. Whilst you are waiting you may as well write your own version,  MY_EXECUTE_COMMAND_LINE using System and accept that this is implementation dependant. Then at least it will be an easy job to replace it with the proper EXECUTE_COMMAND_LINE at some point in the future.

An another point, the string(s)  that you throw at the OS to run is OS specific also.....



Thanks Tim, Steve and app4619.

I am of course aware of the fact that this is a highly OS-dependent thing. (Luckily, this is not something *I* need to worry about in this project.) However, I am always a bit hesitant using a non-standard routine that isn't very portable when I know that there is a standard-compliant way (that does exactly the same thing and is as easy to handle) somewhere out there.

Keep in mind that system always does a wait, which means you couldn't use it if you want to support the WAIT argument. It's more complex than it looks.

Retired 12/31/2016

Don't forget O/S quirkiness relating to pipe and in/out redirection.

Jim Dempsey

My advice would be to write your own procedure and call it EXECUTE_COMMAND_LINE, i.e., exactly the same name as the standard procedure.  Then, place it into its own (non-intrinsic) module, just like the developers of F2KCLI did.  One possible name for the module could be Execute_Command_Line_M.  That way, once the standard version is available, you can just remove the reference to the module and you're ready to use the intrinsic version.

I wouldn't sweat too much about supporting the WAIT argument.  The Fortran 2008 standard provides an out.  It says, "If WAIT is present with the value false, and the processor supports asynchronous execution of the command, the command is executed asynchronously; otherwise it is executed synchronously." [Emphasis mine.]  This means that in your own version, if you believe that it is too difficult to support asynchronous execution of the command, then you are perfectly free to execute it synchronously.  So, in your own version, you need to recognize the WAIT argument, but you can legally and ethically ignore its value.

Many years ago I did something similar with the old Lahey F77L Fortran 77 compiler.  I wanted a version of the Fortran 90 Date_and_Time subroutine.  F77L had an intrinsic subroutine that allowed a programmer to call the MS-DOS INT xx procedures.  My version of Date_and_Time was able to obtain the current date and time using the MS-DOS INT xx calls, but I had no way of getting time zone information.  Therefore, I decided that the time zone was not available, so I assigned all blanks to the ZONE argument and -HUGE(0) to the VALUES(4) argument, as explicitly authorized by the Fortran standard.

Additional note. On Windows you can run the program (command) Start to launch and run a program or batch file asynchronously.

Enter "start /?" to get help information on the start program.

Jim Dempsey

It now looks likely that EXECUTE_COMMAND_LINE will make it in to the 15.0 compiler. No promises, though.

Retired 12/31/2016

Leave a Comment

Please sign in to add a comment. Not a member? Join today