diff --git a/compute/pzgetrf_nopiv.c b/compute/pzgetrf_nopiv.c index 9d78bd9bd8b1c14ab3fb9af5f9a35e9184fd8216..ac33e9985ef32ede6aac4013098e312779206fe3 100644 --- a/compute/pzgetrf_nopiv.c +++ b/compute/pzgetrf_nopiv.c @@ -19,6 +19,7 @@ * @author Florent Pruvost * @author Samuel Thibault * @author Terry Cojean + * @author Matthieu Kuhn * @date 2022-02-22 * @precisions normal z -> s d c * @@ -30,9 +31,9 @@ /** * Parallel tile LU factorization with no pivoting - dynamic scheduling */ -void chameleon_pzgetrf_nopiv(CHAM_desc_t *A, - RUNTIME_sequence_t *sequence, - RUNTIME_request_t *request) +void chameleon_pzgetrf_nopiv( CHAM_desc_t *A, + RUNTIME_sequence_t *sequence, + RUNTIME_request_t *request ) { CHAM_context_t *chamctxt; RUNTIME_option_t options; @@ -51,6 +52,19 @@ void chameleon_pzgetrf_nopiv(CHAM_desc_t *A, ib = CHAMELEON_IB; + if ( chamctxt->autominmax_enabled && (chamctxt->scheduler == RUNTIME_SCHED_STARPU) ) { + int lookahead = chamctxt->lookahead; + int nbtasks_per_step = (A->mt * A->nt) / (A->p * A->q); + int mintasks = nbtasks_per_step * lookahead; + int maxtasks = nbtasks_per_step * (lookahead+1); + + if ( CHAMELEON_Comm_rank() == 0 ) { + chameleon_warning( "chameleon_pzgetrf_nopiv", + "Setting limit for the number of submitted tasks\n" ); + } + RUNTIME_set_minmax_submitted_tasks( mintasks, maxtasks ); + } + for (k = 0; k < chameleon_min(A->mt, A->nt); k++) { RUNTIME_iteration_push(chamctxt, k); diff --git a/control/context.c b/control/context.c index e8635b418a3cb7241fd70538555d966ed308dc75..827ebc811db3a4b0989d093b752c1a89b5b03493 100644 --- a/control/context.c +++ b/control/context.c @@ -137,6 +137,7 @@ CHAM_context_t *chameleon_context_create() chamctxt->profiling_enabled = chameleon_env_is_on( "CHAMELEON_PROFILING_MODE" ); chamctxt->progress_enabled = chameleon_env_is_on( "CHAMELEON_PROGRESS" ); chamctxt->generic_enabled = chameleon_env_is_on( "CHAMELEON_GENERIC" ); + chamctxt->autominmax_enabled = chameleon_env_is_on( "CHAMELEON_AUTOMINMAX" ); chamctxt->runtime_paused = CHAMELEON_FALSE; diff --git a/include/chameleon/runtime.h b/include/chameleon/runtime.h index e1aa0f96c0de8aa8e6b18d849aee1a22f8ee27d6..8794b5618391d33fd7da9987cd7d399fe92f6073 100644 --- a/include/chameleon/runtime.h +++ b/include/chameleon/runtime.h @@ -17,6 +17,7 @@ * @author Florent Pruvost * @author Samuel Thibault * @author Philippe Swartvagher + * @author Matthieu Kuhn * @date 2022-02-22 * */ @@ -647,6 +648,24 @@ RUNTIME_options_ws_alloc( RUNTIME_option_t *options, int RUNTIME_options_ws_free( RUNTIME_option_t *options ); +/** + * @brief Set the minimum and maximum limit of tasks submitted to the runtime + * + * @warning Only STARPU for now + * + * @param[in] min + * Minimum number of tasks under which the task submission + * restarts. + * + * @param[in] max + * Maximum number of tasks submitted to the runtime. + * When reached, we stop submitting and switch to execution + * until the minimum number of tasks is reached. + * + */ +void +RUNTIME_set_minmax_submitted_tasks( int min, int max ); + /** * @} * diff --git a/include/chameleon/struct.h b/include/chameleon/struct.h index 7ab9711e1df9dfc9a9df131c501f37da4d66f0f1..bd49119df09a400e09e21a6d9096b0ec5a19c7ea 100644 --- a/include/chameleon/struct.h +++ b/include/chameleon/struct.h @@ -17,6 +17,7 @@ * @author Cedric Castagnede * @author Florent Pruvost * @author Samuel Thibault + * @author Matthieu Kuhn * @date 2022-02-22 * */ @@ -137,6 +138,7 @@ typedef struct chameleon_context_s { cham_bool_t profiling_enabled; cham_bool_t progress_enabled; cham_bool_t generic_enabled; + cham_bool_t autominmax_enabled; cham_bool_t runtime_paused; cham_householder_t householder; // "domino" (flat) or tree-based (reduction) Householder diff --git a/runtime/openmp/control/runtime_control.c b/runtime/openmp/control/runtime_control.c index e50193c0fd4ab8eccd8860d5f243a16edd897496..02a44c477cdb80cc118174b9af82b328d7668bc2 100644 --- a/runtime/openmp/control/runtime_control.c +++ b/runtime/openmp/control/runtime_control.c @@ -18,6 +18,7 @@ * @author Florent Pruvost * @author Philippe Virouleau * @author Philippe Swartvagher + * @author Matthieu Kuhn * @date 2022-02-22 * */ @@ -127,3 +128,8 @@ int RUNTIME_comm_size( CHAM_context_t *chamctxt ) (void)chamctxt; return 1; } + +void RUNTIME_set_minmax_submitted_tasks( int min, int max ) { + (void)min; + (void)max; +} diff --git a/runtime/parsec/control/runtime_control.c b/runtime/parsec/control/runtime_control.c index 5a5347866f596eba12444fe8ed66085a4adafe8c..5aa0484a49458c1313d28acad2c6ef3f9731100d 100644 --- a/runtime/parsec/control/runtime_control.c +++ b/runtime/parsec/control/runtime_control.c @@ -16,6 +16,7 @@ * @author Mathieu Faverge * @author Samuel Thibault * @author Philippe Swartvagher + * @author Matthieu Kuhn * @date 2022-02-22 * */ @@ -153,3 +154,8 @@ int RUNTIME_comm_size( CHAM_context_t *chamctxt ) (void)chamctxt; return size; } + +void RUNTIME_set_minmax_submitted_tasks( int min, int max ) { + (void)min; + (void)max; +} diff --git a/runtime/quark/control/runtime_control.c b/runtime/quark/control/runtime_control.c index bdb4a78d33b6eeee66d297b95e28e4a2cd20d36f..a457839f7c48fcc1642868e9a4b779ab4bdaa37b 100644 --- a/runtime/quark/control/runtime_control.c +++ b/runtime/quark/control/runtime_control.c @@ -18,6 +18,7 @@ * @author Mathieu Faverge * @author Samuel Thibault * @author Philippe Swartvagher + * @author Matthieu Kuhn * @date 2022-02-22 * */ @@ -134,3 +135,8 @@ int RUNTIME_comm_size( CHAM_context_t *chamctxt ) (void)chamctxt; return 1; } + +void RUNTIME_set_minmax_submitted_tasks( int min, int max ) { + (void)min; + (void)max; +} diff --git a/runtime/starpu/CMakeLists.txt b/runtime/starpu/CMakeLists.txt index 09a02526c81e484f8b914b7100ed6768ec940457..3fb2514a9a98c7b08f37d700e87dde37170d73e2 100644 --- a/runtime/starpu/CMakeLists.txt +++ b/runtime/starpu/CMakeLists.txt @@ -23,6 +23,7 @@ # @author Mathieu Faverge # @author Florent Pruvost # @author Samuel Thibault +# @author Matthieu Kuhn # @date 2022-02-22 # ### @@ -73,6 +74,10 @@ if ( STARPU_FOUND ) if ( HAVE_STARPU_DATA_PEEK ) message("-- ${Blue}Add definition HAVE_STARPU_DATA_PEEK${ColourReset}") endif() + check_function_exists(starpu_set_limit_min_submitted_tasks HAVE_STARPU_SET_LIMIT_SUBMITTED_TASKS ) + if ( HAVE_STARPU_SET_LIMIT_SUBMITTED_TASKS ) + message("-- ${Blue}Add definition HAVE_STARPU_SET_LIMIT_SUBMITTED_TASKS${ColourReset}") + endif() check_struct_has_member( "struct starpu_data_interface_ops" reuse_data_on_node "starpu_data_interfaces.h" HAVE_STARPU_REUSE_DATA_ON_NODE LANGUAGE "C" ) if ( HAVE_STARPU_REUSE_DATA_ON_NODE ) message("-- ${Blue}Add definition HAVE_STARPU_REUSE_DATA_ON_NODE${ColourReset}") diff --git a/runtime/starpu/control/runtime_control.c b/runtime/starpu/control/runtime_control.c index 37979d86ef77b0a5f691034b82de609424b11ed2..bcc79254f0db5ee2e95aab1f703200e9f644d2ae 100644 --- a/runtime/starpu/control/runtime_control.c +++ b/runtime/starpu/control/runtime_control.c @@ -18,6 +18,7 @@ * @author Florent Pruvost * @author Philippe Swartvagher * @author Samuel Thibault + * @author Matthieu Kuhn * @date 2022-02-22 * */ @@ -320,3 +321,16 @@ int RUNTIME_comm_size( CHAM_context_t *chamctxt ) (void)chamctxt; return size; } + +void RUNTIME_set_minmax_submitted_tasks( int min, int max ){ +#if defined(HAVE_STARPU_SET_LIMIT_SUBMITTED_TASKS) + starpu_set_limit_min_submitted_tasks( min ); + starpu_set_limit_max_submitted_tasks( max ); +#else + fprintf( stderr, + "RUNTIME_set_minmax_submitted_tasks: StarPU version does not support dynamic limit setting.\n" + "Please use setting through environment variables:\n" + " export STARPU_LIMIT_MIN_SUBMITTED_TASKS=%d\n" + " export STARPU_LIMIT_MAX_SUBMITTED_TASKS=%d\n", min, max ); +#endif +}