Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions .github/scripts/cmake-consumer/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
cmake_minimum_required(VERSION 3.19)
project(openblas_cmake_consumer C)

find_package(OpenBLAS REQUIRED CONFIG)
# a repeated lookup must not try to redefine the imported target
find_package(OpenBLAS REQUIRED CONFIG)

get_target_property(implib OpenBLAS::OpenBLAS IMPORTED_IMPLIB)
get_filename_component(implib_name "${implib}" NAME)
if (NOT implib_name STREQUAL EXPECTED_IMPLIB)
message(FATAL_ERROR "IMPORTED_IMPLIB is ${implib}, expected ${EXPECTED_IMPLIB}")
endif ()

add_executable(consumer main.c)
target_link_libraries(consumer PRIVATE OpenBLAS::OpenBLAS)
8 changes: 8 additions & 0 deletions .github/scripts/cmake-consumer/main.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#include <cblas.h>

int main(void)
{
double a[4] = {1, 2, 3, 4}, b[4] = {5, 6, 7, 8}, c[4] = {0};
cblas_dgemm(CblasRowMajor, CblasNoTrans, CblasNoTrans, 2, 2, 2, 1.0, a, 2, b, 2, 0.0, c, 2);
return !(c[0] == 19 && c[1] == 22 && c[2] == 43 && c[3] == 50);
}
34 changes: 34 additions & 0 deletions .github/scripts/cmake-consumer/test-consumer.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
#Requires -Version 7.4
# Builds and runs a CMake project against a Windows `make install` tree, with MinGW and MSVC.
param(
[Parameter(Mandatory)][string]$Prefix,
[Parameter(Mandatory)][ValidateSet('x64', 'arm64')][string]$Arch,
[Parameter(Mandatory)][string]$MinGWCompiler,
[Parameter(Mandatory)][string]$DefFile,
[Parameter(Mandatory)][string]$BuildDir
)
$ErrorActionPreference = 'Stop'
$PSNativeCommandUseErrorActionPreference = $true

$Prefix = $Prefix -replace '\\', '/'
$env:PATH = "$($Prefix -replace '/', '\')\bin;$env:PATH"

function Test-Consumer([string]$name, [string]$implib, [string[]]$cmakeArgs) {
$build = Join-Path $BuildDir $name
cmake -S $PSScriptRoot -B $build "-DCMAKE_PREFIX_PATH=$Prefix" "-DEXPECTED_IMPLIB=$implib" @cmakeArgs
cmake --build $build
& "$build/consumer.exe"
}

Test-Consumer mingw libopenblas.dll.a @('-G', 'MinGW Makefiles', "-DCMAKE_C_COMPILER=$MinGWCompiler", '-DCMAKE_SH=CMAKE_SH-NOTFOUND')

$vcTools = @{ x64 = 'x86.x64'; arm64 = 'ARM64' }[$Arch]
$vs = & "${env:ProgramFiles(x86)}\Microsoft Visual Studio\Installer\vswhere.exe" -latest -products * `
-requires "Microsoft.VisualStudio.Component.VC.Tools.$vcTools" -property installationPath
$hostArch = if ($env:PROCESSOR_ARCHITECTURE -eq 'ARM64') { 'arm64' } else { 'amd64' }
& "$vs\Common7\Tools\Launch-VsDevShell.ps1" -Arch ($Arch -eq 'x64' ? 'amd64' : 'arm64') -HostArch $hostArch -SkipAutomaticLocation
Test-Consumer msvc-dlla libopenblas.dll.a @('-G', 'NMake Makefiles', '-DCMAKE_C_COMPILER=cl')

# release packages add an MSVC import library, which the config should prefer
lib /nologo "/machine:$Arch" "/def:$DefFile" /name:libopenblas.dll "/out:$Prefix/lib/libopenblas.lib"
Test-Consumer msvc-lib libopenblas.lib @('-G', 'NMake Makefiles', '-DCMAKE_C_COMPILER=cl')
45 changes: 25 additions & 20 deletions .github/workflows/dynamic_arch.yml
Original file line number Diff line number Diff line change
Expand Up @@ -193,41 +193,46 @@ jobs:

msys2:
if: "github.repository == 'OpenMathLib/OpenBLAS'"
runs-on: windows-latest
runs-on: ${{ matrix.runner || 'windows-latest' }}

strategy:
fail-fast: false
matrix:
msystem: [UCRT64, MINGW32, CLANG64]
msystem: [UCRT64, MINGW32, CLANG64, CLANGARM64]
idx: [int32, int64]
build-type: [Release]
include:
- msystem: UCRT64
idx: int32
target-prefix: mingw-w64-ucrt-x86_64
fc-pkg: mingw-w64-ucrt-x86_64-fc
fc-pkg: fc:p
- msystem: MINGW32
idx: int32
target-prefix: mingw-w64-i686
fc-pkg:
- msystem: CLANG64
idx: int32
target-prefix: mingw-w64-clang-x86_64
fc-pkg: mingw-w64-clang-x86_64-fc
fc-pkg: fc:p
- msystem: CLANGARM64
idx: int32
runner: windows-11-arm
target: ARMV8
fc-pkg: fc:p
- msystem: UCRT64
idx: int64
idx64-flags: -DBINARY=64 -DINTERFACE64=1
target-prefix: mingw-w64-ucrt-x86_64
fc-pkg: mingw-w64-ucrt-x86_64-fc
fc-pkg: fc:p
- msystem: CLANG64
idx: int64
idx64-flags: -DBINARY=64 -DINTERFACE64=1
target-prefix: mingw-w64-clang-x86_64
fc-pkg: mingw-w64-clang-x86_64-fc
fc-pkg: fc:p
- msystem: CLANGARM64
idx: int64
idx64-flags: -DBINARY=64 -DINTERFACE64=1
runner: windows-11-arm
target: ARMV8
fc-pkg: fc:p
- msystem: UCRT64
idx: int32
target-prefix: mingw-w64-ucrt-x86_64
fc-pkg: mingw-w64-ucrt-x86_64-fc
fc-pkg: fc:p
build-type: None
exclude:
- msystem: MINGW32
Expand All @@ -253,13 +258,13 @@ jobs:
msystem: ${{ matrix.msystem }}
update: true
release: false # Use pre-installed version
install: >-
base-devel
${{ matrix.target-prefix }}-cc
install: base-devel
pacboy: >-
cc:p
${{ matrix.fc-pkg }}
${{ matrix.target-prefix }}-cmake
${{ matrix.target-prefix }}-ninja
${{ matrix.target-prefix }}-ccache
cmake:p
ninja:p
ccache:p

- name: Checkout repository
uses: actions/checkout@v6
Expand Down Expand Up @@ -305,7 +310,7 @@ jobs:
-DDYNAMIC_ARCH=ON \
-DUSE_THREAD=ON \
-DNUM_THREADS=64 \
-DTARGET=CORE2 \
-DTARGET=${{ matrix.target || 'CORE2' }} \
${{ matrix.idx64-flags }} \
-DCMAKE_C_COMPILER_LAUNCHER=ccache \
-DCMAKE_Fortran_COMPILER_LAUNCHER=ccache \
Expand Down
82 changes: 82 additions & 0 deletions .github/workflows/windows_make_install.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
name: Windows make install

on:
push:
branches:
- develop
paths-ignore:
- 'docs/**'
- '**/*.md'
pull_request:
branches:
- develop
paths-ignore:
- 'docs/**'
- '**/*.md'

concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true

permissions:
contents: read # to fetch code (actions/checkout)

jobs:
build:
if: "github.repository == 'OpenMathLib/OpenBLAS'"
name: ${{ matrix.msystem }}
runs-on: ${{ matrix.runner }}

strategy:
fail-fast: false
matrix:
include:
- arch: x64
runner: windows-latest
msystem: UCRT64
cc: gcc
target: HASWELL
- arch: arm64
runner: windows-11-arm
msystem: CLANGARM64
cc: clang
target: ARMV8

env:
OPENBLAS_MAKE_ARGS: CC=${{ matrix.cc }} TARGET=${{ matrix.target }} NOFORTRAN=1 NO_LAPACK=1 NO_LAPACKE=1

defaults:
run:
shell: msys2 {0}

steps:
- name: Checkout repository
uses: actions/checkout@v6

- name: Install build dependencies
id: msys2
uses: msys2/setup-msys2@v2
with:
msystem: ${{ matrix.msystem }}
update: true
install: make
pacboy: >-
cc:p
cmake:p
make:p

- name: Build OpenBLAS
run: make -j$(nproc) $OPENBLAS_MAKE_ARGS

- name: Install OpenBLAS
run: |
prefix="$(cygpath -m "$RUNNER_TEMP")/openblas"
make install PREFIX="$prefix" $OPENBLAS_MAKE_ARGS
cat "$prefix/lib/cmake/openblas/OpenBLASConfig.cmake"

- name: Test OpenBLASConfig.cmake with MinGW and MSVC consumers
shell: pwsh
run: |
$env:PATH = "${{ steps.msys2.outputs.msys2-location }}\$('${{ matrix.msystem }}'.ToLower())\bin;$env:PATH"
./.github/scripts/cmake-consumer/test-consumer.ps1 -Arch ${{ matrix.arch }} -MinGWCompiler ${{ matrix.cc }} `
-Prefix "$env:RUNNER_TEMP/openblas" -DefFile exports/libopenblas.def -BuildDir "$env:RUNNER_TEMP/consumer"
Loading
Loading