c++ shared library startup options
3 views (last 30 days)
Show older comments
Hi everyone. I have a question regarding compilation of c++ shared libraries and multithreading.
When creating a standalone executable i know that it is possible to specify startup option (i mostly use deploytool)
-singleCompThread
to make sure that each MCR can only have one active computational thread.
As for C++ shared libraries i am not quite sure how this works. If i do not specify anything do the dll enable multiple threads?
and if so, how can i make sure that the shared library only uses one thread?
The project calling the c++ library is going to start several instances at once, and from testing with a standalone executable (and a .bat file) i have found out that the most effective way was to enable hyperthreading on my PC but only allow a single computational thread inside the matlab executable and run 8 instances at once ( i have 4 physical cores that turns into "8" when hyperthreaded ).
I have been searching the web for quite some time now and i cant find any examples that uses -singlecompthread for c++. The closest i got was the function
mclInitializeApplication
is this where -singleCompThread should be specified?
Any tips or clarifications would be highly appreciated as i am not very familiar with C++.
Thx in advance!
0 Comments
Answers (1)
Kaustubha Govind
on 19 Aug 2013
It looks like specifying the -singleCompThread option during compilation should also work.
For example:
>> mcc -R -singleCompThread -mv foo.m
3 Comments
Kaustubha Govind
on 20 Aug 2013
Ah! Sorry that didn't work. I'm not sure what else to recommend here. If you don't receive any other replies on this forum, you may want to contact MathWorks Tech Support.
See Also
Categories
Find more on Parallel Computing Fundamentals in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!