25 #include <starpu_data.h>
27 #ifndef DOXYGEN_SHOULD_SKIP_THIS
29 pastix_starpu_filter_interface(
void *father_interface,
30 void *child_interface,
31 struct starpu_data_filter *f,
37 size_t *sizetab = (
size_t *)f->filter_arg_ptr;
41 assert( father->
offset == -1 );
44 child->
id = father->
id;
46 child->
offset = sizetab[id];
47 child->
nbblok = sizetab[
id+1] - sizetab[id];
52 assert( child->
offset >= 0 );
54 if ( father->
dataptr == NULL ) {
70 for ( i=0; i<child->
nbblok; i++, blok++) {
80 #if defined(PASTIX_STARPU_INTERFACE_DEBUG)
82 "blok (%9s, size=%8zu, nbblok=%2ld )\n",
83 child->
cblk->
cblktype & CBLK_COMPRESSED ?
"Low-rank" :
"Full-rank",
100 starpu_data_handle_t *handler = ( (starpu_data_handle_t *)( cblk->
handler ) ) + side;
101 int64_t tag_cblk = 2 * cblk->
gcblknum + side;
104 #if defined( PASTIX_WITH_MPI )
105 starpu_mpi_data_register( *handler, spmtx->
mpitag + tag_cblk, cblk->
ownerid );
116 pastix_starpu_register_interface( spmtx, cblk,
PastixLCoef, flttype );
118 pastix_starpu_register_interface( spmtx, cblk,
PastixUCoef, flttype );
169 #if defined( PASTIX_WITH_MPI )
174 if ( spmtx != NULL ) {
184 spmtx->
typesze = pastix_size_of( flttype );
196 for ( cblknum = 0; cblknum < cblkmin2d; cblknum++, n++, cblk++ ) {
197 pastix_starpu_register_cblk( spmtx, cblk, flttype );
201 if ( cblkmin2d < cblknbr ) {
202 struct starpu_data_filter filter = { .filter_func = pastix_starpu_filter_interface };
204 size_t *sizetab = NULL;
214 sizetab = malloc( sizenbr *
sizeof(
size_t ) );
215 assert( sizenbr >= 1 );
217 for ( cblknum = cblkmin2d, n = 0; cblknum < cblknbr;
218 cblknum++, n++, cblk++, cblkhandle++ ) {
219 pastix_starpu_register_cblk( spmtx, cblk, flttype );
221 if ( !( cblk->cblktype & CBLK_TASKS_2D ) ) {
226 blok = cblk[0].fblokptr;
227 lblok = cblk[1].fblokptr;
229 if ( ( lblok - blok ) >= sizenbr ) {
230 sizenbr = ( lblok - blok ) + 1;
232 sizetab = malloc( sizenbr *
sizeof(
size_t ) );
240 sizetab[nchildren + 1] = 1;
247 for ( ; blok < lblok; blok++ ) {
250 while ( ( blok + 1 < lblok ) &&
251 ( blok[0].fcblknm == blok[1].fcblknm ) &&
252 ( blok[0].lcblknm == blok[1].lcblknm ) )
259 sizetab[nchildren + 1] = sizetab[nchildren] + size;
262 filter.nchildren = nchildren;
263 filter.filter_arg_ptr = sizetab;
267 cblkhandle->
handletab = (starpu_data_handle_t *)malloc(
268 2 * nchildren *
sizeof( starpu_data_handle_t ) );
270 starpu_data_partition_plan( cblk->handler[0], &filter, cblkhandle->
handletab );
272 starpu_data_partition_plan(
273 cblk->handler[1], &filter, cblkhandle->
handletab + nchildren );
277 (starpu_data_handle_t *)malloc( nchildren *
sizeof( starpu_data_handle_t ) );
279 starpu_data_partition_plan( cblk->handler[0], &filter, cblkhandle->
handletab );
283 blok = cblk[0].fblokptr;
284 lblok = cblk[1].fblokptr;
290 #if defined( PASTIX_WITH_MPI )
291 tag = tag_desc + 2 * ( blok - solvmtx->
bloktab );
292 starpu_mpi_data_register( blok->
handler[0], tag, cblk->ownerid );
296 #if defined( PASTIX_WITH_MPI )
297 tag = tag_desc + 2 * ( blok - solvmtx->
bloktab ) + 1;
298 starpu_mpi_data_register( blok->
handler[1], tag, cblk->ownerid );
310 for ( ; blok < lblok; blok++ ) {
312 #if defined( PASTIX_WITH_MPI )
313 tag = tag_desc + 2 * ( blok - solvmtx->
bloktab );
314 starpu_mpi_data_register( blok->
handler[0], tag, cblk->ownerid );
318 #if defined( PASTIX_WITH_MPI )
319 tag = tag_desc + 2 * ( blok - solvmtx->
bloktab ) + 1;
320 starpu_mpi_data_register( blok->
handler[1], tag, cblk->ownerid );
328 while ( ( blok < lblok ) && ( blok[0].fcblknm == blok[1].fcblknm ) &&
329 ( blok[0].lcblknm == blok[1].lcblknm ) ) {
337 if ( sizetab != NULL ) {
341 solvmtx->starpu_desc = spmtx;
369 starpu_data_wont_use( cblk->
handler[0] );
373 starpu_data_wont_use( cblk->
handler[1] );
402 starpu_data_acquire_cb( cblk->
handler[0],
404 (
void( * )(
void * ) ) & starpu_data_release,
408 starpu_data_acquire_cb( cblk->
handler[1],
410 (
void( * )(
void * ) ) & starpu_data_release,
416 #if !defined(DOXYGEN_SHOULD_SKIP_THIS)
417 #if !defined(HAVE_STARPU_DATA_PARTITION_CLEAN_NODE)
425 pastix_starpu_data_partition_clean_node(
int unpartition,
426 starpu_data_handle_t root_handle,
428 starpu_data_handle_t *children,
432 starpu_data_unpartition_submit( root_handle, nparts, children, gather_node );
434 starpu_data_partition_clean( root_handle, nparts, children );
438 pastix_starpu_data_partition_clean_node(
int unpartition __attribute__((unused)),
439 starpu_data_handle_t root_handle,
441 starpu_data_handle_t *children,
444 starpu_data_partition_clean_node( root_handle, nparts, children, gather_node );
471 if ( cblk->
cblktype & CBLK_TASKS_2D ) {
481 is_owner ? STARPU_MAIN_RAM : -1 );
489 is_owner ? STARPU_MAIN_RAM : -1 );
497 starpu_data_unregister( cblk->
handler[0] );
500 starpu_data_unregister( cblk->
handler[1] );
530 for ( i = 0; i < cblkmin2d; i++, cblk++ ) {
535 for ( i = cblkmin2d; i < spmtx->
solvmtx->
cblknbr; i++, cblk++, cblkhandle++ ) {
BEGIN_C_DECLS typedef int pastix_int_t
struct pastix_lrblock_s pastix_lrblock_t
The block low-rank structure to hold a matrix in low-rank form.
spm_coeftype_t pastix_coeftype_t
Arithmetic types.
spm_mtxtype_t pastix_mtxtype_t
Matrix symmetry type property.
enum pastix_coefside_e pastix_coefside_t
Data blocks used in the kernel.
starpu_data_handle_t * handletab
starpu_cblk_t * cblktab_handle
enum starpu_data_interface_id id
pastix_coeftype_t flttype
void pastix_starpu_cblk_destroy(int is_owner, SolverCblk *cblk, starpu_cblk_t *cblkhandle)
Destroy a single cblk StarPU data structure of the sparse matrix.
void starpu_sparse_matrix_getoncpu(starpu_sparse_matrix_desc_t *spmtx)
Submit asynchronous calls to retrieve the data on main memory.
struct starpu_cblk_s starpu_cblk_t
Additional StarPU handlers for a column-block when using 2D kernels.
int64_t pastix_starpu_tag_book(int64_t nbtags)
Book a range of StarPU unique tags of size nbtags.
void starpu_sparse_matrix_init(SolverMatrix *solvmtx, pastix_mtxtype_t mtxtype, int nodes, int myrank, pastix_coeftype_t flttype)
Generate the StarPU descriptor of the sparse matrix.
void pastix_starpu_tag_release(int64_t min)
Release the set of tags starting by min.
#define PASTIX_STARPU_INTERFACE_ID
Alias to get the Interface id.
void starpu_sparse_cblk_wont_use(pastix_coefside_t side, SolverCblk *cblk)
Submit asynchronous calls to retrieve the data on main memory.
void pastix_starpu_register(starpu_data_handle_t *handleptr, const SolverCblk *cblk, pastix_coefside_t side, pastix_coeftype_t flttype)
Register a cblk at the StarPU level.
void starpu_sparse_matrix_destroy(starpu_sparse_matrix_desc_t *spmtx)
Free the StarPU descriptor of the sparse matrix.
Interface data structure to register the pieces of data in StarPU.
Additional StarPU handlers for a column-block when using 2D kernels.
StarPU descriptor stucture for the sparse matrix.
static pastix_int_t blok_rownbr(const SolverBlok *blok)
Compute the number of rows of a block.
static pastix_int_t cblk_colnbr(const SolverCblk *cblk)
Compute the number of columns in a column block.
SolverBlok *restrict bloktab
SolverCblk *restrict cblktab
Solver column block structure.
Solver column block structure.