Skip to content

Commit d092129

Browse files
committed
Merge branch 'metapackage_blas'
2 parents d77620b + f71331e commit d092129

File tree

4 files changed

+72
-3
lines changed

4 files changed

+72
-3
lines changed

.github/workflows/meta.yml

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -97,14 +97,14 @@ jobs:
9797
run: |
9898
sudo apt-get update
9999
sudo apt install -y -q openmpi-bin libopenmpi-dev hwloc fabric libhdf5-dev \
100-
libhdf5-fortran-102 libnetcdf-dev libnetcdff-dev
100+
libhdf5-fortran-102 libnetcdf-dev libnetcdff-dev libopenblas-dev
101101
102102
- name: (Ubuntu) Install MPICH
103103
if: contains(matrix.os,'ubuntu') && contains(matrix.mpi,'mpich')
104104
run: |
105105
sudo apt-get update
106106
sudo apt install -y -q mpich hwloc fabric libhdf5-dev libhdf5-fortran-102 \
107-
libnetcdf-dev libnetcdff-dev
107+
libnetcdf-dev libnetcdff-dev libopenblas-dev
108108
109109
- name: (Ubuntu) Retrieve Intel toolchain
110110
if: contains(matrix.os,'ubuntu') && contains(matrix.mpi,'intel')
@@ -238,6 +238,11 @@ jobs:
238238
brew install netcdf
239239
brew install netcdf-fortran
240240
241+
- name: (macOS) Install homebrew OpenBLAS
242+
if: contains(matrix.os,'macos')
243+
run: |
244+
brew install openblas
245+
241246
# Phase 1: Bootstrap fpm with existing version
242247
- name: Install fpm
243248
uses: fortran-lang/setup-fpm@v5
@@ -345,4 +350,3 @@ jobs:
345350
shell: bash
346351
run: |
347352
ci/meta_tests.sh "$PWD/${{ env.FPM_RELEASE }}"
348-

ci/meta_tests.sh

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,5 +52,10 @@ pushd metapackage_netcdf
5252
"$fpm" run --verbose
5353
popd
5454

55+
pushd metapackage_blas
56+
"$fpm" build --verbose
57+
"$fpm" run --verbose
58+
popd
59+
5560
# Cleanup
5661
rm -rf ./*/build
Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
program metapackage_blas
2+
implicit none
3+
4+
interface
5+
subroutine dgesv(n, nrhs, a, lda, ipiv, b, ldb, info)
6+
integer, intent(in) :: n, nrhs, lda, ldb
7+
double precision, intent(in out) :: a(lda,*), b(ldb,*)
8+
integer, intent(out) :: ipiv(*), info
9+
end subroutine dgesv
10+
end interface
11+
12+
integer, parameter :: dp = kind(1.0d0)
13+
real(dp), dimension(:,:), allocatable :: a
14+
real(dp), dimension(:), allocatable :: b
15+
integer :: info
16+
17+
allocate(a(3,3), b(3))
18+
a = reshape([1.0_dp, 2.0_dp, 3.0_dp, &
19+
4.0_dp, 5.0_dp, 6.0_dp, &
20+
7.0_dp, 8.0_dp, 9.0_dp], [3,3])
21+
b = [1.0_dp, 2.0_dp, 3.0_dp]
22+
23+
call solve_eqsys(a, b, info)
24+
if (info /= 0) error stop
25+
26+
stop 0
27+
28+
contains
29+
30+
!> simple wrapper for solvers for real system of linear
31+
!> equations A * X = B
32+
subroutine solve_eqsys(a, b, info)
33+
34+
real(dp), dimension(:,:), intent(inout) :: a
35+
real(dp), dimension(:), intent(inout) :: b
36+
integer, intent(out) :: info
37+
integer :: i_alloc
38+
integer :: n, nrhs, lda, ldb
39+
integer, dimension(:), allocatable :: ipiv
40+
! ------------------------------------------------------------------
41+
42+
lda = size(a,1)
43+
n = size(a,2)
44+
ldb = size(b,1)
45+
nrhs = 1
46+
47+
allocate(ipiv(n), stat = i_alloc)
48+
if (i_alloc /= 0) stop 'solve_eqsys: Allocation for array failed!'
49+
50+
call dgesv(n, nrhs, a, lda, ipiv, b, ldb, info)
51+
52+
info = 0
53+
54+
deallocate(ipiv, stat = i_alloc)
55+
if (i_alloc /= 0) stop 'solve_eqsys: Deallocation for array failed!'
56+
57+
end subroutine solve_eqsys
58+
end program metapackage_blas
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
name = "metapackage_blas"
2+
dependencies.blas="*"

0 commit comments

Comments
 (0)