From e5929aeb8ea2ea528994fc090179aa8b250c64e0 Mon Sep 17 00:00:00 2001 From: Rob Awles Date: Mon, 22 Dec 2003 20:46:53 +0000 Subject: [PATCH] Started porting ctnetwork classes. This commit was SVN r12. --- src/lam/ctnetwork/ctmessage.c | 11 ++++ src/lam/ctnetwork/ctmessage.h | 17 ++++++ src/lam/ctnetwork/ctnode.c | 11 ++++ src/lam/ctnetwork/ctnode.h | 107 ++++++++++++++++++++++++++++++++++ src/lam/ctnetwork/ctpeer.c | 11 ++++ src/lam/ctnetwork/ctpeer.h | 17 ++++++ 6 files changed, 174 insertions(+) create mode 100644 src/lam/ctnetwork/ctmessage.c create mode 100644 src/lam/ctnetwork/ctmessage.h create mode 100644 src/lam/ctnetwork/ctnode.c create mode 100644 src/lam/ctnetwork/ctnode.h create mode 100644 src/lam/ctnetwork/ctpeer.c create mode 100644 src/lam/ctnetwork/ctpeer.h diff --git a/src/lam/ctnetwork/ctmessage.c b/src/lam/ctnetwork/ctmessage.c new file mode 100644 index 0000000000..2e21ac4715 --- /dev/null +++ b/src/lam/ctnetwork/ctmessage.c @@ -0,0 +1,11 @@ +/* + * ctmessage.c + * LAM-MPI + * + * Created by Rob Aulwes on Sun Dec 21 2003. + * Copyright (c) 2003 __MyCompanyName__. All rights reserved. + * + */ + +#include "ctmessage.h" + diff --git a/src/lam/ctnetwork/ctmessage.h b/src/lam/ctnetwork/ctmessage.h new file mode 100644 index 0000000000..70cfd5b05e --- /dev/null +++ b/src/lam/ctnetwork/ctmessage.h @@ -0,0 +1,17 @@ +/* + * ctmessage.h + * LAM-MPI + * + * Created by Rob Aulwes on Sun Dec 21 2003. + * Copyright (c) 2003 __MyCompanyName__. All rights reserved. + * + */ + +#ifndef CT_MESSAGE_H +#define CT_MESSAGE_H + +#include "lam/lfc/object.h" + +#endif /* CT_MESSAGE_H */ + + diff --git a/src/lam/ctnetwork/ctnode.c b/src/lam/ctnetwork/ctnode.c new file mode 100644 index 0000000000..4fe268cd6a --- /dev/null +++ b/src/lam/ctnetwork/ctnode.c @@ -0,0 +1,11 @@ +/* + * ctnode.c + * LAM-MPI + * + * Created by Rob Aulwes on Sun Dec 21 2003. + * Copyright (c) 2003 __MyCompanyName__. All rights reserved. + * + */ + +#include "ctnode.h" + diff --git a/src/lam/ctnetwork/ctnode.h b/src/lam/ctnetwork/ctnode.h new file mode 100644 index 0000000000..7c8e909d82 --- /dev/null +++ b/src/lam/ctnetwork/ctnode.h @@ -0,0 +1,107 @@ +/* + * ctnode.h + * LAM-MPI + * + * Created by Rob Aulwes on Sun Dec 21 2003. + * Copyright (c) 2003 __MyCompanyName__. All rights reserved. + * + */ + +#ifndef CT_NODE_H +#define CT_NODE_H + +#include "lam/lfc/object.h" +#include "lam/lfc/hash_table.h" + +/* + * + * Abstract topology node interface + * every concrete topology should derive from this class. + * + */ + +typedef struct lam_ctnode +{ + lam_object_t super; + uint32_t ctn_label; + uint32_t ctn_num_nodes; /* total # of nodes in network */ + void *ctn_user_info; + lam_fast_hash_t ctn_neighbors; + lam_fast_hash_t ctn_scatter_cache; + lam_fast_hash_t ctn_bcast_cache; +} lam_ctnode_t; + +extern lam_class_info_t ctnode_cls; + +/* + * + * Functions for managing neighbors + * + */ + +void *lam_ctn_get_neighbor(lam_ctnode_t *node, uint32_t neighbor_label); +/* + PRE: neighbor_label is the label of the node's neighbor + POST: returns a pointer to the node's neighbor + */ + +void lam_ctn_set_neighbor(lam_ctnode_t *node, uint32_t label, void *neighbor); +/* + PRE: label represents the label for a valid neighbor. + POST: Adds a link to a neighbor with specified label. + */ + + +/* + * + * Accessor functions + * + */ + +INLINE uint32_t lam_ctn_get_label(lam_ctnode_t *node) {return node->ctn_label;} +INLINE void lam_ctn_set_label(lam_ctnode_t *node, uint32_t label) + {node->ctn_label = label;} + +INLINE uint32_t lam_ctn_get_num_nodes(lam_ctnode_t *node) {return node->ctn_num_nodes;} + + +/* + * + * "Pure virtual" functions that must be implemented + * by the concrete subclass. + * + */ + +uint32_t lam_ctn_label_for_link(lam_ctnode_t *node, uint32_t link); +/* + PRE: The graph edges connecting node to its neighbors are oriented + so that the links (edges) are numbered starting from 1. + POST: Returns the label of neighbor connected to node via given link. + */ + + +char *lam_ctn_initial_control_data(lam_ctnode_t *node, uint32_t *ctrl_size); +/* + POST: Returns pointer to byte array for control data for routing + messages. The length of the control array is stored in + ctrl_size. + */ + + + +/* + * + * Hypercube interface + * + */ + +typedef struct lam_hcube +{ + lam_ctnode_t super; + unsigned int hc_hsize; /* hc_hsize = log2(# nodes in network) */ +} lam_hcube_t; + +extern lam_class_info_t hcube_cls; + +#endif /* CT_NODE_H */ + diff --git a/src/lam/ctnetwork/ctpeer.c b/src/lam/ctnetwork/ctpeer.c new file mode 100644 index 0000000000..7b83521fb4 --- /dev/null +++ b/src/lam/ctnetwork/ctpeer.c @@ -0,0 +1,11 @@ +/* + * ctpeer.c + * LAM-MPI + * + * Created by Rob Aulwes on Sun Dec 21 2003. + * Copyright (c) 2003 __MyCompanyName__. All rights reserved. + * + */ + +#include "ctpeer.h" + diff --git a/src/lam/ctnetwork/ctpeer.h b/src/lam/ctnetwork/ctpeer.h new file mode 100644 index 0000000000..2fc00f7cb1 --- /dev/null +++ b/src/lam/ctnetwork/ctpeer.h @@ -0,0 +1,17 @@ +/* + * ctpeer.h + * LAM-MPI + * + * Created by Rob Aulwes on Sun Dec 21 2003. + * Copyright (c) 2003 __MyCompanyName__. All rights reserved. + * + */ + +#ifndef CT_PEER_H +#define CT_PEER_H + +#include "lam/lfc/object.h" + +#endif /* CT_PEER_H */ + +