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

Attempting fo use an MPI routine before initializing MPICH

Anders_S_1
New Contributor III
2,608 Views

Hi,

I have installed latest VS2022 and oneAPI and get the error code in the title while running a simple source code (see attachment for compile, link, run and source code.

Best regards

Anders S

0 Kudos
1 Solution
Anders_S_1
New Contributor III
2,423 Views

Hi Barbara,

Sorry, I missed the startline output from my source code, proving that you made it work!

I reinstalled VS2022 and oneAPI but I still got the same problem. 

I then tried MPI_Initialize(ierr) instead of MPI_Init(ierr) but still the same problem.

I changed back to MPI_Init(ierr) and then the error disappeared!  Why?

Anyhow, everything seems to work now, which is the main thing!

Best regards

Anders S

View solution in original post

12 Replies
Barbara_P_Intel
Moderator
2,595 Views

Can you please attach the source file? Then we don't have to retype it to use it and possibly introduce errors.

 

0 Kudos
Anders_S_1
New Contributor III
2,578 Views

Hi Barbara,

Here comes a "usable" source code!

Best regards

Anders S

0 Kudos
Anders_S_1
New Contributor III
2,570 Views

Hi Barbara,

I would really appreciate a solution of the problem as I have run short of time due

to time-consuming trials to install and uninstall earlier versions of VS and ifort with

no success. I have searched internet but found no hint how to correct the error.

Best regards

Anders S

0 Kudos
Barbara_P_Intel
Moderator
2,565 Views

My MPI is rusty. I can't find "-localroot" documented for Intel MPI. 

On Linux, this works. 

 

$ mpiexec -n 1 a.out
****************************
3
$

 

On Windows

>mpiifort source_code.f90
mpifc.bat for the Intel(R) MPI Library 2021.8 for Windows*
Copyright Intel Corporation.

Intel(R) Fortran Intel(R) 64 Compiler Classic for applications running on Intel(R) 64, Version 2021.8.0 Build 20221119_000000
Copyright (C) 1985-2022 Intel Corporation.  All rights reserved.

Microsoft (R) Incremental Linker Version 14.34.31937.0
Copyright (C) Microsoft Corporation.  All rights reserved.

-out:source_code.exe
-subsystem:console
"/LIBPATH:C:\Program Files (x86)\Intel\oneAPI\mpi\latest\env\..\lib\release"
"/LIBPATH:C:\Program Files (x86)\Intel\oneAPI\mpi\latest\env\..\lib"
impi.lib
source_code.obj
c:\Users\bperz\source\05796205>mpiexec -n 1 source_code.exe
****************************
55
>
0 Kudos
Anders_S_1
New Contributor III
2,557 Views

Hi Barbara,

localroot was introduced to make the QuickWin plotting work. Before going to

oneAPi, this worked fine.

In Fortran 19.2, Jim Dempsey helped me to change to localonly, when localroot was

getting an error remark.

Best regards

Anders S

0 Kudos
Anders_S_1
New Contributor III
2,424 Views

Hi Barbara,

Sorry, I missed the startline output from my source code, proving that you made it work!

I reinstalled VS2022 and oneAPI but I still got the same problem. 

I then tried MPI_Initialize(ierr) instead of MPI_Init(ierr) but still the same problem.

I changed back to MPI_Init(ierr) and then the error disappeared!  Why?

Anyhow, everything seems to work now, which is the main thing!

Best regards

Anders S

Anders_S_1
New Contributor III
2,487 Views

Hi Barbara,

When I run on a laptop with a core i7-4910MQ processor, everything works.

When I run on a workstation with an AMD 3990X processor I have the reported problem. With VS2017 and Cluster Studio no problems were met with.

I both cases I set up the system via the automatized setup by using the command 64-bit line below the oneAPI in Windows.

 

I did not understand if you managed to solve the problem or not.

Best regards

Anders S

0 Kudos
Barbara_P_Intel
Moderator
2,553 Views

"-localonly" works on Windows for me with your reproducer.



0 Kudos
jimdempseyatthecove
Black Belt
2,507 Views

Barbara,

FYI the issue with -localroot was that the environment was not set up to find the Intel provided mpiexec first, which resulted in selecting the Microsoft provided mpiexec (which does not support the -localroot option). Your installation program may need to place the Intel MPI runtime folders (perhaps OpenMP as well) in the system environment variables that are loaded at startup as opposed via running setvars. 

 

Also, on the HPC forum, I queried as to if there are any feature differences between MS mpiexec and Intel mpiexec. No reply. In particular, .NOT. command line option difference, but rather runtime differences (in particular better performance). Would you be able to list these if any? This would provide a motivation for users to assure the environment is setup correctly, and result in fewer queries/issues as in this thread.

 

Jim Dempsey

0 Kudos
jimdempseyatthecove
Black Belt
2,473 Views

>>I both cases I set up the system via the automatized setup by using the command 64-bit line below the oneAPI in Windows.

Then in that command prompt issue:

  SET>environment.txt

  notepad environment.txt

 

Note, you will have to insert line breaks at ";" for the long definitions.

You will likely see that the MS version of mpiexec will be found first.

You will want to change one of the settings such that the Intel version is found.

General rules:

  • The current working directory.
  • The Windows directory only (no subdirectories are searched).
  • The Windows\System32 directory.
  • Directories listed in the PATH environment variable.
  • Recommended: HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths

IOW if someone/something placed MS's mpiexec in C:\Windows or C:\Windows\System32 then you will have a problem.

.OR.

if PATH contains C:\Program Files\Microsoft MPI\Bin\ before the Intel MPI binaries folder then you will have a problem as well.

 

Jim Dempsey

 

 

0 Kudos
Anders_S_1
New Contributor III
2,414 Views

Hi Jim,

Thank you very much for engaging!

I am not sure about the exact message. When I start a session with Fortran I go to the

oneAPI command prompt for Intel64 and give location of the code. It has never been necessary

to modify the environment. I thought that Intel code was automatically chosen after this procedure.

What exactly have I got to do in order to avoid the problems occurring when the MS mpiexec is invoked?

Best regards

Anders S

0 Kudos
Reply