Updated level3/CMakeLists with correct defines using all combos.

This commit is contained in:
Hank Anderson 2015-01-30 11:21:50 -06:00
parent dbdca7bf0c
commit a6cf8aafc0
3 changed files with 157 additions and 144 deletions

View File

@ -1,88 +1,87 @@
include_directories(${CMAKE_SOURCE_DIR})
# sources that need to be compiled twice, once with no flags and once with LOWER
set(UL_SOURCES
sbmv_k.c
spmv_k.c
spr_k.c
spr2_k.c
syr_k.c
syr2_k.c
)
# sources that need to be compiled several times, for UNIT, TRANS
set(NU_SOURCES
tbmv_U.c
tbsv_U.c
tpmv_U.c
tpsv_U.c
trmv_U.c
trsv_U.c
tbmv_L.c
tbsv_L.c
tpmv_L.c
tpsv_L.c
trmv_L.c
trsv_L.c
)
# first compile all the objects that don't need specific preprocessor defines
add_library(DBLAS_NONE OBJECT
gbmv_k.c # gbmv_N
${UL_SOURCES}
${NU_SOURCES}
)
# then do objects with transpose/triangular/etc definitions
# objects that need TRANS set
add_library(DBLAS_T OBJECT gbmv_k.c ${NU_SOURCES})
set_target_properties(DBLAS_T PROPERTIES COMPILE_DEFINITIONS TRANS)
# objects that need LOWER set
add_library(DBLAS_L OBJECT ${UL_SOURCES})
set_target_properties(DBLAS_L PROPERTIES COMPILE_DEFINITIONS LOWER)
# objects that need UNIT set
add_library(DBLAS_U OBJECT ${NU_SOURCES})
set_target_properties(DBLAS_U PROPERTIES COMPILE_DEFINITIONS UNIT)
# objects that need TRANS and UNIT set
add_library(DBLAS_TU OBJECT ${NU_SOURCES})
set_target_properties(DBLAS_TU PROPERTIES COMPILE_DEFINITIONS UNIT)
set_target_properties(DBLAS_TU PROPERTIES COMPILE_DEFINITIONS TRANS)
#if (DEFINED SMP)
# add_library(DBLASOBJS_SMP
# dgemv_thread_n.c dgemv_thread_t.c
# dger_thread.c
# dsymv_thread_U.c dsymv_thread_L.c
# dsyr_thread_U.c dsyr_thread_L.c
# dsyr2_thread_U.c dsyr2_thread_L.c
# dspr_thread_U.c dspr_thread_L.c
# dspr2_thread_U.c dspr2_thread_L.c
# dtrmv_thread_NUU.c dtrmv_thread_NUN.c
# dtrmv_thread_NLU.c dtrmv_thread_NLN.c
# dtrmv_thread_TUU.c dtrmv_thread_TUN.c
# dtrmv_thread_TLU.c dtrmv_thread_TLN.c
# dspmv_thread_U.c dspmv_thread_L.c
# dtpmv_thread_NUU.c dtpmv_thread_NUN.c
# dtpmv_thread_NLU.c dtpmv_thread_NLN.c
# dtpmv_thread_TUU.c dtpmv_thread_TUN.c
# dtpmv_thread_TLU.c dtpmv_thread_TLN.c
# dgbmv_thread_n.c dgbmv_thread_t.c
# dsbmv_thread_U.c dsbmv_thread_L.c
# dtbmv_thread_NUU.c dtbmv_thread_NUN.c
# dtbmv_thread_NLU.c dtbmv_thread_NLN.c
# dtbmv_thread_TUU.c dtbmv_thread_TUN.c
# dtbmv_thread_TLU.c dtbmv_thread_TLN.c
# )
#endif ()
set(DBLAS_TARGETS DBLAS_NONE DBLAS_T DBLAS_L DBLAS_U DBLAS_TU)
foreach (DBLAS_TARGET ${DBLAS_TARGETS})
set_target_properties(${DBLAS_TARGET} PROPERTIES COMPILE_DEFINITIONS DOUBLE)
endforeach ()
include_directories(${CMAKE_SOURCE_DIR})
# sources that need to be compiled twice, once with no flags and once with LOWER
set(UL_SOURCES
sbmv_k.c
spmv_k.c
spr_k.c
spr2_k.c
syr_k.c
syr2_k.c
)
# sources that need to be compiled several times, for UNIT, TRANS
set(NU_SOURCES
tbmv_U.c
tbsv_U.c
tpmv_U.c
tpsv_U.c
trmv_U.c
trsv_U.c
tbmv_L.c
tbsv_L.c
tpmv_L.c
tpsv_L.c
trmv_L.c
trsv_L.c
)
# first compile all the objects that don't need specific preprocessor defines
add_library(DBLAS_NONE OBJECT
gbmv_k.c # gbmv_N
${UL_SOURCES}
${NU_SOURCES}
)
# then do objects with transpose/triangular/etc definitions
# objects that need TRANS set
add_library(DBLAS_T OBJECT gbmv_k.c ${NU_SOURCES})
set_target_properties(DBLAS_T PROPERTIES COMPILE_DEFINITIONS "TRANS")
# objects that need LOWER set
add_library(DBLAS_L OBJECT ${UL_SOURCES})
set_target_properties(DBLAS_L PROPERTIES COMPILE_DEFINITIONS "LOWER")
# objects that need UNIT set
add_library(DBLAS_U OBJECT ${NU_SOURCES})
set_target_properties(DBLAS_U PROPERTIES COMPILE_DEFINITIONS "UNIT")
# objects that need TRANS and UNIT set
add_library(DBLAS_TU OBJECT ${NU_SOURCES})
set_target_properties(DBLAS_TU PROPERTIES COMPILE_DEFINITIONS "UNIT;TRANS")
#if (DEFINED SMP)
# add_library(DBLASOBJS_SMP
# dgemv_thread_n.c dgemv_thread_t.c
# dger_thread.c
# dsymv_thread_U.c dsymv_thread_L.c
# dsyr_thread_U.c dsyr_thread_L.c
# dsyr2_thread_U.c dsyr2_thread_L.c
# dspr_thread_U.c dspr_thread_L.c
# dspr2_thread_U.c dspr2_thread_L.c
# dtrmv_thread_NUU.c dtrmv_thread_NUN.c
# dtrmv_thread_NLU.c dtrmv_thread_NLN.c
# dtrmv_thread_TUU.c dtrmv_thread_TUN.c
# dtrmv_thread_TLU.c dtrmv_thread_TLN.c
# dspmv_thread_U.c dspmv_thread_L.c
# dtpmv_thread_NUU.c dtpmv_thread_NUN.c
# dtpmv_thread_NLU.c dtpmv_thread_NLN.c
# dtpmv_thread_TUU.c dtpmv_thread_TUN.c
# dtpmv_thread_TLU.c dtpmv_thread_TLN.c
# dgbmv_thread_n.c dgbmv_thread_t.c
# dsbmv_thread_U.c dsbmv_thread_L.c
# dtbmv_thread_NUU.c dtbmv_thread_NUN.c
# dtbmv_thread_NLU.c dtbmv_thread_NLN.c
# dtbmv_thread_TUU.c dtbmv_thread_TUN.c
# dtbmv_thread_TLU.c dtbmv_thread_TLN.c
# )
#endif ()
set(DBLAS_TARGETS DBLAS_NONE DBLAS_T DBLAS_L DBLAS_U DBLAS_TU)
foreach (DBLAS_TARGET ${DBLAS_TARGETS})
set_target_properties(${DBLAS_TARGET} PROPERTIES COMPILE_DEFINITIONS DOUBLE)
endforeach ()

