<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: What environment variables are set by Intel MPI on Windows? in Intel® MPI Library</title>
    <link>https://community.intel.com/t5/Intel-MPI-Library/What-environment-variables-are-set-by-Intel-MPI-on-Windows/m-p/1284165#M8316</link>
    <description>&lt;P&gt;Hi, Thanks for the reply.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I am actually using FORTRAN, does the same code work in it? The code snippet you posted looks like C/C++ code.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;So, what would be the difference between launching the process with or without MPI for the MPI_Comm_size() function?&lt;/P&gt;
&lt;P&gt;Would the function return an error if the program wasn't launched with MPI?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks.&lt;/P&gt;</description>
    <pubDate>Mon, 24 May 2021 18:20:19 GMT</pubDate>
    <dc:creator>SRM</dc:creator>
    <dc:date>2021-05-24T18:20:19Z</dc:date>
    <item>
      <title>What environment variables are set by Intel MPI on Windows?</title>
      <link>https://community.intel.com/t5/Intel-MPI-Library/What-environment-variables-are-set-by-Intel-MPI-on-Windows/m-p/1283741#M8304</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;So I am porting a Fortran code from Linux to Windows. The program is parallelised with MPI (specifically Intel MPI). The porting of the serial part of the code was successful and it runs on Windows without any hitch.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;In the MPI parallel part of the code, there is a line which I assume is checking whether the program has been called with MPI or not.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="fortran"&gt;call get_environment_variable("I_MPI_MPIRUN",  value = env_var, status = ev_status)
if(ev_status .eq. 1) call exec_mpirun(IMPI)&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;From what I can understand if the program is called with mpirun on Linux the I_MPI_MPIRUN environment variable is defined to some value. The program checks for that and if MPI &lt;STRONG&gt;isn't&lt;/STRONG&gt; running, it then calls the function exec_mpirun(). IMPI is a parameter defined as 1. The exec_mpirun() is a C function which runs execvp("mpirun", "mpirun","--map-by","node", "dmrcc_mpi"). dmrcc_mpi is the executable that needs to run.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;However, I can't find any Intel MPI documentation where the I_MPI_MPIRUN environment variable is mentioned. And I am not even sure that the same variable is used for Windows. For windows, the MPI executable is called with mpiexec, which also leads me to suspect the same environment variable wouldn't be used.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;So, is there any way to check whether the program has been called with MPI from within a Fortran code?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;And is I_MPI_MPIRUN variable set by mpiexec on Windows? Or is any other variable set?&lt;/P&gt;</description>
      <pubDate>Sat, 22 May 2021 09:43:09 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-MPI-Library/What-environment-variables-are-set-by-Intel-MPI-on-Windows/m-p/1283741#M8304</guid>
      <dc:creator>SRM</dc:creator>
      <dc:date>2021-05-22T09:43:09Z</dc:date>
    </item>
    <item>
      <title>Re: What environment variables are set by Intel MPI on Windows?</title>
      <link>https://community.intel.com/t5/Intel-MPI-Library/What-environment-variables-are-set-by-Intel-MPI-on-Windows/m-p/1284080#M8310</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks for reaching out to us.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;EM&gt;&amp;gt;&amp;gt;"So, is there any way to check whether the program has been called with MPI from within a Fortran code?"&lt;/EM&gt;&lt;/P&gt;
&lt;P&gt;Yes, by setting a few debug statements like printing No. of processes launched in MPI source code.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;int world_size;
MPI_Comm_size(MPI_COMM_WORLD, &amp;amp;world_size);&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;EM&gt;&amp;gt;&amp;gt;"And is I_MPI_MPIRUN variable set by mpiexec on Windows? Or is any other variable set?"&lt;/EM&gt;&lt;/P&gt;
&lt;P&gt;In windows, as there is no mpirun and there exists only mpiexec it isn't necessary to check for I_MPI_MPIRUN&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks &amp;amp; Regards,&lt;/P&gt;
&lt;P&gt;Santosh&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 24 May 2021 15:16:38 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-MPI-Library/What-environment-variables-are-set-by-Intel-MPI-on-Windows/m-p/1284080#M8310</guid>
      <dc:creator>SantoshY_Intel</dc:creator>
      <dc:date>2021-05-24T15:16:38Z</dc:date>
    </item>
    <item>
      <title>Re: What environment variables are set by Intel MPI on Windows?</title>
      <link>https://community.intel.com/t5/Intel-MPI-Library/What-environment-variables-are-set-by-Intel-MPI-on-Windows/m-p/1284165#M8316</link>
      <description>&lt;P&gt;Hi, Thanks for the reply.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I am actually using FORTRAN, does the same code work in it? The code snippet you posted looks like C/C++ code.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;So, what would be the difference between launching the process with or without MPI for the MPI_Comm_size() function?&lt;/P&gt;
