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

Executing commands on Visual Studio 2022

AdityaGanesh
Beginner
809 Views

Hi,

 

I am new to the Intel Fortran compiler and I have difficulty in setting up my visual studio environment. I use Fortran for scientific programming and have been using it in a Linux environment in my college. I want to use the same in Windows 11 with Visual studio community 2022.

I have the following files in my source files:

- Main_File_1.f90

- Main_File_2.f90

- Sub_Main_File.f90

- modules.f90

- utils.f90

- properties.f90

 

The commands in my Linux machine were:

ifort -c -v -O3 modules.f90 Sub_Main_file.f90 utils.f90 properties.f90

ar rv lib1.a modules.o globals.mod interfaces.mod Sub_Main_file.o utils.o properties.o

ranlib lib1.a

ifort -v -O3 -o First.exe Main_File_1.f90 lib1.a -L$MKLROOT/lib/intel64 -qmkl -lpthread

./First.exe

ifort -v -O3 -o Second.exe Main_File_2.f90 lib1.a -L$MKLROOT/lib/intel64 -qmkl -lpthread

./Second.exe

 

The Main File 1 writes an output file, which is later collated by the Main File 2.

 

I have made the following changes in the properties of my project:

Fortran -> Libraries -> Use Intel Math Kernel Library -> Parallel (/Qmkl:Parallel)

Fortran -> General -> Optimization -> Maximize speed plus higher level optimizations (/O3)

Fortran -> Resources -> Show Progress -> Yes (/v)

 

However, I know this isn't sufficient. Kindly let me know what changes should I include so that the code runs?

0 Kudos
1 Solution
jimdempseyatthecove
Honored Contributor III
798 Views

It appears that you are using Visual Studio. 

Your Linux build/run is creating a library and two executables.

This means that you will need to create three projects, one for the library and one for each executable.

However, note that MS VS can have only one startup project (executable).

IIF you desire to build and run the two executables in one shot, then add a post-build event that runs a command script (aka batch file) to run the two executables (one after the other).

Or, more cumbersome, set the startup project to the first executable, perform a run, set the startup project to the second executable, perform the run. (you would likely do this while debugging).

Note, if you make each executable project dependent on the library project, you need not explicitly specify the library as an input to your link phase of each executable.

 

Jim Dempsey

View solution in original post

0 Kudos
2 Replies
jimdempseyatthecove
Honored Contributor III
799 Views

It appears that you are using Visual Studio. 

Your Linux build/run is creating a library and two executables.

This means that you will need to create three projects, one for the library and one for each executable.

However, note that MS VS can have only one startup project (executable).

IIF you desire to build and run the two executables in one shot, then add a post-build event that runs a command script (aka batch file) to run the two executables (one after the other).

Or, more cumbersome, set the startup project to the first executable, perform a run, set the startup project to the second executable, perform the run. (you would likely do this while debugging).

Note, if you make each executable project dependent on the library project, you need not explicitly specify the library as an input to your link phase of each executable.

 

Jim Dempsey

0 Kudos
Barbara_P_Intel
Employee
738 Views

There's also this about using VS (Visual Studio) with Intel Fortran in the Fortran Developer Guide.

0 Kudos
Reply