@@ -119,6 +119,34 @@ jobs: | |||
- TARGET_BOX=LINUX64_MUSL | |||
- BTYPE="BINARY=64 NO_AFFINITY=1 USE_OPENMP=0 NO_LAPACK=0 TARGET=core2" | |||
- &test-cmake | |||
stage: test | |||
compiler: clang | |||
addons: | |||
apt: | |||
packages: | |||
- gfortran | |||
- cmake | |||
dist: trusty | |||
sudo: true | |||
before_script: | |||
- COMMON_ARGS="-DTARGET=NEHALEM -DNUM_THREADS=32" | |||
script: | |||
- set -e | |||
- mkdir build | |||
- CONFIG=Release | |||
- cmake -Bbuild -H. $CMAKE_ARGS $COMMON_ARGS -DCMAKE_BUILD_TYPE=$CONFIG | |||
- cmake --build build --config $CONFIG -- -j2 | |||
env: | |||
- CMAKE=1 | |||
- <<: *test-cmake | |||
env: | |||
- CMAKE=1 CMAKE_ARGS="-DNOFORTRAN=1" | |||
- <<: *test-cmake | |||
compiler: gcc | |||
env: | |||
- CMAKE=1 | |||
# whitelist | |||
branches: | |||
only: | |||
@@ -3,15 +3,12 @@ | |||
## | |||
cmake_minimum_required(VERSION 2.8.5) | |||
project(OpenBLAS) | |||
project(OpenBLAS C ASM) | |||
set(OpenBLAS_MAJOR_VERSION 0) | |||
set(OpenBLAS_MINOR_VERSION 3) | |||
set(OpenBLAS_PATCH_VERSION 0.dev) | |||
set(OpenBLAS_VERSION "${OpenBLAS_MAJOR_VERSION}.${OpenBLAS_MINOR_VERSION}.${OpenBLAS_PATCH_VERSION}") | |||
enable_language(ASM) | |||
enable_language(C) | |||
# Adhere to GNU filesystem layout conventions | |||
include(GNUInstallDirs) | |||
@@ -26,7 +23,6 @@ if(MSVC) | |||
option(BUILD_WITHOUT_LAPACK "Without LAPACK and LAPACKE (Only BLAS or CBLAS)" ON) | |||
endif() | |||
option(BUILD_WITHOUT_CBLAS "Without CBLAS" OFF) | |||
option(BUILD_DEBUG "Build Debug Version" OFF) | |||
option(DYNAMIC_ARCH "Build with DYNAMIC_ARCH" OFF) | |||
####### | |||
if(BUILD_WITHOUT_LAPACK) | |||
@@ -34,22 +30,6 @@ set(NO_LAPACK 1) | |||
set(NO_LAPACKE 1) | |||
endif() | |||
if(CMAKE_CONFIGURATION_TYPES) # multiconfig generator? | |||
set(CMAKE_CONFIGURATION_TYPES "Debug;Release" CACHE STRING "" FORCE) | |||
set(CMAKE_BUILD_TYPE | |||
Debug Debug | |||
Release Release | |||
) | |||
else() | |||
if( NOT CMAKE_BUILD_TYPE ) | |||
if(BUILD_DEBUG) | |||
set(CMAKE_BUILD_TYPE Debug) | |||
else() | |||
set(CMAKE_BUILD_TYPE Release) | |||
endif() | |||
endif() | |||
endif() | |||
if(BUILD_WITHOUT_CBLAS) | |||
set(NO_CBLAS 1) | |||
endif() | |||
@@ -107,19 +87,10 @@ if (BUILD_COMPLEX16) | |||
list(APPEND FLOAT_TYPES "ZCOMPLEX") # defines COMPLEX and DOUBLE | |||
endif () | |||
set(SUBDIRS_ALL ${SUBDIRS} test ctest utest exports benchmark ../laswp ../bench) | |||
# all :: libs netlib tests shared | |||
# libs : | |||
if (NOT DEFINED CORE OR "${CORE}" STREQUAL "UNKNOWN") | |||
message(FATAL_ERROR "Detecting CPU failed. Please set TARGET explicitly, e.g. make TARGET=your_cpu_target. Please read README for details.") | |||
endif () | |||
if (${NO_STATIC} AND ${NO_SHARED}) | |||
message(FATAL_ERROR "Neither static nor shared are enabled.") | |||
endif () | |||
#Set default output directory | |||
set( CMAKE_LIBRARY_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/lib) | |||
set( CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/lib) | |||
@@ -141,26 +112,20 @@ endforeach () | |||
# Not using add_subdirectory here because lapack-netlib already has its own CMakeLists.txt. Instead include a cmake script with the sources we want. | |||
if (NOT NOFORTRAN AND NOT NO_LAPACK) | |||
include("${PROJECT_SOURCE_DIR}/cmake/lapack.cmake") | |||
if (NOT NO_LAPACKE) | |||
include("${PROJECT_SOURCE_DIR}/cmake/lapacke.cmake") | |||
endif () | |||
if (NOT NO_LAPACKE) | |||
include("${PROJECT_SOURCE_DIR}/cmake/lapacke.cmake") | |||
endif () | |||
endif () | |||
# Only generate .def for dll on MSVC and always produce pdb files for debug and release | |||
if(MSVC) | |||
set(OpenBLAS_DEF_FILE "${PROJECT_BINARY_DIR}/openblas.def") | |||
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /Zi") | |||
set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} /Zi") | |||
set(CMAKE_SHARED_LINKER_FLAGS_RELEASE "${CMAKE_SHARED_LINKER_FLAGS_RELEASE} /DEBUG /OPT:REF /OPT:ICF") | |||
if (${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION} LESS 3.4) | |||
set(OpenBLAS_DEF_FILE "${PROJECT_BINARY_DIR}/openblas.def") | |||
endif() | |||
set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} /Zi") | |||
set(CMAKE_SHARED_LINKER_FLAGS_RELEASE "${CMAKE_SHARED_LINKER_FLAGS_RELEASE} /DEBUG /OPT:REF /OPT:ICF") | |||
endif() | |||
#ifeq ($(DYNAMIC_ARCH), 1) | |||
# @$(MAKE) -C kernel commonlibs || exit 1 | |||
# @for d in $(DYNAMIC_CORE) ; \ | |||
# do $(MAKE) GOTOBLAS_MAKEFILE= -C kernel TARGET_CORE=$$d kernel || exit 1 ;\ | |||
# done | |||
# @echo DYNAMIC_ARCH=1 >> Makefile.conf_last | |||
#endif | |||
if (${DYNAMIC_ARCH}) | |||
add_subdirectory(kernel) | |||
foreach(TARGET_CORE ${DYNAMIC_CORE}) | |||
@@ -169,11 +134,24 @@ if (${DYNAMIC_ARCH}) | |||
endforeach() | |||
endif () | |||
# Only build shared libs for MSVC | |||
if (MSVC) | |||
set(BUILD_SHARED_LIBS ON) | |||
endif() | |||
# add objects to the openblas lib | |||
add_library(${OpenBLAS_LIBNAME} SHARED ${LA_SOURCES} ${LAPACKE_SOURCES} ${TARGET_OBJS} ${OpenBLAS_DEF_FILE}) | |||
include("${PROJECT_SOURCE_DIR}/cmake/export.cmake") | |||
# add objects to the openblas lib | |||
add_library(${OpenBLAS_LIBNAME} ${LA_SOURCES} ${LAPACKE_SOURCES} ${TARGET_OBJS} ${OpenBLAS_DEF_FILE}) | |||
# Handle MSVC exports | |||
if(MSVC AND BUILD_SHARED_LIBS) | |||
if (${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION} LESS 3.4) | |||
include("${PROJECT_SOURCE_DIR}/cmake/export.cmake") | |||
else() | |||
# Creates verbose .def file (51KB vs 18KB) | |||
set_target_properties(${OpenBLAS_LIBNAME} PROPERTIES WINDOWS_EXPORT_ALL_SYMBOLS true) | |||
endif() | |||
endif() | |||
# Set output for libopenblas | |||
set_target_properties( ${OpenBLAS_LIBNAME} PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/lib) | |||
@@ -188,25 +166,28 @@ foreach (OUTPUTCONFIG ${CMAKE_CONFIGURATION_TYPES}) | |||
endforeach() | |||
enable_testing() | |||
add_subdirectory(utest) | |||
if (NOT MSVC) | |||
#only build shared library for MSVC | |||
add_library(${OpenBLAS_LIBNAME}_static STATIC ${LA_SOURCES} ${LAPACKE_SOURCES} ${TARGET_OBJS}) | |||
set_target_properties(${OpenBLAS_LIBNAME}_static PROPERTIES OUTPUT_NAME ${OpenBLAS_LIBNAME}) | |||
set_target_properties(${OpenBLAS_LIBNAME}_static PROPERTIES CLEAN_DIRECT_OUTPUT 1) | |||
if(SMP) | |||
target_link_libraries(${OpenBLAS_LIBNAME} pthread) | |||
target_link_libraries(${OpenBLAS_LIBNAME}_static pthread) | |||
if (USE_THREAD) | |||
# Add threading library to linker | |||
find_package(Threads) | |||
if (THREADS_HAVE_PTHREAD_ARG) | |||
set_property(TARGET ${OpenBLAS_LIBNAME} PROPERTY COMPILE_OPTIONS "-pthread") | |||
set_property(TARGET ${OpenBLAS_LIBNAME} PROPERTY INTERFACE_COMPILE_OPTIONS "-pthread") | |||
endif() | |||
target_link_libraries(${OpenBLAS_LIBNAME} ${CMAKE_THREAD_LIBS_INIT}) | |||
endif() | |||
#build test and ctest | |||
add_subdirectory(test) | |||
if(NOT NO_CBLAS) | |||
add_subdirectory(ctest) | |||
if (MSVC OR NOT NOFORTRAN) | |||
# Broken without fortran on unix | |||
add_subdirectory(utest) | |||
endif() | |||
if (NOT MSVC AND NOT NOFORTRAN) | |||
# Build test and ctest | |||
add_subdirectory(test) | |||
if(NOT NO_CBLAS) | |||
add_subdirectory(ctest) | |||
endif() | |||
endif() | |||
set_target_properties(${OpenBLAS_LIBNAME} PROPERTIES | |||
@@ -214,53 +195,42 @@ set_target_properties(${OpenBLAS_LIBNAME} PROPERTIES | |||
SOVERSION ${OpenBLAS_MAJOR_VERSION} | |||
) | |||
# TODO: Why is the config saved here? Is this necessary with CMake? | |||
#Save the config files for installation | |||
# @cp Makefile.conf Makefile.conf_last | |||
# @cp config.h config_last.h | |||
#ifdef QUAD_PRECISION | |||
# @echo "#define QUAD_PRECISION">> config_last.h | |||
#endif | |||
#ifeq ($(EXPRECISION), 1) | |||
# @echo "#define EXPRECISION">> config_last.h | |||
#endif | |||
### | |||
#ifdef USE_THREAD | |||
# @echo USE_THREAD=$(USE_THREAD) >> Makefile.conf_last | |||
#endif | |||
# @touch lib.grd | |||
# Install project | |||
# Install libraries | |||
install(TARGETS ${OpenBLAS_LIBNAME} | |||
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} | |||
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} | |||
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} ) | |||
# Install include files | |||
set (GENCONFIG_BIN ${CMAKE_BINARY_DIR}/gen_config_h${CMAKE_EXECUTABLE_SUFFIX}) | |||
execute_process(COMMAND ${GENCONFIG_BIN} | |||
${CMAKE_CURRENT_SOURCE_DIR}/config.h | |||
${CMAKE_CURRENT_SOURCE_DIR}/openblas_config_template.h | |||
OUTPUT_VARIABLE OPENBLAS_CONFIG_H_CONTENTS) | |||
file(WRITE ${CMAKE_BINARY_DIR}/openblas_config.tmp "${OPENBLAS_CONFIG_H_CONTENTS}") | |||
configure_file(${CMAKE_BINARY_DIR}/openblas_config.tmp ${CMAKE_BINARY_DIR}/openblas_config.h COPYONLY) | |||
install (FILES ${CMAKE_BINARY_DIR}/openblas_config.h DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}) | |||
message(STATUS "Generating f77blas.h in ${CMAKE_INSTALL_INCLUDEDIR}") | |||
file(WRITE ${CMAKE_BINARY_DIR}/f77blas.h "") | |||
file(APPEND ${CMAKE_BINARY_DIR}/f77blas.h "#ifndef OPENBLAS_F77BLAS_H\n#define OPENBLAS_F77BLAS_H\n#include \"openblas_config.h\"\n") | |||
file(READ ${CMAKE_CURRENT_SOURCE_DIR}/common_interface.h COMMON_INTERFACE_H_CONTENTS) | |||
file(APPEND ${CMAKE_BINARY_DIR}/f77blas.h "${COMMON_INTERFACE_H_CONTENTS}") | |||
file(APPEND ${CMAKE_BINARY_DIR}/f77blas.h "#endif") | |||
install (FILES ${CMAKE_BINARY_DIR}/f77blas.h DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}) | |||
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} ) | |||
message(STATUS "Generating openblas_config.h in ${CMAKE_INSTALL_INCLUDEDIR}") | |||
set(OPENBLAS_CONFIG_H ${CMAKE_BINARY_DIR}/openblas_config.h) | |||
file(WRITE ${OPENBLAS_CONFIG_H} "#ifndef OPENBLAS_CONFIG_H\n") | |||
file(APPEND ${OPENBLAS_CONFIG_H} "#define OPENBLAS_CONFIG_H\n") | |||
file(STRINGS ${PROJECT_BINARY_DIR}/config.h __lines) | |||
foreach(line ${__lines}) | |||
string(REPLACE "#define " "" line ${line}) | |||
file(APPEND ${OPENBLAS_CONFIG_H} "#define OPENBLAS_${line}\n") | |||
endforeach() | |||
file(APPEND ${OPENBLAS_CONFIG_H} "#define OPENBLAS_VERSION \"OpenBLAS ${OpenBLAS_VERSION}\"\n") | |||
file(READ ${CMAKE_CURRENT_SOURCE_DIR}/openblas_config_template.h OPENBLAS_CONFIG_TEMPLATE_H_CONTENTS) | |||
file(APPEND ${OPENBLAS_CONFIG_H} "${OPENBLAS_CONFIG_TEMPLATE_H_CONTENTS}\n") | |||
file(APPEND ${OPENBLAS_CONFIG_H} "#endif /* OPENBLAS_CONFIG_H */\n") | |||
install (FILES ${OPENBLAS_CONFIG_H} DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}) | |||
if(NOT NOFORTRAN) | |||
message(STATUS "Generating f77blas.h in ${CMAKE_INSTALL_INCLUDEDIR}") | |||
set(F77BLAS_H ${CMAKE_BINARY_DIR}/f77blas.h) | |||
file(WRITE ${F77BLAS_H} "#ifndef OPENBLAS_F77BLAS_H\n") | |||
file(APPEND ${F77BLAS_H} "#define OPENBLAS_F77BLAS_H\n") | |||
file(APPEND ${F77BLAS_H} "#include \"openblas_config.h\"\n") | |||
file(READ ${CMAKE_CURRENT_SOURCE_DIR}/common_interface.h COMMON_INTERFACE_H_CONTENTS) | |||
file(APPEND ${F77BLAS_H} "${COMMON_INTERFACE_H_CONTENTS}\n") | |||
file(APPEND ${F77BLAS_H} "#endif") | |||
install (FILES ${F77BLAS_H} DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}) | |||
endif() | |||
if(NOT NO_CBLAS) | |||
message (STATUS "Generating cblas.h in ${CMAKE_INSTALL_INCLUDEDIR}") | |||
@@ -282,10 +252,6 @@ if(NOT NO_LAPACKE) | |||
) | |||
install (FILES ${CMAKE_BINARY_DIR}/lapacke_mangling.h DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}) | |||
endif() | |||
if(NOT MSVC) | |||
install (TARGETS ${OpenBLAS_LIBNAME}_static DESTINATION ${CMAKE_INSTALL_LIBDIR}) | |||
endif() | |||
include(FindPkgConfig QUIET) | |||
if(PKG_CONFIG_FOUND) | |||
@@ -3,9 +3,9 @@ | |||
## Description: Ported from portion of OpenBLAS/Makefile.system | |||
## Sets various variables based on architecture. | |||
if (${ARCH} STREQUAL "x86" OR ${ARCH} STREQUAL "x86_64") | |||
if (X86 OR X86_64) | |||
if (${ARCH} STREQUAL "x86") | |||
if (X86) | |||
if (NOT BINARY) | |||
set(NO_BINARY_MODE 1) | |||
endif () | |||
@@ -33,41 +33,22 @@ if (${CMAKE_C_COMPILER_ID} STREQUAL "Intel") | |||
endif () | |||
if (USE_OPENMP) | |||
if (${CMAKE_C_COMPILER_ID} STREQUAL "GNU" OR ${CMAKE_C_COMPILER_ID} STREQUAL "LSB") | |||
set(CCOMMON_OPT "${CCOMMON_OPT} -fopenmp") | |||
endif () | |||
if (${CMAKE_C_COMPILER_ID} STREQUAL "Clang") | |||
message(WARNING "Clang doesn't support OpenMP yet.") | |||
set(CCOMMON_OPT "${CCOMMON_OPT} -fopenmp") | |||
endif () | |||
if (${CMAKE_C_COMPILER_ID} STREQUAL "Intel") | |||
set(CCOMMON_OPT "${CCOMMON_OPT} -openmp") | |||
endif () | |||
if (${CMAKE_C_COMPILER_ID} STREQUAL "PGI") | |||
set(CCOMMON_OPT "${CCOMMON_OPT} -mp") | |||
endif () | |||
if (${CMAKE_C_COMPILER_ID} STREQUAL "OPEN64") | |||
set(CCOMMON_OPT "${CCOMMON_OPT} -mp") | |||
set(CEXTRALIB "${CEXTRALIB} -lstdc++") | |||
endif () | |||
if (${CMAKE_C_COMPILER_ID} STREQUAL "PATHSCALE") | |||
set(CCOMMON_OPT "${CCOMMON_OPT} -mp") | |||
endif () | |||
# USE_SIMPLE_THREADED_LEVEL3 = 1 | |||
# NO_AFFINITY = 1 | |||
find_package(OpenMP REQUIRED) | |||
if (OpenMP_FOUND) | |||
set(CCOMMON_OPT "${CCOMMON_OPT} ${OpenMP_C_FLAGS} -DUSE_OPENMP") | |||
set(FCOMMON_OPT "${FCOMMON_OPT} ${OpenMP_Fortran_FLAGS}") | |||
endif() | |||
endif () | |||
if (DYNAMIC_ARCH) | |||
if (${ARCH} STREQUAL "x86") | |||
if (X86) | |||
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") | |||
if (X86_64) | |||
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 EXCAVATOR) | |||
@@ -94,7 +75,7 @@ if (${ARCH} STREQUAL "ia64") | |||
endif () | |||
endif () | |||
if (${ARCH} STREQUAL "mips64") | |||
if (MIPS64) | |||
set(NO_BINARY_MODE 1) | |||
endif () | |||
@@ -103,12 +84,12 @@ if (${ARCH} STREQUAL "alpha") | |||
set(BINARY_DEFINED 1) | |||
endif () | |||
if (${ARCH} STREQUAL "arm") | |||
if (ARM) | |||
set(NO_BINARY_MODE 1) | |||
set(BINARY_DEFINED 1) | |||
endif () | |||
if (${ARCH} STREQUAL "arm64") | |||
if (ARM64) | |||
set(NO_BINARY_MODE 1) | |||
set(BINARY_DEFINED 1) | |||
endif () | |||
@@ -1,101 +0,0 @@ | |||
## | |||
## Author: Hank Anderson <hank@statease.com> | |||
## Description: Ported from the OpenBLAS/c_check perl script. | |||
## This is triggered by prebuild.cmake and runs before any of the code is built. | |||
## Creates config.h and Makefile.conf. | |||
# CMake vars set by this file: | |||
# OSNAME (use CMAKE_SYSTEM_NAME) | |||
# ARCH | |||
# C_COMPILER (use CMAKE_C_COMPILER) | |||
# BINARY32 | |||
# BINARY64 | |||
# FU | |||
# CROSS_SUFFIX | |||
# CROSS | |||
# CEXTRALIB | |||
# Defines set by this file: | |||
# OS_ | |||
# ARCH_ | |||
# C_ | |||
# __32BIT__ | |||
# __64BIT__ | |||
# FUNDERSCORE | |||
# PTHREAD_CREATE_FUNC | |||
# N.B. c_check (and ctest.c) is not cross-platform, so instead try to use CMake variables. | |||
set(FU "") | |||
if(APPLE) | |||
set(FU "_") | |||
elseif(MSVC AND ${CMAKE_C_COMPILER_ID} MATCHES "Clang") | |||
set(FU "") | |||
elseif(MSVC) | |||
set(FU "_") | |||
elseif(UNIX) | |||
set(FU "") | |||
endif() | |||
# Convert CMake vars into the format that OpenBLAS expects | |||
string(TOUPPER ${CMAKE_SYSTEM_NAME} HOST_OS) | |||
if (${HOST_OS} STREQUAL "WINDOWS") | |||
set(HOST_OS WINNT) | |||
endif () | |||
# added by hpa - check size of void ptr to detect 64-bit compile | |||
if (NOT DEFINED BINARY) | |||
set(BINARY 32) | |||
if (CMAKE_SIZEOF_VOID_P EQUAL 8) | |||
set(BINARY 64) | |||
endif () | |||
endif () | |||
if (BINARY EQUAL 64) | |||
set(BINARY64 1) | |||
else () | |||
set(BINARY32 1) | |||
endif () | |||
# CMake docs define these: | |||
# CMAKE_SYSTEM_PROCESSOR - The name of the CPU CMake is building for. | |||
# CMAKE_HOST_SYSTEM_PROCESSOR - The name of the CPU CMake is running on. | |||
# | |||
# TODO: CMAKE_SYSTEM_PROCESSOR doesn't seem to be correct - instead get it from the compiler a la c_check | |||
set(ARCH ${CMAKE_SYSTEM_PROCESSOR} CACHE STRING "Target Architecture") | |||
if (${ARCH} STREQUAL "AMD64") | |||
set(ARCH "x86_64") | |||
endif () | |||
# If you are using a 32-bit compiler on a 64-bit system CMAKE_SYSTEM_PROCESSOR will be wrong | |||
if (${ARCH} STREQUAL "x86_64" AND BINARY EQUAL 32) | |||
set(ARCH x86) | |||
endif () | |||
if (${ARCH} STREQUAL "X86") | |||
set(ARCH x86) | |||
endif () | |||
if (${ARCH} MATCHES "ppc") | |||
set(ARCH power) | |||
endif () | |||
set(COMPILER_ID ${CMAKE_CXX_COMPILER_ID}) | |||
if (${COMPILER_ID} STREQUAL "GNU") | |||
set(COMPILER_ID "GCC") | |||
endif () | |||
string(TOUPPER ${ARCH} UC_ARCH) | |||
file(WRITE ${TARGET_CONF_TEMP} | |||
"#define OS_${HOST_OS}\t1\n" | |||
"#define ARCH_${UC_ARCH}\t1\n" | |||
"#define C_${COMPILER_ID}\t1\n" | |||
"#define __${BINARY}BIT__\t1\n" | |||
"#define FUNDERSCORE\t${FU}\n") | |||
if (${HOST_OS} STREQUAL "WINDOWSSTORE") | |||
file(APPEND ${TARGET_CONF_TEMP} | |||
"#define OS_WINNT\t1\n") | |||
endif () | |||
@@ -15,7 +15,7 @@ if (${CMAKE_C_COMPILER} STREQUAL "GNU" OR ${CMAKE_C_COMPILER} STREQUAL "LSB" OR | |||
if (NO_BINARY_MODE) | |||
if (${ARCH} STREQUAL "mips64") | |||
if (MIPS64) | |||
if (BINARY64) | |||
set(CCOMMON_OPT "${CCOMMON_OPT} -mabi=64") | |||
else () | |||
@@ -24,17 +24,12 @@ if (${CMAKE_C_COMPILER} STREQUAL "GNU" OR ${CMAKE_C_COMPILER} STREQUAL "LSB" OR | |||
set(BINARY_DEFINED 1) | |||
endif () | |||
if (${CORE} STREQUAL "LOONGSON3A") | |||
if (${CORE} STREQUAL "LOONGSON3A" OR ${CORE} STREQUAL "LOONGSON3B") | |||
set(CCOMMON_OPT "${CCOMMON_OPT} -march=mips64") | |||
set(FCOMMON_OPT "${FCOMMON_OPT} -march=mips64") | |||
endif () | |||
if (${CORE} STREQUAL "LOONGSON3B") | |||
set(CCOMMON_OPT "${CCOMMON_OPT} -march=mips64") | |||
set(FCOMMON_OPT "${FCOMMON_OPT} -march=mips64") | |||
endif () | |||
if (${OSNAME} STREQUAL "AIX") | |||
if (CMAKE_SYSTEM_NAME STREQUAL "AIX") | |||
set(BINARY_DEFINED 1) | |||
endif () | |||
endif () | |||
@@ -66,7 +61,7 @@ endif () | |||
if (${CMAKE_C_COMPILER} STREQUAL "OPEN64") | |||
if (${ARCH} STREQUAL "mips64") | |||
if (MIPS64) | |||
if (NOT BINARY64) | |||
set(CCOMMON_OPT "${CCOMMON_OPT} -n32") | |||
@@ -94,10 +89,10 @@ endif () | |||
if (${CMAKE_C_COMPILER} STREQUAL "SUN") | |||
set(CCOMMON_OPT "${CCOMMON_OPT} -w") | |||
if (${ARCH} STREQUAL "x86") | |||
if (X86) | |||
set(CCOMMON_OPT "${CCOMMON_OPT} -m32") | |||
else () | |||
set(FCOMMON_OPT "${FCOMMON_OPT} -m64") | |||
set(CCOMMON_OPT "${CCOMMON_OPT} -m64") | |||
endif () | |||
endif () | |||
@@ -34,11 +34,7 @@ else() | |||
endif() | |||
if (NOT ONLY_CBLAS) | |||
# N.B. f_check is not cross-platform, so instead try to use CMake variables | |||
# run f_check (appends to TARGET files) | |||
# message(STATUS "Running f_check...") | |||
# execute_process(COMMAND perl f_check ${TARGET_MAKE} ${TARGET_CONF} ${CMAKE_Fortran_COMPILER} | |||
# WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}) | |||
# TODO: detect whether underscore needed, set #defines and BU appropriately - use try_compile | |||
# TODO: set FEXTRALIB flags a la f_check? | |||
@@ -50,7 +50,7 @@ if (${F_COMPILER} STREQUAL "GFORTRAN") | |||
set(EXTRALIB "{EXTRALIB} -lgfortran") | |||
endif () | |||
if (NO_BINARY_MODE) | |||
if (${ARCH} STREQUAL "mips64") | |||
if (MIPS64) | |||
if (BINARY64) | |||
set(FCOMMON_OPT "${FCOMMON_OPT} -mabi=64") | |||
else () | |||
@@ -130,7 +130,7 @@ if (${F_COMPILER} STREQUAL "PATHSCALE") | |||
endif () | |||
endif () | |||
if (NOT ${ARCH} STREQUAL "mips64") | |||
if (NOT MIPS64) | |||
if (NOT BINARY64) | |||
set(FCOMMON_OPT "${FCOMMON_OPT} -m32") | |||
else () | |||
@@ -158,7 +158,7 @@ if (${F_COMPILER} STREQUAL "OPEN64") | |||
endif () | |||
endif () | |||
if (${ARCH} STREQUAL "mips64") | |||
if (MIPS64) | |||
if (NOT BINARY64) | |||
set(FCOMMON_OPT "${FCOMMON_OPT} -n32") | |||
@@ -189,7 +189,7 @@ endif () | |||
if (${F_COMPILER} STREQUAL "SUN") | |||
set(CCOMMON_OPT "${CCOMMON_OPT} -DF_INTERFACE_SUN") | |||
if (${ARCH} STREQUAL "x86") | |||
if (X86) | |||
set(FCOMMON_OPT "${FCOMMON_OPT} -m32") | |||
else () | |||
set(FCOMMON_OPT "${FCOMMON_OPT} -m64") | |||
@@ -3,19 +3,6 @@ | |||
## Description: Ported from portion of OpenBLAS/Makefile.system | |||
## Detects the OS and sets appropriate variables. | |||
if (${CMAKE_SYSTEM_NAME} STREQUAL "Darwin") | |||
set(ENV{MACOSX_DEPLOYMENT_TARGET} "10.2") # TODO: should be exported as an env var | |||
set(MD5SUM "md5 -r") | |||
endif () | |||
if (${CMAKE_SYSTEM_NAME} STREQUAL "FreeBSD") | |||
set(MD5SUM "md5 -r") | |||
endif () | |||
if (${CMAKE_SYSTEM_NAME} STREQUAL "NetBSD") | |||
set(MD5SUM "md5 -n") | |||
endif () | |||
if (${CMAKE_SYSTEM_NAME} STREQUAL "Linux") | |||
set(EXTRALIB "${EXTRALIB} -lm") | |||
set(NO_EXPRECISION 1) | |||
@@ -56,7 +43,7 @@ if (${CMAKE_SYSTEM_NAME} STREQUAL "Windows") | |||
# Ensure the correct stack alignment on Win32 | |||
# http://permalink.gmane.org/gmane.comp.lib.openblas.general/97 | |||
if (${ARCH} STREQUAL "x86") | |||
if (X86) | |||
if (NOT MSVC AND NOT ${CMAKE_C_COMPILER_ID} STREQUAL "Clang") | |||
set(CCOMMON_OPT "${CCOMMON_OPT} -mincoming-stack-boundary=2") | |||
endif () | |||
@@ -78,7 +65,7 @@ if (CYGWIN) | |||
endif () | |||
if (NOT ${CMAKE_SYSTEM_NAME} STREQUAL "Windows" AND NOT ${CMAKE_SYSTEM_NAME} STREQUAL "Interix" AND NOT ${CMAKE_SYSTEM_NAME} STREQUAL "Android") | |||
if (SMP) | |||
if (USE_THREAD) | |||
set(EXTRALIB "${EXTRALIB} -lpthread") | |||
endif () | |||
endif () | |||
@@ -88,7 +75,7 @@ if (QUAD_PRECISION) | |||
set(NO_EXPRECISION 1) | |||
endif () | |||
if (${ARCH} STREQUAL "x86") | |||
if (X86) | |||
set(NO_EXPRECISION 1) | |||
endif () | |||
@@ -37,123 +37,208 @@ | |||
# CPUIDEMU = ../../cpuid/table.o | |||
if (DEFINED CPUIDEMU) | |||
set(EXFLAGS "-DCPUIDEMU -DVENDOR=99") | |||
endif () | |||
if (DEFINED TARGET_CORE) | |||
if (BUILD_KERNEL) | |||
# set the C flags for just this file | |||
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") | |||
include("${PROJECT_SOURCE_DIR}/cmake/c_check.cmake") | |||
if (NOT NOFORTRAN) | |||
include("${PROJECT_SOURCE_DIR}/cmake/f_check.cmake") | |||
# c_check | |||
set(FU "") | |||
if (APPLE OR (MSVC AND NOT ${CMAKE_C_COMPILER_ID} MATCHES "Clang")) | |||
set(FU "_") | |||
endif() | |||
set(COMPILER_ID ${CMAKE_C_COMPILER_ID}) | |||
if (${COMPILER_ID} STREQUAL "GNU") | |||
set(COMPILER_ID "GCC") | |||
endif () | |||
# compile getarch | |||
set(GETARCH_SRC | |||
${PROJECT_SOURCE_DIR}/getarch.c | |||
${CPUIDEMO} | |||
) | |||
string(TOUPPER ${ARCH} UC_ARCH) | |||
if ("${CMAKE_C_COMPILER_ID}" STREQUAL "MSVC") | |||
#Use generic for MSVC now | |||
message("MSVC") | |||
set(GETARCH_FLAGS ${GETARCH_FLAGS} -DFORCE_GENERIC) | |||
else() | |||
list(APPEND GETARCH_SRC ${PROJECT_SOURCE_DIR}/cpuid.S) | |||
file(WRITE ${TARGET_CONF_TEMP} | |||
"#define OS_${HOST_OS}\t1\n" | |||
"#define ARCH_${UC_ARCH}\t1\n" | |||
"#define C_${COMPILER_ID}\t1\n" | |||
"#define __${BINARY}BIT__\t1\n" | |||
"#define FUNDERSCORE\t${FU}\n") | |||
if (${HOST_OS} STREQUAL "WINDOWSSTORE") | |||
file(APPEND ${TARGET_CONF_TEMP} | |||
"#define OS_WINNT\t1\n") | |||
endif () | |||
if ("${CMAKE_SYSTEM_NAME}" STREQUAL "WindowsStore") | |||
# disable WindowsStore strict CRT checks | |||
set(GETARCH_FLAGS ${GETARCH_FLAGS} -D_CRT_SECURE_NO_WARNINGS) | |||
# f_check | |||
if (NOT NOFORTRAN) | |||
include("${PROJECT_SOURCE_DIR}/cmake/f_check.cmake") | |||
endif () | |||
set(GETARCH_DIR "${PROJECT_BINARY_DIR}/getarch_build") | |||
set(GETARCH_BIN "getarch${CMAKE_EXECUTABLE_SUFFIX}") | |||
file(MAKE_DIRECTORY ${GETARCH_DIR}) | |||
configure_file(${TARGET_CONF_TEMP} ${GETARCH_DIR}/${TARGET_CONF} COPYONLY) | |||
if (NOT "${CMAKE_SYSTEM_NAME}" STREQUAL "WindowsStore") | |||
try_compile(GETARCH_RESULT ${GETARCH_DIR} | |||
SOURCES ${GETARCH_SRC} | |||
COMPILE_DEFINITIONS ${EXFLAGS} ${GETARCH_FLAGS} -I${GETARCH_DIR} -I${PROJECT_SOURCE_DIR} -I${PROJECT_BINARY_DIR} | |||
OUTPUT_VARIABLE GETARCH_LOG | |||
COPY_FILE ${PROJECT_BINARY_DIR}/${GETARCH_BIN} | |||
# Cannot run getarch on target if we are cross-compiling | |||
if (DEFINED CORE AND CMAKE_CROSSCOMPILING) | |||
# Write to config as getarch would | |||
# TODO: Set up defines that getarch sets up based on every other target | |||
# Perhaps this should be inside a different file as it grows larger | |||
file(APPEND ${TARGET_CONF_TEMP} | |||
"#define ${CORE}\n" | |||
"#define CHAR_CORENAME \"${CORE}\"\n") | |||
if ("${CORE}" STREQUAL "ARMV7") | |||
file(APPEND ${TARGET_CONF_TEMP} | |||
"#define L1_DATA_SIZE\t65536\n" | |||
"#define L1_DATA_LINESIZE\t32\n" | |||
"#define L2_SIZE\t512488\n" | |||
"#define L2_LINESIZE\t32\n" | |||
"#define DTB_DEFAULT_ENTRIES\t64\n" | |||
"#define DTB_SIZE\t4096\n" | |||
"#define L2_ASSOCIATIVE\t4\n" | |||
"#define HAVE_VFPV3\n" | |||
"#define HAVE_VFP\n") | |||
set(SGEMM_UNROLL_M 4) | |||
set(SGEMM_UNROLL_N 4) | |||
set(DGEMM_UNROLL_M 4) | |||
set(DGEMM_UNROLL_N 4) | |||
elseif ("${CORE}" STREQUAL "ARMV8") | |||
file(APPEND ${TARGET_CONF_TEMP} | |||
"#define L1_DATA_SIZE\t32768\n" | |||
"#define L1_DATA_LINESIZE\t64\n" | |||
"#define L2_SIZE\t262144\n" | |||
"#define L2_LINESIZE\t64\n" | |||
"#define DTB_DEFAULT_ENTRIES\t64\n" | |||
"#define DTB_SIZE\t4096\n" | |||
"#define L2_ASSOCIATIVE\t32\n") | |||
set(SGEMM_UNROLL_M 4) | |||
set(SGEMM_UNROLL_N 4) | |||
elseif ("${CORE}" STREQUAL "CORTEXA57") | |||
file(APPEND ${TARGET_CONF_TEMP} | |||
"#define L1_CODE_SIZE\t49152\n" | |||
"#define L1_CODE_LINESIZE\t64\n" | |||
"#define L1_CODE_ASSOCIATIVE\t3\n" | |||
"#define L1_DATA_SIZE\t32768\n" | |||
"#define L1_DATA_LINESIZE\t64\n" | |||
"#define L1_DATA_ASSOCIATIVE\t2\n" | |||
"#define L2_SIZE\t2097152\n" | |||
"#define L2_LINESIZE\t64\n" | |||
"#define L2_ASSOCIATIVE\t16\n" | |||
"#define DTB_DEFAULT_ENTRIES\t64\n" | |||
"#define DTB_SIZE\t4096\n" | |||
"#define HAVE_VFPV4\n" | |||
"#define HAVE_VFPV3\n" | |||
"#define HAVE_VFP\n" | |||
"#define HAVE_NEON\n") | |||
set(SGEMM_UNROLL_M 16) | |||
set(SGEMM_UNROLL_N 4) | |||
set(DGEMM_UNROLL_M 8) | |||
set(DGEMM_UNROLL_N 4) | |||
set(CGEMM_UNROLL_M 8) | |||
set(CGEMM_UNROLL_N 4) | |||
set(ZGEMM_UNROLL_M 8) | |||
set(ZGEMM_UNROLL_N 4) | |||
endif() | |||
# Or should this actually be NUM_CORES? | |||
if (${NUM_THREADS} GREATER 0) | |||
file(APPEND ${TARGET_CONF_TEMP} "#define NUM_CORES\t${NUM_THREADS}\n") | |||
endif() | |||
# GetArch_2nd | |||
foreach(float_char S;D;Q;C;Z;X) | |||
if (NOT DEFINED ${float_char}GEMM_UNROLL_M) | |||
set(${float_char}GEMM_UNROLL_M 2) | |||
endif() | |||
if (NOT DEFINED ${float_char}GEMM_UNROLL_N) | |||
set(${float_char}GEMM_UNROLL_N 2) | |||
endif() | |||
endforeach() | |||
file(APPEND ${TARGET_CONF_TEMP} | |||
"#define GEMM_MULTITHREAD_THRESHOLD\t${GEMM_MULTITHREAD_THRESHOLD}\n") | |||
# Move to where gen_config_h would place it | |||
file(RENAME ${TARGET_CONF_TEMP} "${TARGET_CONF_DIR}/${TARGET_CONF}") | |||
else(NOT CMAKE_CROSSCOMPILING) | |||
# compile getarch | |||
set(GETARCH_SRC | |||
${PROJECT_SOURCE_DIR}/getarch.c | |||
${CPUIDEMU} | |||
) | |||
if (NOT ${GETARCH_RESULT}) | |||
MESSAGE(FATAL_ERROR "Compiling getarch failed ${GETARCH_LOG}") | |||
if ("${CMAKE_C_COMPILER_ID}" STREQUAL "MSVC") | |||
#Use generic for MSVC now | |||
message("MSVC") | |||
set(GETARCH_FLAGS ${GETARCH_FLAGS} -DFORCE_GENERIC) | |||
else() | |||
list(APPEND GETARCH_SRC ${PROJECT_SOURCE_DIR}/cpuid.S) | |||
endif () | |||
endif () | |||
message(STATUS "Running getarch") | |||
# use the cmake binary w/ the -E param to run a shell command in a cross-platform way | |||
execute_process(COMMAND ${PROJECT_BINARY_DIR}/${GETARCH_BIN} 0 OUTPUT_VARIABLE GETARCH_MAKE_OUT) | |||
execute_process(COMMAND ${PROJECT_BINARY_DIR}/${GETARCH_BIN} 1 OUTPUT_VARIABLE GETARCH_CONF_OUT) | |||
message(STATUS "GETARCH results:\n${GETARCH_MAKE_OUT}") | |||
# append config data from getarch to the TARGET file and read in CMake vars | |||
file(APPEND ${TARGET_CONF_TEMP} ${GETARCH_CONF_OUT}) | |||
ParseGetArchVars(${GETARCH_MAKE_OUT}) | |||
set(GETARCH2_DIR "${PROJECT_BINARY_DIR}/getarch2_build") | |||
set(GETARCH2_BIN "getarch_2nd${CMAKE_EXECUTABLE_SUFFIX}") | |||
file(MAKE_DIRECTORY ${GETARCH2_DIR}) | |||
configure_file(${TARGET_CONF_TEMP} ${GETARCH2_DIR}/${TARGET_CONF} COPYONLY) | |||
if (NOT "${CMAKE_SYSTEM_NAME}" STREQUAL "WindowsStore") | |||
try_compile(GETARCH2_RESULT ${GETARCH2_DIR} | |||
SOURCES ${PROJECT_SOURCE_DIR}/getarch_2nd.c | |||
COMPILE_DEFINITIONS ${EXFLAGS} ${GETARCH_FLAGS} ${GETARCH2_FLAGS} -I${GETARCH2_DIR} -I${PROJECT_SOURCE_DIR} -I${PROJECT_BINARY_DIR} | |||
OUTPUT_VARIABLE GETARCH2_LOG | |||
COPY_FILE ${PROJECT_BINARY_DIR}/${GETARCH2_BIN} | |||
) | |||
if (NOT ${GETARCH2_RESULT}) | |||
MESSAGE(FATAL_ERROR "Compiling getarch_2nd failed ${GETARCH2_LOG}") | |||
if ("${CMAKE_SYSTEM_NAME}" STREQUAL "WindowsStore") | |||
# disable WindowsStore strict CRT checks | |||
set(GETARCH_FLAGS ${GETARCH_FLAGS} -D_CRT_SECURE_NO_WARNINGS) | |||
endif () | |||
endif () | |||
# use the cmake binary w/ the -E param to run a shell command in a cross-platform way | |||
execute_process(COMMAND ${PROJECT_BINARY_DIR}/${GETARCH2_BIN} 0 OUTPUT_VARIABLE GETARCH2_MAKE_OUT) | |||
execute_process(COMMAND ${PROJECT_BINARY_DIR}/${GETARCH2_BIN} 1 OUTPUT_VARIABLE GETARCH2_CONF_OUT) | |||
set(GETARCH_DIR "${PROJECT_BINARY_DIR}/getarch_build") | |||
set(GETARCH_BIN "getarch${CMAKE_EXECUTABLE_SUFFIX}") | |||
file(MAKE_DIRECTORY ${GETARCH_DIR}) | |||
configure_file(${TARGET_CONF_TEMP} ${GETARCH_DIR}/${TARGET_CONF} COPYONLY) | |||
if (NOT "${CMAKE_SYSTEM_NAME}" STREQUAL "WindowsStore") | |||
try_compile(GETARCH_RESULT ${GETARCH_DIR} | |||
SOURCES ${GETARCH_SRC} | |||
COMPILE_DEFINITIONS ${EXFLAGS} ${GETARCH_FLAGS} -I${GETARCH_DIR} -I${PROJECT_SOURCE_DIR} -I${PROJECT_BINARY_DIR} | |||
OUTPUT_VARIABLE GETARCH_LOG | |||
COPY_FILE ${PROJECT_BINARY_DIR}/${GETARCH_BIN} | |||
) | |||
if (NOT ${GETARCH_RESULT}) | |||
MESSAGE(FATAL_ERROR "Compiling getarch failed ${GETARCH_LOG}") | |||
endif () | |||
endif () | |||
message(STATUS "Running getarch") | |||
# use the cmake binary w/ the -E param to run a shell command in a cross-platform way | |||
execute_process(COMMAND ${PROJECT_BINARY_DIR}/${GETARCH_BIN} 0 OUTPUT_VARIABLE GETARCH_MAKE_OUT) | |||
execute_process(COMMAND ${PROJECT_BINARY_DIR}/${GETARCH_BIN} 1 OUTPUT_VARIABLE GETARCH_CONF_OUT) | |||
message(STATUS "GETARCH results:\n${GETARCH_MAKE_OUT}") | |||
# append config data from getarch to the TARGET file and read in CMake vars | |||
file(APPEND ${TARGET_CONF_TEMP} ${GETARCH_CONF_OUT}) | |||
ParseGetArchVars(${GETARCH_MAKE_OUT}) | |||
set(GETARCH2_DIR "${PROJECT_BINARY_DIR}/getarch2_build") | |||
set(GETARCH2_BIN "getarch_2nd${CMAKE_EXECUTABLE_SUFFIX}") | |||
file(MAKE_DIRECTORY ${GETARCH2_DIR}) | |||
configure_file(${TARGET_CONF_TEMP} ${GETARCH2_DIR}/${TARGET_CONF} COPYONLY) | |||
if (NOT "${CMAKE_SYSTEM_NAME}" STREQUAL "WindowsStore") | |||
try_compile(GETARCH2_RESULT ${GETARCH2_DIR} | |||
SOURCES ${PROJECT_SOURCE_DIR}/getarch_2nd.c | |||
COMPILE_DEFINITIONS ${EXFLAGS} ${GETARCH_FLAGS} ${GETARCH2_FLAGS} -I${GETARCH2_DIR} -I${PROJECT_SOURCE_DIR} -I${PROJECT_BINARY_DIR} | |||
OUTPUT_VARIABLE GETARCH2_LOG | |||
COPY_FILE ${PROJECT_BINARY_DIR}/${GETARCH2_BIN} | |||
) | |||
if (NOT ${GETARCH2_RESULT}) | |||
MESSAGE(FATAL_ERROR "Compiling getarch_2nd failed ${GETARCH2_LOG}") | |||
endif () | |||
endif () | |||
# append config data from getarch_2nd to the TARGET file and read in CMake vars | |||
file(APPEND ${TARGET_CONF_TEMP} ${GETARCH2_CONF_OUT}) | |||
# use the cmake binary w/ the -E param to run a shell command in a cross-platform way | |||
execute_process(COMMAND ${PROJECT_BINARY_DIR}/${GETARCH2_BIN} 0 OUTPUT_VARIABLE GETARCH2_MAKE_OUT) | |||
execute_process(COMMAND ${PROJECT_BINARY_DIR}/${GETARCH2_BIN} 1 OUTPUT_VARIABLE 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 () | |||
# append config data from getarch_2nd to the TARGET file and read in CMake vars | |||
file(APPEND ${TARGET_CONF_TEMP} ${GETARCH2_CONF_OUT}) | |||
ParseGetArchVars(${GETARCH2_MAKE_OUT}) | |||
configure_file(${TARGET_CONF_TEMP} ${TARGET_CONF_DIR}/${TARGET_CONF} COPYONLY) | |||
# compile get_config_h | |||
set(GEN_CONFIG_H_DIR "${PROJECT_BINARY_DIR}/genconfig_h_build") | |||
set(GEN_CONFIG_H_BIN "gen_config_h${CMAKE_EXECUTABLE_SUFFIX}") | |||
set(GEN_CONFIG_H_FLAGS "-DVERSION=\"${OpenBLAS_VERSION}\"") | |||
file(MAKE_DIRECTORY ${GEN_CONFIG_H_DIR}) | |||
ParseGetArchVars(${GETARCH2_MAKE_OUT}) | |||
if (NOT "${CMAKE_SYSTEM_NAME}" STREQUAL "WindowsStore") | |||
try_compile(GEN_CONFIG_H_RESULT ${GEN_CONFIG_H_DIR} | |||
SOURCES ${PROJECT_SOURCE_DIR}/gen_config_h.c | |||
COMPILE_DEFINITIONS ${EXFLAGS} ${GETARCH_FLAGS} ${GEN_CONFIG_H_FLAGS} -I${PROJECT_SOURCE_DIR} | |||
OUTPUT_VARIABLE GEN_CONFIG_H_LOG | |||
COPY_FILE ${PROJECT_BINARY_DIR}/${GEN_CONFIG_H_BIN} | |||
) | |||
if (NOT ${GEN_CONFIG_H_RESULT}) | |||
MESSAGE(FATAL_ERROR "Compiling gen_config_h failed ${GEN_CONFIG_H_LOG}") | |||
endif () | |||
endif () | |||
endif() |
@@ -4,10 +4,25 @@ | |||
## | |||
set(NETLIB_LAPACK_DIR "${PROJECT_SOURCE_DIR}/lapack-netlib") | |||
# TODO: Makefile.system detects Darwin (mac) and switches to clang here -hpa | |||
# http://stackoverflow.com/questions/714100/os-detecting-makefile | |||
# System detection, via CMake. | |||
include("${PROJECT_SOURCE_DIR}/cmake/system_check.cmake") | |||
if(CMAKE_CROSSCOMPILING AND NOT DEFINED TARGET) | |||
# Detect target without running getarch | |||
if (ARM64) | |||
set(TARGET "ARMV8") | |||
elseif(ARM) | |||
set(TARGET "ARMV7") # TODO: Ask compiler which arch this is | |||
else() | |||
message(FATAL_ERROR "When cross compiling, a TARGET is required.") | |||
endif() | |||
endif() | |||
# TODO: Makefile.system sets HOSTCC = $(CC) here if not already set -hpa | |||
# Other files expect CORE, which is actually TARGET and will become TARGET_CORE for kernel build. Confused yet? | |||
# It seems we are meant to use TARGET as input and CORE internally as kernel. | |||
if(NOT DEFINED CORE AND DEFINED TARGET) | |||
set(CORE ${TARGET}) | |||
endif() | |||
# TARGET_CORE will override TARGET which is used in DYNAMIC_ARCH=1. | |||
if (DEFINED TARGET_CORE) | |||
@@ -27,7 +42,7 @@ if (DEFINED BINARY AND DEFINED TARGET AND BINARY EQUAL 32) | |||
endif () | |||
if (DEFINED TARGET) | |||
message(STATUS "Targetting the ${TARGET} architecture.") | |||
message(STATUS "Targeting the ${TARGET} architecture.") | |||
set(GETARCH_FLAGS "-DFORCE_${TARGET}") | |||
endif () | |||
@@ -52,21 +67,16 @@ if (NO_AVX2) | |||
set(GETARCH_FLAGS "${GETARCH_FLAGS} -DNO_AVX2") | |||
endif () | |||
if (CMAKE_BUILD_TYPE STREQUAL Debug) | |||
set(GETARCH_FLAGS "${GETARCH_FLAGS} -g") | |||
if (CMAKE_BUILD_TYPE STREQUAL "Debug") | |||
set(GETARCH_FLAGS "${GETARCH_FLAGS} ${CMAKE_C_FLAGS_DEBUG}") | |||
endif () | |||
# TODO: let CMake handle this? -hpa | |||
#if (${QUIET_MAKE}) | |||
# set(MAKE "${MAKE} -s") | |||
#endif() | |||
if (NOT DEFINED NO_PARALLEL_MAKE) | |||
set(NO_PARALLEL_MAKE 0) | |||
endif () | |||
set(GETARCH_FLAGS "${GETARCH_FLAGS} -DNO_PARALLEL_MAKE=${NO_PARALLEL_MAKE}") | |||
if (CMAKE_CXX_COMPILER STREQUAL loongcc) | |||
if (CMAKE_C_COMPILER STREQUAL loongcc) | |||
set(GETARCH_FLAGS "${GETARCH_FLAGS} -static") | |||
endif () | |||
@@ -77,51 +87,39 @@ else () | |||
set(ONLY_CBLAS 0) | |||
endif () | |||
include("${PROJECT_SOURCE_DIR}/cmake/prebuild.cmake") | |||
# N.B. this is NUM_THREAD in Makefile.system which is probably a bug -hpa | |||
if (NOT CMAKE_CROSSCOMPILING) | |||
if (NOT DEFINED NUM_CORES) | |||
include(ProcessorCount) | |||
ProcessorCount(NUM_CORES) | |||
endif() | |||
if (NOT NUM_CORES EQUAL 0) | |||
# HT? | |||
set(NUM_THREADS ${NUM_CORES}) | |||
endif () | |||
endif() | |||
if (NOT DEFINED NUM_THREADS) | |||
set(NUM_THREADS ${NUM_CORES}) | |||
endif () | |||
set(NUM_THREADS 0) | |||
endif() | |||
if (${NUM_THREADS} EQUAL 1) | |||
if (${NUM_THREADS} LESS 2) | |||
set(USE_THREAD 0) | |||
elseif(NOT DEFINED USE_THREAD) | |||
set(USE_THREAD 1) | |||
endif () | |||
if (DEFINED USE_THREAD) | |||
if (NOT ${USE_THREAD}) | |||
unset(SMP) | |||
else () | |||
set(SMP 1) | |||
endif () | |||
else () | |||
# N.B. this is NUM_THREAD in Makefile.system which is probably a bug -hpa | |||
if (${NUM_THREADS} EQUAL 1) | |||
unset(SMP) | |||
else () | |||
set(SMP 1) | |||
endif () | |||
if (USE_THREAD) | |||
message(STATUS "Multi-threading enabled with ${NUM_THREADS} threads.") | |||
endif () | |||
if (${SMP}) | |||
message(STATUS "SMP enabled.") | |||
endif () | |||
include("${PROJECT_SOURCE_DIR}/cmake/prebuild.cmake") | |||
if (NOT DEFINED NEED_PIC) | |||
set(NEED_PIC 1) | |||
endif () | |||
# TODO: I think CMake should be handling all this stuff -hpa | |||
unset(ARFLAGS) | |||
set(CPP "${COMPILER} -E") | |||
set(AR "${CROSS_SUFFIX}ar") | |||
set(AS "${CROSS_SUFFIX}as") | |||
set(LD "${CROSS_SUFFIX}ld") | |||
set(RANLIB "${CROSS_SUFFIX}ranlib") | |||
set(NM "${CROSS_SUFFIX}nm") | |||
set(DLLWRAP "${CROSS_SUFFIX}dllwrap") | |||
set(OBJCOPY "${CROSS_SUFFIX}objcopy") | |||
set(OBJCONV "${CROSS_SUFFIX}objconv") | |||
# OS dependent settings | |||
include("${PROJECT_SOURCE_DIR}/cmake/os.cmake") | |||
@@ -149,11 +147,13 @@ if (NEED_PIC) | |||
set(CCOMMON_OPT "${CCOMMON_OPT} -fPIC") | |||
endif () | |||
if (${F_COMPILER} STREQUAL "SUN") | |||
set(FCOMMON_OPT "${FCOMMON_OPT} -pic") | |||
else () | |||
set(FCOMMON_OPT "${FCOMMON_OPT} -fPIC") | |||
endif () | |||
if (NOT NOFORTRAN) | |||
if (${F_COMPILER} STREQUAL "SUN") | |||
set(FCOMMON_OPT "${FCOMMON_OPT} -pic") | |||
else () | |||
set(FCOMMON_OPT "${FCOMMON_OPT} -fPIC") | |||
endif () | |||
endif() | |||
endif () | |||
if (DYNAMIC_ARCH) | |||
@@ -174,7 +174,7 @@ if (NO_AVX) | |||
set(CCOMMON_OPT "${CCOMMON_OPT} -DNO_AVX") | |||
endif () | |||
if (${ARCH} STREQUAL "x86") | |||
if (X86) | |||
set(CCOMMON_OPT "${CCOMMON_OPT} -DNO_AVX") | |||
endif () | |||
@@ -182,25 +182,20 @@ if (NO_AVX2) | |||
set(CCOMMON_OPT "${CCOMMON_OPT} -DNO_AVX2") | |||
endif () | |||
if (SMP) | |||
if (USE_THREAD) | |||
# USE_SIMPLE_THREADED_LEVEL3 = 1 | |||
# NO_AFFINITY = 1 | |||
set(CCOMMON_OPT "${CCOMMON_OPT} -DSMP_SERVER") | |||
if (${ARCH} STREQUAL "mips64") | |||
if (MIPS64) | |||
if (NOT ${CORE} STREQUAL "LOONGSON3B") | |||
set(USE_SIMPLE_THREADED_LEVEL3 1) | |||
endif () | |||
endif () | |||
if (USE_OPENMP) | |||
# USE_SIMPLE_THREADED_LEVEL3 = 1 | |||
# NO_AFFINITY = 1 | |||
set(CCOMMON_OPT "${CCOMMON_OPT} -DUSE_OPENMP") | |||
endif () | |||
if (BIGNUMA) | |||
set(CCOMMON_OPT "${CCOMMON_OPT} -DBIGNUMA") | |||
endif () | |||
endif () | |||
if (NO_WARMUP) | |||
@@ -263,7 +258,7 @@ if (NOT ${CMAKE_SYSTEM_NAME} STREQUAL "Linux") | |||
set(NO_AFFINITY 1) | |||
endif () | |||
if (NOT ${ARCH} STREQUAL "x86_64" AND NOT ${ARCH} STREQUAL "x86" AND NOT ${CORE} STREQUAL "LOONGSON3B") | |||
if (NOT X86_64 AND NOT X86 AND NOT ${CORE} STREQUAL "LOONGSON3B") | |||
set(NO_AFFINITY 1) | |||
endif () | |||
@@ -295,52 +290,19 @@ if (MIXED_MEMORY_ALLOCATION) | |||
set(CCOMMON_OPT "${CCOMMON_OPT} -DMIXED_MEMORY_ALLOCATION") | |||
endif () | |||
if (${CMAKE_SYSTEM_NAME} STREQUAL "SunOS") | |||
set(TAR gtar) | |||
set(PATCH gpatch) | |||
set(GREP ggrep) | |||
else () | |||
set(TAR tar) | |||
set(PATCH patch) | |||
set(GREP grep) | |||
endif () | |||
if (NOT DEFINED MD5SUM) | |||
set(MD5SUM md5sum) | |||
endif () | |||
set(AWK awk) | |||
set(SED sed) | |||
set(REVISION "-r${OpenBLAS_VERSION}") | |||
set(MAJOR_VERSION ${OpenBLAS_MAJOR_VERSION}) | |||
if (DEBUG) | |||
set(COMMON_OPT "${COMMON_OPT} -g") | |||
endif () | |||
if (NOT DEFINED COMMON_OPT) | |||
set(COMMON_OPT "-O2") | |||
endif () | |||
#For x86 32-bit | |||
if (DEFINED BINARY AND BINARY EQUAL 32) | |||
if (NOT MSVC) | |||
set(COMMON_OPT "${COMMON_OPT} -m32") | |||
endif() | |||
endif() | |||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${COMMON_OPT} ${CCOMMON_OPT}") | |||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${CCOMMON_OPT}") | |||
if(NOT MSVC) | |||
set(CMAKE_ASM_FLAGS "${CMAKE_ASM_FLAGS} ${COMMON_OPT} ${CCOMMON_OPT}") | |||
set(CMAKE_ASM_FLAGS "${CMAKE_ASM_FLAGS} ${CCOMMON_OPT}") | |||
endif() | |||
# TODO: not sure what PFLAGS is -hpa | |||
set(PFLAGS "${PFLAGS} ${COMMON_OPT} ${CCOMMON_OPT} -I${TOPDIR} -DPROFILE ${COMMON_PROF}") | |||
set(PFLAGS "${PFLAGS} ${CCOMMON_OPT} -I${TOPDIR} -DPROFILE ${COMMON_PROF}") | |||
set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} ${COMMON_OPT} ${FCOMMON_OPT}") | |||
set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} ${FCOMMON_OPT}") | |||
# TODO: not sure what FPFLAGS is -hpa | |||
set(FPFLAGS "${FPFLAGS} ${COMMON_OPT} ${FCOMMON_OPT} ${COMMON_PROF}") | |||
set(FPFLAGS "${FPFLAGS} ${FCOMMON_OPT} ${COMMON_PROF}") | |||
#For LAPACK Fortran codes. | |||
set(LAPACK_FFLAGS "${LAPACK_FFLAGS} ${CMAKE_Fortran_FLAGS}") | |||
@@ -348,7 +310,7 @@ set(LAPACK_FPFLAGS "${LAPACK_FPFLAGS} ${FPFLAGS}") | |||
#Disable -fopenmp for LAPACK Fortran codes on Windows. | |||
if (${CMAKE_SYSTEM_NAME} STREQUAL "Windows") | |||
set(FILTER_FLAGS "-fopenmp;-mp;-openmp;-xopenmp=parralel") | |||
set(FILTER_FLAGS "-fopenmp;-mp;-openmp;-xopenmp=parallel") | |||
foreach (FILTER_FLAG ${FILTER_FLAGS}) | |||
string(REPLACE ${FILTER_FLAG} "" LAPACK_FFLAGS ${LAPACK_FFLAGS}) | |||
string(REPLACE ${FILTER_FLAG} "" LAPACK_FPFLAGS ${LAPACK_FPFLAGS}) | |||
@@ -386,7 +348,7 @@ if (NOT DEFINED LIBSUFFIX) | |||
endif () | |||
if (DYNAMIC_ARCH) | |||
if (DEFINED SMP) | |||
if (USE_THREAD) | |||
set(LIBNAME "${LIBPREFIX}p${REVISION}.${LIBSUFFIX}") | |||
set(LIBNAME_P "${LIBPREFIX}p${REVISION}_p.${LIBSUFFIX}") | |||
else () | |||
@@ -394,7 +356,7 @@ if (DYNAMIC_ARCH) | |||
set(LIBNAME_P "${LIBPREFIX}${REVISION}_p.${LIBSUFFIX}") | |||
endif () | |||
else () | |||
if (DEFINED SMP) | |||
if (USE_THREAD) | |||
set(LIBNAME "${LIBPREFIX}_${LIBCORE}p${REVISION}.${LIBSUFFIX}") | |||
set(LIBNAME_P "${LIBPREFIX}_${LIBCORE}p${REVISION}_p.${LIBSUFFIX}") | |||
else () | |||
@@ -436,7 +398,7 @@ endif () | |||
set(USE_GEMM3M 0) | |||
if (DEFINED ARCH) | |||
if (${ARCH} STREQUAL "x86" OR ${ARCH} STREQUAL "x86_64" OR ${ARCH} STREQUAL "ia64" OR ${ARCH} STREQUAL "MIPS") | |||
if (X86 OR X86_64 OR ${ARCH} STREQUAL "ia64" OR MIPS64) | |||
set(USE_GEMM3M 1) | |||
endif () | |||
@@ -519,35 +481,3 @@ endif () | |||
# export CUFLAGS | |||
# export CULIB | |||
#endif | |||
#.SUFFIXES: .$(PSUFFIX) .$(SUFFIX) .f | |||
# | |||
#.f.$(SUFFIX): | |||
# $(FC) $(FFLAGS) -c $< -o $(@F) | |||
# | |||
#.f.$(PSUFFIX): | |||
# $(FC) $(FPFLAGS) -pg -c $< -o $(@F) | |||
# these are not cross-platform | |||
#ifdef BINARY64 | |||
#PATHSCALEPATH = /opt/pathscale/lib/3.1 | |||
#PGIPATH = /opt/pgi/linux86-64/7.1-5/lib | |||
#else | |||
#PATHSCALEPATH = /opt/pathscale/lib/3.1/32 | |||
#PGIPATH = /opt/pgi/linux86/7.1-5/lib | |||
#endif | |||
#ACMLPATH = /opt/acml/4.3.0 | |||
#ifneq ($(OSNAME), Darwin) | |||
#MKLPATH = /opt/intel/mkl/10.2.2.025/lib | |||
#else | |||
#MKLPATH = /Library/Frameworks/Intel_MKL.framework/Versions/10.0.1.014/lib | |||
#endif | |||
#ATLASPATH = /opt/atlas/3.9.17/opteron | |||
#FLAMEPATH = $(HOME)/flame/lib | |||
#ifneq ($(OSNAME), SunOS) | |||
#SUNPATH = /opt/sunstudio12.1 | |||
#else | |||
#SUNPATH = /opt/SUNWspro | |||
#endif | |||
@@ -0,0 +1,68 @@ | |||
## | |||
## Author: Hank Anderson <hank@statease.com> | |||
## Description: Ported from the OpenBLAS/c_check perl script. | |||
## This is triggered by prebuild.cmake and runs before any of the code is built. | |||
## Creates config.h and Makefile.conf. | |||
# Convert CMake vars into the format that OpenBLAS expects | |||
string(TOUPPER ${CMAKE_SYSTEM_NAME} HOST_OS) | |||
if (${HOST_OS} STREQUAL "WINDOWS") | |||
set(HOST_OS WINNT) | |||
endif () | |||
if(CMAKE_COMPILER_IS_GNUCC AND WIN32) | |||
execute_process(COMMAND ${CMAKE_C_COMPILER} -dumpmachine | |||
OUTPUT_VARIABLE OPENBLAS_GCC_TARGET_MACHINE | |||
OUTPUT_STRIP_TRAILING_WHITESPACE) | |||
if(OPENBLAS_GCC_TARGET_MACHINE MATCHES "amd64|x86_64|AMD64") | |||
set(MINGW64 1) | |||
endif() | |||
endif() | |||
# Pretty thorough determination of arch. Add more if needed | |||
if(CMAKE_CL_64 OR MINGW64) | |||
set(X86_64 1) | |||
elseif(MINGW OR (MSVC AND NOT CMAKE_CROSSCOMPILING)) | |||
set(X86 1) | |||
elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "ppc.*|power.*|Power.*") | |||
set(PPC 1) | |||
elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "mips64.*") | |||
set(MIPS64 1) | |||
elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "amd64.*|x86_64.*|AMD64.*") | |||
set(X86_64 1) | |||
elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "i686.*|i386.*|x86.*|amd64.*|AMD64.*") | |||
set(X86 1) | |||
elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "^(arm.*|ARM.*)") | |||
set(ARM 1) | |||
elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "^(aarch64.*|AARCH64.*)") | |||
set(ARM64 1) | |||
endif() | |||
if (X86_64) | |||
set(ARCH "x86_64") | |||
elseif(X86) | |||
set(ARCH "x86") | |||
elseif(PPC) | |||
set(ARCH "power") | |||
elseif(ARM) | |||
set(ARCH "arm") | |||
elseif(ARM64) | |||
set(ARCH "arm64") | |||
else() | |||
set(ARCH ${CMAKE_SYSTEM_PROCESSOR} CACHE STRING "Target Architecture") | |||
endif () | |||
if (NOT BINARY) | |||
if (X86_64 OR ARM64 OR PPC OR MIPS64) | |||
set(BINARY 64) | |||
else () | |||
set(BINARY 32) | |||
endif () | |||
endif() | |||
if(BINARY EQUAL 64) | |||
set(BINARY64 1) | |||
else() | |||
set(BINARY32 1) | |||
endif() | |||
@@ -16,7 +16,7 @@ foreach(float_type ${FLOAT_TYPES}) | |||
add_executable(x${float_char}cblat1 | |||
c_${float_char}blat1.f | |||
c_${float_char}blas1.c) | |||
target_link_libraries(x${float_char}cblat1 ${OpenBLAS_LIBNAME}_static) | |||
target_link_libraries(x${float_char}cblat1 ${OpenBLAS_LIBNAME}) | |||
add_test(NAME "x${float_char}cblat1" | |||
COMMAND "${CMAKE_CURRENT_BINARY_DIR}/x${float_char}cblat1") | |||
@@ -28,7 +28,7 @@ foreach(float_type ${FLOAT_TYPES}) | |||
auxiliary.c | |||
c_xerbla.c | |||
constant.c) | |||
target_link_libraries(x${float_char}cblat2 ${OpenBLAS_LIBNAME}_static) | |||
target_link_libraries(x${float_char}cblat2 ${OpenBLAS_LIBNAME}) | |||
add_test(NAME "x${float_char}cblat2" | |||
COMMAND sh "${CMAKE_CURRENT_BINARY_DIR}/test_cblas_helper.sh" "${CMAKE_CURRENT_BINARY_DIR}/x${float_char}cblat2" "${PROJECT_SOURCE_DIR}/ctest/${float_char}in2") | |||
@@ -40,7 +40,7 @@ foreach(float_type ${FLOAT_TYPES}) | |||
auxiliary.c | |||
c_xerbla.c | |||
constant.c) | |||
target_link_libraries(x${float_char}cblat3 ${OpenBLAS_LIBNAME}_static) | |||
target_link_libraries(x${float_char}cblat3 ${OpenBLAS_LIBNAME}) | |||
add_test(NAME "x${float_char}cblat3" | |||
COMMAND sh "${CMAKE_CURRENT_BINARY_DIR}/test_cblas_helper.sh" "${CMAKE_CURRENT_BINARY_DIR}/x${float_char}cblat3" "${PROJECT_SOURCE_DIR}/ctest/${float_char}in3") | |||
@@ -73,7 +73,7 @@ GenerateNamedObjects("zgbmv_k.c" "TRANS;CONJ;XCONJ" "gbmv_d" false "" "" "" 2) | |||
# special defines for complex | |||
foreach (float_type ${FLOAT_TYPES}) | |||
if (SMP) | |||
if (USE_THREAD) | |||
GenerateNamedObjects("gemv_thread.c" "" "gemv_thread_n" false "" "" false ${float_type}) | |||
GenerateNamedObjects("gemv_thread.c" "TRANSA" "gemv_thread_t" false "" "" false ${float_type}) | |||
@@ -107,7 +107,7 @@ foreach (float_type ${FLOAT_TYPES}) | |||
GenerateNamedObjects("z${ulvm_source}" "LOWER;HEMVREV" "${op_name}_M" false "" "" false ${float_type}) | |||
endforeach() | |||
if (SMP) | |||
if (USE_THREAD) | |||
GenerateNamedObjects("gemv_thread.c" "CONJ" "gemv_thread_r" false "" "" false ${float_type}) | |||
GenerateNamedObjects("gemv_thread.c" "CONJ;TRANSA" "gemv_thread_c" false "" "" false ${float_type}) | |||
@@ -186,7 +186,7 @@ foreach (float_type ${FLOAT_TYPES}) | |||
GenerateCombinationObjects("${l_source}" "UNIT" "N" "TRANSA" 0 "${op_name}_TU" false ${float_type}) | |||
endforeach () | |||
if (SMP) | |||
if (USE_THREAD) | |||
GenerateNamedObjects("ger_thread.c" "" "" false "" "" false ${float_type}) | |||
foreach(nu_smp_source ${NU_SMP_SOURCES}) | |||
string(REGEX MATCH "[a-z]+_[a-z]+" op_name ${nu_smp_source}) | |||
@@ -197,7 +197,7 @@ foreach (float_type ${FLOAT_TYPES}) | |||
endif () | |||
endforeach () | |||
if (SMP) | |||
if (USE_THREAD) | |||
GenerateCombinationObjects("${UL_SMP_SOURCES}" "LOWER" "U" "" 2) | |||
endif () | |||
@@ -9,7 +9,7 @@ set(GEMM_COMPLEX_DEFINES RN CN RT CT NR TR RR CR NC TC RC CC) | |||
foreach (GEMM_DEFINE ${GEMM_DEFINES}) | |||
string(TOLOWER ${GEMM_DEFINE} GEMM_DEFINE_LC) | |||
GenerateNamedObjects("gemm.c" "${GEMM_DEFINE}" "gemm_${GEMM_DEFINE_LC}" 0) | |||
if (SMP AND NOT USE_SIMPLE_THREADED_LEVEL3) | |||
if (USE_THREAD AND NOT USE_SIMPLE_THREADED_LEVEL3) | |||
GenerateNamedObjects("gemm.c" "${GEMM_DEFINE};THREADED_LEVEL3" "gemm_thread_${GEMM_DEFINE_LC}" 0) | |||
endif () | |||
endforeach () | |||
@@ -32,7 +32,7 @@ GenerateCombinationObjects("syrk_k.c" "LOWER;TRANS" "U;N" "" 1) | |||
GenerateCombinationObjects("syr2k_k.c" "LOWER;TRANS" "U;N" "" 1) | |||
GenerateCombinationObjects("syrk_kernel.c" "LOWER" "U" "" 2) | |||
GenerateCombinationObjects("syr2k_kernel.c" "LOWER" "U" "" 2) | |||
if (SMP) | |||
if (USE_THREAD) | |||
# N.B. these do NOT have a float type (e.g. DOUBLE) defined! | |||
GenerateNamedObjects("gemm_thread_m.c;gemm_thread_n.c;gemm_thread_mn.c;gemm_thread_variable.c;syrk_thread.c" "" "" 0 "" "" 1) | |||
@@ -71,7 +71,7 @@ foreach (float_type ${FLOAT_TYPES}) | |||
GenerateNamedObjects("zher2k_k.c" "HER2K;LOWER" "her2k_LN" false "" "" false ${float_type}) | |||
GenerateNamedObjects("zher2k_k.c" "HER2K;LOWER;TRANS;CONJ" "her2k_LC" false "" "" false ${float_type}) | |||
if (SMP AND NOT USE_SIMPLE_THREADED_LEVEL3) | |||
if (USE_THREAD AND NOT USE_SIMPLE_THREADED_LEVEL3) | |||
#herk | |||
GenerateCombinationObjects("zherk_k.c" "LOWER" "U" "HERK;THREADED_LEVEL3" 3 "herk_thread_N" false ${float_type}) | |||
GenerateCombinationObjects("zherk_k.c" "LOWER" "U" "HERK;THREADED_LEVEL3;TRANS;CONJ" 3 "herk_thread_C" false ${float_type}) | |||
@@ -93,7 +93,7 @@ foreach (float_type ${FLOAT_TYPES}) | |||
if(USE_GEMM3M) | |||
GenerateNamedObjects("gemm3m.c" "${gemm_define}" "gemm3m_${gemm_define_LC}" false "" "" false ${float_type}) | |||
endif() | |||
if (SMP AND NOT USE_SIMPLE_THREADED_LEVEL3) | |||
if (USE_THREAD AND NOT USE_SIMPLE_THREADED_LEVEL3) | |||
GenerateNamedObjects("gemm.c" "${gemm_define};THREADED_LEVEL3" "gemm_thread_${gemm_define_LC}" false "" "" false ${float_type}) | |||
if(USE_GEMM3M) | |||
GenerateNamedObjects("gemm3m.c" "${gemm_define};THREADED_LEVEL3" "gemm3m_thread_${gemm_define_LC}" false "" "" false ${float_type}) | |||
@@ -106,7 +106,7 @@ foreach (float_type ${FLOAT_TYPES}) | |||
foreach (GEMM_DEFINE ${GEMM_DEFINES}) | |||
string(TOLOWER ${GEMM_DEFINE} GEMM_DEFINE_LC) | |||
GenerateNamedObjects("gemm3m.c" "${GEMM_DEFINE}" "gemm3m_${GEMM_DEFINE_LC}" false "" "" false ${float_type}) | |||
if (SMP AND NOT USE_SIMPLE_THREADED_LEVEL3) | |||
if (USE_THREAD AND NOT USE_SIMPLE_THREADED_LEVEL3) | |||
GenerateNamedObjects("gemm3m.c" "${GEMM_DEFINE};THREADED_LEVEL3" "gemm3m_thread_${GEMM_DEFINE_LC}" false "" "" false ${float_type}) | |||
endif () | |||
endforeach () | |||
@@ -7,7 +7,7 @@ else () | |||
set(MEMORY memory.c) | |||
endif () | |||
if (SMP) | |||
if (USE_THREAD) | |||
if (USE_OPENMP) | |||
set(BLAS_SERVER blas_server_omp.c) | |||
@@ -21,8 +21,8 @@ function (build_core TARGET_CORE KDIR TSUFFIX KERNEL_DEFINITIONS) | |||
endif () | |||
if (${ADD_COMMONOBJS}) | |||
if (${ARCH} STREQUAL "x86") | |||
if (NOT "${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC") | |||
if (X86) | |||
if (NOT "${CMAKE_C_COMPILER_ID}" STREQUAL "MSVC") | |||
GenerateNamedObjects("${KERNELDIR}/cpuid.S" "" "" false "" "" true) | |||
else() | |||
GenerateNamedObjects("${KERNELDIR}/cpuid_win.c" "" "" false "" "" true) | |||
@@ -121,7 +121,7 @@ function (build_core TARGET_CORE KDIR TSUFFIX KERNEL_DEFINITIONS) | |||
# Makefile.L3 | |||
set(USE_TRMM false) | |||
if (${ARCH} STREQUAL "arm" OR ${ARCH} STREQUAL "arm64" OR "${TARGET}" STREQUAL "LONGSOON3B" OR "${TARGET}" STREQUAL "GENERIC" OR "${CORE}" STREQUAL "generic" OR "${TARGET}" STREQUAL "HASWELL" OR "${CORE}" STREQUAL "haswell" OR "{CORE}" STREQUAL "zen") | |||
if (ARM OR ARM64 OR "${TARGET}" STREQUAL "LONGSOON3B" OR "${TARGET}" STREQUAL "GENERIC" OR "${CORE}" STREQUAL "generic" OR "${TARGET}" STREQUAL "HASWELL" OR "${CORE}" STREQUAL "haswell" OR "{CORE}" STREQUAL "zen") | |||
set(USE_TRMM true) | |||
endif () | |||
@@ -464,6 +464,30 @@ function (build_core TARGET_CORE KDIR TSUFFIX KERNEL_DEFINITIONS) | |||
GenerateNamedObjects("${KERNELDIR}/${${float_char}GEADD_KERNEL}" "" "geadd_k" false "" "" false ${float_type}) | |||
endforeach () | |||
# Makefile.LA | |||
if(NOT NO_LAPACK) | |||
foreach (float_type ${FLOAT_TYPES}) | |||
if (NOT DEFINED ${float_char}NEG_TCOPY) | |||
if (${float_char} STREQUAL "Z" OR ${float_char} STREQUAL "C" OR ${float_char} STREQUAL "X") | |||
set(${float_char}NEG_TCOPY ../generic/zneg_tcopy.c) | |||
else () | |||
set(${float_char}NEG_TCOPY ../generic/neg_tcopy.c) | |||
endif () | |||
endif () | |||
if (NOT DEFINED ${float_char}LASWP_NCOPY) | |||
if (${float_char} STREQUAL "Z" OR ${float_char} STREQUAL "C" OR ${float_char} STREQUAL "X") | |||
set(${float_char}LASWP_NCOPY ../generic/zlaswp_ncopy.c) | |||
else () | |||
set(${float_char}LASWP_NCOPY ../generic/laswp_ncopy.c) | |||
endif () | |||
endif () | |||
string(SUBSTRING ${float_type} 0 1 float_char) | |||
GenerateNamedObjects("${KERNELDIR}/${${float_char}NEG_TCOPY}_${${float_char}GEMM_UNROLL_M}" "" "neg_tcopy" false "" "" false ${float_type}) | |||
GenerateNamedObjects("${KERNELDIR}/${${float_char}LASWP_NCOPY}_${${float_char}GEMM_UNROLL_N}" "" "laswp_ncopy" false "" "" false ${float_type}) | |||
endforeach() | |||
endif() | |||
if (${DYNAMIC_ARCH}) | |||
set(SETPARAM_TARGET_DIR ${CMAKE_CURRENT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}) | |||
file(READ ${CMAKE_CURRENT_SOURCE_DIR}/setparam-ref.c SETPARAM_REF_CONTENTS) | |||
@@ -484,9 +508,6 @@ function (build_core TARGET_CORE KDIR TSUFFIX KERNEL_DEFINITIONS) | |||
file(REMOVE ${SETPARAM_TARGET_DIR}/kernel${TSUFFIX}.tmp) | |||
endif () | |||
# Makefile.LA | |||
#DBLASOBJS += dneg_tcopy$(TSUFFIX).$(SUFFIX) dlaswp_ncopy$(TSUFFIX).$(SUFFIX) | |||
add_library(kernel${TSUFFIX} OBJECT ${OPENBLAS_SRC}) | |||
set_target_properties(kernel${TSUFFIX} PROPERTIES COMPILE_FLAGS "${KERNEL_DEFINITIONS}") | |||
get_target_property(KERNEL_INCLUDE_DIRECTORIES kernel${TSUFFIX} INCLUDE_DIRECTORIES) | |||
@@ -46,7 +46,7 @@ GenerateNamedObjects("${LAPACK_MANGLED_SOURCES}" "" "" false "" "" false 3) | |||
GenerateNamedObjects("laswp/generic/laswp_k.c" "" "laswp_plus" false "" "" false 3) | |||
GenerateNamedObjects("laswp/generic/laswp_k.c" "MINUS" "laswp_minus" false "" "" false 3) | |||
if (SMP) | |||
if (USE_THREAD) | |||
if (USE_OPENMP) | |||
set(GETRF_SRC getrf/getrf_parallel_omp.c) | |||
@@ -11,7 +11,7 @@ set(OpenBLAS_Tests | |||
foreach(test_bin ${OpenBLAS_Tests}) | |||
add_executable(${test_bin} ${test_bin}.f) | |||
target_link_libraries(${test_bin} ${OpenBLAS_LIBNAME}_static) | |||
target_link_libraries(${test_bin} ${OpenBLAS_LIBNAME}) | |||
endforeach() | |||
# $1 exec, $2 input, $3 output_result | |||