Skip to content

Commit 7f13476

Browse files
committed
Create file for file backed shared memory in process job session dir.
Prevents file collisions and can also be cleaned by orte-clean properly. Signed-off-by: Christoph Niethammer <[email protected]>
1 parent c38866e commit 7f13476

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

ompi/mca/sharedfp/sm/sharedfp_sm_file_open.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -130,12 +130,10 @@ int mca_sharedfp_sm_file_open (struct ompi_communicator_t *comm,
130130
/* the shared memory segment is identified opening a file
131131
** and then mapping it to memory
132132
** For sharedfp we also want to put the file backed shared memory into the tmp directory
133-
** TODO: properly name the file so that different jobs can run on the same system w/o
134-
** overwriting each other, e.g. orte_process_info.proc_session_dir
135133
*/
136134
/*sprintf(sm_filename,"%s%s",filename,".sm");*/
137135
filename_basename = basename((void *)filename);
138-
sm_filename = (char*) malloc( sizeof(char) * (strlen(filename_basename)+64) );
136+
sm_filename = (char*) malloc( sizeof(char) * (strlen(filename_basename)+strlen(ompi_process_info.job_session_dir)+64) );
139137
if (NULL == sm_filename) {
140138
free(sm_data);
141139
free(sh);
@@ -151,7 +149,7 @@ int mca_sharedfp_sm_file_open (struct ompi_communicator_t *comm,
151149
comm->c_coll->coll_bcast ( &masterjobid, 1, MPI_UNSIGNED, 0, comm,
152150
comm->c_coll->coll_bcast_module );
153151

154-
sprintf(sm_filename,"/tmp/OMPIO_%s_%d_%s",filename_basename, masterjobid, ".sm");
152+
sprintf(sm_filename,"%s/OMPIO_%s_%d_%s",ompi_process_info.job_session_dir, filename_basename, masterjobid, ".sm");
155153
/* open shared memory file, initialize to 0, map into memory */
156154
sm_fd = open(sm_filename, O_RDWR | O_CREAT,
157155
S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH);

0 commit comments

Comments
 (0)