people.engr.tamu.edu/davis/suitesparse (#3555)

* new file:   projects/people.engr.tamu.edu/davis/suitesparse/package.yml
new file:   projects/people.engr.tamu.edu/davis/suitesparse/test.c

* let's ty to fix linux

* needs openblas, i believe

* looks like, from the warnings, that it wants the actual library paths

* needs libfortran on darwin too.

---------

Co-authored-by: Jacob Heider <jacob@pkgx.dev>
This commit is contained in:
Andrew 2023-10-08 20:15:37 +03:00 committed by GitHub
parent 99c7d373e3
commit 581ac5005b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 79 additions and 0 deletions

View file

@ -0,0 +1,55 @@
distributable:
url: https://github.com/DrTimothyAldenDavis/SuiteSparse/archive/v{{version}}.tar.gz
strip-components: 1
display-name: suite-sparse
versions:
github: DrTimothyAldenDavis/SuiteSparse
dependencies:
glaros.dtc.umn.edu/metis: '*'
gnu.org/m4: '*'
netlib.org/lapack: '*'
gnu.org/gmp: '*'
openmp.llvm.org: '*'
gnu.org/mpfr: '*'
gnu.org/gcc: '*' # libfortran
build:
dependencies:
cmake.org: '*'
freedesktop.org/pkg-config: '*'
linux:
gnu.org/make: '*'
script:
- make library $ARGS CMAKE_OPTIONS="$CMAKE_ARGS"
- make install $ARGS CMAKE_OPTIONS="$CMAKE_ARGS"
env:
ARGS:
- INSTALL={{prefix}}
- JOBS={{hw.concurrency}}
CMAKE_ARGS:
- -DCMAKE_INSTALL_PREFIX="{{prefix}}
- -DCMAKE_INSTALL_LIBDIR=lib
- -DCMAKE_BUILD_TYPE=Release
- -DCMAKE_FIND_FRAMEWORK=LAST
- -DCMAKE_VERBOSE_MAKEFILE=ON
- -Wno-dev
- -DBUILD_TESTING=OFF
linux:
CMAKE_ARGS:
- -DLAPACK_LIBRARIES={{deps.netlib.org/lapack.prefix}}/lib/liblapack.so.{{deps.netlib.org/lapack.version.major}}
- -DBLAS_LIBRARIES={{deps.netlib.org/lapack.prefix}}/lib/libblas.so.{{deps.netlib.org/lapack.version.major}}
darwin:
CC: clang
CXX: clang++
LD: clang
CMAKE_ARGS:
- -DLAPACK_LIBRARIES={{deps.netlib.org/lapack.prefix}}/lib/liblapack.{{deps.netlib.org/lapack.version.major}}.dylib
- -DBLAS_LIBRARIES={{deps.netlib.org/lapack.prefix}}/lib/libblas.{{deps.netlib.org/lapack.version.major}}.dylib
provides:
- bin/mongoose
test:
dependencies:
freedesktop.org/pkg-config: '*'
script:
- pkg-config --modversion SuiteSparse_config | grep {{version}}
- cc test.c -lsuitesparseconfig -lklu -o test -Wl,-rpath,{{pkgx.prefix}}
- ./test

View file

@ -0,0 +1,24 @@
#include <stdio.h>
#include "klu.h"
int n = 5 ;
int Ap [ ] = {0, 2, 5, 9, 10, 12} ;
int Ai [ ] = { 0, 1, 0, 2, 4, 1, 2, 3, 4, 2, 1, 4} ;
double Ax [ ] = {2., 3., 3., -1., 4., 4., -3., 1., 2., 2., 6., 1.} ;
double b [ ] = {8., 45., -3., 3., 19.} ;
int main (void)
{
klu_symbolic *Symbolic ;
klu_numeric *Numeric ;
klu_common Common ;
int i ;
klu_defaults (&Common) ;
Symbolic = klu_analyze (n, Ap, Ai, &Common) ;
Numeric = klu_factor (Ap, Ai, Ax, Symbolic, &Common) ;
klu_solve (Symbolic, Numeric, 5, 1, b, &Common) ;
klu_free_symbolic (&Symbolic, &Common) ;
klu_free_numeric (&Numeric, &Common) ;
for (i = 0 ; i < n ; i++) printf ("x [%d] = %g\n", i, b [i]) ;
return (0) ;
}