View File

@ -60,16 +60,31 @@ endfunction ()
# these sources are compiled with combinations of TRANS, UPPER, and UNIT, for 32 combinations total
set(TRM_SOURCES trmm_L.c trmm_R.c trsm_L.c trsm_R.c)
AllCombinations("TRANS UPPER UNIT")
set(TRM_DEFINE_COMBOS LIST_OUT)
message(STATUS "alcombos result: ${LIST_OUT}")
foreach (TRM_SOURCE ${TRM_SOURCES})
foreach (TRM_DEFINES ${TRM_DEFINE_COMBOS})
string(REGEX MATCH "[a-z]+_[LR]" TRM_NAME ${TRM_SOURCE})
string(TOUPPER ${TRM_NAME} TRM_NAME)
# TODO: TRM_DEFINES is a colon-separated list of defines to set for this object - need to parse it and set them using set_target_properties, and also come up with a unique id for the lib name (e.g. first letter of each define, so TRANS UPPER UNIT is TUU)
#add_library(${TRM_NAME}_${TRM_DEFINE}_OBJS OBJECT ${TRM_SOURCE})
#set_target_properties(${TRM_NAME}_${TRM_DEFINE}_OBJS PROPERTIES COMPILE_DEFINITIONS ${TRM_DEFINE})
AllCombinations("TRANS;UPPER;UNIT")
set(TRM_DEFINE_COMBOS ${LIST_OUT})
foreach (trm_source ${TRM_SOURCES})
foreach (trm_defines ${TRM_DEFINE_COMBOS})
# replace colon separated list with semicolons, this turns it into a CMake list that we can use foreach with
string(REPLACE ":" ";" trm_defines ${trm_defines})
# build a unique variable name for this obj file by picking two letters from the defines (can't use one in this case)
set(trm_obj_name "")
foreach (trm_define ${trm_defines})
string(REGEX MATCH "^[A-Z][A-Z]" letter ${trm_define})
set(trm_obj_name "${trm_obj_name}${letter}")
endforeach ()
# parse file name
string(REGEX MATCH "[a-z]+_[LR]" trm_name ${trm_source})
string(TOUPPER ${trm_name} trm_name)
# prepend the uppercased file name to the obj name
set(trm_obj_name "${trm_name}_${trm_obj_name}_OBJS")
# now add the object and set the defines
add_library(${trm_obj_name} OBJECT ${trm_source})
set_target_properties(${trm_obj_name} PROPERTIES COMPILE_DEFINITIONS "${trm_defines}")
endforeach ()
endforeach ()

