Skip to content

Commit dd2d3e6

Browse files
committed
Merge branch 'develop' of github.com:xianyi/OpenBLAS into develop
2 parents a789b77 + 3617c22 commit dd2d3e6

File tree

7 files changed

+144
-107
lines changed

7 files changed

+144
-107
lines changed

driver/others/blas_server.c

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,8 @@ USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
8383

8484
#define ATTRIBUTE_SIZE 128
8585

86+
extern void openblas_warning(int verbose, const char * msg);
87+
8688
/* This is a thread server model implementation. The threads are */
8789
/* spawned at first access to blas library, and still remains until */
8890
/* destruction routine is called. The number of threads are */
@@ -921,5 +923,17 @@ int BLASFUNC(blas_thread_shutdown)(void){
921923
return 0;
922924
}
923925

926+
/*
927+
https://github.com/xianyi/OpenBLAS/issues/294
928+
Use pthread_atfork to close blas_thread_server before fork.
929+
Then, re-init blas_thread_server after fork at child and parent.
930+
*/
931+
void openblas_fork_handler()
932+
{
933+
int err;
934+
err = pthread_atfork (BLASFUNC(blas_thread_shutdown), blas_thread_init, blas_thread_init);
935+
if(err != 0)
936+
openblas_warning(0, "OpenBLAS cannot install fork handler. You may meet hang after fork.\n");
937+
}
924938
#endif
925939

driver/others/blas_server_omp.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -315,4 +315,9 @@ int exec_blas(BLASLONG num, blas_queue_t *queue){
315315
return 0;
316316
}
317317

318+
void openblas_fork_handler()
319+
{
320+
321+
}
322+
318323
#endif

driver/others/blas_server_win32.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -498,3 +498,8 @@ void openblas_set_num_threads(int num)
498498
{
499499
goto_set_num_threads(num);
500500
}
501+
502+
void openblas_fork_handler()
503+
{
504+
505+
}

driver/others/memory.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1288,7 +1288,11 @@ void CONSTRUCTOR gotoblas_init(void) {
12881288
#ifdef SMP
12891289
if (blas_cpu_number == 0) blas_get_cpu_number();
12901290
#ifdef SMP_SERVER
1291-
if (blas_server_avail == 0) blas_thread_init();
1291+
if (blas_server_avail == 0) {
1292+
blas_thread_init();
1293+
//deal with pthread and fork.
1294+
openblas_fork_handler();
1295+
}
12921296
#endif
12931297
#endif
12941298

kernel/arm/KERNEL.ARMV6

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,10 +40,10 @@ DAXPYKERNEL = axpy_vfp.S
4040
CAXPYKERNEL = axpy_vfp.S
4141
ZAXPYKERNEL = axpy_vfp.S
4242

43-
SCOPYKERNEL = scopy_vfp.S
44-
DCOPYKERNEL = dcopy_vfp.S
45-
CCOPYKERNEL = ccopy_vfp.S
46-
ZCOPYKERNEL = zcopy_vfp.S
43+
SCOPYKERNEL = copy.c
44+
DCOPYKERNEL = copy.c
45+
CCOPYKERNEL = zcopy.c
46+
ZCOPYKERNEL = zcopy.c
4747

4848
SDOTKERNEL = sdot_vfp.S
4949
DDOTKERNEL = ddot_vfp.S

kernel/arm/KERNEL.ARMV7

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -45,10 +45,10 @@ DAXPYKERNEL = axpy_vfp.S
4545
CAXPYKERNEL = axpy_vfp.S
4646
ZAXPYKERNEL = axpy_vfp.S
4747

48-
SCOPYKERNEL = scopy_vfp.S
49-
DCOPYKERNEL = dcopy_vfp.S
50-
CCOPYKERNEL = ccopy_vfp.S
51-
ZCOPYKERNEL = zcopy_vfp.S
48+
SCOPYKERNEL = copy.c
49+
DCOPYKERNEL = copy.c
50+
CCOPYKERNEL = zcopy.c
51+
ZCOPYKERNEL = zcopy.c
5252

5353
SDOTKERNEL = sdot_vfp.S
5454
DDOTKERNEL = ddot_vfp.S
@@ -66,12 +66,12 @@ CROTKERNEL = rot_vfp.S
6666
ZROTKERNEL = rot_vfp.S
6767

6868
SSCALKERNEL = scal_vfp.S
69-
DSCALKERNEL = scal_vfp.S
69+
DSCALKERNEL = scal.c
7070
CSCALKERNEL = scal_vfp.S
7171
ZSCALKERNEL = scal_vfp.S
7272

7373
SGEMVNKERNEL = gemv_n_vfp.S
74-
DGEMVNKERNEL = gemv_n_vfp.S
74+
DGEMVNKERNEL = gemv_n.c
7575
CGEMVNKERNEL = cgemv_n_vfp.S
7676
ZGEMVNKERNEL = zgemv_n_vfp.S
7777

0 commit comments

Comments
 (0)