Skip to content

Commit 6cfee75

Browse files
Alessandro FanfarilloDamian Rouson
authored andcommitted
Change team implemented
1 parent dcaa1a0 commit 6cfee75

File tree

2 files changed

+29
-4
lines changed

2 files changed

+29
-4
lines changed

src/libcaf.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -276,6 +276,7 @@ void PREFIX (error_stop) (int32_t) __attribute__ ((noreturn));
276276
void PREFIX (fail_image) (void) __attribute__ ((noreturn));
277277

278278
void PREFIX (form_team) (int, caf_team_t *, int);
279+
void PREFIX (change_team) (caf_team_t *, int);
279280

280281
int PREFIX (image_status) (int);
281282
void PREFIX (failed_images) (gfc_descriptor_t *, int, int *);

src/mpi/mpi_caf.c

Lines changed: 28 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5169,15 +5169,39 @@ void PREFIX (form_team) (int team_id, caf_team_t *team, int index __attribute__
51695169
{
51705170
struct caf_teams_list *tmp;
51715171
void * tmp_team;
5172-
MPI_Comm newcomm;
5172+
MPI_Comm *newcomm;
51735173
MPI_Comm *current_comm = &current_team;
51745174

5175-
MPI_Comm_split(*current_comm, team_id, caf_this_image, &newcomm);
5175+
MPI_Barrier(CAF_COMM_WORLD);
5176+
newcomm = (MPI_Comm *)calloc(1,sizeof(MPI_Comm));
5177+
MPI_Comm_split(*current_comm, team_id, caf_this_image, newcomm);
51765178

51775179
tmp = calloc(1,sizeof(struct caf_teams_list));
51785180
tmp->prev = teams_list;
51795181
teams_list = tmp;
51805182
teams_list->team_id = team_id;
5181-
teams_list->team = &newcomm;
5182-
*team = &newcomm;
5183+
teams_list->team = newcomm;
5184+
*team = newcomm;
5185+
}
5186+
5187+
void PREFIX (change_team) (caf_team_t *team, int coselector __attribute__ ((unused)))
5188+
{
5189+
void *tmp_team;
5190+
MPI_Comm *tmp_comm;
5191+
MPI_Barrier(CAF_COMM_WORLD);
5192+
tmp_team = (void *)*team;
5193+
tmp_comm = (MPI_Comm *)tmp_team;
5194+
CAF_COMM_WORLD = *tmp_comm;
5195+
MPI_Comm_rank(*tmp_comm,&caf_this_image);
5196+
caf_this_image++;
5197+
MPI_Comm_size(*tmp_comm,&caf_num_images);
5198+
5199+
/* MPI_Comm_split(*current_comm, team_id, caf_this_image, &newcomm); */
5200+
5201+
/* tmp = calloc(1,sizeof(struct caf_teams_list)); */
5202+
/* tmp->prev = teams_list; */
5203+
/* teams_list = tmp; */
5204+
/* teams_list->team_id = team_id; */
5205+
/* teams_list->team = &newcomm; */
5206+
/* *team = &newcomm; */
51835207
}

0 commit comments

Comments
 (0)