Mentions légales du service

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

Add a pause field in the chamctxt structure to check if the runtime is paused...

Add a pause field in the chamctxt structure to check if the runtime is paused when syncrhonizing the system
parent 15d50172
No related branches found
No related tags found
1 merge request!290Add a pause field to the chamctxt to detect potential deadlock
...@@ -69,7 +69,14 @@ int chameleon_sequence_destroy(CHAM_context_t *chamctxt, RUNTIME_sequence_t *seq ...@@ -69,7 +69,14 @@ int chameleon_sequence_destroy(CHAM_context_t *chamctxt, RUNTIME_sequence_t *seq
*/ */
int chameleon_sequence_wait(CHAM_context_t *chamctxt, RUNTIME_sequence_t *sequence) int chameleon_sequence_wait(CHAM_context_t *chamctxt, RUNTIME_sequence_t *sequence)
{ {
if ( chamctxt->runtime_paused ) {
chameleon_warning("chameleon_sequence_wait()", "CHAMELEON was paused, so it is resumed and it will be paused after the wait");
RUNTIME_resume( chamctxt );
}
RUNTIME_sequence_wait( chamctxt, sequence ); RUNTIME_sequence_wait( chamctxt, sequence );
if ( chamctxt->runtime_paused ) {
RUNTIME_pause( chamctxt );
}
return CHAMELEON_SUCCESS; return CHAMELEON_SUCCESS;
} }
......
...@@ -77,6 +77,8 @@ CHAM_context_t *chameleon_context_create() ...@@ -77,6 +77,8 @@ CHAM_context_t *chameleon_context_create()
chamctxt->progress_enabled = CHAMELEON_FALSE; chamctxt->progress_enabled = CHAMELEON_FALSE;
chamctxt->generic_enabled = CHAMELEON_FALSE; chamctxt->generic_enabled = CHAMELEON_FALSE;
chamctxt->runtime_paused = CHAMELEON_FALSE;
chamctxt->householder = ChamFlatHouseholder; chamctxt->householder = ChamFlatHouseholder;
chamctxt->translation = ChamOutOfPlace; chamctxt->translation = ChamOutOfPlace;
......
...@@ -194,6 +194,11 @@ int CHAMELEON_Pause(void) ...@@ -194,6 +194,11 @@ int CHAMELEON_Pause(void)
chameleon_error("CHAMELEON_Pause()", "CHAMELEON not initialized"); chameleon_error("CHAMELEON_Pause()", "CHAMELEON not initialized");
return CHAMELEON_ERR_NOT_INITIALIZED; return CHAMELEON_ERR_NOT_INITIALIZED;
} }
if ( chamctxt->runtime_paused ) {
chameleon_warning("CHAMELEON_Pause()", "CHAMELEON already paused");
return CHAMELEON_SUCCESS;
}
chamctxt->runtime_paused = CHAMELEON_TRUE;
RUNTIME_pause(chamctxt); RUNTIME_pause(chamctxt);
return CHAMELEON_SUCCESS; return CHAMELEON_SUCCESS;
} }
...@@ -217,6 +222,11 @@ int CHAMELEON_Resume(void) ...@@ -217,6 +222,11 @@ int CHAMELEON_Resume(void)
chameleon_error("CHAMELEON_Resume()", "CHAMELEON not initialized"); chameleon_error("CHAMELEON_Resume()", "CHAMELEON not initialized");
return CHAMELEON_ERR_NOT_INITIALIZED; return CHAMELEON_ERR_NOT_INITIALIZED;
} }
if ( !chamctxt->runtime_paused ) {
chameleon_warning("CHAMELEON_Resume()", "CHAMELEON was already resumed");
return CHAMELEON_SUCCESS;
}
chamctxt->runtime_paused = CHAMELEON_FALSE;
RUNTIME_resume(chamctxt); RUNTIME_resume(chamctxt);
return CHAMELEON_SUCCESS; return CHAMELEON_SUCCESS;
} }
......
...@@ -137,6 +137,7 @@ typedef struct chameleon_context_s { ...@@ -137,6 +137,7 @@ typedef struct chameleon_context_s {
cham_bool_t profiling_enabled; cham_bool_t profiling_enabled;
cham_bool_t progress_enabled; cham_bool_t progress_enabled;
cham_bool_t generic_enabled; cham_bool_t generic_enabled;
cham_bool_t runtime_paused;
cham_householder_t householder; // "domino" (flat) or tree-based (reduction) Householder cham_householder_t householder; // "domino" (flat) or tree-based (reduction) Householder
cham_translation_t translation; // In place or Out of place layout conversion cham_translation_t translation; // In place or Out of place layout conversion
......
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