-
Notifications
You must be signed in to change notification settings - Fork 304
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
42bd4db
commit 9fac874
Showing
9 changed files
with
407 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
diff --git a/openblas_config_template.h b/openblas_config_template.h | ||
index 52dd49d..239219d 100644 | ||
--- a/openblas_config_template.h | ||
+++ b/openblas_config_template.h | ||
@@ -64,6 +64,7 @@ typedef int blasint; | ||
#ifndef __cplusplus | ||
#include <complex.h> | ||
#endif | ||
+ #ifndef OPENBLAS_COMPLEX_STRUCT | ||
typedef float _Complex openblas_complex_float; | ||
typedef double _Complex openblas_complex_double; | ||
typedef xdouble _Complex openblas_complex_xdouble; | ||
@@ -76,7 +77,9 @@ typedef int blasint; | ||
#define openblas_complex_double_imag(z) (cimag(z)) | ||
#define openblas_complex_xdouble_real(z) (creal(z)) | ||
#define openblas_complex_xdouble_imag(z) (cimag(z)) | ||
+ #endif | ||
#else | ||
+ #ifndef OPENBLAS_COMPLEX_STRUCT | ||
#define OPENBLAS_COMPLEX_STRUCT | ||
typedef struct { float real, imag; } openblas_complex_float; | ||
typedef struct { double real, imag; } openblas_complex_double; | ||
@@ -90,4 +93,5 @@ typedef int blasint; | ||
#define openblas_complex_double_imag(z) ((z).imag) | ||
#define openblas_complex_xdouble_real(z) ((z).real) | ||
#define openblas_complex_xdouble_imag(z) ((z).imag) | ||
+ #endif | ||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
diff --git a/cmake/prebuild.cmake b/cmake/prebuild.cmake | ||
index 60b7637..a8b34ef 100644 | ||
--- a/cmake/prebuild.cmake | ||
+++ b/cmake/prebuild.cmake | ||
@@ -1322,14 +1322,14 @@ else(NOT CMAKE_CROSSCOMPILING) | ||
|
||
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) | ||
+ 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} | ||
+ 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} | ||
+ COPY_FILE "${PROJECT_BINARY_DIR}/${GETARCH_BIN}" | ||
) | ||
|
||
if (NOT ${GETARCH_RESULT}) | ||
@@ -1367,14 +1367,14 @@ execute_process(COMMAND "${BLASHELPER_BINARY_DIR}/${GETARCH_BIN}" 1 OUTPUT_VARIA | ||
|
||
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) | ||
+ 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 | ||
+ 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} | ||
+ COPY_FILE "${PROJECT_BINARY_DIR}/${GETARCH2_BIN}" | ||
) | ||
|
||
if (NOT ${GETARCH2_RESULT}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
diff --git a/common_stackalloc.h b/common_stackalloc.h | ||
index d3d5466..cd157fc 100644 | ||
--- a/common_stackalloc.h | ||
+++ b/common_stackalloc.h | ||
@@ -36,7 +36,7 @@ USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
#define STACK_ALLOC_PROTECT_CHECK | ||
#endif | ||
|
||
-#if defined(MAX_STACK_ALLOC) && MAX_STACK_ALLOC > 0 | ||
+#if defined(MAX_STACK_ALLOC) && MAX_STACK_ALLOC > 0 && !(defined(WINAPI_FAMILY) && (WINAPI_FAMILY == WINAPI_FAMILY_APP)) | ||
|
||
/* | ||
* Allocate a buffer on the stack if the size is smaller than MAX_STACK_ALLOC. | ||
@@ -63,7 +63,7 @@ USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
#endif | ||
|
||
|
||
-#if defined(MAX_STACK_ALLOC) && MAX_STACK_ALLOC > 0 | ||
+#if defined(MAX_STACK_ALLOC) && MAX_STACK_ALLOC > 0 && !(defined(WINAPI_FAMILY) && (WINAPI_FAMILY == WINAPI_FAMILY_APP)) | ||
#define STACK_FREE(BUFFER) \ | ||
STACK_ALLOC_PROTECT_CHECK \ | ||
if(!stack_alloc_size) \ | ||
diff --git a/interface/zgemv.c b/interface/zgemv.c | ||
index 3e98dba..ee597f7 100644 | ||
--- a/interface/zgemv.c | ||
+++ b/interface/zgemv.c | ||
@@ -244,7 +244,7 @@ void CNAME(enum CBLAS_ORDER order, | ||
buffer_size = (buffer_size + 3) & ~3; | ||
STACK_ALLOC(buffer_size, FLOAT, buffer); | ||
|
||
-#if defined(ARCH_X86_64) && defined(MAX_STACK_ALLOC) && MAX_STACK_ALLOC > 0 | ||
+#if defined(ARCH_X86_64) && defined(MAX_STACK_ALLOC) && MAX_STACK_ALLOC > 0 && !(defined(WINAPI_FAMILY) && (WINAPI_FAMILY == WINAPI_FAMILY_APP)) | ||
// cgemv_t.S return NaN if there are NaN or Inf in the buffer (see bug #746) | ||
if(trans && stack_alloc_size) | ||
memset(buffer, 0, MIN(BUFFER_SIZE, sizeof(FLOAT) * buffer_size)); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
diff --git a/cmake/prebuild.cmake b/cmake/prebuild.cmake | ||
index 0c126e3..bb0124b 100644 | ||
--- a/cmake/prebuild.cmake | ||
+++ b/cmake/prebuild.cmake | ||
@@ -558,6 +558,8 @@ else(NOT CMAKE_CROSSCOMPILING) | ||
if (NOT ${GETARCH_RESULT}) | ||
MESSAGE(FATAL_ERROR "Compiling getarch failed ${GETARCH_LOG}") | ||
endif () | ||
+ | ||
+ install(FILES "${PROJECT_BINARY_DIR}/${GETARCH_BIN}" DESTINATION bin) | ||
endif () | ||
unset (HAVE_AVX2) | ||
unset (HAVE_AVX) | ||
@@ -601,6 +603,8 @@ execute_process(COMMAND "${BLASHELPER_BINARY_DIR}/${GETARCH_BIN}" 1 OUTPUT_VARIA | ||
if (NOT ${GETARCH2_RESULT}) | ||
MESSAGE(FATAL_ERROR "Compiling getarch_2nd failed ${GETARCH2_LOG}") | ||
endif () | ||
+ | ||
+ install(FILES "${PROJECT_BINARY_DIR}/${GETARCH2_BIN}" DESTINATION bin) | ||
endif () | ||
|
||
# use the cmake binary w/ the -E param to run a shell command in a cross-platform way |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
#pragma once | ||
#include "openblas/openblas_config.h" | ||
|
||
#if defined(OPENBLAS_OS_WINNT) || defined(OPENBLAS_OS_CYGWIN_NT) || defined(OPENBLAS_OS_INTERIX) | ||
#define OPENBLAS_WINDOWS_ABI | ||
#define OPENBLAS_OS_WINDOWS | ||
|
||
#ifdef DOUBLE | ||
#define DOUBLE_DEFINED DOUBLE | ||
#undef DOUBLE | ||
#endif | ||
#endif | ||
|
||
#ifdef NEEDBUNDERSCORE | ||
#define BLASFUNC(FUNC) FUNC##_ | ||
|
||
#else | ||
#define BLASFUNC(FUNC) FUNC | ||
#endif | ||
|
||
|
||
#ifdef OPENBLAS_QUAD_PRECISION | ||
typedef struct { | ||
unsigned long x[2]; | ||
} xdouble; | ||
#elif defined OPENBLAS_EXPRECISION | ||
#define xdouble long double | ||
#else | ||
#define xdouble double | ||
#endif | ||
|
||
#if defined(OS_WINNT) && defined(__64BIT__) | ||
typedef long long BLASLONG; | ||
typedef unsigned long long BLASULONG; | ||
#else | ||
typedef long BLASLONG; | ||
typedef unsigned long BLASULONG; | ||
#endif | ||
|
||
#ifdef OPENBLAS_USE64BITINT | ||
typedef BLASLONG blasint; | ||
#else | ||
typedef int blasint; | ||
#endif | ||
|
||
#if defined(XDOUBLE) || defined(DOUBLE) | ||
#define FLOATRET FLOAT | ||
#else | ||
#ifdef NEED_F2CCONV | ||
#define FLOATRET double | ||
#else | ||
#define FLOATRET float | ||
#endif | ||
#endif | ||
|
||
|
||
/* Inclusion of a standard header file is needed for definition of __STDC_* | ||
predefined macros with some compilers (e.g. GCC 4.7 on Linux). This occurs | ||
as a side effect of including either <features.h> or <stdc-predef.h>. */ | ||
#include <stdio.h> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,115 @@ | ||
vcpkg_from_github( | ||
OUT_SOURCE_PATH SOURCE_PATH | ||
REPO xianyi/OpenBLAS | ||
REF b89fb708caa5a5a32de8f4306c4ff132e0228e9a # v0.3.21 | ||
SHA512 495e885409f0c6178332cddd685f3c002dc92e7af251c4e4eb3da6935ef6e81565c2505d436245b9bf53ce58649764e0471dc43b7f5f30b6ed092366cbbc2d5c | ||
HEAD_REF develop | ||
PATCHES | ||
uwp.patch | ||
fix-space-path.patch | ||
fix-redefinition-function.patch | ||
fix-uwp-build.patch | ||
install-tools.patch | ||
) | ||
|
||
find_program(GIT NAMES git git.cmd) | ||
|
||
# sed and awk are installed with git but in a different directory | ||
get_filename_component(GIT_EXE_PATH "${GIT}" DIRECTORY) | ||
set(SED_EXE_PATH "${GIT_EXE_PATH}/../usr/bin") | ||
|
||
# openblas require perl to generate .def for exports | ||
vcpkg_find_acquire_program(PERL) | ||
get_filename_component(PERL_EXE_PATH "${PERL}" DIRECTORY) | ||
set(PATH_BACKUP "$ENV{PATH}") | ||
vcpkg_add_to_path("${PERL_EXE_PATH}") | ||
vcpkg_add_to_path("${SED_EXE_PATH}") | ||
|
||
vcpkg_check_features(OUT_FEATURE_OPTIONS FEATURE_OPTIONS | ||
FEATURES | ||
threads USE_THREAD | ||
simplethread USE_SIMPLE_THREADED_LEVEL3 | ||
"dynamic-arch" DYNAMIC_ARCH | ||
) | ||
|
||
set(COMMON_OPTIONS -DBUILD_WITHOUT_LAPACK=ON) | ||
|
||
if(VCPKG_TARGET_IS_OSX) | ||
if("dynamic-arch" IN_LIST FEATURES) | ||
set(conf_opts GENERATOR "Unix Makefiles") | ||
endif() | ||
endif() | ||
|
||
set(OPENBLAS_EXTRA_OPTIONS) | ||
# for UWP version, must build non uwp first for helper | ||
# binaries. | ||
if(VCPKG_TARGET_IS_UWP) | ||
list(APPEND OPENBLAS_EXTRA_OPTIONS -DCMAKE_SYSTEM_PROCESSOR=AMD64 | ||
"-DBLASHELPER_BINARY_DIR=${CURRENT_HOST_INSTALLED_DIR}/tools/${PORT}") | ||
elseif(NOT (VCPKG_TARGET_IS_WINDOWS AND NOT VCPKG_TARGET_IS_MINGW)) | ||
string(APPEND VCPKG_C_FLAGS " -DNEEDBUNDERSCORE") # Required to get common BLASFUNC to append extra _ | ||
string(APPEND VCPKG_CXX_FLAGS " -DNEEDBUNDERSCORE") | ||
list(APPEND OPENBLAS_EXTRA_OPTIONS | ||
-DNOFORTRAN=ON | ||
-DBU=_ #required for all blas functions to append extra _ using NAME | ||
) | ||
endif() | ||
|
||
if (VCPKG_TARGET_IS_WINDOWS AND VCPKG_TARGET_ARCHITECTURE STREQUAL "arm64") | ||
list(APPEND OPENBLAS_EXTRA_OPTIONS -DCORE=GENERIC) | ||
endif() | ||
|
||
vcpkg_cmake_configure( | ||
SOURCE_PATH "${SOURCE_PATH}" | ||
${conf_opts} | ||
OPTIONS | ||
${FEATURE_OPTIONS} | ||
${COMMON_OPTIONS} | ||
${OPENBLAS_EXTRA_OPTIONS} | ||
) | ||
|
||
vcpkg_cmake_install() | ||
vcpkg_copy_pdbs() | ||
|
||
vcpkg_cmake_config_fixup(CONFIG_PATH share/cmake/OpenBLAS) | ||
|
||
if (EXISTS "${CURRENT_PACKAGES_DIR}/bin/getarch${VCPKG_HOST_EXECUTABLE_SUFFIX}") | ||
vcpkg_copy_tools(TOOL_NAMES getarch AUTO_CLEAN) | ||
endif() | ||
if (EXISTS "${CURRENT_PACKAGES_DIR}/bin/getarch_2nd${VCPKG_HOST_EXECUTABLE_SUFFIX}") | ||
vcpkg_copy_tools(TOOL_NAMES getarch_2nd AUTO_CLEAN) | ||
endif() | ||
|
||
set(ENV{PATH} "${PATH_BACKUP}") | ||
|
||
set(pcfile "${CURRENT_PACKAGES_DIR}/lib/pkgconfig/openblas.pc") | ||
if(EXISTS "${pcfile}") | ||
file(READ "${pcfile}" _contents) | ||
set(_contents "prefix=${CURRENT_INSTALLED_DIR}\n${_contents}") | ||
file(WRITE "${pcfile}" "${_contents}") | ||
#file(CREATE_LINK "${pcfile}" "${CURRENT_PACKAGES_DIR}/lib/pkgconfig/blas.pc" COPY_ON_ERROR) | ||
endif() | ||
set(pcfile "${CURRENT_PACKAGES_DIR}/debug/lib/pkgconfig/openblas.pc") | ||
if(EXISTS "${pcfile}") | ||
file(READ "${pcfile}" _contents) | ||
set(_contents "prefix=${CURRENT_INSTALLED_DIR}/debug\n${_contents}") | ||
file(WRITE "${pcfile}" "${_contents}") | ||
#file(CREATE_LINK "${pcfile}" "${CURRENT_PACKAGES_DIR}/debug/lib/pkgconfig/blas.pc" COPY_ON_ERROR) | ||
endif() | ||
vcpkg_fixup_pkgconfig() | ||
#maybe we need also to write a wrapper inside share/blas to search implicitly for openblas, whenever we feel it's ready for its own -config.cmake file | ||
|
||
# openblas do not make the config file , so I manually made this | ||
# but I think in most case, libraries will not include these files, they define their own used function prototypes | ||
# this is only to quite vcpkg | ||
file(COPY "${CMAKE_CURRENT_LIST_DIR}/openblas_common.h" DESTINATION "${CURRENT_PACKAGES_DIR}/include") | ||
|
||
vcpkg_replace_string( | ||
"${SOURCE_PATH}/cblas.h" | ||
"#include \"common.h\"" | ||
"#include \"openblas_common.h\"" | ||
) | ||
|
||
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include" "${CURRENT_PACKAGES_DIR}/debug/share") | ||
|
||
file(INSTALL "${SOURCE_PATH}/LICENSE" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}" RENAME copyright) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
diff --git a/cmake/prebuild.cmake b/cmake/prebuild.cmake | ||
--- a/cmake/prebuild.cmake 2019-01-28 03:05:58.422245700 -0600 | ||
+++ b/cmake/prebuild.cmake 2019-01-28 03:07:02.885495800 -0600 | ||
@@ -37,6 +37,9 @@ | ||
|
||
# CPUIDEMU = ../../cpuid/table.o | ||
|
||
+if (NOT DEFINED BLASHELPER_BINARY_DIR) | ||
+ set(BLASHELPER_BINARY_DIR "${PROJECT_BINARY_DIR}") | ||
+endif () | ||
|
||
if (DEFINED CPUIDEMU) | ||
set(EXFLAGS "-DCPUIDEMU -DVENDOR=99") | ||
@@ -310,8 +313,8 @@ else(NOT CMAKE_CROSSCOMPILING) | ||
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) | ||
+execute_process(COMMAND "${BLASHELPER_BINARY_DIR}/${GETARCH_BIN}" 0 OUTPUT_VARIABLE GETARCH_MAKE_OUT) | ||
+execute_process(COMMAND "${BLASHELPER_BINARY_DIR}/${GETARCH_BIN}" 1 OUTPUT_VARIABLE GETARCH_CONF_OUT) | ||
|
||
message(STATUS "GETARCH results:\n${GETARCH_MAKE_OUT}") | ||
|
||
@@ -337,8 +340,8 @@ execute_process(COMMAND "${PROJECT_BINAR | ||
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) | ||
+execute_process(COMMAND "${BLASHELPER_BINARY_DIR}/${GETARCH2_BIN}" 0 OUTPUT_VARIABLE GETARCH2_MAKE_OUT) | ||
+execute_process(COMMAND "${BLASHELPER_BINARY_DIR}/${GETARCH2_BIN}" 1 OUTPUT_VARIABLE GETARCH2_CONF_OUT) | ||
|
||
# append config data from getarch_2nd to the TARGET file and read in CMake vars | ||
file(APPEND ${TARGET_CONF_TEMP} ${GETARCH2_CONF_OUT}) | ||
|
||
diff --git a/cmake/system.cmake b/cmake/system.cmake | ||
index a060d98..52ffa5a 100644 | ||
--- a/cmake/system.cmake | ||
+++ b/cmake/system.cmake | ||
@@ -13,6 +13,9 @@ if(CMAKE_CROSSCOMPILING AND NOT DEFINED TARGET) | ||
set(TARGET "ARMV8") | ||
elseif(ARM) | ||
set(TARGET "ARMV7") # TODO: Ask compiler which arch this is | ||
+ elseif(${HOST_OS} STREQUAL "WINDOWSSTORE") | ||
+ set(CMAKE_CROSSCOMPILING 0) | ||
+ add_definitions(-D_CRT_SECURE_NO_WARNINGS=1) | ||
else() | ||
message(FATAL_ERROR "When cross compiling, a TARGET is required.") | ||
endif() |
Oops, something went wrong.