From cfaf1c678f85c4b6428030069edea02f903764df Mon Sep 17 00:00:00 2001 From: Hank Anderson Date: Thu, 5 Feb 2015 09:17:18 -0600 Subject: [PATCH] Added option to append define codes with an underscore. Fixed the code array not getting reset on subsequent AllCombinations calls. --- cmake/utils.cmake | 12 +++++++++--- driver/level3/CMakeLists.txt | 2 +- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/cmake/utils.cmake b/cmake/utils.cmake index b0c108bbc..276375740 100644 --- a/cmake/utils.cmake +++ b/cmake/utils.cmake @@ -23,6 +23,7 @@ function(AllCombinations list_in) # subtract 1 since we will iterate from 0 to num_combos math(EXPR num_combos "(${num_combos} << ${list_count}) - 1") set(LIST_OUT "") + set(CODES_OUT "") foreach (c RANGE 0 ${num_combos}) set(current_combo "") @@ -119,8 +120,8 @@ endfunction () # @param sources_in the source files to build from # @param defines_in the preprocessor definitions that will be combined to create the object files # @param float_type_in the float type to define for this build (e.g. SINGLE/DOUBLE/etc) -# @param replace_k Replace the "k" in the filename with the define combo letters (else it appends). E.g. symm_k with TRANS and UNIT defined will be symm_TU. # @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) AllCombinations("${defines_in}") @@ -151,10 +152,14 @@ function(GenerateCombinationObjects sources_in defines_in float_type_in all_defi set(replace_k_name "") set(append_name "") - if (replace_k) + if (replace_k EQUAL 1) set(replace_k_name ${define_code}) else () - set(append_name ${define_code}) + if (replace_k EQUAL 2) + set(append_name "_${define_code}") + else () + set(append_name ${define_code}) + endif () endif () GenerateNamedObjects("${source_file}" "${float_type_in}" "${cur_defines}" "" 0 "${replace_k_name}" "${append_name}") @@ -164,3 +169,4 @@ function(GenerateCombinationObjects sources_in defines_in float_type_in all_defi set(COMBO_OBJ_LIST_OUT ${COMBO_OBJ_LIST_OUT} PARENT_SCOPE) endfunction () + diff --git a/driver/level3/CMakeLists.txt b/driver/level3/CMakeLists.txt index 4427c8ebf..02a6097e3 100644 --- a/driver/level3/CMakeLists.txt +++ b/driver/level3/CMakeLists.txt @@ -50,7 +50,7 @@ GenerateCombinationObjects("symm_k.c" "LOWER;RSIDE" "DOUBLE" "NN" 1) list(APPEND DBLAS_OBJS ${OBJ_LIST_OUT}) GenerateCombinationObjects("syrk_k.c;syr2k_k.c" "LOWER;TRANS" "DOUBLE" "" 1) list(APPEND DBLAS_OBJS ${OBJ_LIST_OUT}) -GenerateCombinationObjects("syrk_kernel.c;syr2k_kernel.c" "LOWER" "DOUBLE" "" 1) +GenerateCombinationObjects("syrk_kernel.c;syr2k_kernel.c" "LOWER" "DOUBLE" "" 2) list(APPEND DBLAS_OBJS ${OBJ_LIST_OUT}) #if (SMP)