Skip to content

pthreads doesn't seem to work #288

Closed
@Lephar

Description

After following multithreading docs and several failed attempts, decided to open this issue but the source of the problem very well be my lack of understanding on the library internals. In any way, it is a good idea to add some simple multithreading examples on examples/tapi since there is no complete code examples on Multithreading.md. Not many tutorials or documentation on the web too, since this is a relatively new library.
Anyway, bli_dgemm() works perfectly fine with single core. But none of the ways specified in multithreading docs has any effect on the computation time and bli_thread_get_num_threads() always returns -1. Here is what I did:
Configured as follows before make (also tried with auto instead of x86_64, --enable-threading=pthreads instead of -t pthreads)

    ./configure -t pthreads x86_64 

Way 1:

    export BLIS_NUM_THREADS=16
    ./my_program

Way 2:

    export BLIS_JC_NT=2
    export BLIS_IC_NT=2
    export BLIS_JR_NT=2
    export BLIS_IR_NT=2
    ./my_program

Also added bli_thread_set_num_threads() to my source and tried with or without environment variables:

    bli_thread_set_num_threads(16);
    bli_dgemm(BLIS_NO_TRANSPOSE, BLIS_NO_TRANSPOSE, m, n, k, &alpha, A, rsa, csa, B, rsb, csb, &beta, C, rsc, csc);

Code compiles and works fine, no syntax or linking error, still correct results on matrices, the problem is threading has just no effect. Tested on Arch Linux (4.19 kernel) with both AUR package and 0.5.0 version downloaded from this github page. Same results.

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions