<html xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=Windows-1252">
<meta name="Generator" content="Microsoft Word 15 (filtered medium)">
<style><!--
/* Font Definitions */
@font-face
{font-family:"Cambria Math";
panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
{font-family:Calibri;
panose-1:2 15 5 2 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0cm;
margin-bottom:.0001pt;
font-size:11.0pt;
font-family:"Calibri",sans-serif;}
p.MsoListParagraph, li.MsoListParagraph, div.MsoListParagraph
{mso-style-priority:34;
margin-top:0cm;
margin-right:0cm;
margin-bottom:0cm;
margin-left:36.0pt;
margin-bottom:.0001pt;
font-size:11.0pt;
font-family:"Calibri",sans-serif;}
.MsoChpDefault
{mso-style-type:export-only;
font-family:"Calibri",sans-serif;}
@page WordSection1
{size:612.0pt 792.0pt;
margin:70.85pt 2.0cm 2.0cm 2.0cm;}
div.WordSection1
{page:WordSection1;}
/* List Definitions */
@list l0
{mso-list-id:512650763;
mso-list-type:hybrid;
mso-list-template-ids:-915762932 -1 555137184 68157467 68157455 68157465 68157467 68157455 68157465 68157467;}
@list l0:level1
{mso-level-text:"%1\)";
mso-level-tab-stop:none;
mso-level-number-position:left;
text-indent:-18.0pt;}
@list l0:level2
{mso-level-start-at:5;
mso-level-number-format:bullet;
mso-level-text:-;
mso-level-tab-stop:none;
mso-level-number-position:left;
text-indent:-18.0pt;
font-family:"Calibri",sans-serif;
mso-fareast-font-family:"Times New Roman";}
@list l0:level3
{mso-level-number-format:roman-lower;
mso-level-tab-stop:none;
mso-level-number-position:right;
text-indent:-9.0pt;}
@list l0:level4
{mso-level-tab-stop:none;
mso-level-number-position:left;
text-indent:-18.0pt;}
@list l0:level5
{mso-level-number-format:alpha-lower;
mso-level-tab-stop:none;
mso-level-number-position:left;
text-indent:-18.0pt;}
@list l0:level6
{mso-level-number-format:roman-lower;
mso-level-tab-stop:none;
mso-level-number-position:right;
text-indent:-9.0pt;}
@list l0:level7
{mso-level-tab-stop:none;
mso-level-number-position:left;
text-indent:-18.0pt;}
@list l0:level8
{mso-level-number-format:alpha-lower;
mso-level-tab-stop:none;
mso-level-number-position:left;
text-indent:-18.0pt;}
@list l0:level9
{mso-level-number-format:roman-lower;
mso-level-tab-stop:none;
mso-level-number-position:right;
text-indent:-9.0pt;}
@list l1
{mso-list-id:1339845933;
mso-list-type:hybrid;
mso-list-template-ids:526298250 68157443 68157465 68157467 68157455 68157465 68157467 68157455 68157465 68157467;}
@list l1:level1
{mso-level-number-format:bullet;
mso-level-text:o;
mso-level-tab-stop:none;
mso-level-number-position:left;
margin-left:53.4pt;
text-indent:-18.0pt;
font-family:"Courier New";}
@list l1:level2
{mso-level-number-format:alpha-lower;
mso-level-tab-stop:none;
mso-level-number-position:left;
margin-left:89.4pt;
text-indent:-18.0pt;}
@list l1:level3
{mso-level-number-format:roman-lower;
mso-level-tab-stop:none;
mso-level-number-position:right;
margin-left:125.4pt;
text-indent:-9.0pt;}
@list l1:level4
{mso-level-tab-stop:none;
mso-level-number-position:left;
margin-left:161.4pt;
text-indent:-18.0pt;}
@list l1:level5
{mso-level-number-format:alpha-lower;
mso-level-tab-stop:none;
mso-level-number-position:left;
margin-left:197.4pt;
text-indent:-18.0pt;}
@list l1:level6
{mso-level-number-format:roman-lower;
mso-level-tab-stop:none;
mso-level-number-position:right;
margin-left:233.4pt;
text-indent:-9.0pt;}
@list l1:level7
{mso-level-tab-stop:none;
mso-level-number-position:left;
margin-left:269.4pt;
text-indent:-18.0pt;}
@list l1:level8
{mso-level-number-format:alpha-lower;
mso-level-tab-stop:none;
mso-level-number-position:left;
margin-left:305.4pt;
text-indent:-18.0pt;}
@list l1:level9
{mso-level-number-format:roman-lower;
mso-level-tab-stop:none;
mso-level-number-position:right;
margin-left:341.4pt;
text-indent:-9.0pt;}
ol
{margin-bottom:0cm;}
ul
{margin-bottom:0cm;}
--></style>
</head>
<body lang="IT">
<div class="WordSection1">
<p class="MsoNormal">Dear PETSc users,</p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">I’ve been an happy PETSc user since version 3.3, using it both under Ubuntu (from 14.04 up to 20.04) and CentOS (from 5 to 8).<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">I use it as an optional component for a parallel Fortran code (that, BTW, also uses metis) and, wherever allowed, I used to install myself MPI (both MPICH and OpenMPI) and PETSc on top of it without any trouble ever (besides being, myself,
as dumb as one can be in this).<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">I did this on top of gnu compilers and, less extensively, intel compilers, both on a range of different systems (from virtual machines, to workstations to actual clusters).<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">So far so good.<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">Today I find myself in the need of deploying my application to Windows 10 users, which means giving them a folder with all the executables and libraries to make them run in it, including the mpi runtime. Unfortunately, I also have to rely
on free tools (can’t afford Intel for the moment).<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">To the best of my knowledge, considering also far from optimal solutions, my options would then be: Virtual machines and WSL1, Cygwin, MSYS2-MinGW64, Cross compiling with MinGW64 from within Linux, PGI + Visual Studio + Cygwin (not sure
about this one)<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">I know this is largely unsupported, but I was wondering if there is, nonetheless, some general (and more official) knowledge available on the matter. What I tried so far:<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<ol style="margin-top:0cm" start="1" type="1">
<li class="MsoListParagraph" style="margin-left:0cm;mso-list:l0 level1 lfo2">Virtual machines and WSL1: both work like a charm, just like in the native OS, but very far from ideal for the distribution purpose<o:p></o:p></li></ol>
<p class="MsoNormal"><o:p> </o:p></p>
<ol style="margin-top:0cm" start="2" type="1">
<li class="MsoListParagraph" style="margin-left:0cm;mso-list:l0 level1 lfo2">Cygwin with gnu compilers (as opposed to using Intel and Visual Studio): I was unable to compile myself MPI as I am used to on Linux, so I just tried going all in and let PETSc do
everything for me (using static linking): download and install MPICH, BLAS, LAPACK, METIS and HYPRE. Everything just worked (for now compiling and making trivial tests) and I am able to use everything from within a cygwin terminal (even with executables and
dependencies outside cygwin). Still, even within cygwin, I can’t switch to use, say, the cygwin ompi mpirun/mpiexec for an mpi program compiled with PETSc mpich (things run but not as expected). Some troubles start when I try to use cmd.exe (which I pictured
as the more natural way to launch in Windows). In particular, using (note that \ is in cmd.exe, / was used in cygwin terminal):<o:p></o:p></li></ol>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal" style="margin-left:53.4pt">.\mpiexec.hydra.exe -np 8 .\my.exe<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal" style="margin-left:35.4pt">Nothing happens unless I push Enter a second time. Things seem to work then, but if I try to run a serial executable with the command above I get the following errors (which, instead, doesn’t happen using the
cygwin terminal):<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal" style="margin-left:53.4pt">[proxy:0:0@Dell7540-Paolo] HYDU_sock_write (utils/sock/sock.c:286): write error (No such process)<o:p></o:p></p>
<p class="MsoNormal" style="margin-left:53.4pt">[proxy:0:0@Dell7540-Paolo] HYD_pmcd_pmip_control_cmd_cb (pm/pmiserv/pmip_cb.c:935): unable to write to downstream stdin<o:p></o:p></p>
<p class="MsoNormal" style="margin-left:53.4pt">[proxy:0:0@Dell7540-Paolo] HYDT_dmxu_poll_wait_for_event (tools/demux/demux_poll.c:76): callback returned error status<o:p></o:p></p>
<p class="MsoNormal" style="margin-left:53.4pt">[proxy:0:0@Dell7540-Paolo] main (pm/pmiserv/pmip.c:206): demux engine error waiting for event<o:p></o:p></p>
<p class="MsoNormal" style="margin-left:53.4pt">[mpiexec@Dell7540-Paolo] control_cb (pm/pmiserv/pmiserv_cb.c:200): assert (!closed) failed<o:p></o:p></p>
<p class="MsoNormal" style="margin-left:53.4pt">[mpiexec@Dell7540-Paolo] HYDT_dmxu_poll_wait_for_event (tools/demux/demux_poll.c:76): callback returned error status<o:p></o:p></p>
<p class="MsoNormal" style="margin-left:53.4pt">[mpiexec@Dell7540-Paolo] HYD_pmci_wait_for_completion (pm/pmiserv/pmiserv_pmci.c:198): error waiting for event<o:p></o:p></p>
<p class="MsoNormal" style="margin-left:53.4pt">[mpiexec@Dell7540-Paolo] main (ui/mpich/mpiexec.c:336): process manager error waiting for completion<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal" style="margin-left:35.4pt">Just for the sake of completeness, I also tried using the Intel and Microsoft MPI redistributables, which might be more natural candidates, instead of the petsc compiled version of the MPI runtime (and they are
MPICH derivatives, after all). But, running with:<o:p></o:p></p>
<p class="MsoNormal" style="margin-left:35.4pt"><o:p> </o:p></p>
<p class="MsoNormal" style="margin-left:70.8pt">mpiexec -np 1 my.exe<o:p></o:p></p>
<p class="MsoNormal" style="margin-left:35.4pt"><o:p> </o:p></p>
<p class="MsoNormal" style="margin-left:35.4pt">I get the following error with Intel:<o:p></o:p></p>
<p class="MsoNormal" style="margin-left:35.4pt"><o:p> </o:p></p>
<p class="MsoNormal" style="margin-left:70.8pt">[cli_0]: write_line error; fd=440 buf=:cmd=init pmi_version=1 pmi_subversion=1<o:p></o:p></p>
<p class="MsoNormal" style="margin-left:70.8pt">:<o:p></o:p></p>
<p class="MsoNormal" style="margin-left:70.8pt">system msg for write_line failure : Bad file descriptor<o:p></o:p></p>
<p class="MsoNormal" style="margin-left:70.8pt">[cli_0]: Unable to write to PMI_fd<o:p></o:p></p>
<p class="MsoNormal" style="margin-left:70.8pt">[cli_0]: write_line error; fd=440 buf=:cmd=get_appnum<o:p></o:p></p>
<p class="MsoNormal" style="margin-left:70.8pt">:<o:p></o:p></p>
<p class="MsoNormal" style="margin-left:70.8pt">system msg for write_line failure : Bad file descriptor<o:p></o:p></p>
<p class="MsoNormal" style="margin-left:70.8pt">Fatal error in MPI_Init: Other MPI error, error stack:<o:p></o:p></p>
<p class="MsoNormal" style="margin-left:70.8pt">MPIR_Init_thread(467):<o:p></o:p></p>
<p class="MsoNormal" style="margin-left:70.8pt">MPID_Init(140).......: channel initialization failed<o:p></o:p></p>
<p class="MsoNormal" style="margin-left:70.8pt">MPID_Init(421).......: PMI_Get_appnum returned -1<o:p></o:p></p>
<p class="MsoNormal" style="margin-left:70.8pt">[cli_0]: aborting job:<o:p></o:p></p>
<p class="MsoNormal" style="margin-left:70.8pt">Fatal error in MPI_Init: Other MPI error, error stack:<o:p></o:p></p>
<p class="MsoNormal" style="margin-left:70.8pt">MPIR_Init_thread(467):<o:p></o:p></p>
<p class="MsoNormal" style="margin-left:70.8pt">MPID_Init(140).......: channel initialization failed<o:p></o:p></p>
<p class="MsoNormal" style="margin-left:70.8pt">MPID_Init(421).......: PMI_Get_appnum returned -1<o:p></o:p></p>
<p class="MsoNormal" style="margin-left:35.4pt"><o:p> </o:p></p>
<p class="MsoNormal" style="margin-left:35.4pt">And the following error with MS-MPI:<o:p></o:p></p>
<p class="MsoNormal" style="margin-left:35.4pt"><o:p> </o:p></p>
<p class="MsoNormal" style="margin-left:70.8pt">[unset]: unable to decode hostport from 44e5747b-d19e-4ea8-ac7a-ec2102cabb21<o:p></o:p></p>
<p class="MsoNormal" style="margin-left:70.8pt">Fatal error in MPI_Init: Other MPI error, error stack:<o:p></o:p></p>
<p class="MsoNormal" style="margin-left:70.8pt">MPIR_Init_thread(467):<o:p></o:p></p>
<p class="MsoNormal" style="margin-left:70.8pt">MPID_Init(140).......: channel initialization failed<o:p></o:p></p>
<p class="MsoNormal" style="margin-left:70.8pt">MPID_Init(403).......: PMI_Init returned -1<o:p></o:p></p>
<p class="MsoNormal" style="margin-left:70.8pt">[unset]: aborting job:<o:p></o:p></p>
<p class="MsoNormal" style="margin-left:70.8pt">Fatal error in MPI_Init: Other MPI error, error stack:<o:p></o:p></p>
<p class="MsoNormal" style="margin-left:70.8pt">MPIR_Init_thread(467):<o:p></o:p></p>
<p class="MsoNormal" style="margin-left:70.8pt">MPID_Init(140).......: channel initialization failed<o:p></o:p></p>
<p class="MsoNormal" style="margin-left:70.8pt">MPID_Init(403).......: PMI_Init returned -1<o:p></o:p></p>
<p class="MsoNormal" style="margin-left:35.4pt"><o:p> </o:p></p>
<p class="MsoNormal" style="margin-left:35.4pt">independently from the number of processes, but more processes produce more copies of this. However, both Intel and MS-MPI are able to run a serial fortran executable built with cygwin. I think I made everything
correctly and adding -localhost didn’t help (actually, it caused more problems to the interpretation of the cmd line arguments for mpiexec)<o:p></o:p></p>
<p class="MsoNormal" style="margin-left:35.4pt"><o:p> </o:p></p>
<ol style="margin-top:0cm" start="3" type="1">
<li class="MsoListParagraph" style="margin-left:0cm;mso-list:l0 level1 lfo2">Cygwin with MinGW64 compilers. Never managed to compile MPI, not even trough PETSc.<o:p></o:p></li></ol>
<p class="MsoListParagraph"><o:p> </o:p></p>
<ol style="margin-top:0cm" start="4" type="1">
<li class="MsoListParagraph" style="margin-left:0cm;mso-list:l0 level1 lfo2">MSYS2+MinGW64 compilers. I understood that MinGW is not well supported, probably because of how it handles paths, but I wanted to give it a try, because it should be more “native”
and there seems to be relevant examples out there that managed to do it. I first tried with the msys2 mpi distribution, produced the .mod file out of the mpi.f90 file in the distribution (I tried my best with different hacks from known limitations of this
file as also present in the official MS-MPI distribution) and tried with my code without petsc, but it failed in compiling the code with some strange MPI related error (argument mismatch between two unrelated MPI calls in the code, which is non sense to me).
In contrast, simple mpi tests (hello world like) worked as expected. Then I decided to follow this:<o:p></o:p></li></ol>
<p class="MsoListParagraph"><o:p> </o:p></p>
<p class="MsoListParagraph"><a href="https://doc.freefem.org/introduction/installation.html#compilation-on-windows">https://doc.freefem.org/introduction/installation.html#compilation-on-windows</a><o:p></o:p></p>
<p class="MsoListParagraph"><o:p> </o:p></p>
<p class="MsoListParagraph">but the exact same type of error came up (MPI calls in my code were different, but the error was the same). Trying again from scratch (i.e., without all the things I did in the beginning to compile my code) the same error came up
in compiling some of the freefem dependencies (this time not even mpi calls).<o:p></o:p></p>
<p class="MsoListParagraph"><o:p> </o:p></p>
<p class="MsoListParagraph">As a side note, there seems to be an official effort in porting petsc to msys2 (<a href="https://github.com/okhlybov/MINGW-packages/tree/whpc/mingw-w64-petsc">https://github.com/okhlybov/MINGW-packages/tree/whpc/mingw-w64-petsc</a>),
but it didn’t get into the official packages yet, which I interpret as a warning<o:p></o:p></p>
<p class="MsoListParagraph"><o:p> </o:p></p>
<ol style="margin-top:0cm" start="5" type="1">
<li class="MsoListParagraph" style="margin-left:0cm;mso-list:l0 level1 lfo2">Didn’t give a try to cross compiling with MinGw from Linux, as I tought it couldn’t be any better than doing it from MSYS2<o:p></o:p></li><li class="MsoListParagraph" style="margin-left:0cm;mso-list:l0 level1 lfo2">Didn’t try PGI as I actually didn’t know if I would then been able to make PETSc work.<o:p></o:p></li></ol>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">So, here there are some questions I have with respect to where I stand now and the points above:<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<ol style="margin-top:0cm" start="6" type="1">
<ul style="margin-top:0cm" type="disc">
<li class="MsoListParagraph" style="margin-left:0cm;mso-list:l0 level2 lfo2">I haven’t seen the MSYS2-MinGw64 toolchain mentioned at all in official documentation/discussions. Should I definitely abandon it (despite someone mentioning it as working) because
of known issues?<o:p></o:p></li><li class="MsoListParagraph" style="margin-left:0cm;mso-list:l0 level2 lfo2">What about the PGI route? I don’t see it mentioned as well. I guess it would require some work on win32fe<o:p></o:p></li><li class="MsoListParagraph" style="margin-left:0cm;mso-list:l0 level2 lfo2">For my Cygwin-GNU route (basically what is mentioned in PFLOTRAN documentation), am I expected to then run from the cygwin terminal or should the windows prompt work as well? Is the
fact that I require a second Enter hit and the mismanagement of serial executables the sign of something wrong with the Windows prompt?<o:p></o:p></li><li class="MsoListParagraph" style="margin-left:0cm;mso-list:l0 level2 lfo2">More generally, is there some known working, albeit non official, route given my constraints (free+fortran+windows+mpi+petsc)?<o:p></o:p></li></ul>
</ol>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">Thanks for your attention and your great work on PETSc<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">Best regards<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">Paolo Lampitella<o:p></o:p></p>
</div>
</body>
</html>