Use GEMM_MULTITHREAD_THRESHOLD as a number of ops

...not a matrix size. For GEMM_MULTITHREAD_THRESHOLD=4
(the default value) this does not change anything but
for other values it make the GEMM and GEMV thresholds
changing in the same way.

Close #742
This commit is contained in:
Jerome Robert 2016-01-24 10:30:50 +01:00
parent 1a1935507b
commit 1fe3aab047
2 changed files with 6 additions and 33 deletions

View File

@ -82,9 +82,6 @@ void NAME(char *TRANS, blasint *M, blasint *N,
int buffer_size; int buffer_size;
#ifdef SMP #ifdef SMP
int nthreads; int nthreads;
int nthreads_max;
int nthreads_avail;
double MNK;
#endif #endif
int (*gemv[])(BLASLONG, BLASLONG, BLASLONG, FLOAT, FLOAT *, BLASLONG, FLOAT * , BLASLONG, FLOAT *, BLASLONG, FLOAT *) = { int (*gemv[])(BLASLONG, BLASLONG, BLASLONG, FLOAT, FLOAT *, BLASLONG, FLOAT * , BLASLONG, FLOAT *, BLASLONG, FLOAT *) = {
@ -139,9 +136,6 @@ void CNAME(enum CBLAS_ORDER order,
blasint info, t; blasint info, t;
#ifdef SMP #ifdef SMP
int nthreads; int nthreads;
int nthreads_max;
int nthreads_avail;
double MNK;
#endif #endif
int (*gemv[])(BLASLONG, BLASLONG, BLASLONG, FLOAT, FLOAT *, BLASLONG, FLOAT * , BLASLONG, FLOAT *, BLASLONG, FLOAT *) = { int (*gemv[])(BLASLONG, BLASLONG, BLASLONG, FLOAT, FLOAT *, BLASLONG, FLOAT * , BLASLONG, FLOAT *, BLASLONG, FLOAT *) = {
@ -226,17 +220,10 @@ void CNAME(enum CBLAS_ORDER order,
#ifdef SMP #ifdef SMP
nthreads_max = num_cpu_avail(2); if ( 1L * m * n < 2304L * GEMM_MULTITHREAD_THRESHOLD )
nthreads_avail = nthreads_max; nthreads = 1;
MNK = (double) m * (double) n;
if ( MNK <= (24.0 * 24.0 * (double) (GEMM_MULTITHREAD_THRESHOLD*GEMM_MULTITHREAD_THRESHOLD) ) )
nthreads_max = 1;
if ( nthreads_max > nthreads_avail )
nthreads = nthreads_avail;
else else
nthreads = nthreads_max; nthreads = num_cpu_avail(2);
if (nthreads == 1) { if (nthreads == 1) {
#endif #endif

View File

@ -79,9 +79,6 @@ void NAME(char *TRANS, blasint *M, blasint *N,
FLOAT *buffer; FLOAT *buffer;
#ifdef SMP #ifdef SMP
int nthreads; int nthreads;
int nthreads_max;
int nthreads_avail;
double MNK;
#endif #endif
int (*gemv[])(BLASLONG, BLASLONG, BLASLONG, FLOAT, FLOAT, FLOAT *, BLASLONG, int (*gemv[])(BLASLONG, BLASLONG, BLASLONG, FLOAT, FLOAT, FLOAT *, BLASLONG,
@ -148,9 +145,6 @@ void CNAME(enum CBLAS_ORDER order,
blasint info, t; blasint info, t;
#ifdef SMP #ifdef SMP
int nthreads; int nthreads;
int nthreads_max;
int nthreads_avail;
double MNK;
#endif #endif
int (*gemv[])(BLASLONG, BLASLONG, BLASLONG, FLOAT, FLOAT, FLOAT *, BLASLONG, int (*gemv[])(BLASLONG, BLASLONG, BLASLONG, FLOAT, FLOAT, FLOAT *, BLASLONG,
@ -240,18 +234,10 @@ void CNAME(enum CBLAS_ORDER order,
#ifdef SMP #ifdef SMP
nthreads_max = num_cpu_avail(2); if ( 1L * m * n < 1024L * GEMM_MULTITHREAD_THRESHOLD )
nthreads_avail = nthreads_max; nthreads = 1;
MNK = (double) m * (double) n;
if ( MNK <= ( 256.0 * (double) (GEMM_MULTITHREAD_THRESHOLD * GEMM_MULTITHREAD_THRESHOLD) ))
nthreads_max = 1;
if ( nthreads_max > nthreads_avail )
nthreads = nthreads_avail;
else else
nthreads = nthreads_max; nthreads = num_cpu_avail(2);
if (nthreads == 1) { if (nthreads == 1) {
#endif #endif