Skip to content

Commit

Permalink
Merge branch 'devel' into wrap
Browse files Browse the repository at this point in the history
  • Loading branch information
jcosborn committed Nov 14, 2024
2 parents f222c08 + b81fec0 commit f7a78b1
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 3 deletions.
8 changes: 6 additions & 2 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,17 @@
name: test
on:
[push, pull_request]
pull_request:
push:
# branches:
# - 'devel'
# - 'master'

jobs:
build:
strategy:
matrix:
mpi-impl: [openmpi, mpich]
nim-branch: [version-1-6, version-2-0, devel]
nim-branch: [version-2-0, version-2-2, devel]
fuel-compat: [0, 1]
fail-fast: false
name: nim-${{ matrix.nim-branch }}-${{ matrix.mpi-impl }}-FUELCompat:${{ matrix.fuel-compat }}
Expand Down
12 changes: 12 additions & 0 deletions src/eigens/lapack.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,18 @@ typedef double doublereal;
r f a; \
r U(f) a

L(void, cgemm, (const char *transa, const char *transb,
const int *m, const int *n, const int *k,
const float *alpha, const float *a,
const int *lda, const float *b, const int *ldb,
const float *beta, float *c, const int *ldc));

L(void, dgemm, (const char *transa, const char *transb,
const int *m, const int *n, const int *k,
const double *alpha, const double *a,
const int *lda, const double *b, const int *ldb,
const double *beta, double *c, const int *ldc));

L(void, dsterf, (integer *n, doublereal *d, doublereal *e, integer *info));
L(void, dgetrf, (integer *m, integer *n, doublereal *a, integer * lda,
integer *ipiv, integer *info));
Expand Down
17 changes: 16 additions & 1 deletion src/eigens/lapack.nim
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@ const lapackLib {.strdefine.} = "-llapack -lblas"
#const lapackLib {.strdefine.} = "/usr/lib/lapack/liblapack.a -lblas -lgfortran"
#const lapackLib {.strdefine.} = "-L/usr/lib/lapack -llapack"
{.passL: lapackLib.}
{.pragma: lapack, header: hdr.}
#{.pragma: lapack, header: hdr.}
{.pragma: lapack.}

type
fint* = cint
Expand Down Expand Up @@ -102,3 +103,17 @@ proc dbdsvdx*(uplo: cstring, jobz: cstring, range: cstring, n: ptr fint,
proc dlasq1*(n: ptr fint; d: ptr float64; e: ptr float64;
work: ptr float64; info: ptr fint) {.lapack, importc: "dlasq1_".}


when isMainModule:
template toPtrInt32(x: int): ptr int32 =
var t = x.int32
addr t
template toPtrScomplex(x: int): ptr scomplex =
var t = scomplex(re: x.float32, im: 0'f32)
addr t
template `&`(x: int): untyped = toPtrInt32(x)
template `&&`(x: int): untyped = toPtrScomplex(x)
var c,a,b: ptr scomplex
var cr,cc,bc: int

cgemm("C","N", &cc,&cr,&bc, &&1, b,&bc, a,&bc, &&0, c,&cc)

0 comments on commit f7a78b1

Please sign in to comment.