フィルターのクリア

How to have multiple matlab instances access MEX function files

2 ビュー (過去 30 日間)
Christopher Grose
Christopher Grose 2018 年 12 月 8 日
回答済み: James Tursa 2018 年 12 月 8 日
I am using C/C++ based MEX files to accelerate some matlab functions. However, a problem is that my codes are ultimately meant to run in parallel with multiple matlab instances on shared networks. In particular, my codes need to be run many times but with different input parameters, so the same MEX file needs to be loaded with each MATLAB instance. With this, I encounter the following type of error:
Error using mex
LINK : fatal error LNK1104: cannot open file 'biharmonicPaddedC2.mexw64'
So the problem is that multiple MATLAB instances are not allowed to access the same mex file. The only way I can think of getting around this is by making separate identical C source files, but with different file names, for each matlab instance. Is there an easier way??
I am using Windows 10 and R2018a, although I would need a solution that would also work on linux systems.

採用された回答

James Tursa
James Tursa 2018 年 12 月 8 日
Multiple instances of MATLAB can certainly access and run the same mex routine. But based on the fact that you have a LINK error, it looks like you are trying to compile the mex routine in one instance while another instace is using the file. This will cause the problems you are observing since you are trying to overwrite a file that is in use. The solution is to compile the routine ahead of time, and then let your multiple instances of MATLAB access the pre-compiled mex routine. Is there a reason you are trying to compile the mex routine in each instance?

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeWrite C Functions Callable from MATLAB (MEX Files) についてさらに検索

タグ

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by