From 11eed3f683d09e65f721567b346b0f733bff9a64 Mon Sep 17 00:00:00 2001 From: "Field G. Van Zee" Date: Thu, 13 Oct 2016 14:23:23 -0500 Subject: [PATCH 1/2] Fixed a configure -t omp/openmp bug from fd04869. Details: - Forgot to update certain occurrences of "omp" in common.mk during commit fd04869, which changed the preferred configure option string for enabling OpenMP from "omp" to "openmp". --- common.mk | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/common.mk b/common.mk index 458cdcc03..683d0b0e9 100644 --- a/common.mk +++ b/common.mk @@ -153,9 +153,9 @@ endif ifeq ($(CC_VENDOR),gcc) ifeq ($(THREADING_MODEL),auto) -THREADING_MODEL := omp +THREADING_MODEL := openmp endif -ifeq ($(THREADING_MODEL),omp) +ifeq ($(THREADING_MODEL),openmp) CTHREADFLAGS := -fopenmp LDFLAGS += -fopenmp endif @@ -167,9 +167,9 @@ endif ifeq ($(CC_VENDOR),icc) ifeq ($(THREADING_MODEL),auto) -THREADING_MODEL := omp +THREADING_MODEL := openmp endif -ifeq ($(THREADING_MODEL),omp) +ifeq ($(THREADING_MODEL),openmp) CTHREADFLAGS := -fopenmp LDFLAGS += -fopenmp endif @@ -183,7 +183,7 @@ ifeq ($(CC_VENDOR),clang) ifeq ($(THREADING_MODEL),auto) THREADING_MODEL := pthreads endif -ifeq ($(THREADING_MODEL),omp) +ifeq ($(THREADING_MODEL),openmp) CTHREADFLAGS := -fopenmp LDFLAGS += -fopenmp endif From 28b2af8a71133ce68774e153b6e05afb05affba8 Mon Sep 17 00:00:00 2001 From: "Field G. Van Zee" Date: Thu, 13 Oct 2016 14:50:08 -0500 Subject: [PATCH 2/2] Added disabled code to print thrinfo_t structures. Details: - Added cpp-guarded code to bli_thrcomm_openmp.c that allows a curious developer to print the contents of the thrinfo_t structures of each thread, for verification purposes or just to study the way thread information and communicators are used in BLIS. - Enabled some previously-disabled code in bli_l3_thrinfo.c for freeing an array of thrinfo_t* values that is used in the new, cpp-guarde code mentioned above. - Removed some old commented lines from bli_gemm_front.c. --- frame/3/bli_l3_thrinfo.c | 2 +- frame/3/bli_l3_thrinfo.h | 2 +- frame/3/gemm/bli_gemm_front.c | 12 ------------ frame/thread/bli_thrcomm_openmp.c | 17 +++++++++++++++++ 4 files changed, 19 insertions(+), 14 deletions(-) diff --git a/frame/3/bli_l3_thrinfo.c b/frame/3/bli_l3_thrinfo.c index 78b2b775c..33027a1e8 100644 --- a/frame/3/bli_l3_thrinfo.c +++ b/frame/3/bli_l3_thrinfo.c @@ -422,6 +422,7 @@ exit(1); return paths; } +#endif void bli_l3_thrinfo_free_paths ( @@ -436,5 +437,4 @@ void bli_l3_thrinfo_free_paths bli_free_intl( threads ); } -#endif diff --git a/frame/3/bli_l3_thrinfo.h b/frame/3/bli_l3_thrinfo.h index 71dea7645..fcf1f507d 100644 --- a/frame/3/bli_l3_thrinfo.h +++ b/frame/3/bli_l3_thrinfo.h @@ -121,10 +121,10 @@ thrinfo_t** bli_l3_thrinfo_create_full_paths ( cntx_t* cntx ); +#endif void bli_l3_thrinfo_free_paths ( thrinfo_t** threads ); -#endif diff --git a/frame/3/gemm/bli_gemm_front.c b/frame/3/gemm/bli_gemm_front.c index 324655655..533a6dcaf 100644 --- a/frame/3/gemm/bli_gemm_front.c +++ b/frame/3/gemm/bli_gemm_front.c @@ -88,13 +88,6 @@ void bli_gemm_front // Record the threading for each level within the context. bli_cntx_set_thrloop_from_env( BLIS_GEMM, BLIS_LEFT, cntx ); - // Create the first node in the thrinfo_t tree for each thread. -//thrinfo_t** infos = bli_l3_thrinfo_create_full_paths( cntx ); -//bli_l3_thrinfo_print_paths( infos ); -//exit(1); -//cntl = bli_gemm_cntl_create( BLIS_GEMM ); - //thrinfo_t** infos = bli_l3_thrinfo_create_roots( cntx, cntl ); - // Invoke the internal back-end via the thread handler. bli_l3_thread_decorator ( @@ -107,10 +100,5 @@ void bli_gemm_front cntx, cntl ); -//bli_l3_thrinfo_print_paths( infos ); -//exit(1); - - // Free the thrinfo_t structures. - //bli_l3_thrinfo_free_paths( infos ); } diff --git a/frame/thread/bli_thrcomm_openmp.c b/frame/thread/bli_thrcomm_openmp.c index 68d9d7a29..0882d1659 100644 --- a/frame/thread/bli_thrcomm_openmp.c +++ b/frame/thread/bli_thrcomm_openmp.c @@ -199,6 +199,8 @@ void bli_thrcomm_tree_barrier( barrier_t* barack ) #endif +//#define PRINT_THRINFO + void bli_l3_thread_decorator ( l3int_t func, @@ -217,6 +219,10 @@ void bli_l3_thread_decorator // Allcoate a global communicator for the root thrinfo_t structures. thrcomm_t* gl_comm = bli_thrcomm_create( n_threads ); +#ifdef PRINT_THRINFO + thrinfo_t** threads = bli_malloc_intl( n_threads * sizeof( thrinfo_t* ) ); +#endif + _Pragma( "omp parallel num_threads(n_threads)" ) { dim_t id = omp_get_thread_num(); @@ -245,13 +251,24 @@ void bli_l3_thread_decorator // Free the control tree, if one was created locally. bli_l3_cntl_free_if( a, b, c, cntx, cntl, cntl_use, thread ); +#ifdef PRINT_THRINFO + threads[id] = thread; +#else // Free the current thread's thrinfo_t structure. bli_l3_thrinfo_free( thread ); +#endif } // We shouldn't free the global communicator since it was already freed // by the global communicator's chief thread in bli_l3_thrinfo_free() // (called above). + + +#ifdef PRINT_THRINFO + bli_l3_thrinfo_print_paths( threads ); + bli_l3_thrinfo_free_paths( threads ); + exit(1); +#endif } #endif