thorstone25 / qups

A MATLAB toolbox for prototyping and simulating diagnostic ultrasound imaging systems
Apache License 2.0
38 stars 20 forks source link

Parallel SIMUS Bug #2

Closed apodkowa closed 2 years ago

apodkowa commented 2 years ago

It appears that parallel SIMUS doesn't work out of the box. I just downloaded the MUST toolbox and ran into the following error:

Error using simus (line 293)
DATENUM failed.

Error in UltrasoundSystem/simus (line 682)
            parfor (m = 1:M, kwargs.parcluster)

Caused by:
    Error using datenummx
    Use of function datenummx is not supported on a thread-based pool.

I suspect that MUST doesn't support this type of parfor syntax natively. It might require working with the maintainer to figure out a workable solution.

thorstone25 commented 2 years ago

Hmmm, this may be specific to the type of parcluster.

Does it work if you setup your parpool manually with parpool('local', 'SpmdEnabled', false); and then call UltrasoundSystem/simus?

Does it work if you shutdown the parallel pool with delete(gcp('nocreate'))?

thorstone25 commented 2 years ago

I just tested this on my system. It seems that parfor syntax is fine as it will run on a local parpool and on no parpool, just not a thread-based parpool.

The reason is the adMessage subroutine in the pfield.m function in MUST calls uiwait and msgbox. Even though it's not run, the interpreter errors when it detects a potential call to uiwait and/or msgbox.

There are 2 ways to get around this: