From 2c5c88b0ce3a851f369cdacd4a77edcfe982e1a2 Mon Sep 17 00:00:00 2001 From: Mathieu Faverge <mathieu.faverge@inria.fr> Date: Wed, 17 May 2023 17:07:27 +0200 Subject: [PATCH] map: Add the access parameter to the user level interface --- compute/map.c | 28 +++++++++++++++++++++++----- compute/pmap.c | 12 ++++++------ compute/zprint.c | 4 ++-- control/common.h | 2 +- include/chameleon.h | 6 ++++-- testing/test_fembem | 2 +- 6 files changed, 37 insertions(+), 17 deletions(-) diff --git a/compute/map.c b/compute/map.c index cef413645..1fcb88381 100644 --- a/compute/map.c +++ b/compute/map.c @@ -27,7 +27,16 @@ * ******************************************************************************* * - * @param[in,out] uplo + * @param[in] access + * - ChamR: A is accessed in read-only mode. + * - ChamW: A is accessed in write-only mode. + * WARNING: if the descriptor is set for allocation on the fly, the + * flush call included in this synchronous API will free all allocated + * data, prefer asynchronous call if you want to initialiaze data + * before submitting another algorithm. + * - ChamRW: A is accessed in read-write mode. + * + * @param[in] uplo * - ChamUpper: Only the upper triangular part of the matrix is touched * - ChamLower: Only the lower triangular part of the matrix is touched * - ChamUpperLower: The entire the matrix is touched @@ -51,7 +60,8 @@ * @sa CHAMELEON_map_Tile_Async * */ -int CHAMELEON_map_Tile( cham_uplo_t uplo, +int CHAMELEON_map_Tile( cham_access_t access, + cham_uplo_t uplo, CHAM_desc_t *A, cham_unary_operator_t op_fct, void *op_args ) @@ -68,7 +78,7 @@ int CHAMELEON_map_Tile( cham_uplo_t uplo, } chameleon_sequence_create( chamctxt, &sequence ); - CHAMELEON_map_Tile_Async( uplo, A, op_fct, op_args, sequence, &request ); + CHAMELEON_map_Tile_Async( access, uplo, A, op_fct, op_args, sequence, &request ); CHAMELEON_Desc_Flush( A, sequence ); @@ -89,6 +99,13 @@ int CHAMELEON_map_Tile( cham_uplo_t uplo, * ******************************************************************************* * + * @param[in] access + * - ChamR: A is accessed in read-only mode. + * - ChamW: A is accessed in write-only mode. + * INFO: tile of A can be unallocated before the call if the + * descriptor is set for allocation on the fly. + * - ChamRW: A is accessed in read-write mode. + * * @param[in] sequence * Identifies the sequence of function calls that this call belongs to * (for completion checks and exception handling purposes). @@ -105,7 +122,8 @@ int CHAMELEON_map_Tile( cham_uplo_t uplo, * @sa CHAMELEON_map_Tile * */ -int CHAMELEON_map_Tile_Async( cham_uplo_t uplo, +int CHAMELEON_map_Tile_Async( cham_access_t access, + cham_uplo_t uplo, CHAM_desc_t *A, cham_unary_operator_t op_fct, void *op_args, @@ -146,7 +164,7 @@ int CHAMELEON_map_Tile_Async( cham_uplo_t uplo, return CHAMELEON_SUCCESS; } - chameleon_pmap( uplo, A, op_fct, op_args, sequence, request ); + chameleon_pmap( access, uplo, A, op_fct, op_args, sequence, request ); return CHAMELEON_SUCCESS; } diff --git a/compute/pmap.c b/compute/pmap.c index deb087d28..a2ddf33a4 100644 --- a/compute/pmap.c +++ b/compute/pmap.c @@ -20,7 +20,7 @@ /** * chameleon_pmap - Generate a random matrix by tiles. */ -void chameleon_pmap( cham_uplo_t uplo, CHAM_desc_t *A, +void chameleon_pmap( cham_access_t access, cham_uplo_t uplo, CHAM_desc_t *A, cham_unary_operator_t op_fct, void *op_args, RUNTIME_sequence_t *sequence, RUNTIME_request_t *request ) { @@ -39,12 +39,12 @@ void chameleon_pmap( cham_uplo_t uplo, CHAM_desc_t *A, for (m = 0; m < n; m++) { INSERT_TASK_map( &options, - ChamRW, ChamUpperLower, A(m, n), + access, ChamUpperLower, A(m, n), op_fct, op_args ); } INSERT_TASK_map( &options, - ChamRW, uplo, A(n, n), + access, uplo, A(n, n), op_fct, op_args ); } break; @@ -53,12 +53,12 @@ void chameleon_pmap( cham_uplo_t uplo, CHAM_desc_t *A, for (n = 0; n < A->nt; n++) { INSERT_TASK_map( &options, - ChamRW, uplo, A(n, n), + access, uplo, A(n, n), op_fct, op_args ); for (m = n+1; m < A->mt; m++) { INSERT_TASK_map( &options, - ChamRW, ChamUpperLower, A(m, n), + access, ChamUpperLower, A(m, n), op_fct, op_args ); } } @@ -70,7 +70,7 @@ void chameleon_pmap( cham_uplo_t uplo, CHAM_desc_t *A, for (n = 0; n < A->nt; n++) { INSERT_TASK_map( &options, - ChamRW, uplo, A(m, n), + access, uplo, A(m, n), op_fct, op_args ); } } diff --git a/compute/zprint.c b/compute/zprint.c index fe44e05d4..2329d1a9b 100644 --- a/compute/zprint.c +++ b/compute/zprint.c @@ -152,7 +152,7 @@ int CHAMELEON_zprint( FILE *file, const char *header, /* Call the tile interface */ zprint_runtime_id = chamctxt->scheduler; - chameleon_pmap( uplo, &descAt, zprint, &options, sequence, &request ); + chameleon_pmap( ChamR, uplo, &descAt, zprint, &options, sequence, &request ); /* Submit the matrix conversion back */ chameleon_ztile2lap( chamctxt, &descAl, &descAt, @@ -216,7 +216,7 @@ int CHAMELEON_zprint_Tile( FILE *file, const char *header, chameleon_sequence_create( chamctxt, &sequence ); zprint_runtime_id = chamctxt->scheduler; - chameleon_pmap( uplo, A, zprint, &options, sequence, &request ); + chameleon_pmap( ChamR, uplo, A, zprint, &options, sequence, &request ); CHAMELEON_Desc_Flush( A, sequence ); chameleon_sequence_wait( chamctxt, sequence ); diff --git a/control/common.h b/control/common.h index f31ec1af3..c260ff60f 100644 --- a/control/common.h +++ b/control/common.h @@ -102,7 +102,7 @@ extern char *chameleon_lapack_constants[]; extern "C" { #endif -void chameleon_pmap( cham_uplo_t uplo, CHAM_desc_t *A, +void chameleon_pmap( cham_access_t access, cham_uplo_t uplo, CHAM_desc_t *A, cham_unary_operator_t operator, void *op_args, RUNTIME_sequence_t *sequence, RUNTIME_request_t *request ); diff --git a/include/chameleon.h b/include/chameleon.h index 8c3669af3..56c816018 100644 --- a/include/chameleon.h +++ b/include/chameleon.h @@ -74,11 +74,13 @@ BEGIN_C_DECLS /* **************************************************************************** * CHAMELEON functionnalities */ -int CHAMELEON_map_Tile( cham_uplo_t uplo, +int CHAMELEON_map_Tile( cham_access_t access, + cham_uplo_t uplo, CHAM_desc_t *A, cham_unary_operator_t op_fct, void *op_args ); -int CHAMELEON_map_Tile_Async( cham_uplo_t uplo, +int CHAMELEON_map_Tile_Async( cham_access_t access, + cham_uplo_t uplo, CHAM_desc_t *A, cham_unary_operator_t op_fct, void *op_args, diff --git a/testing/test_fembem b/testing/test_fembem index 906d73c7a..a0056374b 160000 --- a/testing/test_fembem +++ b/testing/test_fembem @@ -1 +1 @@ -Subproject commit 906d73c7abb0821e8df787f05fab2d503a2e76ff +Subproject commit a0056374bf0163ba878d842cbc81999fece362b4 -- GitLab