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

running MPI program

Vladislav03
Novice
696 Views

I'm trying to run a simple "Hello world program" from visual studio. It's configured as in

"mpi-library_developer-guide-windows_2021.13". The project builds successfully, but when I press  "Run' I get the following error: 

 --------------------------- Microsoft Visual Studio --------------------------- The program cannot be started "C:\Program Files (x86)\Intel\oneAPI\2024.2\bin\mpiexec.exe". Input or output cannot be redirected because an invalid file is specified. --------------------------- ok ---------------------------

 

Here's the code:

program hello
integer :: myrank, nprocs
integer :: err
call MPI_INIT(err)
call MPI_COMM_RANK(MPI_COMM_WORLD, myrank, err)
call MPI_COMM_SIZE(MPI_COMM_WORLD, nprocs, err)
if ( myrank .eq. 0 ) then
print *, 'Running on ',nprocs,' Processes'
endif
print *, 'Greetings from process ', myrank
call MPI_FINALIZE(err)
end

The version of MPI and the Intel Fortran compiler is 2024.2

What can I do to  solve this error?

0 Kudos
2 Replies
Ron_Green
Moderator
607 Views

That sounds like VS is having issues executing the mpiexec command.

Have you tested running the hello.exe file from the oneAPI Command Prompt for Intel64?  Open a oneAPI Command Prompt.  Navigate to your project's x64\Debug folder.

then

mpiexec -n 1 hello.exe

(assumes your exe is named 'hello')

If this works, try -n 4 

 

Carefully check the Project Properties, Configuration Properties, Debugging, Command, Command arguments, and Environment settings.  

Check that the Configuration is "Active(Debug)" - if you want the Release configuration you'll have to do that full Properties setup for it as well.  I'm kind of surprosed the iMPI docs did not recommend using Configuration "All Configurations" for this so you don't have issues switching from Debug to Release.

 

If none of this helps I can transfer this issue over to our MPI Forum.

 

0 Kudos
Vladislav03
Novice
563 Views

So, I spent a little time and managed  to start it from the oneAPI Command Prompt for Intel64. Vs2022 still gives the same error when hitting 'run' button. But there are a few more issues I found:

1) The program could be compiled despite the fact that I hadn't written "use mpi" or "include 'mpif.h' " at the start. Moreover I found that if I choose to write 'use mpi' the program do not compile giving the error that it couldn't find compiled file and I need to check include directories (I have checked everything again - both release and debug  configurations are set properly according to the mpi-library_developer-guide)

2) Don't know exactly wether this problem is on the Intel side but when I choose 'release' config to build project, VS22 still build debug config unless I go to the config manager under the window of system bit depth (x64 or x86) and make it 'release' version manually apart from choosing it  on the top panel. 

However now I can run MPI applications somehow and may start learning it :), so thank you very much!

Reply