Commit cc7d5615 by Mathieu Faverge

### Cleanup the map function to answer comments from @agullo and @fpruvost

parent 85764c31
 ... @@ -19,111 +19,28 @@ ... @@ -19,111 +19,28 @@ /** /** ******************************************************************************** ******************************************************************************** * * * Generate a random matrix by tiles. * @ingroup CHAMELEON_Tile * ******************************************************************************* * * @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). * ******************************************************************************* * * * @retval CHAMELEON_SUCCESS successful exit * Apply a given operator on each tile of the given matrix. Operates on * @retval <0 if -i, the i-th argument had an illegal value * matrices stored by tiles. All matrices are passed through descriptors. All * dimensions are taken from the descriptors. * * ******************************************************************************* ******************************************************************************* * * * @sa CHAMELEON_map_Tile * @param[in,out] uplo * @sa CHAMELEON_map_Tile_Async * - 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 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 * * * Generate a random matrix by tiles. Tile equivalent of CHAMELEON_map(). * @param[in,out] A * Operates on matrices stored by tiles. All matrices are passed through * On exit, the operator has been applied on each tile of the matrix A. * descriptors. All dimensions are taken from the descriptors. * * ******************************************************************************* * @param[in] operator * The operator function to apply on each tile of the matrix. * * * @param[in] A * @param[in,out] op_args * On exit, The random matrix A generated. * 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, ... @@ -131,7 +48,6 @@ int CHAMELEON_map( cham_uplo_t uplo, int M, int N, * * ******************************************************************************* ******************************************************************************* * * * @sa CHAMELEON_map * @sa CHAMELEON_map_Tile_Async * @sa CHAMELEON_map_Tile_Async * * */ */ ... @@ -167,7 +83,7 @@ int CHAMELEON_map_Tile( cham_uplo_t uplo, ... @@ -167,7 +83,7 @@ int CHAMELEON_map_Tile( cham_uplo_t uplo, * * * @ingroup CHAMELEON_Tile_Async * @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. * CHAMELEON_map_Tile(). May return before the computation is finished. * Allows for pipelining of operations at runtime. * Allows for pipelining of operations at runtime. * * ... @@ -186,7 +102,6 @@ int CHAMELEON_map_Tile( cham_uplo_t uplo, ... @@ -186,7 +102,6 @@ int CHAMELEON_map_Tile( cham_uplo_t uplo, * * ******************************************************************************* ******************************************************************************* * * * @sa CHAMELEON_map * @sa CHAMELEON_map_Tile * @sa CHAMELEON_map_Tile * * */ */ ... @@ -227,8 +142,9 @@ int CHAMELEON_map_Tile_Async( cham_uplo_t uplo, ... @@ -227,8 +142,9 @@ int CHAMELEON_map_Tile_Async( cham_uplo_t uplo, } } /* Quick return */ /* Quick return */ if (chameleon_min( A->m, A->n ) == 0) if (chameleon_min( A->m, A->n ) == 0) { return CHAMELEON_SUCCESS; return CHAMELEON_SUCCESS; } chameleon_pmap( uplo, A, operator, op_args, sequence, request ); chameleon_pmap( uplo, A, operator, op_args, sequence, request ); ... ...
 ... @@ -54,9 +54,6 @@ ... @@ -54,9 +54,6 @@ /* **************************************************************************** /* **************************************************************************** * CHAMELEON functionnalities * 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, int CHAMELEON_map_Tile( cham_uplo_t uplo, CHAM_desc_t *A, CHAM_desc_t *A, cham_unary_operator_t operator, cham_unary_operator_t operator, ... ...
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!