Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIP: Add lapack #4

Closed
wants to merge 12 commits into from
1 change: 1 addition & 0 deletions .github/workflows/build_recipes.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ jobs:

build_recipes:
runs-on: ubuntu-latest
timeout-minutes: 8 # limit build, REMOVE later
env:
TARGET_PLATFORM: emscripten-wasm32
GITHUB_OWNER: "emscripten-forge"
Expand Down
47 changes: 47 additions & 0 deletions recipes/recipes_emscripten/lapack/build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
#!/bin/bash

set -ex

mkdir -p build
cd build

mkdir -p $PREFIX/include

export EMSDK_PATH=${EMSCRIPTEN_FORGE_EMSDK_DIR}
export LDFLAGS="$LDFLAGS -fno-optimize-sibling-calls"
export FFLAGS="$FFLAGS \
--target=wasm32-unknown-emscripten \
--generate-object-code \
--fixed-form-infer \
--implicit-interface"

# CMAKE_INSTALL_LIBDIR="lib" suppresses CentOS default of lib64 (conda expects lib)

# See https://github.com/Shaikh-Ubaid/lapack/blob/lf_01/LF_README.md
emcmake cmake .. \
-DCMAKE_Fortran_COMPILER=lfortran \
-DTEST_FORTRAN_COMPILER=OFF \
-DCBLAS=no \
-DLAPACKE=no \
-DBUILD_TESTING=no \
-DBUILD_DOUBLE=no \
-DBUILD_COMPLEX=no \
-DBUILD_COMPLEX16=no \
-DLAPACKE_WITH_TMG=no \
-DCMAKE_Fortran_PREPROCESS=yes \
-DCMAKE_Fortran_FLAGS="$FFLAGS" \
-DCMAKE_INSTALL_LIBDIR="lib" \
-DCMAKE_INSTALL_PREFIX=$PREFIX

# emcmake cmake \
# -DCMAKE_INSTALL_PREFIX=${PREFIX} \
# -DCMAKE_INSTALL_LIBDIR="lib" \
# -DBUILD_TESTING=ON \
# -DBUILD_SHARED_LIBS=OFF \
# -DLAPACKE=ON \
# -DCBLAS=ON \
# -DBUILD_DEPRECATED=ON \
# -DTEST_FORTRAN_COMPILER=OFF \
# ${CMAKE_ARGS} ..

