Mentions légales du service

Skip to content
Snippets Groups Projects
Commit 1fc2cceb authored by EYRAUD-DUBOIS Lionel's avatar EYRAUD-DUBOIS Lionel Committed by Mathieu Faverge
Browse files

testings: Add an helper function for the testings to ease the switch from one...

testings: Add an helper function for the testings to ease the switch from one data distribution to another.
parent 2b837576
No related branches found
No related tags found
1 merge request!398Generic data distribution specification
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
* *
* @brief Chameleon CHAMELEON_Complex64_t auxiliary testings routines * @brief Chameleon CHAMELEON_Complex64_t auxiliary testings routines
* *
* @version 1.2.0 * @version 1.3.0
* @author Mathieu Faverge * @author Mathieu Faverge
* @author Cedric Castagnede * @author Cedric Castagnede
* @author Lucas Barros de Assis * @author Lucas Barros de Assis
...@@ -21,7 +21,8 @@ ...@@ -21,7 +21,8 @@
* @author Philippe Swartvagher * @author Philippe Swartvagher
* @author Lucas Nesi * @author Lucas Nesi
* @author Matthieu Kuhn * @author Matthieu Kuhn
* @date 2023-01-05 * @author Lionel Eyraud-Dubois
* @date 2023-07-05
* @precisions normal z -> c d s * @precisions normal z -> c d s
* *
*/ */
...@@ -57,11 +58,12 @@ parameter_t parameters[] = { ...@@ -57,11 +58,12 @@ parameter_t parameters[] = {
#endif #endif
{ NULL, "Machine parameters", 0, PARAM_OPTION, 0, 0, 0, {0}, NULL, NULL, NULL }, { NULL, "Machine parameters", 0, PARAM_OPTION, 0, 0, 0, {0}, NULL, NULL, NULL },
{ "threads", "Number of CPU workers per node", 't', PARAM_OPTION | PARAM_OUTPUT, 1, 7, TestValInt, {-1}, NULL, pread_int, sprint_int }, { "threads", "Number of CPU workers per node", 't', PARAM_OPTION | PARAM_OUTPUT, 1, 7, TestValInt, {-1}, NULL, pread_int, sprint_int },
#if !defined(CHAMELEON_TESTINGS_VENDOR) #if !defined(CHAMELEON_TESTINGS_VENDOR)
{ "gpus", "Number of GPU workers per node", 'g', PARAM_OPTION | PARAM_OUTPUT, 1, 4, TestValInt, { 0}, NULL, pread_int, sprint_int }, { "gpus", "Number of GPU workers per node", 'g', PARAM_OPTION | PARAM_OUTPUT, 1, 4, TestValInt, { 0}, NULL, pread_int, sprint_int },
{ "P", "Rows (P) in the PxQ process grid", 'P', PARAM_OPTION | PARAM_OUTPUT, 1, 2, TestValInt, { 1}, NULL, pread_int, sprint_int }, { "P", "Rows (P) in the PxQ process grid", 'P', PARAM_OPTION | PARAM_OUTPUT, 1, 2, TestValInt, { 1}, NULL, pread_int, sprint_int },
{ "Q", "Columns (Q) in the PxQ process grid", 'Q', PARAM_OUTPUT, 1, 2, TestValInt, { 1}, NULL, pread_int, sprint_int }, { "Q", "Columns (Q) in the PxQ process grid", 'Q', PARAM_OUTPUT, 1, 2, TestValInt, { 1}, NULL, pread_int, sprint_int },
{ "custom", "Name of custom distribution file", -61, PARAM_OPTION, 1, 1, TestString, { 0}, NULL, pread_string, sprint_string },
#endif #endif
{ NULL, "Main input parameters", 0, PARAM_OPTION, 0, 0, 0, {0}, NULL, NULL, NULL }, { NULL, "Main input parameters", 0, PARAM_OPTION, 0, 0, 0, {0}, NULL, NULL, NULL },
......
...@@ -8,11 +8,12 @@ ...@@ -8,11 +8,12 @@
* *
* @brief Chameleon auxiliary routines for testing structures * @brief Chameleon auxiliary routines for testing structures
* *
* @version 1.2.0 * @version 1.3.0
* @author Lucas Barros de Assis * @author Lucas Barros de Assis
* @author Mathieu Faverge * @author Mathieu Faverge
* @author Alycia Lisito * @author Alycia Lisito
* @date 2022-02-22 * @author Lionel Eyraud-Dubois
* @date 2023-07-05
* *
*/ */
#include "testings.h" #include "testings.h"
...@@ -465,6 +466,87 @@ parameters_compute_q( int p ) ...@@ -465,6 +466,87 @@ parameters_compute_q( int p )
param->value.ival = np / p; param->value.ival = np / p;
return param->value.ival; return param->value.ival;
} }
/**
********************************************************************************
*
* @brief Helper function to generate the testing descriptors with the right
* data distrbution.
*
*******************************************************************************
*
* @param[in] filename
* The name of the input file.
*
*******************************************************************************
*/
int
parameters_desc_create( const char *id, CHAM_desc_t **descptr, cham_flttype_t dtyp,
int mb, int nb, int lm, int ln, int m, int n )
{
custom_dist_t *custom_args = NULL;
const char *custom = parameters_getvalue_str( "custom" );
intptr_t mtxfmt = parameters_getvalue_int( "mtxfmt" );
int rc;
mtxfmt = -mtxfmt; /* Inverse sign to get the defined values */
if ( !custom ) {
int P = parameters_getvalue_int( "P" );
int Q = parameters_compute_q( P );
rc = CHAMELEON_Desc_Create(
descptr, (void*)mtxfmt, dtyp, mb, nb, mb * nb, lm, ln, 0, 0, m, n, P, Q );
(*descptr)->name = id;
return rc;
}
if ( ((void*)mtxfmt) == CHAMELEON_MAT_ALLOC_GLOBAL ) {
fprintf( stderr, "In parameters_desc_create, cannot use custom distributions with global matrix allocation (Use --mtxfmt=1)\n" );
return CHAMELEON_ERR_ILLEGAL_VALUE;
}
rc = chameleon_getrankof_custom_init( &custom_args, custom );
if ( rc != CHAMELEON_SUCCESS ) {
return rc;
}
rc = CHAMELEON_Desc_Create_User(
descptr, (void*)mtxfmt, dtyp, mb, nb, mb * nb, lm, ln, 0, 0, m, n, CHAMELEON_Comm_size(), 1,
NULL, NULL, chameleon_getrankof_custom, custom_args );
(*descptr)->name = id;
return rc;
}
/**
*******************************************************************************
*
* @brief Helper function to destroy the testing descriptors.
*
*******************************************************************************
*
* @param[inout] descptr
* The descriptor to destroy. On exit the descriptor can no longer be used.
*
*******************************************************************************
*/
int
parameters_desc_destroy(CHAM_desc_t **descptr)
{
CHAM_desc_t *desc;
if ( descptr == NULL ) {
return CHAMELEON_ERR_ILLEGAL_VALUE;
}
desc = *descptr;
if ( desc == NULL ) {
return CHAMELEON_ERR_ILLEGAL_VALUE;
}
if ( desc->get_rankof_init_arg ) {
if ( desc->get_rankof_init == chameleon_getrankof_custom ) {
chameleon_getrankof_custom_destroy( (custom_dist_t**)&(desc->get_rankof_init_arg) );
}
}
return CHAMELEON_Desc_Destroy( descptr );
}
#endif #endif
void void
......
...@@ -8,12 +8,13 @@ ...@@ -8,12 +8,13 @@
* *
* @brief Chameleon auxiliary routines for testing structures * @brief Chameleon auxiliary routines for testing structures
* *
* @version 1.2.0 * @version 1.3.0
* @author Lucas Barros de Assis * @author Lucas Barros de Assis
* @author Mathieu Faverge * @author Mathieu Faverge
* @author Alycia Lisito * @author Alycia Lisito
* @author Florent Pruvost * @author Florent Pruvost
* @date 2023-01-05 * @author Lionel Eyraud-Dubois
* @date 2023-07-05
* *
*/ */
#ifndef _testings_h_ #ifndef _testings_h_
...@@ -242,6 +243,10 @@ void parameters_destroy( ); ...@@ -242,6 +243,10 @@ void parameters_destroy( );
run_list_t *run_list_generate( const char **params ); run_list_t *run_list_generate( const char **params );
void run_list_destroy( run_list_elt_t *run ); void run_list_destroy( run_list_elt_t *run );
int parameters_desc_create( const char *id, CHAM_desc_t **descptr, cham_flttype_t dtyp,
int mb, int nb, int lm, int ln, int m, int n );
int parameters_desc_destroy( CHAM_desc_t **descptr );
/** /**
* @brief Define the data associated to a single run of a testing * @brief Define the data associated to a single run of a testing
*/ */
......
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