|
@@ -160,21 +160,51 @@ void check_bcsr(starpu_data_handle_t handle_s, starpu_data_handle_t handle_r, in
|
|
|
STARPU_ASSERT(starpu_bcsr_get_firstentry(handle_s) == starpu_bcsr_get_firstentry(handle_r));
|
|
|
STARPU_ASSERT(starpu_bcsr_get_r(handle_s) == starpu_bcsr_get_r(handle_r));
|
|
|
STARPU_ASSERT(starpu_bcsr_get_c(handle_s) == starpu_bcsr_get_c(handle_r));
|
|
|
- // STARPU_ASSERT(starpu_bcsr_get_local_colind(handle_s) == starpu_bcsr_get_local_colind(handle_r));
|
|
|
- // STARPU_ASSERT(starpu_bcsr_get_local_rowptr(handle_s) == starpu_bcsr_get_local_rowptr(handle_r));
|
|
|
|
|
|
starpu_data_acquire(handle_s, STARPU_R);
|
|
|
starpu_data_acquire(handle_r, STARPU_R);
|
|
|
|
|
|
+ uint32_t *colind_s = starpu_bcsr_get_local_colind(handle_s);
|
|
|
+ uint32_t *colind_r = starpu_bcsr_get_local_colind(handle_r);
|
|
|
+ uint32_t *rowptr_s = starpu_bcsr_get_local_rowptr(handle_s);
|
|
|
+ uint32_t *rowptr_r = starpu_bcsr_get_local_rowptr(handle_r);
|
|
|
+
|
|
|
int *bcsr_s = (int *)starpu_bcsr_get_local_nzval(handle_s);
|
|
|
int *bcsr_r = (int *)starpu_bcsr_get_local_nzval(handle_r);
|
|
|
|
|
|
int r = starpu_bcsr_get_r(handle_s);
|
|
|
int c = starpu_bcsr_get_c(handle_s);
|
|
|
int nnz = starpu_bcsr_get_nnz(handle_s);
|
|
|
+ int nrows = starpu_bcsr_get_nrow(handle_s);
|
|
|
|
|
|
int x;
|
|
|
|
|
|
+ for(x=0 ; x<nnz ; x++)
|
|
|
+ {
|
|
|
+ if (colind_s[x] == colind_r[x])
|
|
|
+ {
|
|
|
+ FPRINTF_MPI(stderr, "Success with colind[%d] value: %u == %u\n", x, colind_s[x], colind_r[x]);
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ *error = 1;
|
|
|
+ FPRINTF_MPI(stderr, "Error with colind[%d] value: %u != %u\n", x, colind_s[x], colind_r[x]);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ for(x=0 ; x<nrows+1 ; x++)
|
|
|
+ {
|
|
|
+ if (rowptr_s[x] == rowptr_r[x])
|
|
|
+ {
|
|
|
+ FPRINTF_MPI(stderr, "Success with rowptr[%d] value: %u == %u\n", x, rowptr_s[x], rowptr_r[x]);
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ *error = 1;
|
|
|
+ FPRINTF_MPI(stderr, "Error with rowptr[%d] value: %u != %u\n", x, rowptr_s[x], rowptr_r[x]);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
for(x=0 ; x<r*c*nnz ; x++)
|
|
|
{
|
|
|
if (bcsr_s[x] == bcsr_r[x])
|
|
@@ -383,23 +413,22 @@ void exchange_bcsr(int rank, int *error)
|
|
|
*
|
|
|
* nzval = [0, 1, 2, 3] ++ [4, 5, 6, 7] ++ [8, 9, 10, 11]
|
|
|
* colind = [0, 0, 1]
|
|
|
- * rowptr = [0, 1 ]
|
|
|
+ * rowptr = [0, 1, 3]
|
|
|
* r = c = 2
|
|
|
*/
|
|
|
|
|
|
/* Size of the blocks */
|
|
|
#define BCSR_R 2
|
|
|
#define BCSR_C 2
|
|
|
-#define BCSR_NROW 2
|
|
|
+#define BCSR_NROWS 2
|
|
|
#define BCSR_NNZ_BLOCKS 3 /* out of 4 */
|
|
|
#define BCSR_NZVAL_SIZE (BCSR_R*BCSR_C*BCSR_NNZ_BLOCKS)
|
|
|
|
|
|
- uint32_t colind[BCSR_NNZ_BLOCKS] = {0, 0, 1};
|
|
|
- uint32_t rowptr[BCSR_NROW] = {0, 1};
|
|
|
-
|
|
|
if (rank == 0)
|
|
|
{
|
|
|
starpu_data_handle_t bcsr_handle[2];
|
|
|
+ uint32_t colind[BCSR_NNZ_BLOCKS] = {0, 0, 1};
|
|
|
+ uint32_t rowptr[BCSR_NROWS+1] = {0, 1, BCSR_NNZ_BLOCKS};
|
|
|
int nzval[BCSR_NZVAL_SIZE] =
|
|
|
{
|
|
|
0, 1, 2, 3, /* First block */
|
|
@@ -407,8 +436,8 @@ void exchange_bcsr(int rank, int *error)
|
|
|
8, 9, 10, 11 /* Third block */
|
|
|
};
|
|
|
|
|
|
- starpu_bcsr_data_register(&bcsr_handle[0], STARPU_MAIN_RAM, BCSR_NNZ_BLOCKS, BCSR_NROW, (uintptr_t) nzval, colind, rowptr, 0, BCSR_R, BCSR_C, sizeof(nzval[0]));
|
|
|
- starpu_bcsr_data_register(&bcsr_handle[1], -1, BCSR_NNZ_BLOCKS, BCSR_NROW, (uintptr_t) NULL, colind, rowptr, 0, BCSR_R, BCSR_C, sizeof(nzval[0]));
|
|
|
+ starpu_bcsr_data_register(&bcsr_handle[0], STARPU_MAIN_RAM, BCSR_NNZ_BLOCKS, BCSR_NROWS, (uintptr_t) nzval, colind, rowptr, 0, BCSR_R, BCSR_C, sizeof(nzval[0]));
|
|
|
+ starpu_bcsr_data_register(&bcsr_handle[1], -1, BCSR_NNZ_BLOCKS, BCSR_NROWS, (uintptr_t) NULL, (uint32_t *) NULL, (uint32_t *) NULL, 0, BCSR_R, BCSR_C, sizeof(nzval[0]));
|
|
|
|
|
|
send_recv_and_check(rank, 1, bcsr_handle[0], 0x73, bcsr_handle[1], 0x8337, error, check_bcsr);
|
|
|
|
|
@@ -418,7 +447,7 @@ void exchange_bcsr(int rank, int *error)
|
|
|
else if (rank == 1)
|
|
|
{
|
|
|
starpu_data_handle_t bcsr_handle;
|
|
|
- starpu_bcsr_data_register(&bcsr_handle, -1, BCSR_NNZ_BLOCKS, BCSR_NROW, (uintptr_t) NULL, colind, rowptr, 0, BCSR_R, BCSR_C, sizeof(int));
|
|
|
+ starpu_bcsr_data_register(&bcsr_handle, -1, BCSR_NNZ_BLOCKS, BCSR_NROWS, (uintptr_t) NULL, (uint32_t *) NULL, (uint32_t *) NULL, 0, BCSR_R, BCSR_C, sizeof(int));
|
|
|
send_recv_and_check(rank, 0, bcsr_handle, 0x73, NULL, 0x8337, NULL, NULL);
|
|
|
starpu_data_unregister(bcsr_handle);
|
|
|
}
|