<html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class=""><div class=""><br class=""></div> Based on your report the issue is likely due to a <span style="font-family: Menlo; font-size: 14px;" class="">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 class=""><br class=""></div><div class=""> 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 class=""><br class=""></div><div class=""> 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 class=""><br class=""></div><div class=""> Barry</div><div class=""><br class=""></div><div class=""> 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 class=""><br class=""></div><div class=""><br class=""><div><br class=""><blockquote type="cite" class=""><div class="">On Jun 10, 2022, at 4:14 PM, Kaustubh Khedkar via petsc-users <<a href="mailto:petsc-users@mcs.anl.gov" class="">petsc-users@mcs.anl.gov</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><meta http-equiv="Content-Type" content="text/html; charset=utf-8" class=""><div style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class=""><span style="caret-color: rgb(0, 0, 0);" class="">Hi all,</span><div class="" style="caret-color: rgb(0, 0, 0);"><br class=""></div><div class="" style="caret-color: rgb(0, 0, 0);">I am using the Petsc’s Matlab engine to run some Matlab scripts from my c++ code.</div><div class="" style="caret-color: rgb(0, 0, 0);"><br class=""></div><div class="" style="caret-color: rgb(0, 0, 0);">I have been using Petsc’s Github commit: <span class="" style="font-family: "Helvetica Neue"; font-size: 13px;">9babe2dd5ff256baf1aab74d81ff9ed4c6baba0b </span></div><div class="" style="caret-color: rgb(0, 0, 0);"><span class="" style="font-family: "Helvetica Neue"; font-size: 13px;">(HEAD -> master, origin/master, origin/HEAD)</span></div><div class="" style="caret-color: rgb(0, 0, 0); margin: 0px; font-stretch: normal; font-size: 13px; line-height: normal; font-family: "Helvetica Neue";">Merge: e9b74a6d12 bb2d6e605a</div><div class="" style="caret-color: rgb(0, 0, 0); margin: 0px; font-stretch: normal; font-size: 13px; line-height: normal; font-family: "Helvetica Neue";">Author: Satish Balay <<span class="" style="color: rgb(21, 154, 255);"><a href="mailto:balay@mcs.anl.gov" class="">balay@mcs.anl.gov</a></span>></div><div class="" style="caret-color: rgb(0, 0, 0); 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 class="" style="caret-color: rgb(0, 0, 0); margin: 0px; font-stretch: normal; font-size: 13px; line-height: normal; font-family: "Helvetica Neue";"><br class=""></div><div class="" style="caret-color: rgb(0, 0, 0); margin: 0px; font-stretch: normal; font-size: 13px; line-height: normal; font-family: "Helvetica Neue";">I used the command:</div><div class="" style="caret-color: rgb(0, 0, 0); margin: 0px; font-stretch: normal; font-size: 13px; line-height: normal; font-family: "Helvetica Neue";"><br class=""></div><div class="" style="caret-color: rgb(0, 0, 0); margin: 0px; font-stretch: normal; font-size: 13px; line-height: normal; font-family: "Helvetica Neue";"><span class="pl-c1">PetscMatlabEngineCreate</span>(PETSC_COMM_SELF, <span class="pl-s"><span class="pl-pds">"</span>master<span class="pl-pds">"</span></span>, &(<span class="pl-smi">mengine</span>));</div><div class="" style="caret-color: rgb(0, 0, 0); margin: 0px; font-stretch: normal; font-size: 13px; line-height: normal; font-family: "Helvetica Neue";"><br class=""></div><div class="" style="caret-color: rgb(0, 0, 0); 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 class="" style="caret-color: rgb(0, 0, 0); margin: 0px; font-stretch: normal; font-size: 13px; line-height: normal; font-family: "Helvetica Neue";"><br class=""></div><div class="" style="caret-color: rgb(0, 0, 0); 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 class="" style="caret-color: rgb(0, 0, 0); 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 class="" style="caret-color: rgb(0, 0, 0); margin: 0px; font-stretch: normal; font-size: 13px; line-height: normal; font-family: "Helvetica Neue";"><br class=""></div><div class="" style="caret-color: rgb(0, 0, 0);"><span class="pl-c1">PetscMatlabEngineEvaluate</span>(<span class="pl-smi">mengine</span>, <span class="pl-s"><span class="pl-pds">"</span>load_parameters;<span class="pl-pds">”</span></span>);</div><div class="" style="caret-color: rgb(0, 0, 0);"><br class=""></div><div class="" style="caret-color: rgb(0, 0, 0);">cannot read load_parameters script. where, load_parameters is a Matlab script.</div><div class="" style="caret-color: rgb(0, 0, 0);"><br class=""></div><div class="" style="caret-color: rgb(0, 0, 0);">When I switch the hostname to NULL from master as:</div><div class="" style="caret-color: rgb(0, 0, 0);"><br class=""></div><div class="" style="caret-color: rgb(0, 0, 0);"><span class="pl-c1" style="font-family: "Helvetica Neue"; font-size: 13px;">PetscMatlabEngineCreate</span><span class="" style="font-family: "Helvetica Neue"; font-size: 13px;">(PETSC_COMM_SELF, NULL</span><span class="" style="font-family: "Helvetica Neue"; font-size: 13px;">, &(</span><span class="pl-smi" style="font-family: "Helvetica Neue"; font-size: 13px;">mengine</span><span class="" style="font-family: "Helvetica Neue"; font-size: 13px;">));</span></div><div class="" style="caret-color: rgb(0, 0, 0);"><span class="" style="font-family: "Helvetica Neue"; font-size: 13px;"><br class=""></span></div><div class="" style="caret-color: rgb(0, 0, 0);"><font face="Helvetica Neue" size="2" class="">Everything starts working fine again. All of this was executed on the same machine.</font></div><div class="" style="caret-color: rgb(0, 0, 0);"><font face="Helvetica Neue" size="2" class=""><br class=""></font></div><div class="" style="caret-color: rgb(0, 0, 0);"><font face="Helvetica Neue" size="2" class="">Has anything changed when using the </font><span class="">PetscMatlabEngineEvaluate command?</span></div><div class="" style="caret-color: rgb(0, 0, 0);"><span class=""><br class=""></span></div><div class="" style="caret-color: rgb(0, 0, 0);"><span class=""><br class=""></span></div><div class="" style="caret-color: rgb(0, 0, 0);"><span class="">Thank you,</span></div><div class="" style="caret-color: rgb(0, 0, 0);"><span class="">Kaustubh Khedkar</span></div></div></div></blockquote></div><br class=""></div></body></html>