From 7a0889adec1e553a3ad3ef9b4e2b29f70592500d Mon Sep 17 00:00:00 2001 From: Guillaume Sylvand <guillaume.sylvand@airbus.com> Date: Thu, 22 Sep 2016 13:35:33 +0000 Subject: [PATCH] Move the flag gemm3m_enabled from MORSE_context_t to coreblas/compute/global.c to avoid reverse dependency libcoreblas->libchameleon set_coreblas_gemm3m_enabled()/get_coreblas_gemm3m_enabled() allow to set/get this variable. --- control/context.c | 5 ++--- coreblas/compute/core_zgemm.c | 3 +-- coreblas/compute/global.c | 9 +++++++++ coreblas/include/coreblas.h | 3 +++ include/morse_struct.h | 1 - 5 files changed, 15 insertions(+), 6 deletions(-) diff --git a/control/context.c b/control/context.c index 91b5434aa..c511b4bd9 100644 --- a/control/context.c +++ b/control/context.c @@ -83,7 +83,6 @@ MORSE_context_t *morse_context_create() morse->parallel_enabled = MORSE_FALSE; morse->profiling_enabled = MORSE_FALSE; morse->progress_enabled = MORSE_FALSE; - morse->gemm3m_enabled = MORSE_FALSE; morse->householder = MORSE_FLAT_HOUSEHOLDER; morse->translation = MORSE_OUTOFPLACE; @@ -170,7 +169,7 @@ int MORSE_Enable(MORSE_enum option) break; case MORSE_GEMM3M: #ifdef CBLAS_HAS_ZGEMM3M - morse->gemm3m_enabled = MORSE_TRUE; + set_coreblas_gemm3m_enabled(1); #else morse_error("MORSE_Enable", "cannot enable GEMM3M (not available in cblas)"); #endif @@ -241,7 +240,7 @@ int MORSE_Disable(MORSE_enum option) morse->progress_enabled = MORSE_FALSE; break; case MORSE_GEMM3M: - morse->gemm3m_enabled = MORSE_FALSE; + set_coreblas_gemm3m_enabled(0); break; case MORSE_PARALLEL_MODE: morse->parallel_enabled = MORSE_FALSE; diff --git a/coreblas/compute/core_zgemm.c b/coreblas/compute/core_zgemm.c index b5b7e4d4b..1871af489 100644 --- a/coreblas/compute/core_zgemm.c +++ b/coreblas/compute/core_zgemm.c @@ -43,8 +43,7 @@ void CORE_zgemm(MORSE_enum transA, int transB, MORSE_Complex64_t beta, MORSE_Complex64_t *C, int LDC) { #ifdef CBLAS_HAS_ZGEMM3M - MORSE_context_t *morse = morse_context_self(); - if (morse->gemm3m_enabled) + if (get_coreblas_gemm3m_enabled()) cblas_zgemm3m( CblasColMajor, (CBLAS_TRANSPOSE)transA, (CBLAS_TRANSPOSE)transB, diff --git a/coreblas/compute/global.c b/coreblas/compute/global.c index 69842845c..fb59b345e 100644 --- a/coreblas/compute/global.c +++ b/coreblas/compute/global.c @@ -23,6 +23,15 @@ * **/ +static int coreblas_gemm3m_enabled=0; + +void set_coreblas_gemm3m_enabled(int v) { + coreblas_gemm3m_enabled=v; +} +int get_coreblas_gemm3m_enabled(void) { + return coreblas_gemm3m_enabled; +} + /******************************************************************************* * LAPACK Constants **/ diff --git a/coreblas/include/coreblas.h b/coreblas/include/coreblas.h index a241074a7..b8fcc1c7f 100644 --- a/coreblas/include/coreblas.h +++ b/coreblas/include/coreblas.h @@ -94,6 +94,9 @@ extern "C" { extern char *morse_lapack_constants[]; #define morse_lapack_const(morse_const) morse_lapack_constants[morse_const][0] +void set_coreblas_gemm3m_enabled(int v) ; +int get_coreblas_gemm3m_enabled(void) ; + #ifdef __cplusplus } #endif diff --git a/include/morse_struct.h b/include/morse_struct.h index 397d96e1e..2958ce3d0 100644 --- a/include/morse_struct.h +++ b/include/morse_struct.h @@ -132,7 +132,6 @@ typedef struct morse_context_s { MORSE_bool parallel_enabled; MORSE_bool profiling_enabled; MORSE_bool progress_enabled; - MORSE_bool gemm3m_enabled; MORSE_enum householder; // "domino" (flat) or tree-based (reduction) Householder MORSE_enum translation; // In place or Out of place layout conversion -- GitLab