|
|
@@ -43,25 +43,25 @@ typedef int (*backup_of_fn)(int);
|
|
|
int increment_current_instance()
|
|
|
{
|
|
|
int _inst;
|
|
|
- starpu_pthread_mutex_lock(¤t_instance_mutex);
|
|
|
+ STARPU_PTHREAD_MUTEX_LOCK(¤t_instance_mutex);
|
|
|
_inst = ++current_instance;
|
|
|
- starpu_pthread_mutex_unlock(¤t_instance_mutex);
|
|
|
+ STARPU_PTHREAD_MUTEX_UNLOCK(¤t_instance_mutex);
|
|
|
return _inst;
|
|
|
}
|
|
|
|
|
|
int get_current_instance()
|
|
|
{
|
|
|
int _inst;
|
|
|
- starpu_pthread_mutex_lock(¤t_instance_mutex);
|
|
|
+ STARPU_PTHREAD_MUTEX_LOCK(¤t_instance_mutex);
|
|
|
_inst = current_instance;
|
|
|
- starpu_pthread_mutex_unlock(¤t_instance_mutex);
|
|
|
+ STARPU_PTHREAD_MUTEX_UNLOCK(¤t_instance_mutex);
|
|
|
return _inst;
|
|
|
}
|
|
|
|
|
|
|
|
|
void checkpoint_template_lib_init(void) {
|
|
|
- starpu_pthread_mutex_init(¤t_instance_mutex, NULL);
|
|
|
- starpu_pthread_mutex_init(&cp_template_mutex, NULL);
|
|
|
+ STARPU_PTHREAD_MUTEX_INIT(¤t_instance_mutex, NULL);
|
|
|
+ STARPU_PTHREAD_MUTEX_INIT(&cp_template_mutex, NULL);
|
|
|
starpu_mpi_comm_rank(MPI_COMM_WORLD, &_my_rank);
|
|
|
starpu_mpi_comm_size(MPI_COMM_WORLD, &comm_size);
|
|
|
current_instance = 0;
|
|
|
@@ -85,14 +85,14 @@ void checkpoint_template_lib_quit(void) {
|
|
|
|
|
|
int _starpu_mpi_checkpoint_template_add_data(starpu_mpi_checkpoint_template_t cp_template, int type, void* ptr, int count, int backupped_by, int backup_of, starpu_mpi_tag_t tag)
|
|
|
{
|
|
|
- starpu_pthread_mutex_lock(&cp_template->mutex);
|
|
|
+ STARPU_PTHREAD_MUTEX_LOCK(&cp_template->mutex);
|
|
|
STARPU_ASSERT_MSG(!cp_template->frozen, "It is not possible to modify registered checkpoint template.\n");
|
|
|
struct _starpu_mpi_checkpoint_template_item* item;
|
|
|
item = _starpu_mpi_checkpoint_template_item_create(type, ptr, count, backupped_by, backup_of, tag);
|
|
|
_starpu_mpi_checkpoint_template_item_list_push_back(&cp_template->list, item);
|
|
|
_checkpoint_template_add_to_backup_arrays(cp_template, backupped_by, backup_of);
|
|
|
_STARPU_MPI_DEBUG(5, "New checkpoint data entry %p (data:%p) has been added to cp_template with id:%d. (%s)\n", item, item->ptr, cp_template->cp_id, backupped_by == -1 ? "BACKUP_OF" : "BACKUPPED_BY");
|
|
|
- starpu_pthread_mutex_unlock(&cp_template->mutex);
|
|
|
+ STARPU_PTHREAD_MUTEX_UNLOCK(&cp_template->mutex);
|
|
|
return 0;
|
|
|
}
|
|
|
|
|
|
@@ -236,19 +236,19 @@ int _starpu_mpi_checkpoint_post_cp_discard_send(starpu_mpi_checkpoint_template_t
|
|
|
starpu_mpi_checkpoint_template_t _starpu_mpi_get_checkpoint_template_by_id(int checkpoint_id)
|
|
|
{
|
|
|
int i;
|
|
|
- starpu_pthread_mutex_lock(&cp_template_mutex);
|
|
|
+ STARPU_PTHREAD_MUTEX_LOCK(&cp_template_mutex);
|
|
|
for (i=0 ; i < cp_template_array_size ; i++)
|
|
|
{
|
|
|
-// starpu_pthread_mutex_lock(&cp_template_array[i]->mutex);
|
|
|
+// STARPU_PTHREAD_MUTEX_LOCK(&cp_template_array[i]->mutex);
|
|
|
if (cp_template_array[i]->cp_id == checkpoint_id)
|
|
|
{
|
|
|
-// starpu_pthread_mutex_unlock(&cp_template_array[i]->mutex);
|
|
|
- starpu_pthread_mutex_unlock(&cp_template_mutex);
|
|
|
+// STARPU_PTHREAD_MUTEX_UNLOCK(&cp_template_array[i]->mutex);
|
|
|
+ STARPU_PTHREAD_MUTEX_UNLOCK(&cp_template_mutex);
|
|
|
return cp_template_array[i];
|
|
|
}
|
|
|
-// starpu_pthread_mutex_unlock(&cp_template_array[i]->mutex);
|
|
|
+// STARPU_PTHREAD_MUTEX_UNLOCK(&cp_template_array[i]->mutex);
|
|
|
}
|
|
|
- starpu_pthread_mutex_unlock(&cp_template_mutex);
|
|
|
+ STARPU_PTHREAD_MUTEX_UNLOCK(&cp_template_mutex);
|
|
|
return NULL;
|
|
|
}
|
|
|
|
|
|
@@ -357,7 +357,7 @@ int _starpu_mpi_checkpoint_template_freeze(starpu_mpi_checkpoint_template_t cp_t
|
|
|
{
|
|
|
// char str[256];
|
|
|
int i;
|
|
|
- starpu_pthread_mutex_lock(&cp_template->mutex);
|
|
|
+ STARPU_PTHREAD_MUTEX_LOCK(&cp_template->mutex);
|
|
|
_STARPU_MPI_DEBUG(2, "Start freezing checkpoint id:%d\n", cp_template->cp_id);
|
|
|
cp_template->frozen = 1;
|
|
|
cp_template->message_to_send_number = 0;
|
|
|
@@ -387,16 +387,16 @@ int _starpu_mpi_checkpoint_template_freeze(starpu_mpi_checkpoint_template_t cp_t
|
|
|
// }
|
|
|
// fprintf(stderr, "%s\n", str);
|
|
|
|
|
|
- starpu_pthread_mutex_unlock(&cp_template->mutex);
|
|
|
+ STARPU_PTHREAD_MUTEX_UNLOCK(&cp_template->mutex);
|
|
|
|
|
|
- starpu_pthread_mutex_lock(&cp_template_mutex);
|
|
|
+ STARPU_PTHREAD_MUTEX_LOCK(&cp_template_mutex);
|
|
|
for (i=0 ; i < cp_template_array_size ; i++)
|
|
|
{
|
|
|
STARPU_ASSERT_MSG(cp_template_array[i]->cp_id != cp_template->cp_id, "A checkpoint with id %d has already been registered.\n", cp_template->cp_id);
|
|
|
}
|
|
|
cp_template_array[cp_template_array_size] = cp_template;
|
|
|
cp_template_array_size++;
|
|
|
- starpu_pthread_mutex_unlock(&cp_template_mutex);
|
|
|
+ STARPU_PTHREAD_MUTEX_UNLOCK(&cp_template_mutex);
|
|
|
|
|
|
_STARPU_MPI_DEBUG(2, "Checkpoint id:%d is frozen and registered.\n", cp_template->cp_id);
|
|
|
return cp_template->size;
|
|
|
@@ -455,7 +455,7 @@ int _checkpoint_template_digest_ack_reception(int checkpoint_id, int checkpoint_
|
|
|
int remaining_ack_messages;
|
|
|
struct _starpu_mpi_checkpoint_tracker* tracker, *tracker1;
|
|
|
starpu_mpi_checkpoint_template_t cp_template = _starpu_mpi_get_checkpoint_template_by_id(checkpoint_id);
|
|
|
- starpu_pthread_mutex_lock(&cp_template_mutex);
|
|
|
+ STARPU_PTHREAD_MUTEX_LOCK(&cp_template_mutex);
|
|
|
_STARPU_MPI_DEBUG(20, "Digesting ack recv: id=%d, inst=%d\n", checkpoint_id, checkpoint_instance);
|
|
|
|
|
|
tracker = _starpu_mpi_checkpoint_tracker_update(cp_template, checkpoint_id, cp_template->checkpoint_domain, checkpoint_instance);
|
|
|
@@ -499,7 +499,7 @@ int _checkpoint_template_digest_ack_reception(int checkpoint_id, int checkpoint_
|
|
|
}
|
|
|
|
|
|
_STARPU_MPI_DEBUG(20, "Digested\n");
|
|
|
- starpu_pthread_mutex_unlock(&cp_template_mutex);
|
|
|
+ STARPU_PTHREAD_MUTEX_UNLOCK(&cp_template_mutex);
|
|
|
return 0;
|
|
|
}
|
|
|
|