Skip to content

Commit 32d2ca3

Browse files
committed
Refs #214, #221, #246. Fixed the getrf overflow bug on Windows.
I used a smaller threshold since the stack size is 1MB on windows.
1 parent 6df39ad commit 32d2ca3

File tree

6 files changed

+22
-5
lines changed

6 files changed

+22
-5
lines changed

common.h

+17
Original file line numberDiff line numberDiff line change
@@ -314,6 +314,23 @@ typedef int blasint;
314314
#define YIELDING sched_yield()
315315
#endif
316316

317+
/***
318+
To alloc job_t on heap or statck.
319+
please https://github.com/xianyi/OpenBLAS/issues/246
320+
***/
321+
#if defined(OS_WINDOWS)
322+
#define GETRF_MEM_ALLOC_THRESHOLD 32
323+
#define BLAS3_MEM_ALLOC_THRESHOLD 32
324+
#endif
325+
326+
#ifndef GETRF_MEM_ALLOC_THRESHOLD
327+
#define GETRF_MEM_ALLOC_THRESHOLD 80
328+
#endif
329+
330+
#ifndef BLAS3_MEM_ALLOC_THRESHOLD
331+
#define BLAS3_MEM_ALLOC_THRESHOLD 160
332+
#endif
333+
317334
#ifdef QUAD_PRECISION
318335
#include "common_quad.h"
319336
#endif

driver/level3/level3_gemm3m_thread.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@
5050

5151
//The array of job_t may overflow the stack.
5252
//Instead, use malloc to alloc job_t.
53-
#if MAX_CPU_NUMBER > 210
53+
#if MAX_CPU_NUMBER > BLAS3_MEM_ALLOC_THRESHOLD
5454
#define USE_ALLOC_HEAP
5555
#endif
5656

driver/level3/level3_syrk_threaded.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@
5050

5151
//The array of job_t may overflow the stack.
5252
//Instead, use malloc to alloc job_t.
53-
#if MAX_CPU_NUMBER > 210
53+
#if MAX_CPU_NUMBER > BLAS3_MEM_ALLOC_THRESHOLD
5454
#define USE_ALLOC_HEAP
5555
#endif
5656

driver/level3/level3_thread.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@
5050

5151
//The array of job_t may overflow the stack.
5252
//Instead, use malloc to alloc job_t.
53-
#if MAX_CPU_NUMBER > 210
53+
#if MAX_CPU_NUMBER > BLAS3_MEM_ALLOC_THRESHOLD
5454
#define USE_ALLOC_HEAP
5555
#endif
5656

lapack/getrf/getrf_parallel.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ double sqrt(double);
4545

4646
//In this case, the recursive getrf_parallel may overflow the stack.
4747
//Instead, use malloc to alloc job_t.
48-
#if MAX_CPU_NUMBER > 90
48+
#if MAX_CPU_NUMBER > GETRF_MEM_ALLOC_THRESHOLD
4949
#define USE_ALLOC_HEAP
5050
#endif
5151

lapack/potrf/potrf_parallel.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@
4343

4444
//The array of job_t may overflow the stack.
4545
//Instead, use malloc to alloc job_t.
46-
#if MAX_CPU_NUMBER > 210
46+
#if MAX_CPU_NUMBER > BLAS3_MEM_ALLOC_THRESHOLD
4747
#define USE_ALLOC_HEAP
4848
#endif
4949

0 commit comments

Comments
 (0)