<div dir="ltr">Thanks Barry. Adding absolute paths made it work with "master" hostname. We have added both options in our code just in case the NULL hostname does not work on a different machine. <div><a href="https://github.com/IBAMR/cfd-mpc-wecs/blob/main/main.cpp#L346-L361">https://github.com/IBAMR/cfd-mpc-wecs/blob/main/main.cpp#L346-L361</a><br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Fri, Jun 10, 2022 at 1:48 PM Barry Smith <<a href="mailto:bsmith@petsc.dev">bsmith@petsc.dev</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex"><div style="word-wrap:break-word;line-break:after-white-space"><div><br></div>  Based on your report the issue is likely due to a <span style="font-family:Menlo;font-size:14px">MATLABPATH</span> issue. The difference between using "master" and NULL is that when "master" is used, PETSc ssh's to "master" to startup the Matlab engine while with NULL it launches the Matlab engine directly from the current process in (presumably) the current directory. <div><br></div><div>   When ssh is used it does not have information about the current directory nor would it have any tweaks you have made to your MATLABPATH in your shell. Thus it cannot find the script.</div><div><br></div><div>   Thus when not using NULL you need to make sure that all scripts you plan to launch are findable in the MATLABPATH on the machine you are launching the Matlab engine, maybe by putting the directories in MATLABPATH on in your .bashrc or .profile file or whatever file gets sourced automatically when you ssh to master.</div><div><br></div><div>  Barry</div><div><br></div><div> I have no explanation why the behavior would change with PETSc versions or Matlab versions but the above should resolve the problem; you may have previously just been "lucky" it could fine the script.</div><div><br></div><div><br><div><br><blockquote type="cite"><div>On Jun 10, 2022, at 4:14 PM, Kaustubh Khedkar via petsc-users <<a href="mailto:petsc-users@mcs.anl.gov" target="_blank">petsc-users@mcs.anl.gov</a>> wrote:</div><br><div><div style="word-wrap:break-word;line-break:after-white-space"><span>Hi all,</span><div><br></div><div>I am using the Petsc’s Matlab engine to run some Matlab scripts from my c++ code.</div><div><br></div><div>I have been using Petsc’s Github commit: <span style="font-family:"Helvetica Neue";font-size:13px">9babe2dd5ff256baf1aab74d81ff9ed4c6baba0b </span></div><div><span style="font-family:"Helvetica Neue";font-size:13px">(HEAD -> master, origin/master, origin/HEAD)</span></div><div style="margin:0px;font-stretch:normal;font-size:13px;line-height:normal;font-family:"Helvetica Neue"">Merge: e9b74a6d12 bb2d6e605a</div><div style="margin:0px;font-stretch:normal;font-size:13px;line-height:normal;font-family:"Helvetica Neue"">Author: Satish Balay <<span style="color:rgb(21,154,255)"><a href="mailto:balay@mcs.anl.gov" target="_blank">balay@mcs.anl.gov</a></span>></div><div style="margin:0px;font-stretch:normal;font-size:13px;line-height:normal;font-family:"Helvetica Neue"">Date:   Fri Nov 6 17:46:10 2020 +0000</div><div style="margin:0px;font-stretch:normal;font-size:13px;line-height:normal;font-family:"Helvetica Neue""><br></div><div style="margin:0px;font-stretch:normal;font-size:13px;line-height:normal;font-family:"Helvetica Neue"">I used the command:</div><div style="margin:0px;font-stretch:normal;font-size:13px;line-height:normal;font-family:"Helvetica Neue""><br></div><div style="margin:0px;font-stretch:normal;font-size:13px;line-height:normal;font-family:"Helvetica Neue""><span>PetscMatlabEngineCreate</span>(PETSC_COMM_SELF, <span><span>"</span>master<span>"</span></span>, &(<span>mengine</span>));</div><div style="margin:0px;font-stretch:normal;font-size:13px;line-height:normal;font-family:"Helvetica Neue""><br></div><div style="margin:0px;font-stretch:normal;font-size:13px;line-height:normal;font-family:"Helvetica Neue"">where, the hostname is master. (Verified by typing hostname in the terminal)</div><div style="margin:0px;font-stretch:normal;font-size:13px;line-height:normal;font-family:"Helvetica Neue""><br></div><div style="margin:0px;font-stretch:normal;font-size:13px;line-height:normal;font-family:"Helvetica Neue"">Everything was working fine until I updated my PETSc version to 3.17.2. </div><div style="margin:0px;font-stretch:normal;font-size:13px;line-height:normal;font-family:"Helvetica Neue"">Using this version I get error using the command:</div><div style="margin:0px;font-stretch:normal;font-size:13px;line-height:normal;font-family:"Helvetica Neue""><br></div><div><span>PetscMatlabEngineEvaluate</span>(<span>mengine</span>, <span><span>"</span>load_parameters;<span>”</span></span>);</div><div><br></div><div>cannot read load_parameters script.  where, load_parameters is a Matlab script.</div><div><br></div><div>When I switch the hostname to NULL from master as:</div><div><br></div><div><span style="font-family:"Helvetica Neue";font-size:13px">PetscMatlabEngineCreate</span><span style="font-family:"Helvetica Neue";font-size:13px">(PETSC_COMM_SELF, NULL</span><span style="font-family:"Helvetica Neue";font-size:13px">, &(</span><span style="font-family:"Helvetica Neue";font-size:13px">mengine</span><span style="font-family:"Helvetica Neue";font-size:13px">));</span></div><div><span style="font-family:"Helvetica Neue";font-size:13px"><br></span></div><div><font face="Helvetica Neue" size="2">Everything starts working fine again. All of this was executed on the same machine.</font></div><div><font face="Helvetica Neue" size="2"><br></font></div><div><font face="Helvetica Neue" size="2">Has anything changed when using the </font><span>PetscMatlabEngineEvaluate command?</span></div><div><span><br></span></div><div><span><br></span></div><div><span>Thank you,</span></div><div><span>Kaustubh Khedkar</span></div></div></div></blockquote></div><br></div></div></blockquote></div><br clear="all"><div><br></div>-- <br><div dir="ltr" class="gmail_signature"><div dir="ltr"><div>--Amneet <br><br></div><div><br></div><div><br></div></div></div>