Skip to content

Commit 7a879fa

Browse files
committed
add blas integer model 32
1 parent 7055824 commit 7a879fa

File tree

5 files changed

+18
-2
lines changed

5 files changed

+18
-2
lines changed

CMakeLists.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,8 @@ option(HIPO "Build HIPO" OFF)
150150
message(STATUS "Build HIPO: ${HIPO}")
151151
option(BUILD_OPENBLAS "Build OpenBLAS" OFF)
152152
message(STATUS "Build OpenBLAS: ${BUILD_OPENBLAS}")
153+
option(OPENBLAS_WIN_32 "Build 32bit OpenBLAS on Windows" OFF)
154+
153155
if (HIPO AND CSHARP)
154156
message(ERROR "HIPO is only available in C++. Not yet supported in C#.")
155157
endif()

cmake/FindHipoDeps.cmake

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,8 @@ if (BUILD_OPENBLAS)
2727
if(WIN32 AND CMAKE_SIZEOF_VOID_P EQUAL 4)
2828
message(STATUS "32-bit target detected. Applying 32-bit configuration flags for OpenBLAS.")
2929

30+
set(OPENBLAS_WIN_32 ON)
31+
3032
list(APPEND OPENBLAS_MINIMAL_FLAGS -DCMAKE_GENERATOR_PLATFORM=Win32)
3133

3234
# Crucial for static linking: Force OpenBLAS to use the static runtime
@@ -37,9 +39,9 @@ if (BUILD_OPENBLAS)
3739
set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded")
3840

3941
list(APPEND OPENBLAS_MINIMAL_FLAGS -DUSE_THREAD=OFF)
40-
4142
list(APPEND OPENBLAS_MINIMAL_FLAGS -DINTERFACE64=0)
4243

44+
4345
# Note: If OpenBLAS has an internal logic flag to force 32-bit, you would add it here.
4446
# Example (hypothetical):
4547
# list(APPEND OPENBLAS_MINIMAL_FLAGS -DOPENBLAS_32BIT=ON)

highs/HConfig.h.in

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@
1313
#cmakedefine HIGHS_HAVE_BUILTIN_CLZ
1414
#cmakedefine HIGHS_HAVE_BITSCAN_REVERSE
1515
#cmakedefine BLAS_LIBRARIES "@BLAS_LIBRARIES@"
16+
#cmakedefine OPENBLAS_WIN_32
17+
1618

1719
#define HIGHS_GITHASH "@GITHASH@"
1820
#define HIGHS_VERSION_MAJOR @HIGHS_VERSION_MAJOR@

highs/ipm/hipo/auxiliary/AutoDetect.cpp

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,11 @@ IntegerModel getBlasIntegerModel() {
3131

3232
const float X[3] = {1.0f, 2.0f, 3.0f};
3333

34+
// Check windows
35+
#ifndef OPENBLAS_WIN_32
36+
blas_model = IntegerModel::lp32;
37+
#else
38+
3439
const int64_t incx = 1;
3540
int64_t max_idx = cblas_isamax(n, X, incx);
3641

@@ -49,6 +54,8 @@ IntegerModel getBlasIntegerModel() {
4954
// something went wrong
5055
blas_model = IntegerModel::unknown;
5156
}
57+
#endif
58+
5259
}
5360

5461
return blas_model;
@@ -62,6 +69,9 @@ std::string getIntegerModelString(IntegerModel i) {
6269
case IntegerModel::unknown:
6370
return "Unknown";
6471

72+
case IntegerModel::lp32:
73+
return "LP32";
74+
6575
case IntegerModel::lp64:
6676
return "LP64";
6777

highs/ipm/hipo/auxiliary/AutoDetect.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
namespace hipo {
77
// Detect BLAS integer model
8-
enum class IntegerModel { not_set, unknown, lp64, ilp64 };
8+
enum class IntegerModel { not_set, unknown, lp32, lp64, ilp64 };
99
IntegerModel getBlasIntegerModel();
1010

1111
std::string getIntegerModelString(IntegerModel i);

0 commit comments

Comments
 (0)