Support DYNAMIC_ARCH with cmake
This commit is contained in:
parent
89ec2be110
commit
4260215adf
|
@ -209,6 +209,7 @@ set_target_properties(${OpenBLAS_LIBNAME} PROPERTIES
|
||||||
# @echo "#define EXPRECISION">> config_last.h
|
# @echo "#define EXPRECISION">> config_last.h
|
||||||
#endif
|
#endif
|
||||||
###
|
###
|
||||||
|
|
||||||
#ifeq ($(DYNAMIC_ARCH), 1)
|
#ifeq ($(DYNAMIC_ARCH), 1)
|
||||||
# @$(MAKE) -C kernel commonlibs || exit 1
|
# @$(MAKE) -C kernel commonlibs || exit 1
|
||||||
# @for d in $(DYNAMIC_CORE) ; \
|
# @for d in $(DYNAMIC_CORE) ; \
|
||||||
|
@ -216,6 +217,13 @@ set_target_properties(${OpenBLAS_LIBNAME} PROPERTIES
|
||||||
# done
|
# done
|
||||||
# @echo DYNAMIC_ARCH=1 >> Makefile.conf_last
|
# @echo DYNAMIC_ARCH=1 >> Makefile.conf_last
|
||||||
#endif
|
#endif
|
||||||
|
if (${DYNAMIC_ARCH})
|
||||||
|
add_subdirectory(kernel)
|
||||||
|
foreach(TARGET_CORE ${DYNAMIC_CORE})
|
||||||
|
list(APPEND TARGET_OBJS "$<TARGET_OBJECTS:kernel_${DYNAMIC_CORE}>")
|
||||||
|
endforeach()
|
||||||
|
endif ()
|
||||||
|
|
||||||
#ifdef USE_THREAD
|
#ifdef USE_THREAD
|
||||||
# @echo USE_THREAD=$(USE_THREAD) >> Makefile.conf_last
|
# @echo USE_THREAD=$(USE_THREAD) >> Makefile.conf_last
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -64,16 +64,16 @@ endif ()
|
||||||
|
|
||||||
if (DYNAMIC_ARCH)
|
if (DYNAMIC_ARCH)
|
||||||
if (${ARCH} STREQUAL "x86")
|
if (${ARCH} STREQUAL "x86")
|
||||||
set(DYNAMIC_CORE "KATMAI COPPERMINE NORTHWOOD PRESCOTT BANIAS CORE2 PENRYN DUNNINGTON NEHALEM ATHLON OPTERON OPTERON_SSE3 BARCELONA BOBCAT ATOM NANO")
|
set(DYNAMIC_CORE KATMAI COPPERMINE NORTHWOOD PRESCOTT BANIAS CORE2 PENRYN DUNNINGTON NEHALEM ATHLON OPTERON OPTERON_SSE3 BARCELONA BOBCAT ATOM NANO)
|
||||||
endif ()
|
endif ()
|
||||||
|
|
||||||
if (${ARCH} STREQUAL "x86_64")
|
if (${ARCH} STREQUAL "x86_64")
|
||||||
set(DYNAMIC_CORE "PRESCOTT CORE2 PENRYN DUNNINGTON NEHALEM OPTERON OPTERON_SSE3 BARCELONA BOBCAT ATOM NANO")
|
set(DYNAMIC_CORE PRESCOTT CORE2 PENRYN DUNNINGTON NEHALEM OPTERON OPTERON_SSE3 BARCELONA BOBCAT ATOM NANO)
|
||||||
if (NOT NO_AVX)
|
if (NOT NO_AVX)
|
||||||
set(DYNAMIC_CORE "${DYNAMIC_CORE} SANDYBRIDGE BULLDOZER PILEDRIVER STEAMROLLER")
|
set(DYNAMIC_CORE ${DYNAMIC_CORE} SANDYBRIDGE BULLDOZER PILEDRIVER STEAMROLLER)
|
||||||
endif ()
|
endif ()
|
||||||
if (NOT NO_AVX2)
|
if (NOT NO_AVX2)
|
||||||
set(DYNAMIC_CORE "${DYNAMIC_CORE} HASWELL ZEN")
|
set(DYNAMIC_CORE ${DYNAMIC_CORE} HASWELL ZEN)
|
||||||
endif ()
|
endif ()
|
||||||
endif ()
|
endif ()
|
||||||
|
|
||||||
|
|
|
@ -46,9 +46,11 @@ if (DEFINED TARGET_CORE)
|
||||||
set(GETARCH2_FLAGS "-DBUILD_KERNEL")
|
set(GETARCH2_FLAGS "-DBUILD_KERNEL")
|
||||||
set(TARGET_MAKE "Makefile_kernel.conf")
|
set(TARGET_MAKE "Makefile_kernel.conf")
|
||||||
set(TARGET_CONF "config_kernel.h")
|
set(TARGET_CONF "config_kernel.h")
|
||||||
|
set(TARGET_CONF_DIR ${PROJECT_BINARY_DIR}/kernel_config/${TARGET_CORE})
|
||||||
else()
|
else()
|
||||||
set(TARGET_MAKE "Makefile.conf")
|
set(TARGET_MAKE "Makefile.conf")
|
||||||
set(TARGET_CONF "config.h")
|
set(TARGET_CONF "config.h")
|
||||||
|
set(TARGET_CONF_DIR ${PROJECT_BINARY_DIR})
|
||||||
endif ()
|
endif ()
|
||||||
|
|
||||||
set(TARGET_CONF_TEMP "${PROJECT_BINARY_DIR}/${TARGET_CONF}.tmp")
|
set(TARGET_CONF_TEMP "${PROJECT_BINARY_DIR}/${TARGET_CONF}.tmp")
|
||||||
|
@ -129,7 +131,13 @@ execute_process(COMMAND ${PROJECT_BINARY_DIR}/${GETARCH2_BIN} 1 OUTPUT_VARIABLE
|
||||||
|
|
||||||
# append config data from getarch_2nd to the TARGET file and read in CMake vars
|
# append config data from getarch_2nd to the TARGET file and read in CMake vars
|
||||||
file(APPEND ${TARGET_CONF_TEMP} ${GETARCH2_CONF_OUT})
|
file(APPEND ${TARGET_CONF_TEMP} ${GETARCH2_CONF_OUT})
|
||||||
|
|
||||||
|
if (${BUILD_KERNEL})
|
||||||
|
configure_file(${TARGET_CONF_TEMP} ${PROJECT_BINARY_DIR}/kernel_config/${TARGET_CORE}/${TARGET_CONF} COPYONLY)
|
||||||
|
else ()
|
||||||
configure_file(${TARGET_CONF_TEMP} ${PROJECT_BINARY_DIR}/${TARGET_CONF} COPYONLY)
|
configure_file(${TARGET_CONF_TEMP} ${PROJECT_BINARY_DIR}/${TARGET_CONF} COPYONLY)
|
||||||
|
endif ()
|
||||||
|
|
||||||
ParseGetArchVars(${GETARCH2_MAKE_OUT})
|
ParseGetArchVars(${GETARCH2_MAKE_OUT})
|
||||||
|
|
||||||
# compile get_config_h
|
# compile get_config_h
|
||||||
|
|
|
@ -2,7 +2,6 @@
|
||||||
## Author: Hank Anderson <hank@statease.com>
|
## Author: Hank Anderson <hank@statease.com>
|
||||||
## Description: Ported from OpenBLAS/Makefile.system
|
## Description: Ported from OpenBLAS/Makefile.system
|
||||||
##
|
##
|
||||||
|
|
||||||
set(NETLIB_LAPACK_DIR "${PROJECT_SOURCE_DIR}/lapack-netlib")
|
set(NETLIB_LAPACK_DIR "${PROJECT_SOURCE_DIR}/lapack-netlib")
|
||||||
|
|
||||||
# TODO: Makefile.system detects Darwin (mac) and switches to clang here -hpa
|
# TODO: Makefile.system detects Darwin (mac) and switches to clang here -hpa
|
||||||
|
|
|
@ -225,7 +225,7 @@ function(GenerateNamedObjects sources_in)
|
||||||
|
|
||||||
# create a copy of the source to avoid duplicate obj filename problem with ar.exe
|
# create a copy of the source to avoid duplicate obj filename problem with ar.exe
|
||||||
get_filename_component(source_extension ${source_file} EXT)
|
get_filename_component(source_extension ${source_file} EXT)
|
||||||
set(new_source_file "${CMAKE_CURRENT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/${obj_name}${source_extension}")
|
set(new_source_file "${CMAKE_CURRENT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/${obj_name}${TSUFFIX}${source_extension}")
|
||||||
if (IS_ABSOLUTE ${source_file})
|
if (IS_ABSOLUTE ${source_file})
|
||||||
set(old_source_file ${source_file})
|
set(old_source_file ${source_file})
|
||||||
else ()
|
else ()
|
||||||
|
|
|
@ -1,21 +1,12 @@
|
||||||
|
|
||||||
include_directories(${PROJECT_SOURCE_DIR})
|
include_directories(${PROJECT_SOURCE_DIR})
|
||||||
include_directories(${PROJECT_BINARY_DIR})
|
|
||||||
include("${PROJECT_SOURCE_DIR}/cmake/kernel.cmake")
|
|
||||||
|
|
||||||
# Makefile
|
# Makefile
|
||||||
|
function (build_core TARGET_CORE KDIR TSUFFIX KERNEL_DEFINITIONS)
|
||||||
if (DEFINED TARGET_CORE)
|
include("${PROJECT_SOURCE_DIR}/cmake/kernel.cmake")
|
||||||
#override CFLAGS += -DBUILD_KERNEL -DTABLE_NAME=gotoblas_$(TARGET_CORE)
|
if (${DYNAMIC_ARCH})
|
||||||
set(BUILD_KERNEL 1)
|
include("${PROJECT_SOURCE_DIR}/cmake/system.cmake")
|
||||||
set(KDIR "")
|
|
||||||
set(TSUFFIX "_${TARGET_CORE}")
|
|
||||||
else ()
|
|
||||||
set(TARGET_CORE ${CORE})
|
|
||||||
set(KDIR "")
|
|
||||||
set(TSUFFIX "")
|
|
||||||
endif ()
|
endif ()
|
||||||
|
|
||||||
SetDefaultL1()
|
SetDefaultL1()
|
||||||
SetDefaultL2()
|
SetDefaultL2()
|
||||||
SetDefaultL3()
|
SetDefaultL3()
|
||||||
|
@ -448,4 +439,28 @@ endforeach ()
|
||||||
# Makefile.LA
|
# Makefile.LA
|
||||||
#DBLASOBJS += dneg_tcopy$(TSUFFIX).$(SUFFIX) dlaswp_ncopy$(TSUFFIX).$(SUFFIX)
|
#DBLASOBJS += dneg_tcopy$(TSUFFIX).$(SUFFIX) dlaswp_ncopy$(TSUFFIX).$(SUFFIX)
|
||||||
|
|
||||||
add_library(kernel OBJECT ${OPENBLAS_SRC})
|
add_library(kernel${TSUFFIX} OBJECT ${OPENBLAS_SRC})
|
||||||
|
set_target_properties(kernel${TSUFFIX} PROPERTIES COMPILE_FLAGS "${KERNEL_DEFINITIONS}")
|
||||||
|
get_target_properties(KERNEL_INCLUDE_DIRECTORIES kernel${TSUFFIX} COMPILE_FLAGS)
|
||||||
|
set_target_properties(kernel${TSUFFIX} PROPERTIES INCLUDE_DIRECTORIES "${KERNEL_INCLUDE_DIRECTORIES};${TARGET_CONF_DIR}")
|
||||||
|
endfunction ()
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
if (${DYNAMIC_ARCH})
|
||||||
|
foreach(TARGET_CORE ${DYNAMIC_CORE})
|
||||||
|
set(KERNEL_DEFINITIONS "-DBUILD_KERNEL -DTABLE_NAME=gotoblas_${TARGET_CORE}")
|
||||||
|
set(BUILD_KERNEL 1)
|
||||||
|
set(KDIR "")
|
||||||
|
set(TSUFFIX "_${TARGET_CORE}")
|
||||||
|
build_core("${TARGET_CORE}" "${KDIR}" "${TSUFFIX}" "${KERNEL_DEFINITIONS}")
|
||||||
|
endforeach()
|
||||||
|
else ()
|
||||||
|
set(KERNEL_DEFINITIONS "")
|
||||||
|
set(TARGET_CONF_DIR ${PROJECT_BINARY_DIR})
|
||||||
|
set(TARGET_CORE ${CORE})
|
||||||
|
set(KDIR "")
|
||||||
|
set(TSUFFIX "")
|
||||||
|
build_core("${TARGET_CORE}" "${KDIR}" "${TSUFFIX}" "${KERNEL_DEFINITIONS}")
|
||||||
|
endif ()
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue