Skip to content

Commit 6eac6a8

Browse files
committed
osc/sm: create datafile into the per proc directory in order to make it unique per communicator
Thanks Peter Wind for the report
1 parent 89eea51 commit 6eac6a8

File tree

1 file changed

+17
-16
lines changed

1 file changed

+17
-16
lines changed

ompi/mca/osc/sm/osc_sm_component.c

Lines changed: 17 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
* reserved.
66
* Copyright (c) 2014 Intel, Inc. All rights reserved.
77
* Copyright (c) 2015 Cisco Systems, Inc. All rights reserved.
8-
* Copyright (c) 2015 Research Organization for Information Science
8+
* Copyright (c) 2015-2016 Research Organization for Information Science
99
* and Technology (RIST). All rights reserved.
1010
* $COPYRIGHT$
1111
*
@@ -208,10 +208,9 @@ component_select(struct ompi_win_t *win, void **base, size_t size, int disp_unit
208208
module->posts[0] = (uint64_t *) (module->posts + 1);
209209
} else {
210210
unsigned long total, *rbuf;
211-
char *data_file;
212211
int i, flag;
213212
size_t pagesize;
214-
size_t state_size;
213+
size_t state_size;
215214
int posts_size, post_size = (comm_size + 63) / 64;
216215

217216
OPAL_OUTPUT_VERBOSE((1, ompi_osc_base_framework.framework_output,
@@ -245,22 +244,24 @@ component_select(struct ompi_win_t *win, void **base, size_t size, int disp_unit
245244
total += rbuf[i];
246245
}
247246

248-
if (asprintf(&data_file, "%s"OPAL_PATH_SEP"shared_window_%d.%s",
249-
ompi_process_info.job_session_dir,
250-
ompi_comm_get_cid(module->comm),
251-
ompi_process_info.nodename) < 0) {
252-
return OMPI_ERR_OUT_OF_RESOURCE;
253-
}
254-
255247
/* user opal/shmem directly to create a shared memory segment */
256248
state_size = sizeof(ompi_osc_sm_global_state_t) + sizeof(ompi_osc_sm_node_state_t) * comm_size;
257249
posts_size = comm_size * post_size * sizeof (uint64_t);
258-
if (0 == ompi_comm_rank (module->comm)) {
259-
ret = opal_shmem_segment_create (&module->seg_ds, data_file, total + pagesize + state_size + posts_size);
260-
if (OPAL_SUCCESS != ret) {
261-
goto error;
262-
}
263-
}
250+
if (0 == ompi_comm_rank (module->comm)) {
251+
char *data_file;
252+
if (asprintf(&data_file, "%s"OPAL_PATH_SEP"shared_window_%d.%s",
253+
ompi_process_info.proc_session_dir,
254+
ompi_comm_get_cid(module->comm),
255+
ompi_process_info.nodename) < 0) {
256+
return OMPI_ERR_OUT_OF_RESOURCE;
257+
}
258+
259+
ret = opal_shmem_segment_create (&module->seg_ds, data_file, total + pagesize + state_size + posts_size);
260+
free(data_file);
261+
if (OPAL_SUCCESS != ret) {
262+
goto error;
263+
}
264+
}
264265

265266
ret = module->comm->c_coll.coll_bcast (&module->seg_ds, sizeof (module->seg_ds), MPI_BYTE, 0,
266267
module->comm, module->comm->c_coll.coll_bcast_module);

0 commit comments

Comments
 (0)