mex, mwblas, and multithreading: controlling the number of threads

Hello,
Since maxNumCompThreads is going to be removed, does anyone know of another way to limit the number of cores utilized when calling the MathWorks BLAS library from a mex function?
Right now, I can use maxNumCompThreads(N) to limit my CPU usage to N cores on a shared machine when using ssyrk or dgemm or other useful BLAS functions. I've searched and searched and it doesn't seem like there is going to be a good way to do this without maxNumCompThreads. Are there any options besides "1 thread" and "all threads"?
Thanks, DH

回答 (1 件)

Kaustubha Govind
Kaustubha Govind 2011 年 10 月 6 日

0 投票

From what I understand, the choice needs to be made at MATLAB startup. Starting MATLAB with the -singleCompThread option will force all operations to run in a single thread.

3 件のコメント

dhyun
dhyun 2011 年 10 月 6 日
Yes, that's what I meant when I asked if there were any options besides "1 thread" and "all threads". I want to know if there are any options for "2 threads" or "N threads".
Kaustubha Govind
Kaustubha Govind 2011 年 10 月 6 日
From the documentation, it doesn't look like it. But, I'll let others weigh in. (Maybe you can use an OS-level control to restrict the number of threads for your MATLAB process?)
Jan
Jan 2011 年 10 月 6 日
The maxNumCompThreads function has been very useful for limitting the used resources, although some situations cannot be caugth by such a simple mechanism, e.g. if the BLAS functions are called from several threads of a PARFOR loop.
It is very sad, that its support will be finished.

サインインしてコメントする。

カテゴリ

ヘルプ センター および File ExchangeLoops and Conditional Statements についてさらに検索

質問済み:

2011 年 10 月 5 日

Community Treasure Hunt

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

Start Hunting!

Translated by