Skip to content

Commit 6af4e76

Browse files
authored
Merge pull request #5029 from martin-frbg/issue5020
Add support for compiling with Intel oneAPI 2025.0 on MS Windows
2 parents 37a4ca7 + fbf594b commit 6af4e76

17 files changed

+44
-23
lines changed

CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
cmake_minimum_required(VERSION 3.16.0)
66

7+
set (CMAKE_ASM_SOURCE_FILE_EXTENSIONS "S")
78
project(OpenBLAS C ASM)
89

910
set(OpenBLAS_MAJOR_VERSION 0)

cmake/f_check.cmake

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,13 +45,15 @@ if (NOT ONLY_CBLAS)
4545

4646
# TODO: detect whether underscore needed, set #defines and BU appropriately - use try_compile
4747
# TODO: set FEXTRALIB flags a la f_check?
48-
48+
if (NOT (${CMAKE_SYSTEM_NAME} MATCHES "Windows" AND x${CMAKE_Fortran_COMPILER_ID} MATCHES "IntelLLVM"))
4949
set(BU "_")
5050
file(APPEND ${TARGET_CONF_TEMP}
5151
"#define BUNDERSCORE _\n"
5252
"#define NEEDBUNDERSCORE 1\n"
5353
"#define NEED2UNDERSCORES 0\n")
54-
54+
else ()
55+
set (FCOMMON_OPT "${FCOMMON_OPT} /fp:precise /recursive /names:lowercase /assume:nounderscore")
56+
endif()
5557
else ()
5658

5759
#When we only build CBLAS, we set NOFORTRAN=2

cmake/prebuild.cmake

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ set(TARGET_CONF_TEMP "${PROJECT_BINARY_DIR}/${TARGET_CONF}.tmp")
5858

5959
# c_check
6060
set(FU "")
61-
if (APPLE OR (MSVC AND NOT ${CMAKE_C_COMPILER_ID} MATCHES "Clang"))
61+
if (APPLE OR (MSVC AND NOT (${CMAKE_C_COMPILER_ID} MATCHES "Clang" OR ${CMAKE_C_COMPILER_ID} MATCHES "IntelLLVM")))
6262
set(FU "_")
6363
endif()
6464
if(MINGW AND NOT MINGW64)
@@ -1433,7 +1433,9 @@ else(NOT CMAKE_CROSSCOMPILING)
14331433
message(STATUS "MSVC")
14341434
set(GETARCH_FLAGS ${GETARCH_FLAGS} -DFORCE_GENERIC)
14351435
else()
1436-
list(APPEND GETARCH_SRC ${PROJECT_SOURCE_DIR}/cpuid.S)
1436+
if ("${CMAKE_SYSTEM_NAME}" STREQUAL "Darwin")
1437+
list(APPEND GETARCH_SRC ${PROJECT_SOURCE_DIR}/cpuid.S)
1438+
endif()
14371439
if (DEFINED TARGET_CORE)
14381440
set(GETARCH_FLAGS ${GETARCH_FLAGS} -DFORCE_${TARGET_CORE})
14391441
endif ()

cmake/system.cmake

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -672,6 +672,9 @@ endif ()
672672
if (${CMAKE_C_COMPILER} STREQUAL "LSB" OR ${CMAKE_SYSTEM_NAME} STREQUAL "Windows")
673673
set(LAPACK_CFLAGS "${LAPACK_CFLAGS} -DLAPACK_COMPLEX_STRUCTURE")
674674
endif ()
675+
if (${CMAKE_C_COMPILER_ID} MATCHES "IntelLLVM" AND ${CMAKE_SYSTEM_NAME} STREQUAL "Windows")
676+
set(LAPACK_CFLAGS "${LAPACK_CFLAGS} -DNOCHANGE")
677+
endif ()
675678

676679
if ("${CMAKE_BUILD_TYPE}" STREQUAL "Release")
677680
if ("${F_COMPILER}" STREQUAL "FLANG")

ctest/cblas_test.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,10 @@
1010
#define int long
1111
#endif
1212

13+
#if defined(_MSC_VER) && defined(__INTEL_CLANG_COMPILER)
14+
//#define LAPACK_COMPLEX_STRUCTURE
15+
#define NOCHANGE
16+
#endif
1317
/* e.g. mingw64/x86_64-w64-mingw32/include/winerror.h */
1418
#ifdef FAILED
1519
#undef FAILED

