add uniqueID initialization (#69)
add the interfaces required to support rocshmem initialization
through the uniqueID mechanism. At the moment this still maps to
MPI initialization underneath the hood, but adding the functions might
simplify the porting of some applications to rocshmem. In addition, if
we need to transition away from MPI one day, this is also one step into
this direction.
[ROCm/rocshmem commit: e9f6227d75]
This commit is contained in:
@@ -71,10 +71,50 @@ __host__ void rocshmem_init(MPI_Comm comm = MPI_COMM_WORLD);
|
||||
* to requested thread mode.
|
||||
* @param[in] comm (Optional) MPI Communicator that rocSHMEM will be using
|
||||
* If MPI_COMM_NULL, rocSHMEM will be using MPI_COMM_WORLD
|
||||
*
|
||||
* @return int returns 0 upon success; otherwise, it returns a nonzero
|
||||
* value
|
||||
*/
|
||||
__host__ void rocshmem_init_thread(int requested, int *provided,
|
||||
MPI_Comm comm = MPI_COMM_WORLD);
|
||||
__host__ int rocshmem_init_thread(int requested, int *provided,
|
||||
MPI_Comm comm = MPI_COMM_WORLD);
|
||||
|
||||
/**
|
||||
* @brief Initialize the rocSHMEM runtime and underlying transport layer
|
||||
* using the provided mode and attributes
|
||||
*
|
||||
* @param[in] flags initialization method to be used.
|
||||
* Valid values are ROCSHMEM_INIT_WITH_UNIQUEID and
|
||||
* ROCSHMEM_INIT_WITH_MPI_COMM
|
||||
* @param[in] attr attribute structure specifying input characteristics
|
||||
*
|
||||
* @return int returns 0 upon success; otherwise, it returns a nonzero
|
||||
* value
|
||||
*/
|
||||
__host__ int rocshmem_init_attr(unsigned int flags, rocshmem_init_attr_t *attr);
|
||||
|
||||
/**
|
||||
* @brief Return a uniqueID
|
||||
*
|
||||
* @return int returns 0 upon success; otherwise, it returns a nonzero
|
||||
* value
|
||||
*/
|
||||
__host__ int rocshmem_get_uniqueid(rocshmem_uniqueid_t *uid);
|
||||
|
||||
/**
|
||||
* @brief Query the thread mode used by the runtime.
|
||||
*
|
||||
* @param[in] rank rank of the calling process
|
||||
* @param[in] nranks number of pes
|
||||
* @param[in] uid unique ID used to identify the group processes.
|
||||
* All processes that
|
||||
* @param[out] attr attribute structure to be passed to rocshmem_init_attr
|
||||
*
|
||||
* @return int returns 0 upon success; otherwise, it returns a nonzero
|
||||
* value
|
||||
*/
|
||||
__host__ int rocshmem_set_attr_uniqueid_args(int rank, int nranks,
|
||||
rocshmem_uniqueid_t *uid,
|
||||
rocshmem_init_attr_t *attr);
|
||||
/**
|
||||
* @brief Query the thread mode used by the runtime.
|
||||
*
|
||||
|
||||
@@ -125,6 +125,32 @@ extern rocshmem_team_t ROCSHMEM_TEAM_WORLD;
|
||||
|
||||
const rocshmem_team_t ROCSHMEM_TEAM_INVALID = nullptr;
|
||||
|
||||
/**
|
||||
* @brief Data structure defining the unqiueId
|
||||
*/
|
||||
constexpr int ROCSHMEM_HOSTNAME_LEN = 20;
|
||||
struct rocshmem_uniqueid_t {
|
||||
uint64_t random;
|
||||
char hostname[ROCSHMEM_HOSTNAME_LEN];
|
||||
uint32_t pid;
|
||||
};
|
||||
typedef struct rocshmem_uniqueid_t rocshmem_unique_id_t;
|
||||
|
||||
/**
|
||||
* @brief Data structure used for attribute based
|
||||
* initialization
|
||||
*/
|
||||
struct rocshmem_init_attr_t {
|
||||
int32_t rank;
|
||||
int32_t nranks;
|
||||
rocshmem_uniqueid_t uid;
|
||||
void* mpi_comm;
|
||||
};
|
||||
typedef struct rocshmem_init_attr_t rocshmem_init_attr_t;
|
||||
|
||||
constexpr unsigned int ROCSHMEM_INIT_WITH_MPI_COMM = 0;
|
||||
constexpr unsigned int ROCSHMEM_INIT_WITH_UNIQUEID = 1;
|
||||
|
||||
} // namespace rocshmem
|
||||
|
||||
#endif // LIBRARY_INCLUDE_ROCSHMEM_COMMON_HPP
|
||||
|
||||
Reference in New Issue
Block a user