Community
cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Beginner
47 Views

Running multiple instances of same program

am using Microsoft Visual Studio 2012 coupled with Intel Fortran. It is running a large third party software which I am working on. The program takes data files containing information as inputs and outputs  files with altered data.

Currently I set the working directory for the software using Configuration>Debug Properties. The directory I have set contains the input files. The command arguments are really the file name which the input files are called. They are circled in the red box (see attachment).

The question is, what if I have multiple files in my working directory (InputValues\v2017.1i\Test\Test, Test2 and Test3) which I would like to run simultaneously. They all depend on the currently loaded solution. How do I go about doing this? I have already tried simply appending this to the command argument field but it only runs test and neglects the other ones.

 

 

 

0 Kudos
7 Replies
Highlighted
Valued Contributor II
47 Views

You do not need to run the

You do not need to run the program via Visual Studio. Being able to debug it or simply run it is a nice feature, but at the bottom of that modus operandi is an executable program and you can simply run it in a DOS-box for instance - run it in dozens of DOS-boxes, each with its own working directory and input files.

0 Kudos
Highlighted
Beginner
47 Views

That is exactly what I would

That is exactly what I would like to get more familiar with. How can one create the executable in Microsoft Visual Studio? What parameters are attached to the executable? For example, when I create the executable is it inherently linked to a certain directory or can I assign the directory once in the shell?

Please help with these basic concepts. I am new to compiled software and my installation of Visual studio (via company) restricts my use of the developer command prompt (requires more administrative priviledge than I am entitled to). Therefore I cannot manually compile, link and run programs using the ifort command, and thus understand the behind-the scenes mechanisms that Visual Studio uses.

0 Kudos
Highlighted
Valued Contributor II
47 Views

If you build the solution,

If you build the solution, you get an executable program (assuming that there is a project that has been created for full programs). It is stored in a directory Debug or Release typically. This executable program can be run in any directory, as long as it can find the runtime libraries it depends on.

Can you open a command prompt - under the Intel Fortran entry in the Start menu, look for "Compiler and Performance Libraries", then "Command prompt with Intel Fortran compiler" and then the 32-bits or 64-bits option - depending on the compile configuration in Visual Studio

Move to the directory holding your input files:

cd "my-input-files"

and type the full name of the program, followed by the arguments you need:

"my project\debug\myprogram.exe"  arg1 arg2 arg3

Just a sketch of course - you will have to fill in the right names.

If that is not possible (you do not have the prompt option), then you will have to run via Visual Studio, I guess, but if you run the program instead of debug it, then you can start multiple runs. Just change the working directory to the one you want via the Properties.

HTH

0 Kudos
Highlighted
Beginner
47 Views

Hi Arjen,

Hi Arjen,

Thanks for your response. Unfortunately the Visual Studio/Intel Command Prompts are not an option, I have explored this extensively (please see https://software.intel.com/en-us/forums/intel-visual-fortran-compiler-for-windows/topic/720831 and https://superuser.com/questions/1189201/having-a-host-of-seemingly-related-issues-on-visual-studio-2...). I have concluded, thanks to our in-house IT support that their local security policy prevents the running of these prompts effectively. Being a new employee I cannot easily request this, and even if I did there is no guarantee the request would be accepted.

My starting assumption is that if something can be done by the command prompt, it can also be done through the full IDE. Now, I also do have access to the regular Windows 7 CMD, no problem. I just need some indications/learning resources that would help me learn through the IDE what is best learned through the prompts.

For instance, I understand this program has three main configurations, an internal release, external release and internal debug configuration. When I build the solution which configuration becomes inherent in the executable? Perhaps the executable is independent from the configuration itself.... and this can be controlled when launching the executable? Which commands are run "behind the scenes" when I press Ctrl+F5 on the IDE (Start Without Debugging)? How can I get access to these commands and perhaps modify or play around with them? What ensures that the executable can find the runtime libraries that it depends on to run? Say if I move it to another directory? What is the difference between compile, link and run and how do these come into play?

I realize this is quite a bit and don't expect a full answer right away, but would you mind at least touching upon some of these? Thanks...

0 Kudos
Highlighted
47 Views

Assume you built your

Assume you built your application as one of:

Win32 Debug
Win32 Release
x64 Debug
x64 Release
(or Win32|x64 YourConfigurationNameHere)

Once you have the program running from the IDE (and assume prior to the END PROGAM you have a PAUSE statement.

Locate the .exe file using Windows Explorer (the file manager, not Internet Explorer)

Right-Click on the file name, choose Create Shortcut. Then drag the shortcut somewhere (desktop or some folder you want to use for launching the application).

Test it by running (the shortcut) as-is. It should run (assuming the data files are in the place they were before).

When you get that working, you can right-click on the shortcut, and change the "Start in" folder to point to the exclusive folder for the data files (this would be a good place to place the shortcut too).

If you place multiple shortcuts into the same folder (desktop?) You might want to rename the shortcut to contain the name of the where the data files are located.

What can mess you up (other than  "Start in" folder) is if the IT manager has a firewall or AV filter set to prohibit you running an executable that is launched other than by Visual Studio (or launched from a temp directory). I will let you work out that issue.

Jim Dempsey

 

0 Kudos
Highlighted
Retired Employee
47 Views

You can't run a given program

You can't run a given program more than one at a time from within VS. In addition to what Jim and Arjen have said, you could do one of these (in increasing complexity order):

  1. If the program accepts a file specification on the command line (through GET_COMMAND_ARGUMENT or similar), using a normal Windows Explorer window open the folder containing the input files (and ideally also the EXE), select the input files and "drag and drop" them onto the EXE. Windows will run the EXE once for each file, placing as the command argument the full path to the data file.
  2. Modify your program to accept multiple command arguments (use COMMAND_ARGUMENT_COUNT to see how many) and loop through them, processing each in turn.
  3. Modify your program to use the GetOpenFileName Windows API, allowing selection of input files, and then have the program loop through each one doing the processing.

 

--
Steve (aka "Doctor Fortran") - https://stevelionel.com/drfortran
0 Kudos
Highlighted
47 Views

As usual, Steve is the best..

As usual, Steve is the best...

Jim Dempsey

0 Kudos