make install -j${CPU_COUNT} VERBOSE=1
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
diff --git a/BLAS/CMakeLists.txt b/BLAS/CMakeLists.txt
index a33f38f..308e67f 100644
--- a/BLAS/CMakeLists.txt
+++ b/BLAS/CMakeLists.txt
@@ -1,5 +1,5 @@
+set(CMAKE_Fortran_COMPILER_WORKS TRUE)
enable_language(Fortran)
-
# Check for any necessary platform specific compiler flags
include(CheckLAPACKCompilerFlags)
CheckLAPACKCompilerFlags()
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
diff --git a/LAPACKE/include/CMakeLists.txt b/LAPACKE/include/CMakeLists.txt
index 034491e..1ecf561 100644
--- a/LAPACKE/include/CMakeLists.txt
+++ b/LAPACKE/include/CMakeLists.txt
@@ -14,7 +14,7 @@ if(CMAKE_Fortran_COMPILER AND CMAKE_C_COMPILER)
enable_language(C)
include(FortranCInterface)
## Ensure that the fortran compiler and c compiler specified are compatible
- FortranCInterface_VERIFY()
+ # FortranCInterface_VERIFY()
FortranCInterface_HEADER(${LAPACK_BINARY_DIR}/include/lapacke_mangling.h
MACRO_NAMESPACE "LAPACK_"
SYMBOL_NAMESPACE "LAPACK_")
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
diff --git a/BLAS/SRC/CMakeLists.txt b/BLAS/SRC/CMakeLists.txt
index 9df128e..2f4d478 100644
--- a/BLAS/SRC/CMakeLists.txt
+++ b/BLAS/SRC/CMakeLists.txt
@@ -126,7 +126,7 @@ if(BUILD_INDEX64_EXT_API)
if(CMAKE_Fortran_COMPILER_ID STREQUAL "NAG")
set(COPT_64_F -fpp)
else()
- set(COPT_64_F -cpp)
+ set(COPT_64_F --cpp)
endif()
file(STRINGS ${F} ${F}.lst)
list(FILTER ${F}.lst INCLUDE REGEX "subroutine|SUBROUTINE|external|EXTERNAL|function|FUNCTION")
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
diff --git a/SRC/CMakeLists.txt b/SRC/CMakeLists.txt
index 767165a..8442c83 100644
--- a/SRC/CMakeLists.txt
+++ b/SRC/CMakeLists.txt
@@ -87,7 +87,7 @@ set(SLASRC
sgebrd.f sgecon.f sgeequ.f sgees.f sgeesx.f sgeev.f sgeevx.f
sgehd2.f sgehrd.f sgelq2.f sgelqf.f
sgels.f sgelst.f sgelsd.f sgelss.f sgelsy.f sgeql2.f sgeqlf.f
- sgeqp3.f sgeqp3rk.f sgeqr2.f sgeqr2p.f sgeqrf.f sgeqrfp.f sgerfs.f sgerq2.f sgerqf.f
+ sgeqp3.f sgeqr2.f sgeqr2p.f sgeqrf.f sgeqrfp.f sgerfs.f sgerq2.f sgerqf.f
sgesc2.f sgesdd.f sgesv.f sgesvd.f sgesvdx.f sgesvx.f sgetc2.f sgetf2.f
sgetri.f
sggbak.f sggbal.f
113 changes: 113 additions & 0 deletions recipes/recipes_emscripten/lapack/recipe.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,113 @@
context:
version: 3.12.0
blas_major: 2
blas_minor: 200
lfortran_version: 0.36

# TODO: verify version numbers

source:
url: https://github.com/Reference-LAPACK/lapack/archive/v${{ version }}.tar.gz
# sha256: 4b9ba79bfd4921ca820e83979db76ab3363155709444a787979e81c22285ffa9 # v3.11.0
sha256: eac9570f8e0ad6f30ce4b963f4f033f0f643e7c3912fc9ee6cd99120675ad48b # v3.12.0
patches:
- patches/00_disable_fortran_compiler_check.patch
- patches/01_disable_fortran_c_interface_check.patch
- patches/02_fix_unexpected_argument_pp.patch
- patches/03_skip_error_files.patch

build:
number: 0

outputs:
- package:
name: libblas
version: ${{ blas_major }}.${{ blas_minor }}
requirements:
build:
- ${{ compiler("c") }}
- lfortran>=${{ lfortran_version }}

# TODO: saving for later
# - package:
# name: libtmglib
# version: ${{ version }}
# requirements:
# build:
# - ${{ compiler("c") }}
# - lfortran

# TODO: saving for later
# - package:
# name: libcblas
# version: ${{ blas_major }}.${{ blas_minor }}
# requirements:
# build:
# - ${{ compiler("c") }}
# - lfortran
# run:
# - libblas

- package:
name: liblapack
version: ${{ version }}
requirements:
build:
- ${{ compiler("c") }}
- lfortran>=${{ lfortran_version }}
run:
- libblas

# TODO: saving for later
# - package:
# name: liblapacke
# version: ${{ version }}
# requirements:
# build:
# - ${{ compiler("c") }}
# - lfortran
# run:
# - libblas
# - libcblas
# - liblapack

# TODO: saving for later
# - package:
# name: blas-devel
# version: ${{ blas_major }}.${{ blas_minor }}
# requirements:
# run:
# - libblas
# - libcblas
# - liblapack
# - liblapacke

- package:
name: blas
version: ${{ blas_major }}.${{ blas_minor }}
requirements:
run:
- liblapack
- liblapacke
- libcblas
- blas-devel
- libtmglib

- package:
name: lapack
version: ${{ version }}
requirements:
run:
- liblapack

# TODO: add tests

about:
homepage: http://www.netlib.org/lapack
license: BSD-3-Clause
license_file: LICENSE
summary: Linear Algebra PACKage

extra:
recipe-maintainers:
- IsabelParedes
Loading