&lt;P&gt;Would the function return an error if the program wasn't launched with MPI?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks.&lt;/P&gt;</description>
      <pubDate>Mon, 24 May 2021 18:20:19 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-MPI-Library/What-environment-variables-are-set-by-Intel-MPI-on-Windows/m-p/1284165#M8316</guid>
      <dc:creator>SRM</dc:creator>
      <dc:date>2021-05-24T18:20:19Z</dc:date>
    </item>
    <item>
      <title>Re: What environment variables are set by Intel MPI on Windows?</title>
      <link>https://community.intel.com/t5/Intel-MPI-Library/What-environment-variables-are-set-by-Intel-MPI-on-Windows/m-p/1285370#M8330</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Find the MPI code of sample.f below:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;    program main
    implicit none
    include 'mpif.h'
    integer ierr,size,rank,temp
    call MPI_INIT (ierr)
    call MPI_COMM_SIZE (MPI_COMM_WORLD, size, ierr)
    temp=ierr
    call MPI_COMM_RANK (MPI_COMM_WORLD, rank, ierr)
    if (rank.eq.0 .and. size.ge.1) then
      print *, 'MPI_COMM_SIZE returned ',ierr
      print *,'MPI Launched with ',size,' ranks'
    end if
    !write your code here
    call MPI_FINALIZE (ierr)
    end&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I am using the below FORTRAN code test.f90 to launch MPI executable file sample.exe&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;PROGRAM test_getenv
 call execute_command_line('mpiexec -np 4 sample.exe') 
END PROGRAM&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;On executing test.exe the output will be as follows:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="SantoshY_Intel_0-1622199737409.png" style="width: 637px;"&gt;&lt;img src="https://community.intel.com/t5/image/serverpage/image-id/17126i790309C190F9B84E/image-dimensions/637x88?v=v2&amp;amp;whitelist-exif-data=Orientation%2CResolution%2COriginalDefaultFinalSize%2CCopyright" width="637" height="88" role="button" title="SantoshY_Intel_0-1622199737409.png" alt="SantoshY_Intel_0-1622199737409.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;If MPI is launched, then we will get "4" ranks in output as we passed np=4 in test.f90. else by default, we get "1" rank.&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;Thus we can confirm whether MPI is launched successfully or not.&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;I&gt;&amp;gt;&amp;gt;"Would the function return an error if the program wasn't launched with MPI?"&lt;/I&gt;&lt;/P&gt;
&lt;P&gt;Yes, you can refer to the code sample.f and if ierr=0, then call to MPI_COMM_SIZE is successful.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks &amp;amp; Regards,&lt;/P&gt;
&lt;P&gt;Santosh&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 28 May 2021 11:06:03 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-MPI-Library/What-environment-variables-are-set-by-Intel-MPI-on-Windows/m-p/1285370#M8330</guid>
      <dc:creator>SantoshY_Intel</dc:creator>
      <dc:date>2021-05-28T11:06:03Z</dc:date>
    </item>
    <item>
      <title>Re:What environment variables are set by Intel MPI on Windows?</title>
      <link>https://community.intel.com/t5/Intel-MPI-Library/What-environment-variables-are-set-by-Intel-MPI-on-Windows/m-p/1287172#M8364</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;We haven't heard back from you. Is the solution provided helped? Please let us know if the issue still persists.&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;Thanks &amp;amp; Regards,&lt;/P&gt;&lt;P&gt;Santosh&lt;/P&gt;&lt;BR /&gt;</description>
      <pubDate>Fri, 04 Jun 2021 10:28:40 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-MPI-Library/What-environment-variables-are-set-by-Intel-MPI-on-Windows/m-p/1287172#M8364</guid>
      <dc:creator>SantoshY_Intel</dc:creator>
      <dc:date>2021-06-04T10:28:40Z</dc:date>
    </item>
    <item>
      <title>Re: Re:What environment variables are set by Intel MPI on Windows?</title>
      <link>https://community.intel.com/t5/Intel-MPI-Library/What-environment-variables-are-set-by-Intel-MPI-on-Windows/m-p/1287523#M8380</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Many thanks for the solution. I haven't actually used the solution yet, I have found many other problems in the code (different MPI processes are trying to write to the same file at the same time etc.), which I am trying to fix before I can test whether it runs without error or not.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;But I think your solution is right, so I will mark it as accepted.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks,&lt;/P&gt;
&lt;P&gt;SRM&lt;/P&gt;</description>
      <pubDate>Sun, 06 Jun 2021 11:26:01 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-MPI-Library/What-environment-variables-are-set-by-Intel-MPI-on-Windows/m-p/1287523#M8380</guid>
      <dc:creator>SRM</dc:creator>
      <dc:date>2021-06-06T11:26:01Z</dc:date>
    </item>
    <item>
      <title>Re: What environment variables are set by Intel MPI on Windows?</title>
      <link>https://community.intel.com/t5/Intel-MPI-Library/What-environment-variables-are-set-by-Intel-MPI-on-Windows/m-p/1287596#M8386</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks for accepting as a solution.&lt;/P&gt;
&lt;P&gt;As your issue has been resolved, we will no longer respond to this thread. If you require additional assistance from Intel, please start a new thread. Any further interaction in this thread will be considered community only.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks &amp;amp; Regards,&lt;/P&gt;
&lt;P&gt;Santosh&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 21 Jun 2021 11:32:22 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-MPI-Library/What-environment-variables-are-set-by-Intel-MPI-on-Windows/m-p/1287596#M8386</guid>
      <dc:creator>SantoshY_Intel</dc:creator>
      <dc:date>2021-06-21T11:32:22Z</dc:date>
    </item>
  </channel>
</rss>

