Skip to content

Commit 6a55609

Browse files
author
Alessandro Fanfarillo
committed
Sync team implemented
1 parent 131b769 commit 6a55609

File tree

2 files changed

+29
-0
lines changed

2 files changed

+29
-0
lines changed

src/libcaf.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -295,6 +295,7 @@ void PREFIX (fail_image) (void) __attribute__ ((noreturn));
295295
void PREFIX (form_team) (int, caf_team_t *, int);
296296
void PREFIX (change_team) (caf_team_t *, int);
297297
void PREFIX (end_team) (caf_team_t *);
298+
void PREFIX (sync_team) (caf_team_t *, int);
298299

299300
int PREFIX (image_status) (int);
300301
void PREFIX (failed_images) (gfc_descriptor_t *, int, int *);

src/mpi/mpi_caf.c

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4899,3 +4899,31 @@ void PREFIX (end_team) (caf_team_t *team __attribute__ ((unused)))
48994899
caf_this_image++;
49004900
MPI_Comm_size(CAF_COMM_WORLD,&caf_num_images);
49014901
}
4902+
4903+
void PREFIX (sync_team) (caf_team_t *team , int unused __attribute__ ((unused)))
4904+
{
4905+
caf_teams_list *tmp_list = NULL;
4906+
caf_used_teams_list *tmp_used = NULL;
4907+
void *tmp_team;
4908+
MPI_Comm *tmp_comm;
4909+
4910+
/* Check if the team is the current, and ancestor or a descendant. To be implemented. */
4911+
4912+
tmp_used = used_teams;
4913+
tmp_list = (struct caf_teams_list *)*team;
4914+
tmp_team = (void *)tmp_list->team;
4915+
tmp_comm = (MPI_Comm *)tmp_team;
4916+
4917+
while(tmp_used)
4918+
{
4919+
if(tmp_used->team_list_elem == tmp_list)
4920+
break;
4921+
tmp_used = tmp_used->prev;
4922+
}
4923+
4924+
if(tmp_used == NULL)
4925+
caf_runtime_error("SYNC TEAM called on team different from current or ancestor or descendant");
4926+
4927+
MPI_Barrier(*tmp_comm);
4928+
4929+
}

0 commit comments

Comments
 (0)