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

338 request for fuselets #339

Merged
merged 60 commits into from
Jan 8, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
60 commits
Select commit Hold shift + click to select a range
079c8f8
Fix a bad copy-paste
anyzelman Sep 27, 2024
f4ced32
Some short-cut monoid and semiring definitions useful for fuselets. W…
anyzelman Sep 27, 2024
e85c30b
First example implemented
anyzelman Sep 27, 2024
6796248
Add example two, improved error handling, and added initialisation / …
anyzelman Sep 27, 2024
4b53733
I think I misunderstood the first example -- and that this fix captur…
anyzelman Sep 27, 2024
034c2db
Bugfixes, unify API re input scalars, clarify some elements in spec/docs
anyzelman Sep 27, 2024
f1d0df2
Doxygen fixes
anyzelman Sep 27, 2024
1dac516
Fix docs and add new requested fuselet
anyzelman Oct 8, 2024
6037a82
Default monoid and semiring naming should be dromedaryCase
anyzelman Oct 8, 2024
73ac7ba
Working commit, apologies.
anyzelman Oct 8, 2024
f6627fd
Add forgotten descriptors
anyzelman Oct 9, 2024
3a5b45b
Implement spmv_dot, make grb::wait more fine-grained
anyzelman Oct 9, 2024
8bcd867
Write the spec of spmv_dot_norm2
anyzelman Oct 9, 2024
8490aa8
Provide implementation for spmv_dot_norm2
anyzelman Oct 9, 2024
02534c1
Fix typo and add last fuselet
anyzelman Oct 9, 2024
1cae257
Record the time spent in implementing one of the fuselets
anyzelman Oct 9, 2024
45df804
Clarify the level of code maturity in the reported measurement
anyzelman Oct 9, 2024
3809c86
Couple of metabug fixes, and add one code clarification
anyzelman Oct 9, 2024
3507cd0
Fix code style
anyzelman Oct 10, 2024
fc154ee
Complete the set of standard semirings and document them
anyzelman Oct 10, 2024
007bac1
Now also provide variants for CRSes with integer offset and index arrays
anyzelman Oct 11, 2024
e0d3128
Add tests for default semirings
anyzelman Oct 11, 2024
0494028
New semiring tests trips a compiler warning for behaviour that normal…
anyzelman Oct 11, 2024
f6a5cba
Enable new test in test suite
anyzelman Oct 11, 2024
6f3f2ab
Merge branch '338-request-for-fuselets' of github.com:Algebraic-Progr…
anyzelman Oct 14, 2024
e8b368f
Fix some naming issues, add one more standard semiring, and fix up do…
anyzelman Oct 24, 2024
d126dc3
Add some more predefined monoids and document them as well as the new…
anyzelman Oct 24, 2024
ab3c880
Test all standard semirings
anyzelman Oct 24, 2024
9403b1b
Add unit tests for default monoids
anyzelman Oct 24, 2024
fd35da7
Remove unnecessary suppressions for monoid unit test
anyzelman Oct 24, 2024
3dde13c
Check for commutativity of the additive monoid in the semiring unit test
anyzelman Oct 24, 2024
9eba1ac
Clean up semiring test
anyzelman Oct 24, 2024
868ad01
Unrelated hotfix on GCC 11.4, ARM
anyzelman Nov 4, 2024
1a671d2
Hotfix: error in performance test output when inner equals 0
anyzelman Nov 4, 2024
7d435b8
Add missing headers
anyzelman Nov 9, 2024
7b825e0
Add fuselet performance test
anyzelman Nov 9, 2024
27b850d
Unrelated hotfix: typo in spmspm perftest
anyzelman Nov 9, 2024
0d8a53a
Fix perftest output
anyzelman Nov 9, 2024
71170e7
Enable smoke test for fuselets
anyzelman Nov 9, 2024
1dfdc12
Had some spare minutes, almost finished a second test. WIP commit, ap…
anyzelman Nov 30, 2024
dbdce0b
Finish test started over the weekend, and remove code duplication bet…
anyzelman Dec 2, 2024
726bc2e
Add one zero to fuselets perftest as 10M might fit in L3
anyzelman Dec 2, 2024
4dcddd2
Apologies for the incremental commits -- but 10 inner repetitions is …
anyzelman Dec 2, 2024
9daf3a9
Add test for test_update_spmv_dot and fix one typo
anyzelman Jan 6, 2025
34cdb7c
Add test for update_update_norm2 fuselet
anyzelman Jan 6, 2025
2b52bd9
Make naming of fuselets consistent
anyzelman Jan 6, 2025
f61f047
Add last two tests
anyzelman Jan 6, 2025
6873e53
Simplify and fix implementation of doubleUpdate_update_norm2
anyzelman Jan 6, 2025
c810bf6
Add documentation for fuselets
anyzelman Jan 6, 2025
9b49be0
Extend documentation a bit
anyzelman Jan 6, 2025
6b0f0ff
GitHub CI detected missing include, herewith fixed
anyzelman Jan 6, 2025
6217585
Code review: fix typo
anyzelman Jan 6, 2025
b01c952
Fix more missing includes, detected by GitHub CI (GCC 13.3)
anyzelman Jan 6, 2025
1c3a9cd
Idem for hyperdags and nonblocking backends
anyzelman Jan 6, 2025
e4865cb
Idem for tests/unit/parser.cpp
anyzelman Jan 6, 2025
96ee287
Fix ambiguous CMake target name
anyzelman Jan 7, 2025
3735611
Remove now-unintended rename
anyzelman Jan 7, 2025
e180dc5
Follow the suggestion in the MR comments-- the changed fuselets have …
anyzelman Jan 7, 2025
498538a
Last commit missed one instance -- now updated also
anyzelman Jan 7, 2025
8a02afb
Final code review: fix doxygen error
anyzelman Jan 7, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions include/graphblas.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,12 @@
* -# #grb::Monoid, and
* -# #grb::Semiring.
*
* A list of standard operators, monoids, and semirings are provided in their
* respective name spaces:
* -# #grb::operators,
* -# #grb::monoids, and
* -# #grb::semirings.
*
* Binary operators are parametrised in two input domains and one output domain,
* \f$ D_1 \times D_2 \to D_3 \f$. The \f$ D_i \f$ are given as template
* arguments to the operator. A #grb::Monoid is composed from a binary operator
Expand Down
2 changes: 2 additions & 0 deletions include/graphblas/base/io.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@

