From 10fe3f8366edad4799ce61d6b6526c84a0ee1bb5 Mon Sep 17 00:00:00 2001 From: Mathieu Faverge <mathieu.faverge@inria.fr> Date: Wed, 11 Aug 2021 12:08:32 +0200 Subject: [PATCH] testings: add testing_[start|stop] functions to control timing and introduce submission time --- testing/chameleon_ztesting.c | 60 ++++++++++++++++++++++++++++++++++++ testing/run_list.c | 2 +- testing/testings.h | 20 ++++++++++++ 3 files changed, 81 insertions(+), 1 deletion(-) diff --git a/testing/chameleon_ztesting.c b/testing/chameleon_ztesting.c index ca4850622..ecdfa7045 100644 --- a/testing/chameleon_ztesting.c +++ b/testing/chameleon_ztesting.c @@ -44,6 +44,7 @@ static parameter_t parameters[] = { { "mtxfmt", "Change the way the matrix is stored (0: global, 1: tiles, 2: OOC)", -32, PARAM_OPTION | PARAM_INPUT | PARAM_OUTPUT, 1, 6, TestValInt, {0}, NULL, pread_int, sprint_int }, { "profile", "Display the kernel profiling", -33, PARAM_OPTION, 0, 0, TestValInt, {0}, NULL, pread_int, sprint_int }, { "forcegpu", "Force kernels on GPU", -34, PARAM_OPTION, 0, 0, TestValInt, {0}, NULL, pread_int, sprint_int }, + { "splitsub", "Wait for whole graph submission before execution", 'S', PARAM_OPTION, 0, 0, TestValInt, {0}, NULL, pread_int, sprint_int }, { 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 }, @@ -101,6 +102,7 @@ static parameter_t parameters[] = { { "hlvl", "Tree used for high level reduction between nodes", -23, PARAM_OPTION | PARAM_INPUT | PARAM_OUTPUT, 2, 4, TestValInt, {0}, NULL, pread_int, sprint_int }, { "domino", "Enable/Disable the domino between upper and lower trees", -24, PARAM_OPTION | PARAM_INPUT | PARAM_OUTPUT, 2, 6, TestValInt, {0}, NULL, pread_int, sprint_int }, + { "tsub", "Graph submission time in s", 999, PARAM_OUTPUT, 2, 13, TestValFixdbl, {0}, NULL, pread_fixdbl, sprint_fixdbl }, { "time", "Time in s", 1000, PARAM_OUTPUT, 2, 13, TestValFixdbl, {0}, NULL, pread_fixdbl, sprint_fixdbl }, { "gflops", "GFlop/s", 1001, PARAM_OUTPUT, 2, 13, TestValFixdbl, {0}, NULL, pread_fixdbl, sprint_fixdbl }, { "RETURN", "Result of the testing: SUCCESS/FAILED", 1002, PARAM_OUTPUT, 2, 7, TestValInt, {0}, NULL, pread_int, sprint_check }, @@ -493,6 +495,64 @@ parameters_destroy() return; } +void +testing_start( testdata_t *tdata ) +{ + int splitsub = parameters_getvalue_int( "splitsub" ); + + tdata->sequence = NULL; + tdata->request.status = 0; + tdata->request.schedopt = NULL; + +#if defined(CHAMELEON_USE_MPI) + CHAMELEON_Distributed_start(); +#endif + + if ( splitsub ) { + CHAMELEON_Sequence_Create( &(tdata->sequence) ); + CHAMELEON_Pause(); + } + + /* Register starting time */ + tdata->tsub = RUNTIME_get_time(); + tdata->texec = tdata->tsub; +} + +void +testing_stop( testdata_t *tdata, cham_fixdbl_t flops ) +{ + int splitsub = parameters_getvalue_int( "splitsub" ); + cham_fixdbl_t t0, t1, t2, gflops; + + /* Submission is done, we need to start the computations */ + if ( splitsub ) { + tdata->tsub = RUNTIME_get_time(); + CHAMELEON_Resume(); + CHAMELEON_Sequence_Wait( tdata->sequence ); + CHAMELEON_Sequence_Destroy( tdata->sequence ); + } +#if defined(CHAMELEON_USE_MPI) + CHAMELEON_Distributed_stop(); +#endif + t2 = RUNTIME_get_time(); + + t0 = tdata->texec; + t1 = tdata->tsub; + /* + * texec / Submission / tsub / Execution / t + * + * => texec = t2 - t1 + * => tsub = t1 - t0 + */ + tdata->tsub = t1 - t0; + tdata->texec = t2 - t1; + + gflops = flops * 1.e-9 / tdata->texec; + run_arg_add_fixdbl( tdata->args, "time", tdata->texec ); + run_arg_add_fixdbl( tdata->args, "tsub", tdata->tsub ); + run_arg_add_fixdbl( tdata->args, "gflops", ( tdata->hres == CHAMELEON_SUCCESS ) ? gflops : -1. ); +} + int main (int argc, char **argv) { int ncores, ngpus, human, check, i, niter; diff --git a/testing/run_list.c b/testing/run_list.c index 258e231b7..6b55f2441 100644 --- a/testing/run_list.c +++ b/testing/run_list.c @@ -695,7 +695,7 @@ const char *common_input[] = { "threads", "gpus", "P", "Q", NULL }; /** * @brief The common output parameters to all tests */ -const char *common_output[] = { "time", "gflops", NULL }; +const char *common_output[] = { "tsub", "time", "gflops", NULL }; /** ******************************************************************************** diff --git a/testing/testings.h b/testing/testings.h index 4e6b0efbf..3b7ca5f26 100644 --- a/testing/testings.h +++ b/testing/testings.h @@ -217,6 +217,26 @@ void run_list_destroy( run_list_elt_t *run ); void testing_register( testing_t *test ); + +/** + * @brief Define the data associated to a single run of a testing + */ +struct testing_; +typedef struct testing_ testing_t; +typedef int (*test_fct_t)( run_arg_list_t *, int ); + +typedef struct testdata_ { + run_arg_list_t *args; /**< The parameters of the test */ + int hres; /**< The returned value of the test */ + cham_fixdbl_t texec; /**< The execution time of test */ + cham_fixdbl_t tsub; /**< The task submission tome of the test */ + RUNTIME_sequence_t *sequence; /**< The sequence to run the test if splitsub */ + RUNTIME_request_t request; /**< The request to run the test if splitsub */ +} testdata_t; + +void testing_start( testdata_t *tdata ); +void testing_stop( testdata_t *tdata, cham_fixdbl_t flops ); + /** * @brief Macros to enable distributed synchronization if necessary */ -- GitLab