Skip to content

Commit 1f03262

Browse files
committed
add 32
1 parent 50827d2 commit 1f03262

File tree

7 files changed

+168
-55
lines changed

7 files changed

+168
-55
lines changed

.github/workflows/hipo-fetch.yml

Lines changed: 79 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,83 @@ jobs:
2121
working-directory: ${{runner.workspace}}/build
2222
run: |
2323
cmake $GITHUB_WORKSPACE -DHIPO=ON -DBUILD_OPENBLAS=ON \
24-
-DALL_TESTS=${{ matrix.all_tests }}
24+
-DALL_TESTS=${{ matrix.all_tests }}
25+
26+
- name: Build
27+
working-directory: ${{runner.workspace}}/build
28+
run: |
29+
cmake --build . --parallel
30+
31+
- name: Test executable
32+
working-directory: ${{runner.workspace}}/build
33+
run: ./bin/highs --solver=hipo $GITHUB_WORKSPACE/check/instances/afiro.mps
34+
35+
- name: Ctest
36+
working-directory: ${{runner.workspace}}/build
37+
run: |
38+
ctest --parallel --timeout 300 --output-on-failure
39+
40+
ubuntu_32:
41+
runs-on: ubuntu-latest
42+
strategy:
43+
matrix:
44+
# config: [Release, Debug]
45+
config: [Release]
46+
all_tests: [ON]
47+
48+
steps:
49+
- uses: actions/checkout@v4
50+
51+
- name: Create Build Environment
52+
run: cmake -E make_directory ${{runner.workspace}}/build
53+
54+
- name: Configure CMake
55+
working-directory: ${{runner.workspace}}/build
56+
run: |
57+
cmake $GITHUB_WORKSPACE -DHIPO=ON -DBUILD_OPENBLAS=ON \
58+
-DALL_TESTS=${{ matrix.all_tests }} \
59+
-DCMAKE_C_FLAGS="-m32" \
60+
-DCMAKE_CXX_FLAGS="-m32" \
61+
-DCMAKE_SHARED_LINKER_FLAGS="-m32"
62+
63+
- name: Build
64+
working-directory: ${{runner.workspace}}/build
65+
run: |
66+
cmake --build . --parallel
67+
68+
- name: Test executable
69+
working-directory: ${{runner.workspace}}/build
70+
run: ./bin/highs --solver=hipo $GITHUB_WORKSPACE/check/instances/afiro.mps
71+
72+
- name: Ctest
73+
working-directory: ${{runner.workspace}}/build
74+
run: |
75+
ctest --parallel --timeout 300 --output-on-failure ubuntu_32:
76+
77+
ubuntu_32_arm:
78+
runs-on: ubuntu-latest-arm
79+
strategy:
80+
matrix:
81+
# config: [Release, Debug]
82+
config: [Release]
83+
all_tests: [ON]
84+
85+
steps:
86+
- uses: actions/checkout@v4
87+
88+
- name: Create Build Environment
89+
run: cmake -E make_directory ${{runner.workspace}}/build
90+
91+
# sudo apt-get update
92+
# sudo apt-get install -y gcc-arm-linux-gnueabihf g++-arm-linux-gnueabihf
93+
94+
- name: Configure CMake
95+
working-directory: ${{runner.workspace}}/build
96+
run: |
97+
export CC=arm-linux-gnueabihf-gcc
98+
export CXX=arm-linux-gnueabihf-g++
99+
cmake $GITHUB_WORKSPACE -DHIPO=ON -DBUILD_OPENBLAS=ON \
100+
-DALL_TESTS=${{ matrix.all_tests }}
25101
26102
- name: Build
27103
working-directory: ${{runner.workspace}}/build
@@ -43,6 +119,7 @@ jobs:
43119
matrix:
44120
config: [Release]
45121
all_tests: [ON]
122+
arch: ["x64", "Win32"]
46123

