threadsafe but single threaded

43 views
Skip to first unread message

Erling D. Andersen

unread,
Aug 21, 2017, 3:55:48 AM8/21/17
to blis-discuss
Hi

After reading

https://github.com/flame/blis/wiki/Multithreading

I realize I need

./configure --enable-threading=pthreads ......

to make Blis threadsafe.

However, since I thread myself then I do want Blis to run single threaded independent of the setting of

export BLIS_NUM_THREADS=8

Will the setting

bli_thread_set_num_threads( 1 );

after bli_init achieve this?

Field G. Van Zee

unread,
Sep 6, 2017, 3:18:38 PM9/6/17
to blis-d...@googlegroups.com
Erling,

Sorry for the delayed response. I don't know how this message fell
through the cracks, but it did. Apologies.

Yes, using bli_thread_set_num_threads() to set the number of threads to
1 (after bli_init(), of course) should have the desired effect of BLIS
running single-threaded but also thread-safe.

One caveat: Please make sure that bli_init()/bli_finalize() are outside
of your application's threaded region. I don't recall if these functions
are also thread-safe.

Let us know if you have any other questions.

Field

Jeff Hammond

unread,
Sep 6, 2017, 4:00:56 PM9/6/17
to Field G. Van Zee, blis-discuss
On Wed, Sep 6, 2017 at 12:18 PM, Field G. Van Zee <fi...@cs.utexas.edu> wrote:
Erling,

Sorry for the delayed response. I don't know how this message fell through the cracks, but it did. Apologies.

Yes, using bli_thread_set_num_threads() to set the number of threads to 1 (after bli_init(), of course) should have the desired effect of BLIS running single-threaded but also thread-safe.

One caveat: Please make sure that bli_init()/bli_finalize() are outside of your application's threaded region. I don't recall if these functions are also thread-safe.


If they aren't, it's a simple matter of pthread_once to fix it...

Jeff
 
Let us know if you have any other questions.

Field


On 08/21/2017 02:55 AM, Erling D. Andersen wrote:
Hi

After reading

    https://github.com/flame/blis/wiki/Multithreading

I realize I need

    ./configure --enable-threading=pthreads ......

to make Blis threadsafe.

However, since I thread myself then I do want Blis to run single threaded independent of the setting of

    export BLIS_NUM_THREADS=8

Will the setting

    bli_thread_set_num_threads( 1 );

after bli_init achieve this?
 

--
You received this message because you are subscribed to the Google Groups "blis-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to blis-discuss+unsubscribe@googlegroups.com.
To post to this group, send email to blis-d...@googlegroups.com.
Visit this group at https://groups.google.com/group/blis-discuss.
For more options, visit https://groups.google.com/d/optout.



--

Erling D. Andersen

unread,
Sep 29, 2017, 8:12:53 AM9/29/17
to blis-discuss
Thanks for the update.
Reply all
Reply to author
Forward
0 new messages