[petsc-users] Error with PetscMatlabEngineCreate

Amneet Bhalla mail2amneet at gmail.com
Fri Jun 10 22:51:55 CDT 2022


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.
https://github.com/IBAMR/cfd-mpc-wecs/blob/main/main.cpp#L346-L361

On Fri, Jun 10, 2022 at 1:48 PM Barry Smith <bsmith at petsc.dev> wrote:

>
>   Based on your report the issue is likely due to a MATLABPATH 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.
>
>    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.
>
>    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.
>
>   Barry
>
>  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.
>
>
>
> On Jun 10, 2022, at 4:14 PM, Kaustubh Khedkar via petsc-users <
> petsc-users at mcs.anl.gov> wrote:
>
> Hi all,
>
> I am using the Petsc’s Matlab engine to run some Matlab scripts from my
> c++ code.
>
> I have been using Petsc’s Github commit:
> 9babe2dd5ff256baf1aab74d81ff9ed4c6baba0b
> (HEAD -> master, origin/master, origin/HEAD)
> Merge: e9b74a6d12 bb2d6e605a
> Author: Satish Balay <balay at mcs.anl.gov>
> Date:   Fri Nov 6 17:46:10 2020 +0000
>
> I used the command:
>
> PetscMatlabEngineCreate(PETSC_COMM_SELF, "master", &(mengine));
>
> where, the hostname is master. (Verified by typing hostname in the
> terminal)
>
> Everything was working fine until I updated my PETSc version to 3.17.2.
> Using this version I get error using the command:
>
> PetscMatlabEngineEvaluate(mengine, "load_parameters;”);
>
> cannot read load_parameters script.  where, load_parameters is a Matlab
> script.
>
> When I switch the hostname to NULL from master as:
>
> PetscMatlabEngineCreate(PETSC_COMM_SELF, NULL, &(mengine));
>
> Everything starts working fine again. All of this was executed on the same
> machine.
>
> Has anything changed when using the PetscMatlabEngineEvaluate command?
>
>
> Thank you,
> Kaustubh Khedkar
>
>
>

-- 
--Amneet
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20220610/90a47701/attachment.html>


More information about the petsc-users mailing list