26 #include <starpu_data.h>
28 #ifndef DOXYGEN_SHOULD_SKIP_THIS
30 pastix_starpu_filter_interface(
void *father_interface,
31 void *child_interface,
32 struct starpu_data_filter *f,
38 size_t *sizetab = (
size_t *)f->filter_arg_ptr;
42 assert( father->
offset == -1 );
45 child->
id = father->
id;
47 child->
offset = sizetab[id];
48 child->
nbblok = sizetab[
id+1] - sizetab[id];
53 assert( child->
offset >= 0 );
67 for ( i=0; i<child->
nbblok; i++, blok++) {
77 #if defined(PASTIX_STARPU_INTERFACE_DEBUG)
79 "blok (%9s, size=%8zu, nbblok=%2ld )\n",
80 child->
cblk->
cblktype & CBLK_COMPRESSED ?
"Low-rank" :
"Full-rank",
86 if ( father->
dataptr != NULL ) {
99 starpu_data_handle_t *handler = ( (starpu_data_handle_t *)( cblk->
handler ) ) + side;
102 #if defined( PASTIX_WITH_MPI )
104 if ( cblk->
cblktype & CBLK_FANIN ) {
106 starpu_mpi_data_register( *handler, spmtx->
mpitag + tag_cblk, spmtx->
solvmtx->clustnum );
114 tag_cblk = 2 * cblk->
gcblknum + side;
116 starpu_mpi_data_register( *handler, spmtx->
mpitag + tag_cblk, cblk->
ownerid );
118 #if defined(PASTIX_DEBUG_STARPU)
119 fprintf( stderr,
"[%2d][pastix][%s] Matrix cblk=%d, owner=%d, tag=%ld, size=%ld\n",
134 if ( ( cblk->
cblktype & (CBLK_FANIN|CBLK_RECV) ) &&
135 ( cblk->
cblktype & CBLK_TASKS_2D ) ) {
144 pastix_starpu_register_interface( spmtx, cblk,
PastixLCoef, flttype );
146 pastix_starpu_register_interface( spmtx, cblk,
PastixUCoef, flttype );
150 #if defined( PASTIX_WITH_MPI )
160 if ( cblk->
cblktype & CBLK_FANIN ) {
161 tag = tag_desc + 2 * blok->
gfaninnm;
162 ownerid = spmtx->
solvmtx->clustnum;
164 else if ( cblk->
cblktype & CBLK_RECV ) {
165 tag = tag_desc + 2 * blok->
gfaninnm;
168 tag = tag_desc + 2 * blok->
gbloknm;
171 starpu_mpi_data_register( blok->
handler[0], tag, ownerid );
174 starpu_mpi_data_register( blok->
handler[1], tag, ownerid );
240 if ( spmtx != NULL ) {
250 spmtx->
typesze = pastix_size_of( flttype );
262 for ( cblknum = 0; cblknum < cblkmin2d; cblknum++, n++, cblk++ ) {
263 pastix_starpu_register_cblk( spmtx, cblk, flttype );
267 if ( cblkmin2d < cblknbr ) {
268 struct starpu_data_filter filter = { .filter_func = pastix_starpu_filter_interface };
270 size_t *sizetab = NULL;
280 sizetab = malloc( sizenbr *
sizeof(
size_t ) );
281 assert( sizenbr >= 1 );
283 for ( cblknum = cblkmin2d, n = 0; cblknum < cblknbr;
284 cblknum++, n++, cblk++, cblkhandle++ ) {
285 pastix_starpu_register_cblk( spmtx, cblk, flttype );
287 if ( !(cblk->cblktype & CBLK_TASKS_2D) ) {
292 blok = cblk[0].fblokptr;
293 lblok = cblk[1].fblokptr;
295 if ( ( lblok - blok ) >= sizenbr ) {
296 sizenbr = ( lblok - blok ) + 1;
298 sizetab = malloc( sizenbr *
sizeof(
size_t ) );
306 sizetab[nchildren + 1] = 1;
313 for ( ; blok < lblok; blok++ ) {
316 while ( ( blok + 1 < lblok ) &&
317 ( blok[0].fcblknm == blok[1].fcblknm ) &&
318 ( blok[0].lcblknm == blok[1].lcblknm ) )
325 sizetab[nchildren + 1] = sizetab[nchildren] + size;
328 filter.nchildren = nchildren;
329 filter.filter_arg_ptr = sizetab;
333 cblkhandle->
handletab = (starpu_data_handle_t *)malloc(
334 2 * nchildren *
sizeof( starpu_data_handle_t ) );
336 starpu_data_partition_plan( cblk->handler[0], &filter, cblkhandle->
handletab );
338 starpu_data_partition_plan(
339 cblk->handler[1], &filter, cblkhandle->
handletab + nchildren );
343 (starpu_data_handle_t *)malloc( nchildren *
sizeof( starpu_data_handle_t ) );
345 starpu_data_partition_plan( cblk->handler[0], &filter, cblkhandle->
handletab );
349 blok = cblk[0].fblokptr;
350 lblok = cblk[1].fblokptr;
362 pastix_starpu_mpi_register_blok( spmtx, cblk, blok, tag_desc );
369 for ( ; blok < lblok; blok++ ) {
377 pastix_starpu_mpi_register_blok( spmtx, cblk, blok, tag_desc );
380 while ( ( blok < lblok ) && ( blok[0].fcblknm == blok[1].fcblknm ) &&
381 ( blok[0].lcblknm == blok[1].lcblknm ) ) {
389 if ( sizetab != NULL ) {
393 solvmtx->starpu_desc = spmtx;
421 #if defined(PASTIX_WITH_MPI)
422 starpu_mpi_cache_flush( MPI_COMM_WORLD, cblk->
handler[0] );
424 starpu_data_wont_use( cblk->
handler[0] );
428 #if defined(PASTIX_WITH_MPI)
429 starpu_mpi_cache_flush( MPI_COMM_WORLD, cblk->
handler[1] );
431 starpu_data_wont_use( cblk->
handler[1] );
460 starpu_data_acquire_cb( cblk->
handler[0],
462 (
void( * )(
void * ) ) & starpu_data_release,
466 starpu_data_acquire_cb( cblk->
handler[1],
468 (
void( * )(
void * ) ) & starpu_data_release,
496 if ( cblk->
cblktype & CBLK_TASKS_2D ) {
497 int gather_node = -1;
499 if ( is_owner && !(cblk->
cblktype & CBLK_FANIN) ) {
500 gather_node = STARPU_MAIN_RAM;
508 starpu_data_partition_clean_node( cblk->
handler[0],
515 starpu_data_partition_clean_node( cblk->
handler[1],
526 starpu_data_unregister( cblk->
handler[0] );
529 starpu_data_unregister( cblk->
handler[1] );
559 for ( i = 0; i < cblkmin2d; i++, cblk++ ) {
564 for ( i = cblkmin2d; i < spmtx->
solvmtx->
cblknbr; i++, cblk++, cblkhandle++ ) {
BEGIN_C_DECLS typedef int pastix_int_t
void cpucblk_zalloc(pastix_coefside_t side, SolverCblk *cblk)
Allocate the cblk structure to store the coefficient.
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.
struct starpu_codelet cl_fanin_init_cpu
Main structure for all tasks of fanin_init type.
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.
pastix_int_t gfanincblknbr
pastix_coeftype_t flttype
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.
pastix_int_t gfaninbloknbr
SolverCblk *restrict cblktab
Solver column block structure.
Solver column block structure.