From 4230fe472e1c363dec5edc7e47593514a988cae1 Mon Sep 17 00:00:00 2001 From: Martin Kroeker Date: Tue, 28 Jul 2026 20:45:46 +0200 Subject: [PATCH 1/2] Tag openblas_set_num_threads and get/set_affinity with OPENBLAS_EXPORT --- driver/others/blas_server_omp.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/driver/others/blas_server_omp.c b/driver/others/blas_server_omp.c index 7ee56b73c0..d77fbea659 100644 --- a/driver/others/blas_server_omp.c +++ b/driver/others/blas_server_omp.c @@ -118,17 +118,19 @@ void goto_set_num_threads(int num_threads) { #endif } +OPENBLAS_EXPORT void openblas_set_num_threads(int num_threads) { blas_is_num_threads_set_explicitly = 1; goto_set_num_threads(num_threads); } #ifdef OS_LINUX - +OPENBLAS_EXPORT int openblas_setaffinity(int thread_idx, size_t cpusetsize, cpu_set_t* cpu_set) { fprintf(stderr,"OpenBLAS: use OpenMP environment variables for setting cpu affinity\n"); return -1; } +OPENBLAS_EXPORT int openblas_getaffinity(int thread_idx, size_t cpusetsize, cpu_set_t* cpu_set) { fprintf(stderr,"OpenBLAS: use OpenMP environment variables for querying cpu affinity\n"); return -1; From 28e75a85307ad308cf590e18a31b439f43a6dc55 Mon Sep 17 00:00:00 2001 From: Martin Kroeker Date: Tue, 28 Jul 2026 20:52:15 +0200 Subject: [PATCH 2/2] Tag get/set_affinity with OPENBLAS_EXPORT --- driver/others/blas_server.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/driver/others/blas_server.c b/driver/others/blas_server.c index 25a8042dba..5ff0d87036 100644 --- a/driver/others/blas_server.c +++ b/driver/others/blas_server.c @@ -335,7 +335,7 @@ static void legacy_exec(void *func, int mode, blas_arg_t *args, void *sb){ } } -#if defined(OS_LINUX) && !defined(NO_AFFINITY) +#if defined(OS_LINUX) && !defined(NO_AFFINITY) int gotoblas_set_affinity(int); int gotoblas_set_affinity2(int); int get_node(void); @@ -345,7 +345,7 @@ static int increased_threads = 0; #ifdef OS_LINUX extern int openblas_get_num_threads(void); - +OPENBLAS_EXPORT int openblas_setaffinity(int thread_idx, size_t cpusetsize, cpu_set_t* cpu_set) { const int active_threads = openblas_get_num_threads(); @@ -360,6 +360,7 @@ int openblas_setaffinity(int thread_idx, size_t cpusetsize, cpu_set_t* cpu_set) return pthread_setaffinity_np(thread, cpusetsize, cpu_set); } +OPENBLAS_EXPORT int openblas_getaffinity(int thread_idx, size_t cpusetsize, cpu_set_t* cpu_set) { const int active_threads = openblas_get_num_threads();