Skip to content

Commit e629994

Browse files
committed
oshmem: get rid of oshmem_proc_to
store oshmem related per proc data in a oshmem_proc_data_t, that is written in the padding section of a ompi_proc_t this data can be accessed via the OSHMEM_PROC_DATA(proc) macro Fixes #2023
1 parent 99b2664 commit e629994

File tree

17 files changed

+105
-99
lines changed

17 files changed

+105
-99
lines changed

ompi/proc/proc.h

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,13 +65,16 @@ BEGIN_C_DECLS
6565
* a tag increases the memory consumed by Open MPI, so should only be done
6666
* if unavoidable.
6767
*/
68+
69+
#define OMPI_PROC_PADDING_SIZE 16
70+
6871
struct ompi_proc_t {
6972
opal_proc_t super;
7073

7174
/* endpoint data */
7275
void *proc_endpoints[OMPI_PROC_ENDPOINT_TAG_MAX];
7376

74-
char padding[16]; /* for future extensions (OSHMEM uses this area also)*/
77+
char padding[OMPI_PROC_PADDING_SIZE]; /* for future extensions (OSHMEM uses this area also)*/
7578
};
7679
typedef struct ompi_proc_t ompi_proc_t;
7780
OBJ_CLASS_DECLARATION(ompi_proc_t);

oshmem/include/oshmem/types.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
/*
22
* Copyright (c) 2013 Mellanox Technologies, Inc.
33
* All rights reserved.
4+
* Copyright (c) 2016 Research Organization for Information Science
5+
* and Technology (RIST). All rights reserved.
46
* $COPYRIGHT$
57
*
68
* Additional copyrights may follow
@@ -16,7 +18,7 @@
1618
* dependencies.
1719
*/
1820

19-
struct oshmem_proc_t;
21+
struct ompi_proc_t;
2022
struct oshmem_group_t;
2123
struct oshmem_op_t;
2224

