1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556 |
- #include <starpu.h>
- #include "pxlu.h"
- static STARPU_PLU(compute_ax_block)(unsigned size, unsigned nblocks,
- TYPE *block_data, TYPE *sub_x, TYPE *sub_y)
- {
- CPU_GEMV("N", size/nblocks, size/nblocks, 1.0, block_data, size/nblocks, sub_x, 1, 1.0, sub_y, 1);
- }
- void STARPU_PLU(compute_ax)(unsigned size, TYPE *x, TYPE *y, unsigned nblocks, int rank)
- {
-
- TYPE *yi = calloc(size, sizeof(TYPE));
-
- unsigned long i,j;
- for (j = 0; j < nblocks; j++)
- {
- for (i = 0; i < nblocks; i++)
- {
- if (get_block_rank(i, j) == rank)
- {
-
- TYPE *block_data = STARPU_PLU(get_block)(j, i);
- TYPE *sub_x = &x[i*(size/nblocks)];
- TYPE *sub_yi = &yi[j*(size/nblocks)];
- STARPU_PLU(compute_ax_block)(size, nblocks, block_data, sub_x, sub_yi);
- }
- }
- }
-
- MPI_Reduce(yi, y, size, MPI_TYPE, MPI_SUM, 0, MPI_COMM_WORLD);
- }
|