47124
steps:
48125
- uses: actions/checkout@v4
@@ -53,6 +130,7 @@ jobs:
53130
cmake `
54131
-S "$env:GITHUB_WORKSPACE" `
55132
-B "${{ runner.workspace }}/build" `
133+
-A ${{ matrix.arch }}
56134
-DHIPO=ON `
57135
-DALL_TESTS=${{ matrix.all_tests }} `
58136
-DBUILD_OPENBLAS=ON

.github/workflows/release-cpack.yml

Lines changed: 48 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -71,54 +71,54 @@ jobs:
7171
name: windows-${{ matrix.arch }}
7272
path: build/*.zip
7373

74-
# build-windows-32:
75-
# runs-on: windows-latest
76-
# strategy:
77-
# fail-fast: false
78-
# matrix:
79-
# arch: [Win32]
80-
# steps:
81-
# - uses: actions/checkout@v3
82-
# - name: Build
83-
# run: |
84-
# cmake -B build -G "Visual Studio 17 2022" -A ${{ matrix.arch }} `
85-
# -DHIPO=ON -DBUILD_OPENBLAS=ON -DBUILD_STATIC_EXE=ON `
86-
# -DCMAKE_MSVC_RUNTIME_LIBRARY=MultiThreadedDLL
87-
# cmake --build build --config Release --parallel
88-
# cd build
89-
# cpack -C Release
90-
91-
# # -DCMAKE_MSVC_RUNTIME_LIBRARY=MultiThreadedDLL
92-
# # Win32
93-
94-
# - name: Upload artifacts
95-
# uses: actions/upload-artifact@v4
96-
# with:
97-
# name: windows-${{ matrix.arch }}
98-
# path: build/*.zip
99-
100-
# build-windows-arm-32:
101-
# runs-on: windows-11-arm
102-
# strategy:
103-
# matrix:
104-
# arch: [ARM]
105-
# steps:
106-
# - uses: actions/checkout@v3
107-
# - name: Build
108-
# run: |
109-
# cmake -B build -G "Visual Studio 17 2022" -A ${{ matrix.arch }} `
110-
# -DHIPO=ON -DBUILD_OPENBLAS=ON -DBUILD_STATIC_EXE=ON `
111-
# -DCMAKE_MSVC_RUNTIME_LIBRARY=MultiThreadedDLL `
112-
# -DCMAKE_VS_WINDOWS_SDK_VERSION=10.0.20348.0
113-
# cmake --build build --config Release --parallel
114-
# cd build
115-
# cpack -C Release
116-
117-
# - name: Upload artifacts
118-
# uses: actions/upload-artifact@v4
119-
# with:
120-
# name: windows-${{ matrix.arch }}
121-
# path: build/*.zip
74+
build-windows-32:
75+
runs-on: windows-latest
76+
strategy:
77+
fail-fast: false
78+
matrix:
79+
arch: [Win32]
80+
steps:
81+
- uses: actions/checkout@v3
82+
- name: Build
83+
run: |
84+
cmake -B build -G "Visual Studio 17 2022" -A ${{ matrix.arch }} `
85+
-DHIPO=ON -DBUILD_OPENBLAS=ON -DBUILD_STATIC_EXE=ON `
86+
-DCMAKE_MSVC_RUNTIME_LIBRARY=MultiThreadedDLL
87+
cmake --build build --config Release --parallel
88+
cd build
89+
cpack -C Release
90+
91+
# -DCMAKE_MSVC_RUNTIME_LIBRARY=MultiThreadedDLL
92+
# Win32
93+
94+
- name: Upload artifacts
95+
uses: actions/upload-artifact@v4
96+
with:
97+
name: windows-${{ matrix.arch }}
98+
path: build/*.zip
99+
100+
build-windows-arm-32:
101+
runs-on: windows-11-arm
102+
strategy:
103+
matrix:
104+
arch: [ARM]
105+
steps:
106+
- uses: actions/checkout@v3
107+
- name: Build
108+
run: |
109+
cmake -B build -G "Visual Studio 17 2022" -A ${{ matrix.arch }} `
110+
-DHIPO=ON -DBUILD_OPENBLAS=ON -DBUILD_STATIC_EXE=ON `
111+
-DCMAKE_MSVC_RUNTIME_LIBRARY=MultiThreadedDLL `
112+
-DCMAKE_VS_WINDOWS_SDK_VERSION=10.0.20348.0
113+
cmake --build build --config Release --parallel
114+
cd build
115+
cpack -C Release
116+
117+
- name: Upload artifacts
118+
uses: actions/upload-artifact@v4
119+
with:
120+
name: windows-${{ matrix.arch }}
121+
path: build/*.zip
122122

123123
build-windows-arm:
124124
runs-on: windows-11-arm

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: 26 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,34 @@ if (BUILD_OPENBLAS)
1616
-DNO_COMPLEX=ON
1717
-DNO_SINGLE=ON
1818
-DONLY_BLAS=ON
19+
)
1920

20-
# Crucial for size on ARM: Target the specific architecture
21-
-DTARGET=ARMV8
21+
if(CMAKE_SYSTEM_PROCESSOR MATCHES "aarch64|arm64|armv8|arm")
22+
message(STATUS "ARM architecture detected. Applying -DTARGET=ARMV8.")
23+
list(APPEND OPENBLAS_MINIMAL_FLAGS -DTARGET=ARMV8)
24+
endif()
2225

23-
# may be needed for 32 bit
24-
# -DCMAKE_MSVC_RUNTIME_LIBRARY=MultiThreadedDLL
25-
)
26+
# CMAKE_SIZEOF_VOID_P is 4 for 32-bit builds, 8 for 64-bit builds.
27+
if(WIN32 AND CMAKE_SIZEOF_VOID_P EQUAL 4)
28+
message(STATUS "32-bit target detected. Applying 32-bit configuration flags for OpenBLAS.")
29+
30+
set(OPENBLAS_WIN_32 ON)
31+
32+
list(APPEND OPENBLAS_MINIMAL_FLAGS -DCMAKE_GENERATOR_PLATFORM=Win32)
33+
34+
# Crucial for static linking: Force OpenBLAS to use the static runtime
35+
if (NOT BUILD_SHARED_LIBS)
36+
set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded")
37+
endif()
38+
39+
40+
# list(APPEND OPENBLAS_MINIMAL_FLAGS -DUSE_THREAD=OFF)
41+
list(APPEND OPENBLAS_MINIMAL_FLAGS -DINTERFACE64=0)
42+
43+
# If the MSVC runtime library issue persists, you can try this flag as well,
44+
# though CMAKE_GENERATOR_PLATFORM should usually be sufficient.
45+
# list(APPEND OPENBLAS_MINIMAL_FLAGS -DCMAKE_MSVC_RUNTIME_LIBRARY=MultiThreadedDLL)
46+
endif()
2647

2748
message(CHECK_START "Fetching OpenBLAS")
2849
list(APPEND CMAKE_MESSAGE_INDENT " ")

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)