Skip to content

Commit

Permalink
Refactoring of QR: stabilized Gram-Schmidt for split=1 and TS-QR for …
Browse files Browse the repository at this point in the history
…split=0 (#1329)

* added file `myqr.py` that contains experiment in direction blockwise stabilized GS for QR (split=1)

* Update __init__.py

* removed `myrandn` since `randn` is fixed meanwhile

* ...

* replaced previour QR implementation by the new one

* ...

* refactoring

* ...

* added some unit tests for the refactored qr with split=1

* ...

* resolved some bugs related to calc_q, calc_r etc.

* removed option overwrite_a

* extended comments in the code

* ...

* removed strange option full_q (should be addressed somewhere else later)

* formatting of warning

* adapted API of new qr to follow the one in numpy

* first version of split=0 (TS-QR), stil with bugs

* fixed some bugs, some others are stil there...

* fixed some bugs: a problem was, e.g., that torch's qr returns non-contiguous q and r even if input was contiguous

* still errors but I dont find them...

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* found bugs in TS-QR, now we should have a running version
TODOS: extend comments (to have maintainable code), check ROCm-support, unittests for wrong inpus/errors

* removed skip from some svd_tests on AMD (they were introduced due to missing QR support)
added tests for catching wrong inputs in QR
slightly extended docs of QR

* Update test_matrixgallery.py

removed skips for AMD devices

* Update linalg.py

modified continuous benchmarks for new qr implementation

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Update linalg.py

removed bug in benchmarks

* resolved first parts of the comments in the review

* updated docs of refactored QR since no batches of matrices are supported

* modified docs according to review

* removed "from time import sleep", completed dead end sentence in docs

---------

Co-authored-by: Hoppe <[email protected]>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Claudia Comito <[email protected]>
4 people authored Apr 17, 2024

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
1 parent 86fe8a6 commit 67bc254
Showing 5 changed files with 397 additions and 1,099 deletions.
16 changes: 9 additions & 7 deletions benchmarks/cb/linalg.py
Original file line number Diff line number Diff line change
@@ -16,14 +16,12 @@ def matmul_split_1(a, b):

@monitor()
def qr_split_0(a):
for t in range(2, 3):
qr = a.qr(tiles_per_proc=t)
qr = ht.linalg.qr(a)


@monitor()
def qr_split_1(a):
for t in range(1, 3):
qr = a.qr(tiles_per_proc=t)
qr = ht.linalg.qr(a)


@monitor()
@@ -53,12 +51,16 @@ def run_linalg_benchmarks():
matmul_split_1(a, b)
del a, b

n = int((4000000 // MPI.COMM_WORLD.size) ** 0.5)
m = MPI.COMM_WORLD.size * n
a_0 = ht.random.random((m, n), split=0)
qr_split_0(a_0)
del a_0

n = 2000
a_0 = ht.random.random((n, n), split=0)
a_1 = ht.random.random((n, n), split=1)
qr_split_0(a_0)
qr_split_1(a_1)
del a_0, a_1
del a_1

n = 50
A = ht.random.random((n, n), dtype=ht.float64, split=0)
Loading

0 comments on commit 67bc254

Please sign in to comment.