Mentions légales du service

Skip to content
Snippets Groups Projects
Commit d81f87d4 authored by Mathieu Faverge's avatar Mathieu Faverge
Browse files

example: Replace the deprecated build function by the map one

parent 71848245
No related branches found
No related tags found
1 merge request!445Mapv: Add some missing fixes, and make the map kernel non runtime dependent.
...@@ -128,7 +128,7 @@ int CHAMELEON_zbuild( cham_uplo_t uplo, int M, int N, ...@@ -128,7 +128,7 @@ int CHAMELEON_zbuild( cham_uplo_t uplo, int M, int N,
A, NB, NB, LDA, N, M, N, sequence, &request ); A, NB, NB, LDA, N, M, N, sequence, &request );
/* Call the tile interface */ /* 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 */ /* Submit the matrix conversion back */
chameleon_ztile2lap( chamctxt, &descAl, &descAt, chameleon_ztile2lap( chamctxt, &descAl, &descAt,
...@@ -201,7 +201,7 @@ int CHAMELEON_zbuild_Tile( cham_uplo_t uplo, CHAM_desc_t *A, ...@@ -201,7 +201,7 @@ int CHAMELEON_zbuild_Tile( cham_uplo_t uplo, CHAM_desc_t *A,
} }
chameleon_sequence_create( chamctxt, &sequence ); 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 ); CHAMELEON_Desc_Flush( A, sequence );
......
...@@ -11,12 +11,12 @@ ...@@ -11,12 +11,12 @@
* *
* @brief Chameleon step7 example * @brief Chameleon step7 example
* *
* @version 1.2.0 * @version 1.3.0
* @author Florent Pruvost * @author Florent Pruvost
* @author Guillaume Sylvand * @author Guillaume Sylvand
* @author Mathieu Faverge * @author Mathieu Faverge
* @author Philippe Virouleau * @author Philippe Virouleau
* @date 2022-02-22 * @date 2024-03-14
* *
*/ */
#include "step7.h" #include "step7.h"
...@@ -135,12 +135,32 @@ int main(int argc, char *argv[]) { ...@@ -135,12 +135,32 @@ int main(int argc, char *argv[]) {
/* generate A matrix with random values such that it is spd. /* generate A matrix with random values such that it is spd.
We use the callback function Cham_build_callback_plgsy() defined in step7.h We use the callback function Cham_build_callback_plgsy() defined in step7.h
In this example, it is just a wrapper toward CORE_dplgsy() */ In this example, it is just a wrapper toward CORE_dplgsy() */
struct data_pl data_A={(double)N, 51, N}; struct data_pl plgsy_args = { (double)N, 51 };
CHAMELEON_dbuild_Tile(ChamUpperLower, descA, (void*)&data_A, Cham_build_callback_plgsy); 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() */ /* generate RHS with the callback Cham_build_callback_plrnt() */
struct data_pl data_B={0., 5673, N}; struct data_pl plrnt_args = { 0., 5673 };
CHAMELEON_dbuild_Tile(ChamUpperLower, descB, (void*)&data_B, Cham_build_callback_plrnt); 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 */ /* copy A before facto. in order to check the result */
CHAMELEON_dlacpy_Tile(ChamUpperLower, descA, descAC); CHAMELEON_dlacpy_Tile(ChamUpperLower, descA, descAC);
......
...@@ -11,11 +11,11 @@ ...@@ -11,11 +11,11 @@
* *
* @brief Chameleon step7 example header * @brief Chameleon step7 example header
* *
* @version 1.2.0 * @version 1.3.0
* @author Florent Pruvost * @author Florent Pruvost
* @author Guillaume Sylvand * @author Guillaume Sylvand
* @author Mathieu Faverge * @author Mathieu Faverge
* @date 2022-02-22 * @date 2024-03-14
* *
*/ */
#ifndef _step7_h_ #ifndef _step7_h_
...@@ -74,19 +74,42 @@ static void init_iparam(int iparam[IPARAM_SIZEOF]){ ...@@ -74,19 +74,42 @@ static void init_iparam(int iparam[IPARAM_SIZEOF]){
* and store it at the adresse 'buffer' with leading dimension 'ld' * and store it at the adresse 'buffer' with leading dimension 'ld'
*/ */
struct data_pl { struct data_pl {
double bump; double bump;
unsigned long long int seed; 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) { static int Cham_build_plgsy_cpu( void *op_args, cham_uplo_t uplo, int m, int n, int ndata,
struct data_pl *data=(struct data_pl *)user_data; const CHAM_desc_t *descA, CHAM_tile_t *tileA, ... )
CORE_dplgsy(data->bump, row_max-row_min+1, col_max-col_min+1, buffer, ld, data->bigM, row_min, col_min, data->seed); {
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) { static int Cham_build_plrnt_cpu( void *op_args, cham_uplo_t uplo, int m, int n, int ndata,
struct data_pl *data=(struct data_pl *)user_data; const CHAM_desc_t *descA, CHAM_tile_t *tileA, ... )
CORE_dplrnt(row_max-row_min+1, col_max-col_min+1, buffer, ld, data->bigM, row_min, col_min, data->seed); {
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;
} }
/** /**
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment