Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
28447 Discussions

how to stop program execution in CVF

napata
Beginner
1,065 Views
I want to be able to stop an execution of a program that is running from the CVF window. My test runs starts with 100 to 1000 iterations and I want to have the option of halting the execution depending on the output to the screen (useful or junk). I searched through all the icons in CVF window and non includes stop or suspend execution?

In unix, I use "ps" command to get the job id and then "kill id" command.
The online manual refers to "kill" and determining the id but no clear example of how to use them.

(2) As a first time user of build, project, and workspace concepts, I am loading the input data required by the program manually to the project folder. Loading them to workspace does not work? I thought by adding the fortran routines and the input data files to the project by:
project/add to project/files would do the job. It does not.

My solution is to run the program and then let it crash and tell me where it expected to find the file. Then I load the file. I am sure there is a smarter way to add the data files? -:)

Thanks

0 Kudos
4 Replies
WSinc
New Contributor I
1,065 Views
I'm not sure how you set up the application, but if it's a console application, Ctrl-C will stop it.

Another approach is to solicit input every 100 or so iterations and ask whether it should continue. That has the advantage of controlling the output better.
0 Kudos
gchien
Beginner
1,065 Views
> In unix, I use "ps" command to get the job id and
> then "kill id" command.
> The online manual refers to "kill" and determining
> the id but no clear example of how to use them.

The Windows equivalent of "ps" is Task Manager. If you are on Windowns NT/2000/XP, right click on an empty area of the task bar (where the Start button is located) and select Task Manager from the context menu. On Windows 95/98 (not sure about Me), you can do it by the three-finger salute (ctrl-alt-Del) and pick the running program from the list to kill.

> (2) As a first time user of build, project, and
> workspace concepts, I am loading the input data
> required by the program manually to the project
> folder. Loading them to workspace does not work? I
> thought by adding the fortran routines and the input
> data files to the project by:
> project/add to project/files would do the job. It
> does not.

This mechanism is for you to load program source files and, perhaps, some include files with data into the workspace. How does your program open the data file? By taking the data file name/path from the command line? If this is the case, then you can specify it as a program argument in the Debug tab of the Project>Settings... dialog. Don't forget to specify All Configurations in the Settings For: field before you enter the data file name.

> My solution is to run the program and then let it
> crash and tell me where it expected to find the file.
> Then I load the file. I am sure there is a smarter
> way to add the data files? -:)

Run what program? The IDE, the compiler/linker, or your own program? When you know the path of the file, how do you load it? Can't tell you "a smarter way" without these information ;-)

Regards,
Greg Chien
http://protodesign-inc.com

0 Kudos
isn-removed200637
1,065 Views
Regarding your query about where to put the data files needed by your executable....
In my experience, if you do not inquire by way of using
the Getopenfilename function, then the only place to put the data required by an executable (.EXE) is in the same directory as the executable.
This means in the /release/ or /debug/ sub-folder created by your project. If you start your .EXE from the command line, or by double-clicking on its icon, this is the only sure way, especially if you have moved the .EXE file after first creating it.

However, if you start the program using 'Execute whatever.EXE' from the Devstudio Build menu then, in my experience, if the datafile is in the Project folder, the data file will be found. But this is probably non-standard, so put your data with the executable. If you use a shortcut to the executable from your desktop, I think that you can specify the folder to set as the 'current directory' when you set up the shortcut. This folder should contain the data files.

IMHO, the better solution is to program an 'INQUIRE(EXIST=' to check if the data file exists in the current directory and then to program a call to Getopenfilename to find and select a data file if the expected data file is not present where expected.
0 Kudos
isn-removed200637
1,065 Views
More on data files...
You could generate and use your own file extension for
your data files (e.g. .xyz) and then associate them with your executable using the Options menu item in Windows Explorer (you have to give the executable's full path location here). Once this has been set up, then by double clicking on any data file with this extension, in whatever folder, you should then start your executable as if you had issued a Run command line 'Executable.exe /fullpath/datafilename'.
Then you need to extract the /fullpath/datafilename from the command line using GETARGS within your main program. This is straightforward.

Once you add this GETARGS functionality, you will have drag-and-drop functionality: by creating a desk-top short-cut to your executable, you can then drag a datafile icon onto it (from Explorer say), drop it there and the executable and datafile are matched up. Your executable will then fire up with the /fullpath/datafile name as the first argument on the command line after the name of the executable...ergo, no more missing datafiles.
0 Kudos
Reply