Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
39 commits
Select commit Hold shift + click to select a range
f67b463
masked set matrix to matrix
aleksamilisavljevic Feb 21, 2024
969ddd9
tests
aleksamilisavljevic Feb 21, 2024
c7cb4f5
tests refactor
aleksamilisavljevic Feb 21, 2024
34af750
nonblocking implementation
aleksamilisavljevic Feb 21, 2024
1611bc4
hyperdags implementation
aleksamilisavljevic Feb 21, 2024
d250c54
rename
aleksamilisavljevic Feb 26, 2024
cc73689
code cleanup
aleksamilisavljevic Feb 27, 2024
3e33029
omp reductions
aleksamilisavljevic Feb 27, 2024
36849bd
Fixes after rebase
anyzelman Aug 17, 2025
969ce5c
The code in the unit test was correct re invert_mask, even though pre…
anyzelman Aug 17, 2025
17868d8
Code review on implementations for indirect backends
anyzelman Aug 17, 2025
6c7d9db
Code review utils
anyzelman Aug 17, 2025
009ce24
Wrote spec for set(matrix,matrix,matrix)
anyzelman Aug 18, 2025
473e700
Initial code review. Main TODO: parallelise this operation using the …
anyzelman Aug 18, 2025
777f640
Fix static error
anyzelman Aug 23, 2025
3daf10a
Fix silly snafu my side
anyzelman Aug 23, 2025
a0c297e
Made masked tests generic, and add test for empty mask. Passes OK
anyzelman Aug 23, 2025
4f5fedd
Enable casting tests, use Boolean and non-Boolean masks
anyzelman Aug 23, 2025
47029c5
Bugfix for no_casting set-matrix-to-matrix
anyzelman Aug 23, 2025
dff5ec2
Add no-casting tests
anyzelman Aug 23, 2025
ebbd717
Bugfix
anyzelman Aug 23, 2025
1525dbe
Better debug tracing
anyzelman Aug 23, 2025
86b156b
Enable masked void-to-void matrix sets
anyzelman Aug 23, 2025
7975e56
Bugfix
anyzelman Aug 23, 2025
25fdef4
Complete unit test by testing casting from non-voids to void
anyzelman Aug 23, 2025
72da7fd
Unit test uncovered bug in hyperdags implementation, herewith fixed
anyzelman Aug 24, 2025
bc63b59
Also execute matrixSet unit test for larger matrices
anyzelman Aug 24, 2025
c5b11a1
BSP1D I/O implementation of grb::set(matrix,matrix,matrix). All unit …
anyzelman Aug 24, 2025
0955f9f
Remove redundant template info from constructor
anyzelman Sep 22, 2025
c698489
Hotfix missing include
anyzelman Sep 22, 2025
182c79e
Hotfix bug in matrixFileReader
anyzelman Sep 22, 2025
972069b
Hotfix bug in BSP1D I/O
anyzelman Sep 22, 2025
66a1974
Refactor SPA buffer management from blas3/mxm to matrix.hpp. This pre…
anyzelman Sep 22, 2025
958aa68
Metabugfix: use heap for dynamic arrays, not the stack
anyzelman Sep 27, 2025
df2d41d
make SPA buffer retrieval compatible with void matrices
anyzelman Sep 27, 2025
efe6f6a
make SPA buffer retrieval compatible with void matrices
anyzelman Sep 27, 2025
7b16925
Always select at least one thread
anyzelman Sep 27, 2025
6e2e381
Bugfix error in expected capacity calculation (metabug - did not trig…
anyzelman Sep 27, 2025
a6ae18b
fix typo
anyzelman Oct 14, 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
165 changes: 144 additions & 21 deletions include/graphblas/base/io.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -1218,15 +1218,17 @@ namespace grb {
* -# #grb::descriptors::invert_mask, and
* -# #grb::descriptors::structural.
*
* However, and differently from most ALP primtivies, the
* However, and differently from most ALP/GraphBLAS primitivies, the
* #grb::descriptors::invert_mask and #grb::descriptors::structural are
* mutually exclusive for this primitive.
* \endparblock
*
* @tparam OutputType The type of each element in the given matrix.
* @tparam MaskType The type of each element in the given mask.
* @tparam ValueType The type of the given value. Should be convertible
* to \a OutputType.
* @tparam ValueType The type of the given value.
*
* The given \a ValueType must be convertible to \a OutputType.
*
* @tparam RIT The integer type for encoding row indices.
* @tparam CIT The integer type for encoding column indices.
* @tparam NIT The integer type for encoding nonzero indices.
Expand All @@ -1244,51 +1246,50 @@ namespace grb {
* the default is #grb::EXECUTE.
*
* In #grb::RESIZE mode:
* @returns #grb::SUCCESS When the capacity of \a C has been (made) sufficient
* to store the requested output.
*
* @returns #grb::SUCCESS When the capacity of \a C (has been made or already
* was) sufficient to store the requested output.
* @returns #grb::OUTOFMEM When out-of-memory conditions have been met while
* executing. If this error code is returned, \a C
* resizing \a C. If this error code is returned, \a C
* shall be unmodified compared to its state at
* function entry.
*
* In #grb::EXECUTE mode:
* @returns #grb::SUCCESS When the call completes successfully.
*
* @returns #grb::SUCCESS When the computation has completed or will execute
* successfully.
* @returns #grb::ILLEGAL When \a C did not have enough capacity to store the
* output of the requested computation.
*
* Either mode may additionally return:
* @returns #grb::ILLEGAL In case the given \a mask was empty.
*
* @returns #grb::MISMATCH In case \a C and \a mask have mismatching sizes.
* @returns #grb::PANIC In case an unmitigable error was encountered. The
* caller is suggested to exit gracefully, and in any
* case to not make any further calls to ALP.
* caller, when encountering this return code, is
* suggested to exit gracefully and to not make any
* further calls to ALP.
*
* When \a descr includes #grb::descriptors::no_casting then code shall not
* compile if one of the following conditions are met:
* -# \a ValueType does not match \a OutputType; or
* -# \a MaskType does not match <tt>bool</tt>.
*
* In these cases, the code shall not compile: implementations must throw
* a static assertion failure in this case.
*
* Similarly, it is forbidden to call this function with both following
* descriptors simultaneously:
* - #grb::descriptors::invert_mask \em and #grb::descriptors::structural.
*
* The use of the #grb::descriptors::structural_complement descriptor hence is
* is forbidden also. Implementations shall throw a static assertion failure
* if the user nonetheless asks for structural mask inversion.
* is forbidden also. These conditions, when encountered, should lead to
* compile-time errors also.
*
* \note One vehicle to ensure compilation does not occur in these cases is via
* <tt>static_assert</tt>.
*
* \parblock
* \par Performance semantics
* Each backend must define performance semantics for this primitive.
*
* @see perfSemantics
*
* \warning Generally, if \a mask equals \a C and the mask is non-structural,
* then optimised implementations will assign higher costs than when
* \a mask does not equal \a C. This is because the nonzero structure
* update cannot be done in-place.
* \endparblock
*/
template<
Expand Down Expand Up @@ -1320,6 +1321,128 @@ namespace grb {
return UNSUPPORTED;
}

/**
* Sets all values of a matrix to that of a given source matrix, if and only if
* the corresponding value coordinates evaluate <tt>true</tt> at the given mask
* matrix.
*
* @tparam descr The descriptor used for this operation.
*
* \parblock
* \par Accepted descriptors
* -# #grb::descriptors::no_operation,
* -# #grb::descriptors::no_casting,
* -# #grb::descriptors::invert_mask,
* -# #grb::descriptors::structural
*
* However, and differently from most ALP primtivies, the
* #grb::descriptors::invert_mask and #grb::descriptors::structural are
* mutually exclusive for this primitive.
* \endparblock
*
* @tparam OutputType The type of each element in the destination matrix.
* @tparam MaskType The type of each element in the output mask.
* @tparam ValueType The type of each element in the source matrix.
*
* The given \a ValueType must be convertible to \a OutputType.
*
* \internal
* @tparam RIT1 The integer type for encoding row indices in \a C.
* @tparam CIT1 The integer type for encoding column indices in \a C.
* @tparam NIT1 The integer type for encoding nonzero indices in \a C.
* @tparam RIT2 The integer type for encoding row indices in \a mask.
* @tparam CIT2 The integer type for encoding column indices in \a mask.
* @tparam NIT2 The integer type for encoding nonzero indices in \a mask.
* @tparam RIT3 The integer type for encoding row indices in \a A.
* @tparam CIT3 The integer type for encoding column indices in \a A.
* @tparam NIT3 The integer type for encoding nonzero indices in \a A.
* @tparam backend The backend selected for executing this primitive.
* \endinternal
*
* @param[out] C The matrix that will be a masked copy of \a A.
* @param[in] mask Matrix that acts as output mask on \a C.
* @param[in] A The source matrix which will (partially) be copied to
* \a A.
* @param[in] phase Which #grb::Phase of the operation is requested. Optional;
* the default is #grb::EXECUTE.
*
* In #grb::RESIZE mode:
*
* @returns #grb::SUCCESS When the capacity of \a C (has been made or already
* was) sufficient to store the requested output.
* @returns #grb::OUTOFMEM When out-of-memory conditions were met while
* resizing \a C. If this error code is returned, \a C
* shall be left unmodified compared to its state at
* function entry.
*
* In #grb::EXECUTE mode:
*
* @returns #grb::SUCCESS When the computation has completed or will execute
* successfully.
* @returns #grb::ILLEGAL When \a C did not have enough capacity to store the
* output of the requested computation.
*
* Either mode may additionally return:
*
* @returns #grb::MISMATCH When \a A and \a C have mismatching sizes.
* @returns #grb::MISMATCH When \a C and \a mask have mismatching sizes.
* @returns #grb::PANIC In case an unmitigable error was encountered. The
* caller, when encountering this return code, is
* suggested to exit the program gracefully and to not
* make any further calls to ALP.
*
* When \a descr includes #grb::descriptors::no_casting, then code shall not
* comile if one of the following conditions are met:
* -# \a ValueType does not match \a OutputType; or
* -# \a MaskType does not match <tt>bool</tt>.
*
* Similarly, it is forbidden to call this function with both following
* descriptors simultaneously:
* - #grb::descriptors::invert_mask \em and #grb::descriptors::structural.
*
* The use of the #grb::descriptors::structural_complement descriptor hence is
* is forbidden also. These conditions should lead to compile-time errors also.
*
* \note One vehicle to ensure compilation does not occur in these cases is via
* <tt>static_assert</tt>.
*
* \parblock
* \par Performance semantics
* Each backend must define performance semantics for this primitive.
*
* @see perfSemantics
* \endparblock
*/
template<
Descriptor descr = descriptors::no_operation,
typename OutputType, typename MaskType, typename ValueType,
typename RIT1, typename CIT1, typename NIT1,
typename RIT2, typename CIT2, typename NIT2,
typename RIT3, typename CIT3, typename NIT3,
Backend backend
>
RC set(
Matrix< OutputType, backend, RIT1, CIT1, NIT1 > &C,
const Matrix< MaskType, backend, RIT2, CIT2, NIT2 > &mask,
const Matrix< ValueType, backend, RIT3, CIT3, NIT3 > &A,
const Phase &phase = EXECUTE,
const typename std::enable_if<
!grb::is_object< OutputType >::value &&
!grb::is_object< ValueType >::value &&
!grb::is_object< MaskType >::value,
void >::type * const = nullptr
) noexcept {
#ifndef NDEBUG
const bool should_not_call_base_matrix_masked_matrix_set = false;
assert( should_not_call_base_matrix_masked_matrix_set );
#endif
(void) C;
(void) mask;
(void) A;
(void) phase;
return UNSUPPORTED;
}

/**
* Sets the element of a given vector at a given position to a given value.
*
Expand Down Expand Up @@ -1763,7 +1886,7 @@ namespace grb {
* successfully, then a call to this function shall return #grb::SUCCESS.
*
* The are several other cases in which the computation of nonblocking
* primtives is forced:
* primitives is forced:
* -# whenever an output iterator of an output container of any of the non-
* blocking primitives is requested; and
* -# whenever an output container of any of the non-blocking primitives is
Expand Down
1 change: 1 addition & 0 deletions include/graphblas/bsp1d/init.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
#include <graphblas/utils/DMapper.hpp>
#include <graphblas/utils/threadLocalStorage.hpp>

#include <cstdint> //uintptr_t
#include <assert.h> //assertions

#include <lpf/core.h>
Expand Down
Loading