Added SMP objects to driver/level3.
authorHank Anderson <hank.p.anderson@gmail.com>
Thu, 5 Feb 2015 18:22:48 +0000 (12:22 -0600)
committerHank Anderson <hank.p.anderson@gmail.com>
Thu, 5 Feb 2015 18:22:48 +0000 (12:22 -0600)
cmake/utils.cmake
driver/level3/CMakeLists.txt

index 2a1d105..286f271 100644 (file)
@@ -83,8 +83,10 @@ function(GenerateNamedObjects sources_in float_type_in defines_in name_in use_cb
   set(OBJ_LIST_OUT "")
   foreach (source_file ${sources_in})
 
-    string(SUBSTRING ${float_type_in} 0 1 float_char)
-    string(TOLOWER ${float_char} float_char)
+    if (NOT float_type_in STREQUAL "")
+      string(SUBSTRING ${float_type_in} 0 1 float_char)
+      string(TOLOWER ${float_char} float_char)
+    endif ()
 
     if (NOT name_in)
       get_filename_component(source_name ${source_file} NAME_WE)
@@ -134,8 +136,13 @@ endfunction ()
 #                  If 0, it will simply append the code, e.g. symm_L.c with TRANS and UNIT will be symm_LTU.
 #                  If 2, it will append the code with an underscore, e.g. symm.c with TRANS and UNIT will be symm_TU.
 #                  If 3, it will insert the code *around* the last character with an underscore, e.g. symm_L.c with TRANS and UNIT will be symm_TLU (required by BLAS level2 objects).
+# @param alternate_name replaces the source name as the object name (define codes are still appended)
 function(GenerateCombinationObjects sources_in defines_in absent_codes_in float_type_in all_defines_in replace_scheme)
 
+  if (DEFINED ARGV6)
+    set(alternate_name ${ARGV6})
+  endif ()
+
   AllCombinations("${defines_in}" "${absent_codes_in}")
   set(define_combos ${LIST_OUT})
   set(define_codes ${CODES_OUT})
@@ -182,7 +189,7 @@ function(GenerateCombinationObjects sources_in defines_in absent_codes_in float_
         endif ()
       endif ()
 
-      GenerateNamedObjects("${source_file}" "${float_type_in}" "${cur_defines}" "" 0 "${replace_code}" "${append_code}") 
+      GenerateNamedObjects("${source_file}" "${float_type_in}" "${cur_defines}" "${alternate_name}" 0 "${replace_code}" "${append_code}")
       list(APPEND COMBO_OBJ_LIST_OUT "${OBJ_LIST_OUT}")
     endforeach ()
   endforeach ()
index 61133ce..6876649 100644 (file)
@@ -28,6 +28,10 @@ foreach (GEMM_DEFINE ${GEMM_DEFINES})
   string(TOLOWER ${GEMM_DEFINE} GEMM_DEFINE_LC)
   GenerateNamedObjects("gemm.c" "DOUBLE" "${GEMM_DEFINE}" "gemm_${GEMM_DEFINE_LC}" 0)
   list(APPEND DBLAS_OBJS ${OBJ_LIST_OUT})
+  if (SMP AND NOT USE_SIMPLE_THREADED_LEVEL3)
+    GenerateNamedObjects("gemm.c" "DOUBLE" "${GEMM_DEFINE};THREADED_LEVEL3" "gemm_thread_${GEMM_DEFINE_LC}" 0)
+    list(APPEND DBLAS_OBJS ${OBJ_LIST_OUT})
+  endif ()
 endforeach ()
 
 GenerateCombinationObjects("trmm_L.c;trmm_R.c;trsm_L.c;trsm_R.c" "TRANS;UPPER;UNIT" "N;L;N" "DOUBLE" "" 0)
@@ -39,19 +43,20 @@ list(APPEND DBLAS_OBJS ${COMBO_OBJ_LIST_OUT})
 GenerateCombinationObjects("syrk_kernel.c;syr2k_kernel.c" "LOWER" "U" "DOUBLE" "" 2)
 list(APPEND DBLAS_OBJS ${COMBO_OBJ_LIST_OUT})
 
-#if (SMP)
-#
-#  COMMONOBJS  += gemm_thread_m.c gemm_thread_n.c gemm_thread_mn.c gemm_thread_variable.c
-#  COMMONOBJS  += syrk_thread.c
-#
-#  if (USE_SIMPLE_THREADED_LEVEL3)
-#    DBLASOBJS    += dgemm_thread_nn.c dgemm_thread_nt.c dgemm_thread_tn.c dgemm_thread_tt.c
-#    DBLASOBJS    += dsymm_thread_LU.c dsymm_thread_LL.c dsymm_thread_RU.c dsymm_thread_RL.c
-#    DBLASOBJS    += dsyrk_thread_UN.c dsyrk_thread_UT.c dsyrk_thread_LN.c dsyrk_thread_LT.c
-#
-#  endif ()
-#endif ()
-#
+if (SMP)
+
+  # N.B. these do NOT have a float type (e.g. DOUBLE) defined!
+  GenerateNamedObjects("gemm_thread_m.c;gemm_thread_n.c;gemm_thread_mn.c;gemm_thread_variable.c;syrk_thread.c" "" "" "" 0)
+  list(APPEND DBLAS_OBJS ${OBJ_LIST_OUT})
+
+  if (NOT USE_SIMPLE_THREADED_LEVEL3)
+    GenerateCombinationObjects("syrk_k.c" "LOWER;TRANS" "U;N" "DOUBLE" "THREADED_LEVEL3" 2 "syrk_thread")
+    list(APPEND DBLAS_OBJS ${COMBO_OBJ_LIST_OUT})
+    GenerateCombinationObjects("symm_k.c" "RSIDE;LOWER" "L;U" "DOUBLE" "THREADED_LEVEL3;NN" 2 "symm_thread")
+    list(APPEND DBLAS_OBJS ${COMBO_OBJ_LIST_OUT})
+  endif ()
+endif ()
+
 #HPLOBJS =
 #      dgemm_nn.c dgemm_nt.c dgemm_tn.c dgemm_tt.c
 #      dtrsm_LNUU.c dtrsm_LNUN.c dtrsm_LNLU.c dtrsm_LNLN.c