oshmem/mca/atomic/mxm/atomic_mxm_cswap.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
/*
22
* Copyright (c) 2013 Mellanox Technologies, Inc.
33
* All rights reserved.
4+
* Copyright (c) 2016 Research Organization for Information Science
5+
* and Technology (RIST). All rights reserved.
46
* $COPYRIGHT$
57
*
68
* Additional copyrights may follow
@@ -60,7 +62,7 @@ int mca_atomic_mxm_cswap(void *target,
6062
return OSHMEM_ERR_BAD_PARAM;
6163
}
6264

63-
ptl_id = oshmem_proc_group_all(pe)->transport_ids[0];
65+
ptl_id = OSHMEM_PROC_DATA(oshmem_proc_group_all(pe))->transport_ids[0];
6466
if (MXM_PTL_SHM == ptl_id) {
6567
ptl_id = MXM_PTL_RDMA;
6668
}

oshmem/mca/atomic/mxm/atomic_mxm_fadd.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
/*
22
* Copyright (c) 2013 Mellanox Technologies, Inc.
33
* All rights reserved.
4+
* Copyright (c) 2016 Research Organization for Information Science
5+
* and Technology (RIST). All rights reserved.
46
* $COPYRIGHT$
57
*
68
* Additional copyrights may follow
@@ -62,7 +64,7 @@ int mca_atomic_mxm_fadd(void *target,
6264
return OSHMEM_ERR_BAD_PARAM;
6365
}
6466

65-
ptl_id = oshmem_proc_group_all(pe)->transport_ids[0];
67+
ptl_id = OSHMEM_PROC_DATA(oshmem_proc_group_all(pe))->transport_ids[0];
6668
if (MXM_PTL_SHM == ptl_id) {
6769
ptl_id = MXM_PTL_RDMA;
6870
}

oshmem/mca/memheap/base/memheap_base_mkey.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
/*
33
* Copyright (c) 2013-2015 Mellanox Technologies, Inc.
44
* All rights reserved.
5-
* Copyright (c) 2015 Research Organization for Information Science
5+
* Copyright (c) 2015-2016 Research Organization for Information Science
66
* and Technology (RIST). All rights reserved.
77
* Copyright (c) 2015 Intel, Inc. All rights reserved.
88
* Copyright (c) 2015 Los Alamos National Security, LLC. All rights
@@ -93,7 +93,7 @@ int mca_memheap_seg_cmp(const void *k, const void *v)
9393
*/
9494
static int pack_local_mkeys(opal_buffer_t *msg, int pe, int seg, int all_trs)
9595
{
96-
oshmem_proc_t *proc;
96+
ompi_proc_t *proc;
9797
int i, n, tr_id;
9898
sshmem_mkey_t *mkey;
9999

@@ -111,7 +111,7 @@ static int pack_local_mkeys(opal_buffer_t *msg, int pe, int seg, int all_trs)
111111
MEMHEAP_VERBOSE(5, "found %d transports to %d", n, pe);
112112
for (i = 0; i < n; i++) {
113113
if (!all_trs) {
114-
tr_id = proc->transport_ids[i];
114+
tr_id = OSHMEM_PROC_DATA(proc)->transport_ids[i];
115115
}
116116
else {
117117
tr_id = i;
@@ -171,7 +171,7 @@ static void unpack_remote_mkeys(opal_buffer_t *msg, int remote_pe)
171171
int32_t n;
172172
int32_t tr_id;
173173
int i;
174-
oshmem_proc_t *proc;
174+
ompi_proc_t *proc;
175175

176176
proc = oshmem_proc_group_find(oshmem_group_all, remote_pe);
177177
cnt = 1;

oshmem/mca/scoll/fca/scoll_fca_module.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/**
22
* Copyright (c) 2013 Mellanox Technologies, Inc.
33
* All rights reserved.
4-
* Copyright (c) 2014 Research Organization for Information Science
4+
* Copyright (c) 2014-2016 Research Organization for Information Science
55
* and Technology (RIST). All rights reserved.
66
* $COPYRIGHT$
77
*
@@ -106,7 +106,7 @@ static int have_remote_peers(struct oshmem_group_t *group,
106106
size_t size,
107107
int *local_peers)
108108
{
109-
struct oshmem_proc_t *proc;
109+
struct ompi_proc_t *proc;
110110
size_t i;
111111
int ret;
112112

@@ -130,7 +130,7 @@ static int have_remote_peers(struct oshmem_group_t *group,
130130
static int _get_local_ranks(mca_scoll_fca_module_t *fca_module)
131131
{
132132
struct oshmem_group_t *comm = fca_module->comm;
133-
oshmem_proc_t* proc;
133+
ompi_proc_t* proc;
134134
int i, rank;
135135

136136
/* Count the local ranks */

oshmem/mca/spml/base/base.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
* Copyright (c) 2013 Mellanox Technologies, Inc.
33
* All rights reserved.
44
* Copyright (c) 2015 Cisco Systems, Inc. All rights reserved.
5+
* Copyright (c) 2016 Research Organization for Information Science
6+
* and Technology (RIST). All rights reserved.
57
* $COPYRIGHT$
68
*
79
* Additional copyrights may follow
@@ -57,7 +59,7 @@ OSHMEM_DECLSPEC int mca_spml_base_spml_selected(const char *name);
5759
* Verify that all new procs are using the currently selected component
5860
*/
5961
OSHMEM_DECLSPEC int mca_spml_base_spml_check_selected(const char *my_spml,
60-
oshmem_proc_t **procs,
62+
ompi_proc_t **procs,
6163
size_t nprocs);
6264

6365
OSHMEM_DECLSPEC int mca_spml_base_wait(void* addr,

oshmem/mca/spml/base/spml_base_request.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
* All rights reserved.
55
* Copyright (c) 2015 Los Alamos National Security, LLC. All rights
66
* reserved.
7-
* Copyright (c) 2015 Research Organization for Information Science
7+
* Copyright (c) 2015-2016 Research Organization for Information Science
88
* and Technology (RIST). All rights reserved.
99
* $COPYRIGHT$
1010
*
@@ -72,7 +72,7 @@ struct mca_spml_base_request_t {
7272
void *req_addr; /**< pointer to application buffer */
7373
size_t req_count; /**< count of user datatype elements *//* TODO: Need to remove since we are going to remove datatype*/
7474
int32_t req_peer; /**< peer process - rank of process executing the parallel program */
75-
oshmem_proc_t* req_proc; /**< peer process */
75+
ompi_proc_t* req_proc; /**< peer process */
7676
uint64_t req_sequence; /**< sequence number for shmem one sided ordering */
7777
};
7878
typedef struct mca_spml_base_request_t mca_spml_base_request_t;

oshmem/mca/spml/ikrit/spml_ikrit.c

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
/*
33
* Copyright (c) 2013-2015 Mellanox Technologies, Inc.
44
* All rights reserved.
5-
* Copyright (c) 2014 Research Organization for Information Science
5+
* Copyright (c) 2014-2016 Research Organization for Information Science
66
* and Technology (RIST). All rights reserved.
77
* Copyright (c) 2015 Los Alamos National Security, LLC. All rights
88
* reserved.
@@ -332,31 +332,31 @@ int mca_spml_ikrit_enable(bool enable)
332332

333333
static int create_ptl_idx(int dst_pe)
334334
{
335-
oshmem_proc_t *proc;
335+
ompi_proc_t *proc;
336336

337337
proc = oshmem_proc_group_find(oshmem_group_all, dst_pe);
338338

339-
proc->transport_ids = (char *) malloc(MXM_PTL_LAST * sizeof(char));
340-
if (!proc->transport_ids)
339+
OSHMEM_PROC_DATA(proc)->transport_ids = (char *) malloc(MXM_PTL_LAST * sizeof(char));
340+
if (NULL == OSHMEM_PROC_DATA(proc)->transport_ids)
341341
return OSHMEM_ERROR;
342342

343-
proc->num_transports = 1;
343+
OSHMEM_PROC_DATA(proc)->num_transports = 1;
344344
#if MXM_API < MXM_VERSION(2,0)
345345
if (oshmem_my_proc_id() == dst_pe)
346-
proc->transport_ids[0] = MXM_PTL_SELF;
346+
OSHMEM_PROC_DATA(proc)->transport_ids[0] = MXM_PTL_SELF;
347347
else
348348
#endif
349-
proc->transport_ids[0] = MXM_PTL_RDMA;
349+
OSHMEM_PROC_DATA(proc)->transport_ids[0] = MXM_PTL_RDMA;
350350
return OSHMEM_SUCCESS;
351351
}
352352

353353
static void destroy_ptl_idx(int dst_pe)
354354
{
355-
oshmem_proc_t *proc;
355+
ompi_proc_t *proc;
356356

357357
proc = oshmem_proc_group_find(oshmem_group_all, dst_pe);
358-
if (proc->transport_ids)
359-
free(proc->transport_ids);
358+
if (NULL != OSHMEM_PROC_DATA(proc)->transport_ids)
359+
free(OSHMEM_PROC_DATA(proc)->transport_ids);
360360
}
361361

362362
static void mxm_peer_construct(mxm_peer_t *p)
@@ -376,7 +376,7 @@ OBJ_CLASS_INSTANCE( mxm_peer_t,
376376
mxm_peer_construct,
377377
mxm_peer_destruct);
378378

379-
int mca_spml_ikrit_del_procs(oshmem_proc_t** procs, size_t nprocs)
379+
int mca_spml_ikrit_del_procs(ompi_proc_t** procs, size_t nprocs)
380380
{
381381
size_t i, n;
382382
int my_rank = oshmem_my_proc_id();
@@ -407,7 +407,7 @@ int mca_spml_ikrit_del_procs(oshmem_proc_t** procs, size_t nprocs)
407407
return OSHMEM_SUCCESS;
408408
}
409409

410-
int mca_spml_ikrit_add_procs(oshmem_proc_t** procs, size_t nprocs)
410+
int mca_spml_ikrit_add_procs(ompi_proc_t** procs, size_t nprocs)
411411
{
412412
spml_ikrit_mxm_ep_conn_info_t *ep_info = NULL;
413413
spml_ikrit_mxm_ep_conn_info_t *ep_hw_rdma_info = NULL;
@@ -421,7 +421,7 @@ int mca_spml_ikrit_add_procs(oshmem_proc_t** procs, size_t nprocs)
421421
mxm_error_t err;
422422
size_t i, n;
423423
int rc = OSHMEM_ERROR;
424-
oshmem_proc_t *proc_self;
424+
ompi_proc_t *proc_self;
425425
int my_rank = oshmem_my_proc_id();
426426

427427
OBJ_CONSTRUCT(&mca_spml_ikrit.active_peers, opal_list_t);
@@ -589,9 +589,9 @@ int mca_spml_ikrit_add_procs(oshmem_proc_t** procs, size_t nprocs)
589589
continue;
590590

591591
/* use zcopy for put/get via sysv shared memory */
592-
procs[i]->transport_ids[0] = MXM_PTL_SHM;
593-
procs[i]->transport_ids[1] = MXM_PTL_RDMA;
594-
procs[i]->num_transports = 2;
592+
OSHMEM_PROC_DATA(procs[i])->transport_ids[0] = MXM_PTL_SHM;
593+
OSHMEM_PROC_DATA(procs[i])->transport_ids[1] = MXM_PTL_RDMA;
594+
OSHMEM_PROC_DATA(procs[i])->num_transports = 2;
595595
}
596596

597597
SPML_VERBOSE(50, "*** ADDED PROCS ***");
@@ -743,7 +743,7 @@ int mca_spml_ikrit_deregister(sshmem_mkey_t *mkeys)
743743

744744
static inline int get_ptl_id(int dst)
745745
{
746-
oshmem_proc_t *proc;
746+
ompi_proc_t *proc;
747747

748748
/* get endpoint and btl */
749749
proc = oshmem_proc_group_all(dst);
@@ -752,7 +752,7 @@ static inline int get_ptl_id(int dst)
752752
oshmem_shmem_abort(-1);
753753
return -1;
754754
}
755-
return proc->transport_ids[0];
755+
return OSHMEM_PROC_DATA(proc)->transport_ids[0];
756756
}
757757

758758
int mca_spml_ikrit_oob_get_mkeys(int pe, uint32_t seg, sshmem_mkey_t *mkeys)

oshmem/mca/spml/ikrit/spml_ikrit.h

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44
* All rights reserved.
55
* Copyright (c) 2015 Los Alamos National Security, LLC. All rights
66
* reserved.
7+
* Copyright (c) 2016 Research Organization for Information Science
8+
* and Technology (RIST). All rights reserved.
79
* $COPYRIGHT$
810
*
911
* Additional copyrights may follow
@@ -166,8 +168,8 @@ extern int mca_spml_ikrit_oob_get_mkeys(int pe,
166168
uint32_t seg,
167169
sshmem_mkey_t *mkeys);
168170

169-
extern int mca_spml_ikrit_add_procs(oshmem_proc_t** procs, size_t nprocs);
170-
extern int mca_spml_ikrit_del_procs(oshmem_proc_t** procs, size_t nprocs);
171+
extern int mca_spml_ikrit_add_procs(ompi_proc_t** procs, size_t nprocs);
172+
extern int mca_spml_ikrit_del_procs(ompi_proc_t** procs, size_t nprocs);
171173
extern int mca_spml_ikrit_fence(void);
172174
extern int spml_ikrit_progress(void);
173175

0 commit comments

Comments
 (0)