#include <assert.h>

#include <cstdint> // for uintptr_t


namespace grb {

Expand Down
1 change: 1 addition & 0 deletions include/graphblas/hyperdags/hyperdags.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
#include <map>
#include <set>
#include <vector>
#include <cstdint> // uintptr_t
#include <ostream>
#include <iostream>
#include <type_traits>
Expand Down
224 changes: 141 additions & 83 deletions include/graphblas/identities.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,91 +55,130 @@ namespace grb {
/** Standard identity for numerical addition. */
template< typename D >
class zero {
static_assert( std::is_convertible< int, D >::value, "Cannot form identity under the requested domain" );

public:
/**
* @tparam D The domain of the value to return.
* @return The identity under standard addition (i.e., `zero').
*/
static constexpr D value() {
return static_cast< D >( 0 );
}

static_assert( std::is_convertible< int, D >::value,
"Cannot form identity under the requested domain" );

public:

/**
* @tparam D The domain of the value to return.
* @return The identity under standard addition (i.e., `zero').
*/
static constexpr D value() {
return static_cast< D >( 0 );
}

};

template< typename K, typename V >
class zero< std::pair< K, V > > {
public:
static constexpr std::pair< K, V > value() {
return std::make_pair( zero< K >::value(), zero< V >::value() );
}

public:

static constexpr std::pair< K, V > value() {
return std::make_pair( zero< K >::value(), zero< V >::value() );
}

};

/** Standard identity for numerical multiplication. */
template< typename D >
class one {
static_assert( std::is_convertible< int, D >::value, "Cannot form identity under the requested domain" );

public:
/**
* @tparam D The domain of the value to return.
* @return The identity under standard multiplication (i.e., `one').
*/
static constexpr D value() {
return static_cast< D >( 1 );
}

static_assert( std::is_convertible< int, D >::value,
"Cannot form identity under the requested domain" );

public:

/**
* @tparam D The domain of the value to return.
* @return The identity under standard multiplication (i.e., `one').
*/
static constexpr D value() {
return static_cast< D >( 1 );
}

};

template< typename K, typename V >
class one< std::pair< K, V > > {
public:
static constexpr std::pair< K, V > value() {
return std::make_pair( one< K >::value(), one< V >::value() );
}

public:

static constexpr std::pair< K, V > value() {
return std::make_pair( one< K >::value(), one< V >::value() );
}

};

/** Standard identity for the minimum operator. */
template< typename D >
class infinity {
static_assert( std::is_arithmetic< D >::value, "Cannot form identity under the requested domain" );

public:
/**
* @tparam D The domain of the value to return.
* @return The identity under the standard min operator (i.e., `infinity'),
* of type \a D.
*/
static constexpr D value() {
return std::numeric_limits< D >::has_infinity ? std::numeric_limits< D >::infinity() : std::numeric_limits< D >::max();
}
static_assert( std::is_arithmetic< D >::value,
"Cannot form identity under the requested domain" );

public:

/**
* @tparam D The domain of the value to return.
* @return The identity under the standard min operator (i.e., `infinity'),
* of type \a D.
*/
static constexpr D value() {
return std::numeric_limits< D >::has_infinity
? std::numeric_limits< D >::infinity()
: std::numeric_limits< D >::max();
}

};

template< typename K, typename V >
class infinity< std::pair< K, V > > {
public:
static constexpr std::pair< K, V > value() {
return std::make_pair( infinity< K >::value(), infinity< V >::value() );
}

public:

static constexpr std::pair< K, V > value() {
return std::make_pair( infinity< K >::value(), infinity< V >::value() );
}

};

/** Standard identity for the maximum operator. */
template< typename D >
class negative_infinity {

static_assert( std::is_arithmetic< D >::value, "Cannot form identity under the requested domain" );

public:
/**
* @tparam D The domain of the value to return.
* @return The identity under the standard max operator, i.e.,
* `minus infinity'.
*/
static constexpr D value() {
return std::numeric_limits< D >::min() == 0 ? 0 : ( std::numeric_limits< D >::has_infinity ? -std::numeric_limits< D >::infinity() : std::numeric_limits< D >::min() );
}
public:

/**
* @tparam D The domain of the value to return.
* @return The identity under the standard max operator, i.e.,
* `minus infinity'.
*/
static constexpr D value() {
return std::numeric_limits< D >::min() == 0
? 0
: ( std::numeric_limits< D >::has_infinity
? -std::numeric_limits< D >::infinity()
: std::numeric_limits< D >::min()
);
}

};

template< typename K, typename V >
class negative_infinity< std::pair< K, V > > {
public:

public:

static constexpr std::pair< K, V > value() {
return std::make_pair( negative_infinity< K >::value(), negative_infinity< V >::value() );
return std::make_pair( negative_infinity< K >::value(),
negative_infinity< V >::value() );
}

};

/**
Expand All @@ -149,24 +188,33 @@ namespace grb {
*/
template< typename D >
class logical_false {
static_assert( std::is_convertible< bool, D >::value, "Cannot form identity under the requested domain" );

public:
/**
* @tparam D The domain of the value to return.
* @return The identity under the standard logical OR operator, i.e.,
* \a false.
*/
static const constexpr D value() {
return static_cast< D >( false );
}

static_assert( std::is_convertible< bool, D >::value,
"Cannot form identity under the requested domain" );

public:

/**
* @tparam D The domain of the value to return.
* @return The identity under the standard logical OR operator, i.e.,
* \a false.
*/
static const constexpr D value() {
return static_cast< D >( false );
}

};

template< typename K, typename V >
class logical_false< std::pair< K, V > > {
public:
static constexpr std::pair< K, V > value() {
return std::make_pair( logical_false< K >::value(), logical_false< V >::value() );
}

public:

static constexpr std::pair< K, V > value() {
return std::make_pair( logical_false< K >::value(),
logical_false< V >::value() );
}

};

/**
Expand All @@ -176,27 +224,37 @@ namespace grb {
*/
template< typename D >
class logical_true {
static_assert( std::is_convertible< bool, D >::value, "Cannot form identity under the requested domain" );

public:
/**
* @tparam D The domain of the value to return.
* @return The identity under the standard logical AND operator, i.e.,
* \a true.
*/
static constexpr D value() {
return static_cast< D >( true );
}

static_assert( std::is_convertible< bool, D >::value,
"Cannot form identity under the requested domain" );

public:

/**
* @tparam D The domain of the value to return.
* @return The identity under the standard logical AND operator, i.e.,
* \a true.
*/
static constexpr D value() {
return static_cast< D >( true );
}

};

template< typename K, typename V >
class logical_true< std::pair< K, V > > {
public:
static constexpr std::pair< K, V > value() {
return std::make_pair( logical_true< K >::value(), logical_true< V >::value() );
}

public:

static constexpr std::pair< K, V > value() {
return std::make_pair( logical_true< K >::value(),
logical_true< V >::value() );
}

};

} // namespace identities

} // namespace grb

#endif
Expand Down
Loading
Loading