mirror of
https://github.com/OpenMathLib/OpenBLAS
synced 2026-06-19 00:35:10 +08:00
Merge pull request #5029 from martin-frbg/issue5020
Add support for compiling with Intel oneAPI 2025.0 on MS Windows
This commit is contained in:
@@ -4,6 +4,7 @@
|
||||
|
||||
cmake_minimum_required(VERSION 3.16.0)
|
||||
|
||||
set (CMAKE_ASM_SOURCE_FILE_EXTENSIONS "S")
|
||||
project(OpenBLAS C ASM)
|
||||
|
||||
set(OpenBLAS_MAJOR_VERSION 0)
|
||||
|
||||
@@ -45,13 +45,15 @@ if (NOT ONLY_CBLAS)
|
||||
|
||||
# TODO: detect whether underscore needed, set #defines and BU appropriately - use try_compile
|
||||
# TODO: set FEXTRALIB flags a la f_check?
|
||||
|
||||
if (NOT (${CMAKE_SYSTEM_NAME} MATCHES "Windows" AND x${CMAKE_Fortran_COMPILER_ID} MATCHES "IntelLLVM"))
|
||||
set(BU "_")
|
||||
file(APPEND ${TARGET_CONF_TEMP}
|
||||
"#define BUNDERSCORE _\n"
|
||||
"#define NEEDBUNDERSCORE 1\n"
|
||||
"#define NEED2UNDERSCORES 0\n")
|
||||
|
||||
else ()
|
||||
set (FCOMMON_OPT "${FCOMMON_OPT} /fp:precise /recursive /names:lowercase /assume:nounderscore")
|
||||
endif()
|
||||
else ()
|
||||
|
||||
#When we only build CBLAS, we set NOFORTRAN=2
|
||||
|
||||
@@ -58,7 +58,7 @@ set(TARGET_CONF_TEMP "${PROJECT_BINARY_DIR}/${TARGET_CONF}.tmp")
|
||||
|
||||
# c_check
|
||||
set(FU "")
|
||||
if (APPLE OR (MSVC AND NOT ${CMAKE_C_COMPILER_ID} MATCHES "Clang"))
|
||||
if (APPLE OR (MSVC AND NOT (${CMAKE_C_COMPILER_ID} MATCHES "Clang" OR ${CMAKE_C_COMPILER_ID} MATCHES "IntelLLVM")))
|
||||
set(FU "_")
|
||||
endif()
|
||||
if(MINGW AND NOT MINGW64)
|
||||
@@ -1433,7 +1433,9 @@ else(NOT CMAKE_CROSSCOMPILING)
|
||||
message(STATUS "MSVC")
|
||||
set(GETARCH_FLAGS ${GETARCH_FLAGS} -DFORCE_GENERIC)
|
||||
else()
|
||||
list(APPEND GETARCH_SRC ${PROJECT_SOURCE_DIR}/cpuid.S)
|
||||
if ("${CMAKE_SYSTEM_NAME}" STREQUAL "Darwin")
|
||||
list(APPEND GETARCH_SRC ${PROJECT_SOURCE_DIR}/cpuid.S)
|
||||
endif()
|
||||
if (DEFINED TARGET_CORE)
|
||||
set(GETARCH_FLAGS ${GETARCH_FLAGS} -DFORCE_${TARGET_CORE})
|
||||
endif ()
|
||||
|
||||
@@ -672,6 +672,9 @@ endif ()
|
||||
if (${CMAKE_C_COMPILER} STREQUAL "LSB" OR ${CMAKE_SYSTEM_NAME} STREQUAL "Windows")
|
||||
set(LAPACK_CFLAGS "${LAPACK_CFLAGS} -DLAPACK_COMPLEX_STRUCTURE")
|
||||
endif ()
|
||||
if (${CMAKE_C_COMPILER_ID} MATCHES "IntelLLVM" AND ${CMAKE_SYSTEM_NAME} STREQUAL "Windows")
|
||||
set(LAPACK_CFLAGS "${LAPACK_CFLAGS} -DNOCHANGE")
|
||||
endif ()
|
||||
|
||||
if ("${CMAKE_BUILD_TYPE}" STREQUAL "Release")
|
||||
if ("${F_COMPILER}" STREQUAL "FLANG")
|
||||
|
||||
@@ -10,6 +10,10 @@
|
||||
#define int long
|
||||
#endif
|
||||
|
||||
#if defined(_MSC_VER) && defined(__INTEL_CLANG_COMPILER)
|
||||
//#define LAPACK_COMPLEX_STRUCTURE
|
||||
#define NOCHANGE
|
||||
#endif
|
||||
/* e.g. mingw64/x86_64-w64-mingw32/include/winerror.h */
|
||||
#ifdef FAILED
|
||||
#undef FAILED
|
||||
|
||||
@@ -67,8 +67,14 @@ extern "C" {
|
||||
#define lapack_logical lapack_int
|
||||
#endif
|
||||
|
||||
#if defined(_MSC_VER) && defined(__INTEL_CLANG_COMPILER)
|
||||
#define LAPACK_COMPLEX_STRUCTURE
|
||||
#define LAPACK_GLOBAL(lcname,UCNAME) lcname
|
||||
#define NOCHANGE
|
||||
#endif
|
||||
|
||||
#ifndef LAPACK_COMPLEX_CUSTOM
|
||||
#if defined(_MSC_VER)
|
||||
#if defined(_MSC_VER) && !defined(__INTEL_CLANG_COMPILER)
|
||||
#define _CRT_USE_C_COMPLEX_H
|
||||
#include <complex.h>
|
||||
#define LAPACK_COMPLEX_CUSTOM
|
||||
|
||||
@@ -36,7 +36,10 @@ USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
#include <stdlib.h>
|
||||
#include "ctest.h"
|
||||
|
||||
#if defined(_MSC_VER) && defined(__INTEL_CLANG_COMPILER)
|
||||
//#define LAPACK_COMPLEX_STRUCTURE
|
||||
#define NOCHANGE
|
||||
#endif
|
||||
#include <common.h>
|
||||
#include <math.h>
|
||||
|
||||
|
||||
@@ -206,7 +206,7 @@ void ztranspose(blasint rows, blasint cols, double *alpha, double *a_src, int ld
|
||||
* param lda_dst - leading dimension of output matrix A
|
||||
* param conj specifies conjugation
|
||||
*/
|
||||
void scopy(blasint rows, blasint cols, float alpha, float *a_src, int lda_src,
|
||||
void my_scopy(blasint rows, blasint cols, float alpha, float *a_src, int lda_src,
|
||||
float *a_dst, blasint lda_dst)
|
||||
{
|
||||
blasint i, j;
|
||||
@@ -217,7 +217,7 @@ void scopy(blasint rows, blasint cols, float alpha, float *a_src, int lda_src,
|
||||
}
|
||||
}
|
||||
|
||||
void dcopy(blasint rows, blasint cols, double alpha, double *a_src, int lda_src,
|
||||
void my_dcopy(blasint rows, blasint cols, double alpha, double *a_src, int lda_src,
|
||||
double *a_dst, blasint lda_dst)
|
||||
{
|
||||
blasint i, j;
|
||||
@@ -228,7 +228,7 @@ void dcopy(blasint rows, blasint cols, double alpha, double *a_src, int lda_src,
|
||||
}
|
||||
}
|
||||
|
||||
void ccopy(blasint rows, blasint cols, float *alpha, float *a_src, int lda_src,
|
||||
void my_ccopy(blasint rows, blasint cols, float *alpha, float *a_src, int lda_src,
|
||||
float *a_dst, blasint lda_dst, int conj)
|
||||
{
|
||||
blasint i, j;
|
||||
@@ -243,7 +243,7 @@ void ccopy(blasint rows, blasint cols, float *alpha, float *a_src, int lda_src,
|
||||
}
|
||||
}
|
||||
|
||||
void zcopy(blasint rows, blasint cols, double *alpha, double *a_src, int lda_src,
|
||||
void my_zcopy(blasint rows, blasint cols, double *alpha, double *a_src, int lda_src,
|
||||
double *a_dst, blasint lda_dst, int conj)
|
||||
{
|
||||
blasint i, j;
|
||||
|
||||
@@ -65,12 +65,12 @@ extern void ctranspose(blasint rows, blasint cols, float *alpha, float *a_src, i
|
||||
extern void ztranspose(blasint rows, blasint cols, double *alpha, double *a_src, int lda_src,
|
||||
double *a_dst, blasint lda_dst, int conj);
|
||||
|
||||
extern void scopy(blasint rows, blasint cols, float alpha, float *a_src, int lda_src,
|
||||
extern void my_scopy(blasint rows, blasint cols, float alpha, float *a_src, int lda_src,
|
||||
float *a_dst, blasint lda_dst);
|
||||
extern void dcopy(blasint rows, blasint cols, double alpha, double *a_src, int lda_src,
|
||||
extern void my_dcopy(blasint rows, blasint cols, double alpha, double *a_src, int lda_src,
|
||||
double *a_dst, blasint lda_dst);
|
||||
extern void ccopy(blasint rows, blasint cols, float *alpha, float *a_src, int lda_src,
|
||||
extern void my_ccopy(blasint rows, blasint cols, float *alpha, float *a_src, int lda_src,
|
||||
float *a_dst, blasint lda_dst, int conj);
|
||||
extern void zcopy(blasint rows, blasint cols, double *alpha, double *a_src, int lda_src,
|
||||
extern void my_zcopy(blasint rows, blasint cols, double *alpha, double *a_src, int lda_src,
|
||||
double *a_dst, blasint lda_dst, int conj);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
@@ -91,7 +91,7 @@ static float check_cimatcopy(char api, char order, char trans, blasint rows, bla
|
||||
ctranspose(m, n, alpha, data_cimatcopy.a_test, lda_src, data_cimatcopy.a_verify, lda_dst, conj);
|
||||
}
|
||||
else {
|
||||
ccopy(m, n, alpha, data_cimatcopy.a_test, lda_src, data_cimatcopy.a_verify, lda_dst, conj);
|
||||
my_ccopy(m, n, alpha, data_cimatcopy.a_test, lda_src, data_cimatcopy.a_verify, lda_dst, conj);
|
||||
}
|
||||
|
||||
if (api == 'F') {
|
||||
|
||||
@@ -92,7 +92,7 @@ static float check_comatcopy(char api, char order, char trans, blasint rows, bla
|
||||
ctranspose(m, n, alpha, data_comatcopy.a_test, lda, data_comatcopy.b_verify, ldb, conj);
|
||||
}
|
||||
else {
|
||||
ccopy(m, n, alpha, data_comatcopy.a_test, lda, data_comatcopy.b_verify, ldb, conj);
|
||||
my_ccopy(m, n, alpha, data_comatcopy.a_test, lda, data_comatcopy.b_verify, ldb, conj);
|
||||
}
|
||||
|
||||
if (api == 'F') {
|
||||
|
||||
@@ -86,7 +86,7 @@ static double check_dimatcopy(char api, char order, char trans, blasint rows, bl
|
||||
dtranspose(m, n, alpha, data_dimatcopy.a_test, lda_src, data_dimatcopy.a_verify, lda_dst);
|
||||
}
|
||||
else {
|
||||
dcopy(m, n, alpha, data_dimatcopy.a_test, lda_src, data_dimatcopy.a_verify, lda_dst);
|
||||
my_dcopy(m, n, alpha, data_dimatcopy.a_test, lda_src, data_dimatcopy.a_verify, lda_dst);
|
||||
}
|
||||
|
||||
if (api == 'F') {
|
||||
|
||||
@@ -87,7 +87,7 @@ static double check_domatcopy(char api, char order, char trans, blasint rows, bl
|
||||
dtranspose(m, n, alpha, data_domatcopy.a_test, lda, data_domatcopy.b_verify, ldb);
|
||||
}
|
||||
else {
|
||||
dcopy(m, n, alpha, data_domatcopy.a_test, lda, data_domatcopy.b_verify, ldb);
|
||||
my_dcopy(m, n, alpha, data_domatcopy.a_test, lda, data_domatcopy.b_verify, ldb);
|
||||
}
|
||||
|
||||
if (api == 'F') {
|
||||
|
||||
@@ -86,7 +86,7 @@ static float check_simatcopy(char api, char order, char trans, blasint rows, bla
|
||||
stranspose(m, n, alpha, data_simatcopy.a_test, lda_src, data_simatcopy.a_verify, lda_dst);
|
||||
}
|
||||
else {
|
||||
scopy(m, n, alpha, data_simatcopy.a_test, lda_src, data_simatcopy.a_verify, lda_dst);
|
||||
my_scopy(m, n, alpha, data_simatcopy.a_test, lda_src, data_simatcopy.a_verify, lda_dst);
|
||||
}
|
||||
|
||||
if (api == 'F') {
|
||||
|
||||
@@ -87,7 +87,7 @@ static float check_somatcopy(char api, char order, char trans, blasint rows, bla
|
||||
stranspose(m, n, alpha, data_somatcopy.a_test, lda, data_somatcopy.b_verify, ldb);
|
||||
}
|
||||
else {
|
||||
scopy(m, n, alpha, data_somatcopy.a_test, lda, data_somatcopy.b_verify, ldb);
|
||||
my_scopy(m, n, alpha, data_somatcopy.a_test, lda, data_somatcopy.b_verify, ldb);
|
||||
}
|
||||
|
||||
if (api == 'F') {
|
||||
|
||||
@@ -91,7 +91,7 @@ static double check_zimatcopy(char api, char order, char trans, blasint rows, bl
|
||||
ztranspose(m, n, alpha, data_zimatcopy.a_test, lda_src, data_zimatcopy.a_verify, lda_dst, conj);
|
||||
}
|
||||
else {
|
||||
zcopy(m, n, alpha, data_zimatcopy.a_test, lda_src, data_zimatcopy.a_verify, lda_dst, conj);
|
||||
my_zcopy(m, n, alpha, data_zimatcopy.a_test, lda_src, data_zimatcopy.a_verify, lda_dst, conj);
|
||||
}
|
||||
|
||||
if (api == 'F') {
|
||||
|
||||
@@ -92,7 +92,7 @@ static double check_zomatcopy(char api, char order, char trans, blasint rows, bl
|
||||
ztranspose(m, n, alpha, data_zomatcopy.a_test, lda, data_zomatcopy.b_verify, ldb, conj);
|
||||
}
|
||||
else {
|
||||
zcopy(m, n, alpha, data_zomatcopy.a_test, lda, data_zomatcopy.b_verify, ldb, conj);
|
||||
my_zcopy(m, n, alpha, data_zomatcopy.a_test, lda, data_zomatcopy.b_verify, ldb, conj);
|
||||
}
|
||||
|
||||
if (api == 'F') {
|
||||
|
||||
Reference in New Issue
Block a user