View File

@ -1,46 +1,45 @@
include_directories(${CMAKE_SOURCE_DIR})
# TODO: Need to generate object files for S, D, C, Q and X - start with D for now.
# The sources are the same, but there are additional preprocessor definitions depending on the precision (see Makefile.tail).
add_library(DBLAS1OBJS OBJECT
axpy.c swap.c
copy.c scal.c
dot.c
asum.c nrm2.c
max.c # amax/min/amin compiled later from same source
rot.c rotg.c rotm.c rotmg.c
axpby.c
)
# N.B. The original Makefile passed in -UUSE_MIN and -UUSE_ABS (where appropriate), no way to do that at a source-level in cmake. REMOVE_DEFINITIONS removes a definition for the rest of the compilation.
add_library(AMAX_OBJ OBJECT max.c)
set_target_properties(AMAX_OBJ PROPERTIES COMPILE_DEFINITIONS USE_ABS)
add_library(AMIN_OBJ OBJECT max.c)
set_target_properties(AMIN_OBJ PROPERTIES COMPILE_DEFINITIONS USE_ABS)
set_target_properties(AMIN_OBJ PROPERTIES COMPILE_DEFINITIONS USE_MIN)
add_library(MIN_OBJ OBJECT max.c)
set_target_properties(MIN_OBJ PROPERTIES COMPILE_DEFINITIONS USE_MIN)
# TODO: USE_NETLIB_GEMV shoudl switch gemv.c to netlib/*gemv.f
add_library(DBLAS2OBJS OBJECT
gemv.c ger.c
trsv.c trmv.c symv.c
syr.c syr2.c gbmv.c
sbmv.c spmv.c
spr.c spr2.c
tbsv.c tbmv.c
tpsv.c tpmv.c
)
add_library(DBLAS3OBJS OBJECT
gemm.c symm.c
trsm.c syrk.c syr2k.c
omatcopy.c imatcopy.c
)
# trmm is trsm with a compiler flag set
add_library(TRMM_OBJ OBJECT trsm.c)
set_target_properties(TRMM_OBJ PROPERTIES COMPILE_DEFINITIONS TRMM)
include_directories(${CMAKE_SOURCE_DIR})
# TODO: Need to generate object files for S, D, C, Q and X - start with D for now.
# The sources are the same, but there are additional preprocessor definitions depending on the precision (see Makefile.tail).
add_library(DBLAS1OBJS OBJECT
axpy.c swap.c
copy.c scal.c
dot.c
asum.c nrm2.c
max.c # amax/min/amin compiled later from same source
rot.c rotg.c rotm.c rotmg.c
axpby.c
)
# N.B. The original Makefile passed in -UUSE_MIN and -UUSE_ABS (where appropriate), no way to do that at a source-level in cmake. REMOVE_DEFINITIONS removes a definition for the rest of the compilation.
add_library(AMAX_OBJ OBJECT max.c)
set_target_properties(AMAX_OBJ PROPERTIES COMPILE_DEFINITIONS "USE_ABS")
add_library(AMIN_OBJ OBJECT max.c)
set_target_properties(AMIN_OBJ PROPERTIES COMPILE_DEFINITIONS "USE_ABS;USE_MIN")
add_library(MIN_OBJ OBJECT max.c)
set_target_properties(MIN_OBJ PROPERTIES COMPILE_DEFINITIONS "USE_MIN")
# TODO: USE_NETLIB_GEMV shoudl switch gemv.c to netlib/*gemv.f
add_library(DBLAS2OBJS OBJECT
gemv.c ger.c
trsv.c trmv.c symv.c
syr.c syr2.c gbmv.c
sbmv.c spmv.c
spr.c spr2.c
tbsv.c tbmv.c
tpsv.c tpmv.c
)
add_library(DBLAS3OBJS OBJECT
gemm.c symm.c
trsm.c syrk.c syr2k.c
omatcopy.c imatcopy.c
)
# trmm is trsm with a compiler flag set
add_library(TRMM_OBJ OBJECT trsm.c)
set_target_properties(TRMM_OBJ PROPERTIES COMPILE_DEFINITIONS TRMM)