diff --git a/compute/zbuild.c b/compute/zbuild.c index 6a56eaadbe738e78a4498d7344b5cf1bc67f502e..f36980ecc536d4cd24614b168d7b04c91651a053 100644 --- a/compute/zbuild.c +++ b/compute/zbuild.c @@ -128,7 +128,7 @@ int CHAMELEON_zbuild( cham_uplo_t uplo, int M, int N, A, NB, NB, LDA, N, M, N, sequence, &request ); /* Call the tile interface */ - CHAMELEON_zbuild_Tile_Async( uplo, &descAt, user_data, user_build_callback, sequence, &request ); + chameleon_pzbuild( uplo, &descAt, user_data, user_build_callback, sequence, &request ); /* Submit the matrix conversion back */ chameleon_ztile2lap( chamctxt, &descAl, &descAt, @@ -201,7 +201,7 @@ int CHAMELEON_zbuild_Tile( cham_uplo_t uplo, CHAM_desc_t *A, } chameleon_sequence_create( chamctxt, &sequence ); - CHAMELEON_zbuild_Tile_Async( uplo, A, user_data, user_build_callback, sequence, &request ); + chameleon_pzbuild( uplo, A, user_data, user_build_callback, sequence, &request ); CHAMELEON_Desc_Flush( A, sequence ); diff --git a/example/lapack_to_chameleon/step7.c b/example/lapack_to_chameleon/step7.c index 7390979f401662f70f45d0c9eb7dcfae5bd459a7..8802ee7e74dfcdd147e67e47070b0f253fa8981e 100644 --- a/example/lapack_to_chameleon/step7.c +++ b/example/lapack_to_chameleon/step7.c @@ -11,12 +11,12 @@ * * @brief Chameleon step7 example * - * @version 1.2.0 + * @version 1.3.0 * @author Florent Pruvost * @author Guillaume Sylvand * @author Mathieu Faverge * @author Philippe Virouleau - * @date 2022-02-22 + * @date 2024-03-14 * */ #include "step7.h" @@ -135,12 +135,32 @@ int main(int argc, char *argv[]) { /* generate A matrix with random values such that it is spd. We use the callback function Cham_build_callback_plgsy() defined in step7.h In this example, it is just a wrapper toward CORE_dplgsy() */ - struct data_pl data_A={(double)N, 51, N}; - CHAMELEON_dbuild_Tile(ChamUpperLower, descA, (void*)&data_A, Cham_build_callback_plgsy); + struct data_pl plgsy_args = { (double)N, 51 }; + struct cham_map_operator_s plgsy_op = { + .name = "plgsy", + .cpufunc = Cham_build_plgsy_cpu, + .cudafunc = NULL, + .hipfunc = NULL, + }; + struct cham_map_data_s plgsy_data = { + .access = ChamW, + .desc = descA, + }; + CHAMELEON_mapv_Tile( ChamUpperLower, 1, &plgsy_data, &plgsy_op, &plgsy_args ); /* generate RHS with the callback Cham_build_callback_plrnt() */ - struct data_pl data_B={0., 5673, N}; - CHAMELEON_dbuild_Tile(ChamUpperLower, descB, (void*)&data_B, Cham_build_callback_plrnt); + struct data_pl plrnt_args = { 0., 5673 }; + struct cham_map_operator_s plrnt_op = { + .name = "plrnt", + .cpufunc = Cham_build_plrnt_cpu, + .cudafunc = NULL, + .hipfunc = NULL, + }; + struct cham_map_data_s plrnt_data = { + .access = ChamW, + .desc = descA, + }; + CHAMELEON_mapv_Tile( ChamUpperLower, 1, &plrnt_data, &plrnt_op, &plrnt_args ); /* copy A before facto. in order to check the result */ CHAMELEON_dlacpy_Tile(ChamUpperLower, descA, descAC); diff --git a/example/lapack_to_chameleon/step7.h b/example/lapack_to_chameleon/step7.h index 5026f8750456e486f12846eb83a92589987ea47f..33d74144209dd9b3cdbfc06fd14ffc1d65c456fc 100644 --- a/example/lapack_to_chameleon/step7.h +++ b/example/lapack_to_chameleon/step7.h @@ -11,11 +11,11 @@ * * @brief Chameleon step7 example header * - * @version 1.2.0 + * @version 1.3.0 * @author Florent Pruvost * @author Guillaume Sylvand * @author Mathieu Faverge - * @date 2022-02-22 + * @date 2024-03-14 * */ #ifndef _step7_h_ @@ -74,19 +74,42 @@ static void init_iparam(int iparam[IPARAM_SIZEOF]){ * and store it at the adresse 'buffer' with leading dimension 'ld' */ struct data_pl { - double bump; + double bump; unsigned long long int seed; - int bigM; }; -static void Cham_build_callback_plgsy(int row_min, int row_max, int col_min, int col_max, void *buffer, int ld, void *user_data) { - struct data_pl *data=(struct data_pl *)user_data; - CORE_dplgsy(data->bump, row_max-row_min+1, col_max-col_min+1, buffer, ld, data->bigM, row_min, col_min, data->seed); +static int Cham_build_plgsy_cpu( void *op_args, cham_uplo_t uplo, int m, int n, int ndata, + const CHAM_desc_t *descA, CHAM_tile_t *tileA, ... ) +{ + struct data_pl *data = (struct data_pl *)op_args; + int tempmm, tempnn; + + /* Get the dimension of the tile */ + tempmm = (m == (descA->mt-1)) ? (descA->m - m * descA->mb) : descA->mb; + tempnn = (n == (descA->nt-1)) ? (descA->n - n * descA->nb) : descA->nb; + + TCORE_dplgsy( data->bump, tempmm, tempnn, tileA, + descA->m, m * descA->mb, n * descA->nb, data->seed ); + + (void)uplo; + return 0; } -static void Cham_build_callback_plrnt(int row_min, int row_max, int col_min, int col_max, void *buffer, int ld, void *user_data) { - struct data_pl *data=(struct data_pl *)user_data; - CORE_dplrnt(row_max-row_min+1, col_max-col_min+1, buffer, ld, data->bigM, row_min, col_min, data->seed); +static int Cham_build_plrnt_cpu( void *op_args, cham_uplo_t uplo, int m, int n, int ndata, + const CHAM_desc_t *descA, CHAM_tile_t *tileA, ... ) +{ + struct data_pl *data = (struct data_pl *)op_args; + int tempmm, tempnn; + + /* Get the dimension of the tile */ + tempmm = (m == (descA->mt-1)) ? (descA->m - m * descA->mb) : descA->mb; + tempnn = (n == (descA->nt-1)) ? (descA->n - n * descA->nb) : descA->nb; + + TCORE_dplrnt( tempmm, tempnn, tileA, + descA->m, m * descA->mb, n * descA->nb, data->seed ); + + (void)uplo; + return 0; } /**