Skip to content

Commit 5ca3b3e

Browse files
committed
Release notes. Move RandBLAS::exceptions::Error to RandBLAS::Error. Minor docstring changes.
1 parent cddaba3 commit 5ca3b3e

8 files changed

Lines changed: 117 additions & 40 deletions

File tree

RandBLAS/base.hh

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -428,15 +428,5 @@ concept SketchingOperator = requires {
428428
#define SketchingOperator typename
429429
#endif
430430

431-
// I want to add a constraint to SketchingOperator so that conformant types SKOP have two-argument constructors of the form SKOP(typename SKOP::
432-
433-
/// * - :math:`\ttt{S.own_memory}`
434-
/// - :math:`\ttt{bool}`
435-
/// - RandBLAS has permission to attach memory to :math:`\ttt{S}`
436-
/// if and only if this is true. If true at destruction time, RandBLAS
437-
/// must delete any memory attached to :math:`\ttt{S}.` RandBLAS is
438-
/// forbidden from deleting attached memory under any other circumstances.
439-
440-
441431
} // end namespace RandBLAS::base
442432

RandBLAS/exceptions.hh

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -33,12 +33,9 @@
3333
#include <cstdarg>
3434
#include <string>
3535

36-
namespace RandBLAS::exceptions {
37-
// Code below copy-pasted from BLAS++ with minimal changes.
36+
// Mose code in this file is adapted from BLAS++.
3837

39-
#define UNUSED(x) (void)(x)
40-
#define SET_BUT_UNUSED(x) (void)(x)
41-
// ^ Use to suppress compiler warnings for unused variables in functions.
38+
namespace RandBLAS {
4239

4340
// -----------------------------------------------------------------------------
4441
/// Minimalist exception class for RandBLAS errors.
@@ -88,7 +85,7 @@ public:
8885
/// try {
8986
/// /* do something that might raise a RandBLAS error */
9087
/// randblas_require(1 < 0);
91-
/// } catch (RandBLAS::Exceptions::Error &e) {
88+
/// } catch (RandBLAS::Error &e) {
9289
/// std::string message{e.what()};
9390
/// /* inspect the message */
9491
/// std::cout << message << std::endl;
@@ -102,6 +99,14 @@ private:
10299
std::string msg_;
103100
};
104101

102+
} // end namespace RandBLAS
103+
104+
namespace RandBLAS::exceptions {
105+
106+
#define UNUSED(x) (void)(x)
107+
#define SET_BUT_UNUSED(x) (void)(x)
108+
// ^ Use to suppress compiler warnings for unused variables in functions.
109+
105110
namespace internal {
106111

107112
// -----------------------------------------------------------------------------

RandBLAS/sparse_data/base.hh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -157,15 +157,15 @@ static inline void sorted_nonzero_locations_to_pointer_array(
157157
/// .. code:: c++
158158
///
159159
/// ~SpMat() {
160-
/// if (this->own_memory) {
161-
/// delete [] this->vals;
160+
/// if (own_memory) {
161+
/// if (vals != nullptr) delete [] vals;
162162
/// // ... class-specific code ...
163163
/// }
164164
/// }
165165
///
166166
/// **View constructors**
167167
///
168-
/// This concept doesn't place specific requirements constructors for view sparse matrix views of existing data.
168+
/// This concept doesn't place requirements on constructors for sparse matrix views of existing data.
169169
/// However, all of RandBLAS' sparse matrix classes offer such constructors. See individual classes'
170170
/// documentation for details.
171171
///

RandBLAS/sparse_skops.hh

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -503,7 +503,9 @@ state_t fill_sparse_unpacked_nosub(
503503
);
504504
nnz = vec_nnz * dim_minor;
505505
return state;
506-
} else if (D.major_axis == Axis::Long) {
506+
} else {
507+
// We're long-axis major.
508+
507509
// We don't sample all at once since we might need to merge duplicate entries
508510
// in each long-axis vector. The way we do this is different than the
509511
// standard COOMatrix convention of just adding entries together.
@@ -517,7 +519,7 @@ state_t fill_sparse_unpacked_nosub(
517519
for (int64_t i = 0; i < dim_minor; ++i) {
518520
state = sample_indices_iid_uniform(dim_major, vec_nnz, idxs_long, vals, state);
519521
// ^ That writes directly so S.vals and either S.rows or S.cols.
520-
// The new values might need to be changed if there are duplicates in lind.
522+
// The new values might need to be changed if there are duplicates in idxs_long.
521523
// We have a helper function for this since it's a tedious process.
522524
// The helper function also sets whichever of S.rows or S.cols wasn't populated.
523525
laso_merge_long_axis_vector_coo_data(
@@ -531,8 +533,6 @@ state_t fill_sparse_unpacked_nosub(
531533
}
532534
nnz = total_nnz;
533535
return state;
534-
} else {
535-
throw std::invalid_argument("D.major_axis must be Axis::Short or Axis::Long.");
536536
}
537537
}
538538

rtd/source/api_reference/utilities.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,10 @@ Random sampling from index sets
2525
.. doxygenfunction:: RandBLAS::repeated_fisher_yates(int64_t k, int64_t n, int64_t r, sint_t *samples, const state_t &state)
2626
:project: RandBLAS
2727

28-
I/O and debugging
28+
Debugging and I/O
2929
=================
3030

31-
.. doxygenclass:: RandBLAS::exceptions::Error
31+
.. doxygenclass:: RandBLAS::Error
3232
:project: RandBLAS
3333
:members:
3434

rtd/source/index.rst

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,12 @@
1414
RandBLAS: sketching for randomized numerical linear algebra
1515
===========================================================
1616

17-
RandBLAS is a C++ library for randomized linear dimension reduction -- an operation commonly known as *sketching*.
18-
We built RandBLAS to make it easier to write, debug, and deploy high-performance implementations of sketching-based algorithms.
17+
RandBLAS is a C++ library for randomized linear dimension reduction an operation commonly known as *sketching*.
18+
We built RandBLAS to make it easier to write and debug high-performance implementations of sketching-based algorithms.
1919

2020
RandBLAS is efficient, flexible, and reliable.
2121
It uses CPU-based OpenMP acceleration to apply its sketching operators to matrices stored in main memory.
22-
It includes dense and sparse sketching operators (e.g., Gaussian operators, CountSketch, OSNAPs, etc..), which can
22+
It includes dense and sparse sketching operators (e.g., Gaussian operators, CountSketch, OSNAPs, etc), which can
2323
be applied to dense or sparse data in any combination that leads to a dense sketch.
2424

2525
With RandBLAS and an LAPACK-like library at your disposal, you can implement
@@ -29,9 +29,6 @@ without ever realizing the entire sketching operator in memory.
2929

3030
Learn more by reading our `tutorial <tutorial/index.html>`_ or our `API reference <api_reference/index.html>`_.
3131
If we've piqued your interest, try RandBLAS yourself!
32-
We've got a handy `installation guide <installation/index.html>`_ on this website.
33-
34-
35-
Source Code
36-
-----------
37-
Source code can be obtained at our `github repository <https://github.com/BallisticLA/RandBLAS>`_.
32+
We've got a handy `installation guide <installation/index.html>`_ on this website
33+
and `examples <https://github.com/BallisticLA/RandBLAS/tree/main/examples>`_ in
34+
our `GitHub repository <https://github.com/BallisticLA/RandBLAS>`_.

rtd/source/updates/index.rst

Lines changed: 88 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,98 @@ Changes to RandBLAS
44

55
This page details changes made to RandBLAS over time, in reverse chronological order.
66
We have a tentative policy of providing bugfix support for any release of
7-
RandBLAS upon request, no matter how old. With any luck, RandBLAS will grow enough
8-
in the future that we will change this policy to support a handful of versions
9-
at a time.
7+
RandBLAS upon request, no matter how old. With any luck, this project will grow enough
8+
that we'll have to change this policy.
109

1110
RandBLAS follows `Semantic Versioning <https://semver.org>`_.
1211

1312

13+
RandBLAS 1.0
14+
------------
15+
*Release date: September 12, 2024. Release manager: Riley Murray.*
16+
17+
Today marks RandBLAS' second-ever release, its first *stable* release,
18+
and its first release featuring the contributions of someone who showed
19+
up entirely out of the blue (shoutout to Rylie Weaver)!
20+
21+
Overview of changes
22+
~~~~~~~~~~~~~~~~~~~
23+
24+
**New features for core functionality**
25+
26+
The semantics of :cpp:any:`RandBLAS::SparseDist::major_axis` have changed in RandBLAS 1.0.
27+
As a result of this change, SparseSkOps can represent
28+
LESS-Uniform operators and operators for plain row or column sampling with replacement.
29+
(This is in addition to hashing-style operators like CountSketch, which we've supported since version 0.2.)
30+
31+
We have four new functions for sampling from index sets.
32+
33+
* :cpp:any:`RandBLAS::weights_to_cdf`
34+
* :cpp:any:`RandBLAS::sample_indices_iid`
35+
* :cpp:any:`RandBLAS::sample_indices_iid_uniform`
36+
* :cpp:any:`RandBLAS::repeated_fisher_yates`
37+
38+
We have two new functions for getting low-level data for a sketching operator's explicit representation:
39+
:cpp:any:`RandBLAS::fill_dense_unpacked` and :cpp:any:`RandBLAS::fill_sparse_unpacked_nosub`.
40+
These are useful if you want to incorporate RandBLAS' sketching functionality into other frameworks,
41+
like Kokkos, cuBLAS, or MKL.
42+
43+
Finally, there's :cpp:any:`RandBLAS::sketch_symmetric`, overloaded for sketching from the left or right.
44+
45+
**Quality-of-life improvements**
46+
47+
* We've significantly expanded the tutorial part of our web docs. It now has details on updating sketches and
48+
some advice on choosing parameters for sketching distributions.
49+
* :cpp:any:`RandBLAS::Error` is now in the public API.
50+
* :cpp:any:`RandBLAS::print_buff_to_stream` is for writing MATLAB-style or NumPy-style string representations of matrices to a provided stream, like std::cout.
51+
* We settled on a unified memory-management / memory-ownership policy. There's no difference between DenseSkOp, SparseSkOp, or any of the sparse matrix types. The abstract policy is described in our web documentation. The consequences of the policy for each of the aforementioned types is documented in source code and on our website.
52+
* We added a few utility functions for working with dense matrices: symmetrize, overwrite_triangle, and transpose_square.
53+
54+
**Significantly revised APIs for sketching distributions and operators**
55+
56+
* Added new :cpp:any:`RandBLAS::SketchingDistribution` and :cpp:any:`RandBLAS::SketchingOperator` C++20 concepts.
57+
* API revisions to DenseDist/DenseSkOp and SparseDist/SparseSkOp were mostly about taking quantities which we would compute from an object's const members with free-functions,
58+
and instead making those quantities const members themselves. Good examples of this are :cpp:any:`RandBLAS::DenseDist::isometry_scale`
59+
and :cpp:any:`RandBLAS::SparseDist::isometry_scale`, whose meanings are explained in the SketchingDistribution docs.
60+
* :cpp:any:`RandBLAS::DenseSkOp::next_state` and :cpp:any:`RandBLAS::SparseSkOp::next_state` are computed at construction time,
61+
without actually performing any random sampling. This means that one can define a sequence of independent sketching without
62+
changing an RNGState's "key" and without realizing any of them explicitly.
63+
64+
**New statistical tests**
65+
66+
* Kolmogorov–Smirnov tests for distributional correctness of sample_indices_iid, sample_indices_iid_uniform, repeated_fisher_yates, and the scalar distributions that can be used with DenseSkOp (standard-normal and uniform over [-1,1]).
67+
* Tests for subspace embedding properties of DenseSkOp. A forthcoming paper will describe how these tests cover a wide range of relevant parameter values at very mild computational cost.
68+
* We've incorporated select tests from Random123 into our testing framework.
69+
70+
71+
Contributors
72+
~~~~~~~~~~~~
73+
74+
I'd like to start by acknowledging the contributions of `Parth Nobel <https://ptnobel.github.io/>`_ to RandBLAS' development.
75+
Parth and I have worked on-and-off on several projects involving RandNLA algorithms.
76+
None of these projects has been published yet, but they've had a significant role in uncovering
77+
bugs and setting development priorities for RandBLAS. (As a recent example in the latter category,
78+
I probably wouldn't have added the "sample_indices_iid" function were it not for its relevance to
79+
one of our projects.) This led me to be quite surprised when I noticed that Parth technically hasn't
80+
made a commit to the RandBLAS repository! Let this statement set the record straight: Parth has
81+
made very real contributions to RandBLAS, even if the commit history doesn't currently reflect that.
82+
83+
Rylie Weaver, the aforementioned out-of-the-blue contributor, helped write our Kolmogorov–Smirnov tests for repeated Fisher–Yates.
84+
85+
I wrote a lot of code (as one might imagine).
86+
87+
Funding acknowledgements
88+
~~~~~~~~~~~~~~~~~~~~~~~~
89+
90+
This work was wholly supported by LDRD funding from Sandia National Laboratories.
91+
92+
Sandia National Laboratories is a multi-mission laboratory managed and operated by
93+
National Technology and Engineering Solutions of Sandia, LLC., a wholly owned subsidiary
94+
of Honeywell International, Inc., for the U.S. Department of Energy’s National Nuclear
95+
Security Administration under contract DE-NA-0003525.
96+
97+
98+
1499
RandBLAS 0.2
15100
------------
16101

test/test_exceptions.cc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ TEST_F(TestExceptions, randblas_require_var_arg) {
1515
bool successful_raise = false;
1616
try {
1717
randblas_require(successful_raise);
18-
} catch (RandBLAS::exceptions::Error &e) {
18+
} catch (RandBLAS::Error &e) {
1919
std::string message{e.what()};
2020
successful_raise = message.find("successful_raise") != std::string::npos;
2121
}
@@ -26,7 +26,7 @@ TEST_F(TestExceptions, randblas_require_expr_arg) {
2626
int flag = 0;
2727
try {
2828
randblas_require(flag > 1);
29-
} catch (RandBLAS::exceptions::Error &e) {
29+
} catch (RandBLAS::Error &e) {
3030
std::string message{e.what()};
3131
flag = (int) message.find("flag > 1") != std::string::npos;
3232
}
@@ -38,7 +38,7 @@ TEST_F(TestExceptions, randblas_error_if_msg_output) {
3838
bool expect_true = false;
3939
try {
4040
randblas_error_if_msg(error_trigger, "Custom message.");
41-
} catch (RandBLAS::exceptions::Error &e) {
41+
} catch (RandBLAS::Error &e) {
4242
std::string message{e.what()};
4343
expect_true = message.find("Custom message.") != std::string::npos;
4444
}

0 commit comments

Comments
 (0)