Codes when define is absent are now a parameter to AllCombinations.
authorHank Anderson <hank.p.anderson@gmail.com>
Thu, 5 Feb 2015 15:23:47 +0000 (09:23 -0600)
committerHank Anderson <hank.p.anderson@gmail.com>
Thu, 5 Feb 2015 15:23:47 +0000 (09:23 -0600)
The level3 object names should now be correct.

cmake/utils.cmake
driver/level3/CMakeLists.txt

index 2763757..075c0cc 100644 (file)
@@ -15,9 +15,10 @@ endfunction ()
 # Returns all combinations of the input list, as a list with colon-separated combinations
 # E.g. input of A B C returns A B C A:B A:C B:C
 # N.B. The input is meant to be a list, and to past a list to a function in CMake you must quote it (e.g. AllCombinations("${LIST_VAR}")).
+# #param absent_codes codes to use when an element is absent from a combination. For example, if you have TRANS;UNIT;UPPER you may want the code to be NNL when nothing is present.
 # @returns LIST_OUT a list of combinations
 #          CODES_OUT a list of codes corresponding to each combination, with N meaning the item is not present, and the first letter of the list item meaning it is presen
-function(AllCombinations list_in)
+function(AllCombinations list_in absent_codes_in)
   list(LENGTH list_in list_count)
   set(num_combos 1)
   # subtract 1 since we will iterate from 0 to num_combos
@@ -43,7 +44,7 @@ function(AllCombinations list_in)
         endif ()
         string(SUBSTRING ${list_elem} 0 1 code_char)
       else ()
-        set(code_char "N")
+        list(GET absent_codes_in ${list_index} code_char)
       endif ()
       set(current_code "${current_code}${code_char}")
     endforeach ()
@@ -122,9 +123,9 @@ endfunction ()
 # @param float_type_in the float type to define for this build (e.g. SINGLE/DOUBLE/etc)
 # @param all_defines_in (optional) preprocessor definitions that will be applied to all objects
 # @param replace_k If 1, replace the "k" in the filename with the define combo letters. E.g. symm_k with TRANS and UNIT defined will be symm_TU. If 0, appends, or if 2 appends with an underscore.
-function(GenerateCombinationObjects sources_in defines_in float_type_in all_defines_in replace_k)
+function(GenerateCombinationObjects sources_in defines_in absent_codes_in float_type_in all_defines_in replace_k)
 
-  AllCombinations("${defines_in}")
+  AllCombinations("${defines_in}" "${absent_codes_in}")
   set(define_combos ${LIST_OUT})
   set(define_codes ${CODES_OUT})
 
index 02a6097..d9d4da7 100644 (file)
@@ -30,27 +30,13 @@ foreach (GEMM_DEFINE ${GEMM_DEFINES})
   list(APPEND DBLAS_OBJS ${OBJ_LIST_OUT})
 endforeach ()
 
-AllCombinations("TRANS;UPPER;UNIT")
-set(define_combos ${LIST_OUT})
-foreach (def_combo ${define_combos})
-  # replace colon separated list with semicolons, this turns it into a CMake list that we can use foreach with
-  string(REPLACE ":" ";" def_combo ${def_combo})
-
-  # build a unique variable name for this obj file by picking two letters from the defines (can't use one in this case)
-  set(obj_name "")
-  foreach (combo_elem ${def_combo})
-    string(REGEX MATCH "^[A-Z][A-Z]" letter ${combo_elem})
-    set(obj_name "${obj_name}${letter}")
-  endforeach ()
-endforeach ()
-
-GenerateCombinationObjects("trmm_L.c;trmm_R.c;trsm_L.c;trsm_R.c" "TRANS;UPPER;UNIT" "DOUBLE" "" 0)
+GenerateCombinationObjects("trmm_L.c;trmm_R.c;trsm_L.c;trsm_R.c" "TRANS;UPPER;UNIT" "N;L;N" "DOUBLE" "" 0)
 list(APPEND DBLAS_OBJS ${OBJ_LIST_OUT})
-GenerateCombinationObjects("symm_k.c" "LOWER;RSIDE" "DOUBLE" "NN" 1)
+GenerateCombinationObjects("symm_k.c" "RSIDE;LOWER" "L;U" "DOUBLE" "NN" 1)
 list(APPEND DBLAS_OBJS ${OBJ_LIST_OUT})
-GenerateCombinationObjects("syrk_k.c;syr2k_k.c" "LOWER;TRANS" "DOUBLE" "" 1)
+GenerateCombinationObjects("syrk_k.c;syr2k_k.c" "LOWER;TRANS" "U;N" "DOUBLE" "" 1)
 list(APPEND DBLAS_OBJS ${OBJ_LIST_OUT})
-GenerateCombinationObjects("syrk_kernel.c;syr2k_kernel.c" "LOWER" "DOUBLE" "" 2)
+GenerateCombinationObjects("syrk_kernel.c;syr2k_kernel.c" "LOWER" "U" "DOUBLE" "" 2)
 list(APPEND DBLAS_OBJS ${OBJ_LIST_OUT})
 
 #if (SMP)