Skip to content

Commit

Permalink
mmap: patch shmem_ptr enablement w/ mmap transport
Browse files Browse the repository at this point in the history
  • Loading branch information
davidozog committed Jun 4, 2024
1 parent e8165f9 commit 974c41f
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
2 changes: 2 additions & 0 deletions src/shmem_remote_pointer.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ shmem_internal_ptr(const void *target, int pe)
if (-1 != (node_rank = shmem_internal_get_shr_rank(pe))) {
#if USE_XPMEM
return shmem_transport_xpmem_ptr(target, pe, node_rank);
#elif USE_MMAP
return shmem_transport_mmap_ptr(target, pe, node_rank);
#else
return NULL;
#endif
Expand Down
14 changes: 7 additions & 7 deletions src/transport_mmap.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,29 +29,29 @@ struct shmem_transport_mmap_peer_info_t {
extern struct shmem_transport_mmap_peer_info_t *shmem_transport_mmap_peers;

#ifdef ENABLE_ERROR_CHECKING
#define MMAP_GET_REMOTE_ACCESS(target, rank, ptr) \
#define MMAP_GET_REMOTE_ACCESS(target, rank, ptr) \
do { \
if (((void*) target > shmem_internal_data_base) && \
((char*) target < (char*) shmem_internal_data_base + shmem_internal_data_length)) { \
ptr = (char*) target - (char*) shmem_internal_data_base + \
(char*) shmem_transport_mmap_peers[rank].data_ptr; \
} else if (((void*) target > shmem_internal_heap_base) && \
(char*) shmem_transport_mmap_peers[rank].data_ptr; \
} else if (((void*) target >= shmem_internal_heap_base) && \
((char*) target < (char*) shmem_internal_heap_base + shmem_internal_heap_length)) { \
ptr = (char*) target - (char*) shmem_internal_heap_base + \
(char*) shmem_transport_mmap_peers[rank].heap_ptr; \
(char*) shmem_transport_mmap_peers[rank].heap_ptr; \
} else { \
ptr = NULL; \
} \
} while (0)
#else
#define MMAP_GET_REMOTE_ACCESS(target, rank, ptr) \
#define MMAP_GET_REMOTE_ACCESS(target, rank, ptr) \
do { \
if ((void*) target < shmem_internal_heap_base) { \
ptr = (char*) target - (char*) shmem_internal_data_base + \
(char*) shmem_transport_mmap_peers[rank].data_ptr; \
(char*) shmem_transport_mmap_peers[rank].data_ptr; \
} else { \
ptr = (char*) target - (char*) shmem_internal_heap_base + \
(char*) shmem_transport_mmap_peers[rank].heap_ptr; \
(char*) shmem_transport_mmap_peers[rank].heap_ptr; \
} \
} while (0)
#endif
Expand Down

0 comments on commit 974c41f

Please sign in to comment.