Mentions légales du service

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

Merge branch 'issue105' into 'master'

Add a pause field to the chamctxt to detect potential deadlock

Closes #105

See merge request !290
parents 15d50172 bd3ee28e
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
*/
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 );
if ( chamctxt->runtime_paused ) {
RUNTIME_pause( chamctxt );
}
return CHAMELEON_SUCCESS;
}
......
......@@ -77,6 +77,8 @@ CHAM_context_t *chameleon_context_create()
chamctxt->progress_enabled = CHAMELEON_FALSE;
chamctxt->generic_enabled = CHAMELEON_FALSE;
chamctxt->runtime_paused = CHAMELEON_FALSE;
chamctxt->householder = ChamFlatHouseholder;
chamctxt->translation = ChamOutOfPlace;
......
......@@ -137,7 +137,7 @@ int __chameleon_finalize(void)
{
CHAM_context_t *chamctxt = chameleon_context_self();
if (chamctxt == NULL) {
chameleon_error("CHAMELEON_Finalize()", "CHAMELEON not initialized");
chameleon_error("CHAMELEON_Finalize", "CHAMELEON not initialized");
return CHAMELEON_ERR_NOT_INITIALIZED;
}
RUNTIME_flush();
......@@ -191,9 +191,14 @@ int CHAMELEON_Pause(void)
{
CHAM_context_t *chamctxt = chameleon_context_self();
if (chamctxt == NULL) {
chameleon_error("CHAMELEON_Pause()", "CHAMELEON not initialized");
chameleon_error("CHAMELEON_Pause", "CHAMELEON 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);
return CHAMELEON_SUCCESS;
}
......@@ -214,9 +219,14 @@ int CHAMELEON_Resume(void)
{
CHAM_context_t *chamctxt = chameleon_context_self();
if (chamctxt == NULL) {
chameleon_error("CHAMELEON_Resume()", "CHAMELEON not initialized");
chameleon_error("CHAMELEON_Resume", "CHAMELEON 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);
return CHAMELEON_SUCCESS;
}
......@@ -236,10 +246,10 @@ int CHAMELEON_Distributed_start(void)
{
CHAM_context_t *chamctxt = chameleon_context_self();
if (chamctxt == NULL) {
chameleon_error("CHAMELEON_Finalize()", "CHAMELEON not initialized");
chameleon_error("CHAMELEON_Finalize", "CHAMELEON not initialized");
return CHAMELEON_ERR_NOT_INITIALIZED;
}
RUNTIME_barrier (chamctxt);
RUNTIME_barrier( chamctxt );
return CHAMELEON_SUCCESS;
}
......@@ -258,10 +268,10 @@ int CHAMELEON_Distributed_stop(void)
{
CHAM_context_t *chamctxt = chameleon_context_self();
if (chamctxt == NULL) {
chameleon_error("CHAMELEON_Finalize()", "CHAMELEON not initialized");
chameleon_error("CHAMELEON_Finalize", "CHAMELEON not initialized");
return CHAMELEON_ERR_NOT_INITIALIZED;
}
RUNTIME_barrier (chamctxt);
RUNTIME_barrier( chamctxt );
return CHAMELEON_SUCCESS;
}
......@@ -281,7 +291,7 @@ int CHAMELEON_Comm_size()
{
CHAM_context_t *chamctxt = chameleon_context_self();
if (chamctxt == NULL) {
chameleon_error("CHAMELEON_Comm_size()", "CHAMELEON not initialized");
chameleon_error("CHAMELEON_Comm_size", "CHAMELEON not initialized");
return -1;
}
......@@ -304,7 +314,7 @@ int CHAMELEON_Comm_rank()
{
CHAM_context_t *chamctxt = chameleon_context_self();
if (chamctxt == NULL) {
chameleon_error("CHAMELEON_Comm_rank()", "CHAMELEON not initialized");
chameleon_error("CHAMELEON_Comm_rank", "CHAMELEON not initialized");
return -1;
}
......@@ -327,7 +337,7 @@ int CHAMELEON_GetThreadNbr( )
{
CHAM_context_t *chamctxt = chameleon_context_self();
if (chamctxt == NULL) {
chameleon_error("CHAMELEON_GetThreadNbr()", "CHAMELEON not initialized");
chameleon_error("CHAMELEON_GetThreadNbr", "CHAMELEON not initialized");
return -1;
}
......
......@@ -137,6 +137,7 @@ typedef struct chameleon_context_s {
cham_bool_t profiling_enabled;
cham_bool_t progress_enabled;
cham_bool_t generic_enabled;
cham_bool_t runtime_paused;
cham_householder_t householder; // "domino" (flat) or tree-based (reduction) Householder
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