@@ -254,11 +254,6 @@ static int mca_btl_sm_component_close(void)
254254 OBJ_DESTRUCT (& mca_btl_sm_component .pending_endpoints );
255255 OBJ_DESTRUCT (& mca_btl_sm_component .pending_fragments );
256256
257- if (mca_smsc_base_has_feature (MCA_SMSC_FEATURE_CAN_MAP )
258- && NULL != mca_btl_sm_component .my_segment ) {
259- munmap (mca_btl_sm_component .my_segment , mca_btl_sm_component .segment_size );
260- }
261-
262257 mca_btl_sm_component .my_segment = NULL ;
263258
264259 if (mca_btl_sm_component .mpool ) {
@@ -276,14 +271,9 @@ static int mca_btl_base_sm_modex_send(void)
276271
277272 modex_size = sizeof (modex ) - sizeof (modex .seg_ds );
278273
279- if (!mca_smsc_base_has_feature (MCA_SMSC_FEATURE_CAN_MAP )) {
280274 modex .seg_ds_size = opal_shmem_sizeof_shmem_ds (& mca_btl_sm_component .seg_ds );
281275 memmove (& modex .seg_ds , & mca_btl_sm_component .seg_ds , modex .seg_ds_size );
282276 modex_size += modex .seg_ds_size ;
283- } else {
284- modex .segment_base = (uintptr_t ) mca_btl_sm_component .my_segment ;
285- modex .seg_ds_size = 0 ;
286- }
287277
288278 int rc ;
289279 OPAL_MODEX_SEND (rc , PMIX_LOCAL , & mca_btl_sm_component .super .btl_version , & modex , modex_size );
@@ -376,41 +366,29 @@ mca_btl_sm_component_init(int *num_btls, bool enable_progress_threads, bool enab
376366 mca_btl_sm .super .btl_put = NULL ;
377367 }
378368
379- if (!mca_smsc_base_has_feature (MCA_SMSC_FEATURE_CAN_MAP )) {
380- char * sm_file ;
369+ char * sm_file ;
381370
382- rc = opal_asprintf (& sm_file , "%s" OPAL_PATH_SEP "sm_segment.%s.%u.%x.%d" ,
383- mca_btl_sm_component .backing_directory , opal_process_info .nodename ,
371+ rc = opal_asprintf (& sm_file , "%s" OPAL_PATH_SEP "sm_segment.%s.%u.%x.%d" ,
372+ mca_btl_sm_component .backing_directory , opal_process_info .nodename ,
384373 geteuid (), OPAL_PROC_MY_NAME .jobid , MCA_BTL_SM_LOCAL_RANK );
385- if (0 > rc ) {
386- free (btls );
387- return NULL ;
388- }
389- opal_pmix_register_cleanup (sm_file , false, false, false);
390-
391- rc = opal_shmem_segment_create (& component -> seg_ds , sm_file , component -> segment_size );
392- free (sm_file );
393- if (OPAL_SUCCESS != rc ) {
394- BTL_VERBOSE (("Could not create shared memory segment" ));
395- free (btls );
396- return NULL ;
397- }
374+ if (0 > rc ) {
375+ free (btls );
376+ return NULL ;
377+ }
378+ opal_pmix_register_cleanup (sm_file , false, false, false);
398379
399- component -> my_segment = opal_shmem_segment_attach (& component -> seg_ds );
400- if (NULL == component -> my_segment ) {
401- BTL_VERBOSE (("Could not attach to just created shared memory segment" ));
402- goto failed ;
403- }
404- } else {
405- /* if the shared-memory single-copy component can map memory (XPMEM) an anonymous segment
406- * can be used instead */
407- component -> my_segment = mmap (NULL , component -> segment_size , PROT_READ | PROT_WRITE ,
408- MAP_ANONYMOUS | MAP_SHARED , -1 , 0 );
409- if ((void * ) -1 == component -> my_segment ) {
410- BTL_VERBOSE (("Could not create anonymous memory segment" ));
411- free (btls );
412- return NULL ;
413- }
380+ rc = opal_shmem_segment_create (& component -> seg_ds , sm_file , component -> segment_size );
381+ free (sm_file );
382+ if (OPAL_SUCCESS != rc ) {
383+ BTL_VERBOSE (("Could not create shared memory segment" ));
384+ free (btls );
385+ return NULL ;
386+ }
387+
388+ component -> my_segment = opal_shmem_segment_attach (& component -> seg_ds );
389+ if (NULL == component -> my_segment ) {
390+ BTL_VERBOSE (("Could not attach to just created shared memory segment" ));
391+ goto failed ;
414392 }
415393
416394 /* initialize my fifo */
@@ -432,11 +410,7 @@ mca_btl_sm_component_init(int *num_btls, bool enable_progress_threads, bool enab
432410
433411 return btls ;
434412failed :
435- if (mca_smsc_base_has_feature (MCA_SMSC_FEATURE_CAN_MAP )) {
436- munmap (component -> my_segment , component -> segment_size );
437- } else {
438- opal_shmem_unlink (& component -> seg_ds );
439- }
413+ opal_shmem_unlink (& component -> seg_ds );
440414
441415 if (btls ) {
442416 free (btls );
0 commit comments