diff --git a/compute/map.c b/compute/map.c index 51cff7d61d74bff8da89c536ed53409df3f10b27..ac60d4b20f4ca0b51f5aa9960ea3dfd5c0663bc1 100644 --- a/compute/map.c +++ b/compute/map.c @@ -19,111 +19,28 @@ /** ******************************************************************************** * - * Generate a random matrix by tiles. - * - ******************************************************************************* - * - * @param[in] M - * The number of rows of A. - * - * @param[in] N - * The order of the matrix A. N >= 0. - * - * @param[out] A - * On exit, The random matrix A generated. - * - * @param[in] LDA - * The leading dimension of the array A. LDA >= max(1,M). - * - ******************************************************************************* + * @ingroup CHAMELEON_Tile * - * @retval CHAMELEON_SUCCESS successful exit - * @retval <0 if -i, the i-th argument had an illegal value + * Apply a given operator on each tile of the given matrix. Operates on + * matrices stored by tiles. All matrices are passed through descriptors. All + * dimensions are taken from the descriptors. * ******************************************************************************* * - * @sa CHAMELEON_map_Tile - * @sa CHAMELEON_map_Tile_Async - * - */ -int CHAMELEON_map( cham_uplo_t uplo, int M, int N, - CHAMELEON_Complex64_t *A, int LDA, - cham_unary_operator_t operator, void *op_args ) -{ - int NB; - int status; - CHAM_context_t *chamctxt; - RUNTIME_sequence_t *sequence = NULL; - RUNTIME_request_t request = RUNTIME_REQUEST_INITIALIZER; - CHAM_desc_t descAl, descAt; - - chamctxt = chameleon_context_self(); - if (chamctxt == NULL) { - chameleon_fatal_error("CHAMELEON_map", "CHAMELEON not initialized"); - return CHAMELEON_ERR_NOT_INITIALIZED; - } - /* Check input arguments */ - if (M < 0) { - chameleon_error("CHAMELEON_map", "illegal value of M"); - return -1; - } - if (N < 0) { - chameleon_error("CHAMELEON_map", "illegal value of N"); - return -2; - } - if (LDA < chameleon_max(1, M)) { - chameleon_error("CHAMELEON_map", "illegal value of LDA"); - return -4; - } - /* Quick return */ - if (chameleon_min(M, N) == 0) - return CHAMELEON_SUCCESS; - - /* Tune NB depending on M, N & NRHS; Set NBNB */ - status = chameleon_tune(CHAMELEON_FUNC_ZGEMM, M, N, 0); - if (status != CHAMELEON_SUCCESS) { - chameleon_error("CHAMELEON_map", "chameleon_tune() failed"); - return status; - } - - /* Set NT */ - NB = CHAMELEON_NB; - chameleon_sequence_create( chamctxt, &sequence ); - - /* Submit the matrix conversion */ - chameleon_zlap2tile( chamctxt, &descAl, &descAt, ChamDescInout, uplo, - A, NB, NB, LDA, N, M, N, sequence, &request ); - - /* Call the tile interface */ - CHAMELEON_map_Tile_Async( uplo, &descAt, operator, op_args, sequence, &request ); - - /* Submit the matrix conversion back */ - chameleon_ztile2lap( chamctxt, &descAl, &descAt, - ChamDescInout, uplo, sequence, &request ); - - chameleon_sequence_wait( chamctxt, sequence ); - - /* Cleanup the temporary data */ - chameleon_ztile2lap_cleanup( chamctxt, &descAl, &descAt ); - - status = sequence->status; - chameleon_sequence_destroy( chamctxt, sequence ); - return status; -} - -/** - ******************************************************************************** - * - * @ingroup CHAMELEON_Tile + * @param[in,out] 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 * - * Generate a random matrix by tiles. Tile equivalent of CHAMELEON_map(). - * Operates on matrices stored by tiles. All matrices are passed through - * descriptors. All dimensions are taken from the descriptors. + * @param[in,out] A + * On exit, the operator has been applied on each tile of the matrix A. * - ******************************************************************************* + * @param[in] operator + * The operator function to apply on each tile of the matrix. * - * @param[in] A - * On exit, The random matrix A generated. + * @param[in,out] op_args + * The arguments structure passed to the operator function when applied + * on each tile. May be updated by the operator function. * ******************************************************************************* * @@ -131,7 +48,6 @@ int CHAMELEON_map( cham_uplo_t uplo, int M, int N, * ******************************************************************************* * - * @sa CHAMELEON_map * @sa CHAMELEON_map_Tile_Async * */ @@ -167,7 +83,7 @@ int CHAMELEON_map_Tile( cham_uplo_t uplo, * * @ingroup CHAMELEON_Tile_Async * - * Generate a random matrix by tiles. Non-blocking equivalent of + * Apply a given operator on each tile of the given matrix. Non-blocking equivalent of * CHAMELEON_map_Tile(). May return before the computation is finished. * Allows for pipelining of operations at runtime. * @@ -186,7 +102,6 @@ int CHAMELEON_map_Tile( cham_uplo_t uplo, * ******************************************************************************* * - * @sa CHAMELEON_map * @sa CHAMELEON_map_Tile * */ @@ -227,8 +142,9 @@ int CHAMELEON_map_Tile_Async( cham_uplo_t uplo, } /* Quick return */ - if (chameleon_min( A->m, A->n ) == 0) + if (chameleon_min( A->m, A->n ) == 0) { return CHAMELEON_SUCCESS; + } chameleon_pmap( uplo, A, operator, op_args, sequence, request ); diff --git a/include/chameleon.h b/include/chameleon.h index ddc898f67e6f2cd97e014c7169041b4f17e6bde1..403e599bbf2b551faad89502b4b10e958012eced 100644 --- a/include/chameleon.h +++ b/include/chameleon.h @@ -54,9 +54,6 @@ /* **************************************************************************** * CHAMELEON functionnalities */ -int CHAMELEON_map( cham_uplo_t uplo, int M, int N, - CHAMELEON_Complex64_t *A, int LDA, - cham_unary_operator_t operator, void *op_args ); int CHAMELEON_map_Tile( cham_uplo_t uplo, CHAM_desc_t *A, cham_unary_operator_t operator,