Skip to content

Add Parameters for setting obenblas #1534

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions setting-openblas-threads.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
//To set the number of threads in OpenBLAS using the openblas_set_num_threads function in C++, you can follow these steps:


#include <cblas.h>

//2.Call the openblas_set_num_threads function and pass the desired number of threads as an argument:
openblas_set_num_threads(num_threads);

/*3.Replace num_threads with the desired number of threads you want to use for parallel execution.
For example, if you want to set it to 4, you would use*/
openblas_set_num_threads(4);.

//4.Make sure to link against the OpenBLAS library when compiling your code.
g++ your_code.cpp -lopenblas

/*By setting the number of threads using openblas_set_num_threads, you can control the parallel execution of OpenBLAS operations in your C++ code.

Note that the openblas_set_num_threads function sets the number of threads globally for OpenBLAS, which may affect other parts of your program that use OpenBLAS.*/