|
|
@@ -63,13 +63,7 @@ static blas_pool_t pool; |
|
|
|
static HANDLE blas_threads [MAX_CPU_NUMBER]; |
|
|
|
static DWORD blas_threads_id[MAX_CPU_NUMBER]; |
|
|
|
|
|
|
|
void goto_set_num_threads(int num) |
|
|
|
{ |
|
|
|
} |
|
|
|
|
|
|
|
void openblas_set_num_threads(int num) |
|
|
|
{ |
|
|
|
} |
|
|
|
|
|
|
|
static void legacy_exec(void *func, int mode, blas_arg_t *args, void *sb){ |
|
|
|
|
|
|
@@ -187,7 +181,7 @@ static DWORD WINAPI blas_thread_server(void *arg){ |
|
|
|
|
|
|
|
do { |
|
|
|
action = WaitForMultipleObjects(2, handles, FALSE, INFINITE); |
|
|
|
} while ((action != WAIT_OBJECT_0) && (action == WAIT_OBJECT_0 + 1)); |
|
|
|
} while ((action != WAIT_OBJECT_0) && (action != WAIT_OBJECT_0 + 1)); |
|
|
|
|
|
|
|
if (action == WAIT_OBJECT_0 + 1) break; |
|
|
|
|
|
|
@@ -271,7 +265,9 @@ static DWORD WINAPI blas_thread_server(void *arg){ |
|
|
|
} else { |
|
|
|
legacy_exec(routine, queue -> mode, queue -> args, sb); |
|
|
|
} |
|
|
|
} |
|
|
|
}else{ |
|
|
|
continue; //if queue == NULL |
|
|
|
} |
|
|
|
|
|
|
|
#ifdef SMP_DEBUG |
|
|
|
fprintf(STDERR, "Server[%2ld] Finished!\n", cpu); |
|
|
@@ -445,7 +441,7 @@ int BLASFUNC(blas_thread_shutdown)(void){ |
|
|
|
|
|
|
|
SetEvent(pool.killed); |
|
|
|
|
|
|
|
for(i = 0; i < blas_cpu_number - 1; i++){ |
|
|
|
for(i = 0; i < blas_num_threads - 1; i++){ |
|
|
|
WaitForSingleObject(blas_threads[i], INFINITE); |
|
|
|
} |
|
|
|
|
|
|
@@ -456,3 +452,37 @@ int BLASFUNC(blas_thread_shutdown)(void){ |
|
|
|
|
|
|
|
return 0; |
|
|
|
} |
|
|
|
|
|
|
|
void goto_set_num_threads(int num_threads) |
|
|
|
{ |
|
|
|
long i; |
|
|
|
|
|
|
|
if (num_threads < 1) num_threads = blas_cpu_number; |
|
|
|
|
|
|
|
if (num_threads > MAX_CPU_NUMBER) num_threads = MAX_CPU_NUMBER; |
|
|
|
|
|
|
|
if (num_threads > blas_num_threads) { |
|
|
|
|
|
|
|
LOCK_COMMAND(&server_lock); |
|
|
|
|
|
|
|
//increased_threads = 1; |
|
|
|
|
|
|
|
for(i = blas_num_threads - 1; i < num_threads - 1; i++){ |
|
|
|
|
|
|
|
blas_threads[i] = CreateThread(NULL, 0, |
|
|
|
blas_thread_server, (void *)i, |
|
|
|
0, &blas_threads_id[i]); |
|
|
|
} |
|
|
|
|
|
|
|
blas_num_threads = num_threads; |
|
|
|
|
|
|
|
UNLOCK_COMMAND(&server_lock); |
|
|
|
} |
|
|
|
|
|
|
|
blas_cpu_number = num_threads; |
|
|
|
} |
|
|
|
|
|
|
|
void openblas_set_num_threads(int num) |
|
|
|
{ |
|
|
|
goto_set_num_threads(num); |
|
|
|
} |