MultiBUGS icon indicating copy to clipboard operation
MultiBUGS copied to clipboard

Calling MultiBUGS from MATLAB

Open aspassiani opened this issue 7 years ago • 3 comments

I've been using MATLAB to create my BUGS scripts as well as my input files (data and initialized values) and have it call OpenBUGS to run my model. Unfortunately, I've been unsuccessful with doing this using MultiBUGS. The issues seems to be with the additional line in the script "modelDistribute(4)". MultiBUGS stops here and the log files shows:

...
BugsCmds.UpdateGaurd;
BugsCmds.specificationDialog.numProc :=4;
BugsMaster.Install('MPImsimp');
BugsCmds.Distribute('MPImsimp')

port name:
ncalrpc:AE550-2831[794cef1a-041a-4c3f-9fa3-dfe9f5e6f8e3]
ncacn_ip_tcp:ae550-2831[57750] 1
BugsWorker.exe written 605696 293392

mpi command:
mpiexec -n 4 "C:\MultiBUGS\BugsWorker"

However, if I set the number of cores to be 1 in MATLAB then there isn't an issue. Also, if I run the script I created with Matlab directly in MultiBUGS (without using matlab to call MultiBUGS) the model also runs without an issue. I was wondering if there is a reason that MultiBUGS doesn't want to run when using MATLAB to call it, specificaly when the number of cores is set to more than one?

Thanks, Alessio

aspassiani avatar Feb 28 '18 07:02 aspassiani

Thanks for the report. It sounds like this is probably related to the way in which MATLAB interfaces with BUGS. Interfacing BUGS and MATLAB isn't something I'm familiar with - what is the package/method you use? Is it MATBUGS (https://github.com/matbugs/matbugs)?

rjbgoudie avatar Mar 02 '18 13:03 rjbgoudie

Yes, I'm using MATBUGS. I've had it work with OpenBUGS and just changed the scripted a bit to add the extra line to specify the number of cores. I was wondering if there could be an issue with MATLAB having its own MPI files? But I'm not sure how that would work.

aspassiani avatar Mar 05 '18 00:03 aspassiani

any progress? I'm very interested in this!

YanVT avatar Sep 16 '23 03:09 YanVT