2004-06-03 22:13:01 +00:00
|
|
|
/*
|
|
|
|
* $HEADER$
|
|
|
|
*/
|
|
|
|
/**
|
|
|
|
* @file
|
|
|
|
*/
|
|
|
|
#ifndef MCA_PTL_SM_H
|
|
|
|
#define MCA_PTL_SM_H
|
|
|
|
|
|
|
|
#include <stdlib.h>
|
|
|
|
#include <sys/types.h>
|
|
|
|
#include <sys/socket.h>
|
|
|
|
#include <netinet/in.h>
|
2004-06-15 19:07:45 +00:00
|
|
|
#include "class/ompi_free_list.h"
|
2004-06-03 22:13:01 +00:00
|
|
|
#include "mca/pml/pml.h"
|
|
|
|
#include "mca/ptl/ptl.h"
|
2004-06-17 20:57:47 +00:00
|
|
|
#include "mca/mpool/mpool.h"
|
2004-08-06 19:35:57 +00:00
|
|
|
#include "mca/common/sm/common_sm_mmap.h"
|
2004-08-05 21:59:24 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Shared Memory resource managment
|
|
|
|
*/
|
|
|
|
struct mca_ptl_sm_module_resource_t {
|
2004-08-18 15:02:21 +00:00
|
|
|
mca_common_sm_file_header_t segment_header;
|
2004-08-05 21:59:24 +00:00
|
|
|
};
|
|
|
|
typedef struct mca_ptl_sm_module_resource_t mca_ptl_sm_module_resource_t;
|
|
|
|
extern mca_ptl_sm_module_resource_t mca_ptl_sm_module_resource;
|
2004-06-03 22:13:01 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Shared Memory (SM) PTL module.
|
|
|
|
*/
|
2004-08-02 00:24:22 +00:00
|
|
|
struct mca_ptl_sm_component_t {
|
|
|
|
mca_ptl_base_component_1_0_0_t super; /**< base PTL component */
|
2004-06-17 20:57:47 +00:00
|
|
|
int sm_free_list_num; /**< initial size of free lists */
|
|
|
|
int sm_free_list_max; /**< maximum size of free lists */
|
|
|
|
int sm_free_list_inc; /**< number of elements to alloc when growing free lists */
|
|
|
|
int sm_max_procs; /**< upper limit on the number of processes using the shared memory pool */
|
|
|
|
char* sm_mpool_name; /**< name of shared memory pool module */
|
2004-08-04 17:23:34 +00:00
|
|
|
mca_mpool_base_module_t* sm_mpool; /**< shared memory pool */
|
2004-06-17 20:57:47 +00:00
|
|
|
void* sm_mpool_base; /**< base address of shared memory pool */
|
2004-08-11 16:06:14 +00:00
|
|
|
ompi_free_list_t sm_send_requests; /**< free list of sm send requests -- sendreq + sendfrag */
|
|
|
|
ompi_free_list_t sm_send_frags; /**< free list of sm send fragments */
|
|
|
|
ompi_free_list_t sm_recv_frags; /**< free list of sm recv fragments */
|
|
|
|
ompi_mutex_t sm_lock;
|
2004-08-06 23:19:25 +00:00
|
|
|
char* sm_resouce_ctl_file; /**< name of shared memory file used
|
|
|
|
to coordinate resource usage */
|
2004-08-18 15:02:21 +00:00
|
|
|
mca_common_sm_mmap_t *mmap_file; /**< description of mmap'ed
|
|
|
|
file */
|
2004-06-03 22:13:01 +00:00
|
|
|
};
|
2004-08-02 00:24:22 +00:00
|
|
|
typedef struct mca_ptl_sm_component_t mca_ptl_sm_component_t;
|
|
|
|
extern mca_ptl_sm_component_t mca_ptl_sm_component;
|
2004-06-03 22:13:01 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Register shared memory module parameters with the MCA framework
|
|
|
|
*/
|
2004-08-02 00:24:22 +00:00
|
|
|
extern int mca_ptl_sm_component_open(void);
|
2004-06-03 22:13:01 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Any final cleanup before being unloaded.
|
|
|
|
*/
|
2004-08-02 00:24:22 +00:00
|
|
|
extern int mca_ptl_sm_component_close(void);
|
2004-06-03 22:13:01 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* SM module initialization.
|
|
|
|
*
|
|
|
|
* @param num_ptls (OUT) Number of PTLs returned in PTL array.
|
|
|
|
* @param allow_multi_user_threads (OUT) Flag indicating wether PTL supports user threads (TRUE)
|
|
|
|
* @param have_hidden_threads (OUT) Flag indicating wether PTL uses threads (TRUE)
|
|
|
|
*
|
|
|
|
*/
|
2004-08-02 00:24:22 +00:00
|
|
|
extern mca_ptl_base_module_t** mca_ptl_sm_component_init(
|
2004-06-03 22:13:01 +00:00
|
|
|
int *num_ptls,
|
|
|
|
bool *allow_multi_user_threads,
|
|
|
|
bool *have_hidden_threads
|
|
|
|
);
|
|
|
|
|
|
|
|
/**
|
2004-08-02 00:24:22 +00:00
|
|
|
* shared memory component control.
|
2004-06-03 22:13:01 +00:00
|
|
|
*/
|
2004-08-02 00:24:22 +00:00
|
|
|
extern int mca_ptl_sm_component_control(
|
2004-06-03 22:13:01 +00:00
|
|
|
int param,
|
|
|
|
void* value,
|
|
|
|
size_t size
|
|
|
|
);
|
|
|
|
|
|
|
|
/**
|
2004-08-02 00:24:22 +00:00
|
|
|
* shared memory component progress.
|
2004-06-03 22:13:01 +00:00
|
|
|
*/
|
2004-08-02 00:24:22 +00:00
|
|
|
extern int mca_ptl_sm_component_progress(
|
2004-06-03 22:13:01 +00:00
|
|
|
mca_ptl_tstamp_t tstamp
|
|
|
|
);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* SM PTL Interface
|
|
|
|
*/
|
|
|
|
struct mca_ptl_sm_t {
|
2004-08-02 00:24:22 +00:00
|
|
|
mca_ptl_base_module_t super; /**< base PTL interface */
|
2004-07-15 18:42:02 +00:00
|
|
|
int num_smp_procs; /**< current number of smp procs on this
|
|
|
|
host */
|
|
|
|
int my_smp_rank; /**< My SMP process rank. Used for accessing
|
|
|
|
* SMP specfic data structures. */
|
2004-06-03 22:13:01 +00:00
|
|
|
};
|
|
|
|
typedef struct mca_ptl_sm_t mca_ptl_sm_t;
|
|
|
|
|
|
|
|
extern mca_ptl_sm_t mca_ptl_sm;
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Cleanup any resources held by the PTL.
|
|
|
|
*
|
|
|
|
* @param ptl PTL instance.
|
2004-06-07 15:33:53 +00:00
|
|
|
* @return OMPI_SUCCESS or error status on failure.
|
2004-06-03 22:13:01 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
extern int mca_ptl_sm_finalize(
|
2004-08-02 00:24:22 +00:00
|
|
|
struct mca_ptl_base_module_t* ptl
|
2004-06-03 22:13:01 +00:00
|
|
|
);
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* PML->PTL notification of change in the process list.
|
|
|
|
*
|
|
|
|
* @param ptl (IN)
|
|
|
|
* @param proc (IN)
|
|
|
|
* @param peer (OUT)
|
2004-06-07 15:33:53 +00:00
|
|
|
* @return OMPI_SUCCESS or error status on failure.
|
2004-06-03 22:13:01 +00:00
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
extern int mca_ptl_sm_add_procs(
|
2004-08-02 00:24:22 +00:00
|
|
|
struct mca_ptl_base_module_t* ptl,
|
2004-06-03 22:13:01 +00:00
|
|
|
size_t nprocs,
|
2004-06-07 15:33:53 +00:00
|
|
|
struct ompi_proc_t **procs,
|
2004-06-03 22:13:01 +00:00
|
|
|
struct mca_ptl_base_peer_t** peers,
|
2004-06-07 15:33:53 +00:00
|
|
|
ompi_bitmap_t* reachability
|
2004-06-03 22:13:01 +00:00
|
|
|
);
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* PML->PTL notification of change in the process list.
|
|
|
|
*
|
|
|
|
* @param ptl (IN) PTL instance
|
|
|
|
* @param proc (IN) Peer process
|
|
|
|
* @param peer (IN) Peer addressing information.
|
|
|
|
* @return Status indicating if cleanup was successful
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
extern int mca_ptl_sm_del_procs(
|
2004-08-02 00:24:22 +00:00
|
|
|
struct mca_ptl_base_module_t* ptl,
|
2004-06-03 22:13:01 +00:00
|
|
|
size_t nprocs,
|
2004-06-07 15:33:53 +00:00
|
|
|
struct ompi_proc_t **procs,
|
2004-06-03 22:13:01 +00:00
|
|
|
struct mca_ptl_base_peer_t **peers
|
|
|
|
);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* PML->PTL Allocate a send request from the PTL modules free list.
|
|
|
|
*
|
|
|
|
* @param ptl (IN) PTL instance
|
|
|
|
* @param request (OUT) Pointer to allocated request.
|
|
|
|
* @return Status indicating if allocation was successful.
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
extern int mca_ptl_sm_request_alloc(
|
2004-08-02 00:24:22 +00:00
|
|
|
struct mca_ptl_base_module_t* ptl,
|
2004-06-24 19:28:30 +00:00
|
|
|
struct mca_pml_base_send_request_t**
|
2004-06-03 22:13:01 +00:00
|
|
|
);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* PML->PTL Return a send request to the PTL modules free list.
|
|
|
|
*
|
|
|
|
* @param ptl (IN) PTL instance
|
|
|
|
* @param request (IN) Pointer to allocated request.
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
extern void mca_ptl_sm_request_return(
|
2004-08-02 00:24:22 +00:00
|
|
|
struct mca_ptl_base_module_t* ptl,
|
2004-06-24 19:28:30 +00:00
|
|
|
struct mca_pml_base_send_request_t*
|
2004-06-03 22:13:01 +00:00
|
|
|
);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* PML->PTL Notification that a receive fragment has been matched.
|
|
|
|
*
|
|
|
|
* @param ptl (IN) PTL instance
|
|
|
|
* @param recv_frag (IN) Receive fragment
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
extern void mca_ptl_sm_matched(
|
2004-08-02 00:24:22 +00:00
|
|
|
struct mca_ptl_base_module_t* ptl,
|
2004-06-03 22:13:01 +00:00
|
|
|
struct mca_ptl_base_recv_frag_t* frag
|
|
|
|
);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* PML->PTL Initiate a send of the specified size.
|
|
|
|
*
|
|
|
|
* @param ptl (IN) PTL instance
|
|
|
|
* @param ptl_base_peer (IN) PTL peer addressing
|
|
|
|
* @param send_request (IN/OUT) Send request (allocated by PML via mca_ptl_base_request_alloc_fn_t)
|
|
|
|
* @param size (IN) Number of bytes PML is requesting PTL to deliver
|
|
|
|
* @param flags (IN) Flags that should be passed to the peer via the message header.
|
2004-06-07 15:33:53 +00:00
|
|
|
* @param request (OUT) OMPI_SUCCESS if the PTL was able to queue one or more fragments
|
2004-06-03 22:13:01 +00:00
|
|
|
*/
|
|
|
|
extern int mca_ptl_sm_send(
|
2004-08-02 00:24:22 +00:00
|
|
|
struct mca_ptl_base_module_t* ptl,
|
2004-06-03 22:13:01 +00:00
|
|
|
struct mca_ptl_base_peer_t* ptl_peer,
|
2004-06-24 19:28:30 +00:00
|
|
|
struct mca_pml_base_send_request_t*,
|
2004-06-03 22:13:01 +00:00
|
|
|
size_t offset,
|
2004-06-24 19:28:30 +00:00
|
|
|
size_t size,
|
2004-06-03 22:13:01 +00:00
|
|
|
int flags
|
|
|
|
);
|
|
|
|
|
2004-06-11 20:42:01 +00:00
|
|
|
/**
|
|
|
|
* Data structure used to hold information that will be exchanged with
|
|
|
|
* all other procs at startup. !!!!! This is only temporary, until the
|
|
|
|
* registry is complete
|
|
|
|
*/
|
|
|
|
#define MCA_PTL_SM_MAX_HOSTNAME_LEN 128
|
|
|
|
typedef struct mca_ptl_sm_exchange{
|
|
|
|
char host_name[MCA_PTL_SM_MAX_HOSTNAME_LEN];
|
|
|
|
}mca_ptl_sm_exchange_t;
|
|
|
|
|
2004-06-03 22:13:01 +00:00
|
|
|
#endif
|
|
|
|
|