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
|
||||
#endif
|
||||
###
|
||||
|
||||
#ifeq ($(DYNAMIC_ARCH), 1)
|
||||
# @$(MAKE) -C kernel commonlibs || exit 1
|
||||
# @for d in $(DYNAMIC_CORE) ; \
|
||||
|
@ -216,6 +217,13 @@ set_target_properties(${OpenBLAS_LIBNAME} PROPERTIES
|
|||
# done
|
||||
# @echo DYNAMIC_ARCH=1 >> Makefile.conf_last
|
||||
#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
|
||||
# @echo USE_THREAD=$(USE_THREAD) >> Makefile.conf_last
|
||||
#endif
|
||||
|
|
|
@ -64,16 +64,16 @@ endif ()
|
|||
|
||||
if (DYNAMIC_ARCH)
|
||||
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 ()
|
||||
|
||||
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)
|
||||
set(DYNAMIC_CORE "${DYNAMIC_CORE} SANDYBRIDGE BULLDOZER PILEDRIVER STEAMROLLER")
|
||||
set(DYNAMIC_CORE ${DYNAMIC_CORE} SANDYBRIDGE BULLDOZER PILEDRIVER STEAMROLLER)
|
||||
endif ()
|
||||
if (NOT NO_AVX2)
|
||||
set(DYNAMIC_CORE "${DYNAMIC_CORE} HASWELL ZEN")
|
||||
set(DYNAMIC_CORE ${DYNAMIC_CORE} HASWELL ZEN)
|
||||
endif ()
|
||||
endif ()
|
||||
|
||||
|
|
|
@ -46,9 +46,11 @@ if (DEFINED TARGET_CORE)
|
|||
set(GETARCH2_FLAGS "-DBUILD_KERNEL")
|
||||
set(TARGET_MAKE "Makefile_kernel.conf")
|
||||
set(TARGET_CONF "config_kernel.h")
|
||||
set(TARGET_CONF_DIR ${PROJECT_BINARY_DIR}/kernel_config/${TARGET_CORE})
|
||||
else()
|
||||
set(TARGET_MAKE "Makefile.conf")
|
||||
set(TARGET_CONF "config.h")
|
||||
set(TARGET_CONF_DIR ${PROJECT_BINARY_DIR})
|
||||
endif ()
|
||||
|
||||
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
|
||||
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)
|
||||
endif ()
|
||||
|
||||
ParseGetArchVars(${GETARCH2_MAKE_OUT})
|
||||
|
||||
# compile get_config_h
|
||||
|
|
|
@ -2,7 +2,6 @@
|
|||
## Author: Hank Anderson <hank@statease.com>
|
||||
## Description: Ported from OpenBLAS/Makefile.system
|
||||
##
|
||||
|
||||
set(NETLIB_LAPACK_DIR "${PROJECT_SOURCE_DIR}/lapack-netlib")
|
||||
|
||||
# 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
|
||||
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})
|
||||
set(old_source_file ${source_file})
|
||||
else ()
|
||||
|
|
|
@ -1,21 +1,12 @@
|
|||
|
||||
include_directories(${PROJECT_SOURCE_DIR})
|
||||
include_directories(${PROJECT_BINARY_DIR})
|
||||
include("${PROJECT_SOURCE_DIR}/cmake/kernel.cmake")
|
||||
|
||||
# Makefile
|
||||
|
||||
if (DEFINED TARGET_CORE)
|
||||
#override CFLAGS += -DBUILD_KERNEL -DTABLE_NAME=gotoblas_$(TARGET_CORE)
|
||||
set(BUILD_KERNEL 1)
|
||||
set(KDIR "")
|
||||
set(TSUFFIX "_${TARGET_CORE}")
|
||||
else ()
|
||||
set(TARGET_CORE ${CORE})
|
||||
set(KDIR "")
|
||||
set(TSUFFIX "")
|
||||
function (build_core TARGET_CORE KDIR TSUFFIX KERNEL_DEFINITIONS)
|
||||
include("${PROJECT_SOURCE_DIR}/cmake/kernel.cmake")
|
||||
if (${DYNAMIC_ARCH})
|
||||
include("${PROJECT_SOURCE_DIR}/cmake/system.cmake")
|
||||
endif ()
|
||||
|
||||
SetDefaultL1()
|
||||
SetDefaultL2()
|
||||
SetDefaultL3()
|
||||
|
@ -448,4 +439,28 @@ endforeach ()
|
|||
# Makefile.LA
|
||||
#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