lapack-netlib/LAPACKE/include/lapacke_config.h

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,8 +67,14 @@ extern "C" {
6767
#define lapack_logical lapack_int
6868
#endif
6969

70+
#if defined(_MSC_VER) && defined(__INTEL_CLANG_COMPILER)
71+
#define LAPACK_COMPLEX_STRUCTURE
72+
#define LAPACK_GLOBAL(lcname,UCNAME) lcname
73+
#define NOCHANGE
74+
#endif
75+
7076
#ifndef LAPACK_COMPLEX_CUSTOM
71-
#if defined(_MSC_VER)
77+
#if defined(_MSC_VER) && !defined(__INTEL_CLANG_COMPILER)
7278
#define _CRT_USE_C_COMPLEX_H
7379
#include <complex.h>
7480
#define LAPACK_COMPLEX_CUSTOM

utest/openblas_utest.h

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,10 @@ USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
3636

3737
#include <stdlib.h>
3838
#include "ctest.h"
39-
39+
#if defined(_MSC_VER) && defined(__INTEL_CLANG_COMPILER)
40+
//#define LAPACK_COMPLEX_STRUCTURE
41+
#define NOCHANGE
42+
#endif
4043
#include <common.h>
4144
#include <math.h>
4245

utest/test_extensions/common.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,7 @@ void ztranspose(blasint rows, blasint cols, double *alpha, double *a_src, int ld
206206
* param lda_dst - leading dimension of output matrix A
207207
* param conj specifies conjugation
208208
*/
209-
void scopy(blasint rows, blasint cols, float alpha, float *a_src, int lda_src,
209+
void my_scopy(blasint rows, blasint cols, float alpha, float *a_src, int lda_src,
210210
float *a_dst, blasint lda_dst)
211211
{
212212
blasint i, j;
@@ -217,7 +217,7 @@ void scopy(blasint rows, blasint cols, float alpha, float *a_src, int lda_src,
217217
}
218218
}
219219

220-
void dcopy(blasint rows, blasint cols, double alpha, double *a_src, int lda_src,
220+
void my_dcopy(blasint rows, blasint cols, double alpha, double *a_src, int lda_src,
221221
double *a_dst, blasint lda_dst)
222222
{
223223
blasint i, j;
@@ -228,7 +228,7 @@ void dcopy(blasint rows, blasint cols, double alpha, double *a_src, int lda_src,
228228
}
229229
}
230230

231-
void ccopy(blasint rows, blasint cols, float *alpha, float *a_src, int lda_src,
231+
void my_ccopy(blasint rows, blasint cols, float *alpha, float *a_src, int lda_src,
232232
float *a_dst, blasint lda_dst, int conj)
233233
{
234234
blasint i, j;
@@ -243,7 +243,7 @@ void ccopy(blasint rows, blasint cols, float *alpha, float *a_src, int lda_src,
243243
}
244244
}
245245

246-
void zcopy(blasint rows, blasint cols, double *alpha, double *a_src, int lda_src,
246+
void my_zcopy(blasint rows, blasint cols, double *alpha, double *a_src, int lda_src,
247247
double *a_dst, blasint lda_dst, int conj)
248248
{
249249
blasint i, j;

utest/test_extensions/common.h

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -65,12 +65,12 @@ extern void ctranspose(blasint rows, blasint cols, float *alpha, float *a_src, i
6565
extern void ztranspose(blasint rows, blasint cols, double *alpha, double *a_src, int lda_src,
6666
double *a_dst, blasint lda_dst, int conj);
6767

68-
extern void scopy(blasint rows, blasint cols, float alpha, float *a_src, int lda_src,
68+
extern void my_scopy(blasint rows, blasint cols, float alpha, float *a_src, int lda_src,
6969
float *a_dst, blasint lda_dst);
70-
extern void dcopy(blasint rows, blasint cols, double alpha, double *a_src, int lda_src,
70+
extern void my_dcopy(blasint rows, blasint cols, double alpha, double *a_src, int lda_src,
7171
double *a_dst, blasint lda_dst);
72-
extern void ccopy(blasint rows, blasint cols, float *alpha, float *a_src, int lda_src,
72+
extern void my_ccopy(blasint rows, blasint cols, float *alpha, float *a_src, int lda_src,
7373
float *a_dst, blasint lda_dst, int conj);
74-
extern void zcopy(blasint rows, blasint cols, double *alpha, double *a_src, int lda_src,
74+
extern void my_zcopy(blasint rows, blasint cols, double *alpha, double *a_src, int lda_src,
7575
double *a_dst, blasint lda_dst, int conj);
76-
#endif
76+
#endif

utest/test_extensions/test_cimatcopy.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ static float check_cimatcopy(char api, char order, char trans, blasint rows, bla
9191
ctranspose(m, n, alpha, data_cimatcopy.a_test, lda_src, data_cimatcopy.a_verify, lda_dst, conj);
9292
}
9393
else {
94-
ccopy(m, n, alpha, data_cimatcopy.a_test, lda_src, data_cimatcopy.a_verify, lda_dst, conj);
94+
my_ccopy(m, n, alpha, data_cimatcopy.a_test, lda_src, data_cimatcopy.a_verify, lda_dst, conj);
9595
}
9696

9797
if (api == 'F') {

utest/test_extensions/test_comatcopy.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ static float check_comatcopy(char api, char order, char trans, blasint rows, bla
9292
ctranspose(m, n, alpha, data_comatcopy.a_test, lda, data_comatcopy.b_verify, ldb, conj);
9393
}
9494
else {
95-
ccopy(m, n, alpha, data_comatcopy.a_test, lda, data_comatcopy.b_verify, ldb, conj);
95+
my_ccopy(m, n, alpha, data_comatcopy.a_test, lda, data_comatcopy.b_verify, ldb, conj);
9696
}
9797

9898
if (api == 'F') {

utest/test_extensions/test_dimatcopy.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ static double check_dimatcopy(char api, char order, char trans, blasint rows, bl
8686
dtranspose(m, n, alpha, data_dimatcopy.a_test, lda_src, data_dimatcopy.a_verify, lda_dst);
8787
}
8888
else {
89-
dcopy(m, n, alpha, data_dimatcopy.a_test, lda_src, data_dimatcopy.a_verify, lda_dst);
89+
my_dcopy(m, n, alpha, data_dimatcopy.a_test, lda_src, data_dimatcopy.a_verify, lda_dst);
9090
}
9191

9292
if (api == 'F') {

utest/test_extensions/test_domatcopy.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ static double check_domatcopy(char api, char order, char trans, blasint rows, bl
8787
dtranspose(m, n, alpha, data_domatcopy.a_test, lda, data_domatcopy.b_verify, ldb);
8888
}
8989
else {
90-
dcopy(m, n, alpha, data_domatcopy.a_test, lda, data_domatcopy.b_verify, ldb);
90+
my_dcopy(m, n, alpha, data_domatcopy.a_test, lda, data_domatcopy.b_verify, ldb);
9191
}
9292

9393
if (api == 'F') {

utest/test_extensions/test_simatcopy.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ static float check_simatcopy(char api, char order, char trans, blasint rows, bla
8686
stranspose(m, n, alpha, data_simatcopy.a_test, lda_src, data_simatcopy.a_verify, lda_dst);
8787
}
8888
else {
89-
scopy(m, n, alpha, data_simatcopy.a_test, lda_src, data_simatcopy.a_verify, lda_dst);
89+
my_scopy(m, n, alpha, data_simatcopy.a_test, lda_src, data_simatcopy.a_verify, lda_dst);
9090
}
9191

9292
if (api == 'F') {

utest/test_extensions/test_somatcopy.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ static float check_somatcopy(char api, char order, char trans, blasint rows, bla
8787
stranspose(m, n, alpha, data_somatcopy.a_test, lda, data_somatcopy.b_verify, ldb);
8888
}
8989
else {
90-
scopy(m, n, alpha, data_somatcopy.a_test, lda, data_somatcopy.b_verify, ldb);
90+
my_scopy(m, n, alpha, data_somatcopy.a_test, lda, data_somatcopy.b_verify, ldb);
9191
}
9292

9393
if (api == 'F') {

utest/test_extensions/test_zimatcopy.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ static double check_zimatcopy(char api, char order, char trans, blasint rows, bl
9191
ztranspose(m, n, alpha, data_zimatcopy.a_test, lda_src, data_zimatcopy.a_verify, lda_dst, conj);
9292
}
9393
else {
94-
zcopy(m, n, alpha, data_zimatcopy.a_test, lda_src, data_zimatcopy.a_verify, lda_dst, conj);
94+
my_zcopy(m, n, alpha, data_zimatcopy.a_test, lda_src, data_zimatcopy.a_verify, lda_dst, conj);
9595
}
9696

9797
if (api == 'F') {

utest/test_extensions/test_zomatcopy.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ static double check_zomatcopy(char api, char order, char trans, blasint rows, bl
9292
ztranspose(m, n, alpha, data_zomatcopy.a_test, lda, data_zomatcopy.b_verify, ldb, conj);
9393
}
9494
else {
95-
zcopy(m, n, alpha, data_zomatcopy.a_test, lda, data_zomatcopy.b_verify, ldb, conj);
95+
my_zcopy(m, n, alpha, data_zomatcopy.a_test, lda, data_zomatcopy.b_verify, ldb, conj);
9696
}
9797

9898
if (api == 'F') {

0 commit comments

Comments
 (0)