diff --git a/src/lam/ctnetwork/ctchannel.c b/src/lam/ctnetwork/ctchannel.c new file mode 100644 index 0000000000..8f6dc5f88a --- /dev/null +++ b/src/lam/ctnetwork/ctchannel.c @@ -0,0 +1,11 @@ +/* + * ctchannel.c + * LAM-MPI + * + * Created by Rob Aulwes on Tue Dec 23 2003. + * Copyright (c) 2003 __MyCompanyName__. All rights reserved. + * + */ + +#include "ctchannel.h" + diff --git a/src/lam/ctnetwork/ctchannel.h b/src/lam/ctnetwork/ctchannel.h new file mode 100644 index 0000000000..2c83a33f00 --- /dev/null +++ b/src/lam/ctnetwork/ctchannel.h @@ -0,0 +1,71 @@ +/* + * ctchannel.h + * LAM-MPI + * + * Created by Rob Aulwes on Tue Dec 23 2003. + * Copyright (c) 2003 __MyCompanyName__. All rights reserved. + * + */ + +#ifndef CT_CHANNEL_H +#define CT_CHANNEL_H + +#include "lam/base/object.h" +#include "runtime/ctnetwork/ctmessage.h" + + +/* + * Channel error codes + */ + +typedef enum +{ + CT_CHNL_OK = 0, + CT_CHNL_ERROR, /* general channel error. */ + CT_CHNL_MALLOC, /* unable to alloc mem. */ + CT_CHNL_CLOSED, /* channel is not open */ + CT_CHNL_CONN_LOST, /* lost connection */ + CT_CHNL_INVALID_MSG, /* unable to pack/unpack msg or msg is NULL */ + CT_CHNL_TIMED_OUT /* channel operation timed out. */ +} lam_ctchnl_status_t; + + +/* + * + * Abstract communication channel class + * The controllers and clients use these objects to + * communicate in the network. + */ + +#define CTCHANNEL(obj) (lam_ctchannel_t *)(obj) + +struct lam_ctchannel; + +typedef struct lam_ctchannel_class +{ + lam_class_info_t super; + /* return: error code args: (channel, data, data length, bytes sent) */ + uint32_t cth_send(struct lam_ctchannel *, const uint8_t *, uint32_t, uint32_t *); + + /* return: error code args: (channel, recv buffer, buffer length, bytes received) */ + uint32_t cth_recv(struct lam_ctchannel *, const uint8_t *, uint32_t, uint32_t *); + + /* return: error code args: (channel, msg ptr) */ + uint32_t cth_get_msg(struct lam_ctchannel *, lam_ctmsg_t **msg); + + /* return: error code args: (channel, recv buffer ptr, bytes received) */ + uint32_t cth_get_packed_msg(struct lam_ctchannel *, const uint8_t **, uint32_t *); + + /* return: error code args: (channel, msg) */ + uint32_t cth_send_msg(struct lam_ctchannel *, lam_ctmsg_t *msg); + + /* return: error code args: (channel, msg ptr, msg len) */ + uint32_t cth_send_packed_msg(struct lam_ctchannel *, const uint8_t *, uint32_t); + +} lam_ctchannel_class_t; + + + +#endif /* CT_CHANNEL_H */ + + diff --git a/src/lam/ctnetwork/ctcontroller.c b/src/lam/ctnetwork/ctcontroller.c new file mode 100644 index 0000000000..6f1d3b343f --- /dev/null +++ b/src/lam/ctnetwork/ctcontroller.c @@ -0,0 +1,32 @@ +/* + * Copyright 2002-2003. The Regents of the University of California. This material + * was produced under U.S. Government contract W-7405-ENG-36 for Los Alamos + * National Laboratory, which is operated by the University of California for + * the U.S. Department of Energy. The Government is granted for itself and + * others acting on its behalf a paid-up, nonexclusive, irrevocable worldwide + * license in this material to reproduce, prepare derivative works, and + * perform publicly and display publicly. Beginning five (5) years after + * October 10,2002 subject to additional five-year worldwide renewals, the + * Government is granted for itself and others acting on its behalf a paid-up, + * nonexclusive, irrevocable worldwide license in this material to reproduce, + * prepare derivative works, distribute copies to the public, perform publicly + * and display publicly, and to permit others to do so. NEITHER THE UNITED + * STATES NOR THE UNITED STATES DEPARTMENT OF ENERGY, NOR THE UNIVERSITY OF + * CALIFORNIA, NOR ANY OF THEIR EMPLOYEES, MAKES ANY WARRANTY, EXPRESS OR + * IMPLIED, OR ASSUMES ANY LEGAL LIABILITY OR RESPONSIBILITY FOR THE ACCURACY, + * COMPLETENESS, OR USEFULNESS OF ANY INFORMATION, APPARATUS, PRODUCT, OR + * PROCESS DISCLOSED, OR REPRESENTS THAT ITS USE WOULD NOT INFRINGE PRIVATELY + * OWNED RIGHTS. + + * Additionally, this program is free software; you can distribute it and/or + * modify it under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation; either version 2 of the License, + * or any later version. Accordingly, this program is distributed in the hope + * that it will be useful, but WITHOUT ANY WARRANTY; without even the implied + * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + */ +/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/ + +#include "ctpeer.h" + diff --git a/src/lam/ctnetwork/ctcontroller.h b/src/lam/ctnetwork/ctcontroller.h new file mode 100644 index 0000000000..bdf3ff8184 --- /dev/null +++ b/src/lam/ctnetwork/ctcontroller.h @@ -0,0 +1,48 @@ +/* + * Copyright 2002-2003. The Regents of the University of California. This material + * was produced under U.S. Government contract W-7405-ENG-36 for Los Alamos + * National Laboratory, which is operated by the University of California for + * the U.S. Department of Energy. The Government is granted for itself and + * others acting on its behalf a paid-up, nonexclusive, irrevocable worldwide + * license in this material to reproduce, prepare derivative works, and + * perform publicly and display publicly. Beginning five (5) years after + * October 10,2002 subject to additional five-year worldwide renewals, the + * Government is granted for itself and others acting on its behalf a paid-up, + * nonexclusive, irrevocable worldwide license in this material to reproduce, + * prepare derivative works, distribute copies to the public, perform publicly + * and display publicly, and to permit others to do so. NEITHER THE UNITED + * STATES NOR THE UNITED STATES DEPARTMENT OF ENERGY, NOR THE UNIVERSITY OF + * CALIFORNIA, NOR ANY OF THEIR EMPLOYEES, MAKES ANY WARRANTY, EXPRESS OR + * IMPLIED, OR ASSUMES ANY LEGAL LIABILITY OR RESPONSIBILITY FOR THE ACCURACY, + * COMPLETENESS, OR USEFULNESS OF ANY INFORMATION, APPARATUS, PRODUCT, OR + * PROCESS DISCLOSED, OR REPRESENTS THAT ITS USE WOULD NOT INFRINGE PRIVATELY + * OWNED RIGHTS. + + * Additionally, this program is free software; you can distribute it and/or + * modify it under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation; either version 2 of the License, + * or any later version. Accordingly, this program is distributed in the hope + * that it will be useful, but WITHOUT ANY WARRANTY; without even the implied + * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + */ +/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/ + +#ifndef CT_CONTROLLER_H +#define CT_CONTROLLER_H + +#include "lam/base/object.h" +#include "runtime/ctnetwork/ctnode.h" + +typedef struct lam_ctcontroller +{ + lam_object_t super; + lam_ctnode_t ctl_node; +} lam_ctctrl_t; + +void lam_ctl_init(lam_ctctrl_t *ctrl); +void lam_ctl_destroy(lam_ctctrl_t *ctrl); + +#endif /* CT_CONTROLLER_H */ + + diff --git a/src/lam/ctnetwork/ctmessage.c b/src/lam/ctnetwork/ctmessage.c index 2e21ac4715..425ff7a7c1 100644 --- a/src/lam/ctnetwork/ctmessage.c +++ b/src/lam/ctnetwork/ctmessage.c @@ -1,11 +1,32 @@ /* - * ctmessage.c - * LAM-MPI - * - * Created by Rob Aulwes on Sun Dec 21 2003. - * Copyright (c) 2003 __MyCompanyName__. All rights reserved. - * + * Copyright 2002-2003. The Regents of the University of California. This material + * was produced under U.S. Government contract W-7405-ENG-36 for Los Alamos + * National Laboratory, which is operated by the University of California for + * the U.S. Department of Energy. The Government is granted for itself and + * others acting on its behalf a paid-up, nonexclusive, irrevocable worldwide + * license in this material to reproduce, prepare derivative works, and + * perform publicly and display publicly. Beginning five (5) years after + * October 10,2002 subject to additional five-year worldwide renewals, the + * Government is granted for itself and others acting on its behalf a paid-up, + * nonexclusive, irrevocable worldwide license in this material to reproduce, + * prepare derivative works, distribute copies to the public, perform publicly + * and display publicly, and to permit others to do so. NEITHER THE UNITED + * STATES NOR THE UNITED STATES DEPARTMENT OF ENERGY, NOR THE UNIVERSITY OF + * CALIFORNIA, NOR ANY OF THEIR EMPLOYEES, MAKES ANY WARRANTY, EXPRESS OR + * IMPLIED, OR ASSUMES ANY LEGAL LIABILITY OR RESPONSIBILITY FOR THE ACCURACY, + * COMPLETENESS, OR USEFULNESS OF ANY INFORMATION, APPARATUS, PRODUCT, OR + * PROCESS DISCLOSED, OR REPRESENTS THAT ITS USE WOULD NOT INFRINGE PRIVATELY + * OWNED RIGHTS. + + * Additionally, this program is free software; you can distribute it and/or + * modify it under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation; either version 2 of the License, + * or any later version. Accordingly, this program is distributed in the hope + * that it will be useful, but WITHOUT ANY WARRANTY; without even the implied + * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. */ +/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/ #include "ctmessage.h" diff --git a/src/lam/ctnetwork/ctmessage.h b/src/lam/ctnetwork/ctmessage.h index 70cfd5b05e..1595abeaa6 100644 --- a/src/lam/ctnetwork/ctmessage.h +++ b/src/lam/ctnetwork/ctmessage.h @@ -1,16 +1,83 @@ /* - * ctmessage.h - * LAM-MPI - * - * Created by Rob Aulwes on Sun Dec 21 2003. - * Copyright (c) 2003 __MyCompanyName__. All rights reserved. - * + * Copyright 2002-2003. The Regents of the University of California. This material + * was produced under U.S. Government contract W-7405-ENG-36 for Los Alamos + * National Laboratory, which is operated by the University of California for + * the U.S. Department of Energy. The Government is granted for itself and + * others acting on its behalf a paid-up, nonexclusive, irrevocable worldwide + * license in this material to reproduce, prepare derivative works, and + * perform publicly and display publicly. Beginning five (5) years after + * October 10,2002 subject to additional five-year worldwide renewals, the + * Government is granted for itself and others acting on its behalf a paid-up, + * nonexclusive, irrevocable worldwide license in this material to reproduce, + * prepare derivative works, distribute copies to the public, perform publicly + * and display publicly, and to permit others to do so. NEITHER THE UNITED + * STATES NOR THE UNITED STATES DEPARTMENT OF ENERGY, NOR THE UNIVERSITY OF + * CALIFORNIA, NOR ANY OF THEIR EMPLOYEES, MAKES ANY WARRANTY, EXPRESS OR + * IMPLIED, OR ASSUMES ANY LEGAL LIABILITY OR RESPONSIBILITY FOR THE ACCURACY, + * COMPLETENESS, OR USEFULNESS OF ANY INFORMATION, APPARATUS, PRODUCT, OR + * PROCESS DISCLOSED, OR REPRESENTS THAT ITS USE WOULD NOT INFRINGE PRIVATELY + * OWNED RIGHTS. + + * Additionally, this program is free software; you can distribute it and/or + * modify it under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation; either version 2 of the License, + * or any later version. Accordingly, this program is distributed in the hope + * that it will be useful, but WITHOUT ANY WARRANTY; without even the implied + * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. */ +/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/ #ifndef CT_MESSAGE_H #define CT_MESSAGE_H -#include "lam/lfc/object.h" +#include "lam/base/object.h" + + +/* + * + * Available Classes + * + */ + +extern lam_class_info_t lam_ctmsg_cls; + +/* + * + * CT Message interface + * + */ + +/* + * Message control info for routing msgs. + */ + +enum +{ + LAM_CT_BCAST = 1, + LAM_CT_ALLGATHER, + LAM_CT_SCATTER, + LAM_CT_PT2PT +}; + +typedef struct lam_ct_ctrl +{ + uint8_t ctc_is_user_msg; /* 1 -> msg is for user app. */ + uint8_t ctc_routing_type; /* broadcast, scatter, pt2pt, etc. */ + uint16_t ctc_len; + uint8_t *ctc_info; +} lam_ct_ctrl_t; + + + +typedef struct lam_ctmsg +{ + lam_object_t super; + lam_ct_ctrl_t ctm_ctrl; + uint32_t ctm_len; + uint8_t *ctm_data; + int ctm_should_free; +} lam_ctmsg_t; #endif /* CT_MESSAGE_H */ diff --git a/src/lam/ctnetwork/ctnode.c b/src/lam/ctnetwork/ctnode.c index 4fe268cd6a..7bf590e50b 100644 --- a/src/lam/ctnetwork/ctnode.c +++ b/src/lam/ctnetwork/ctnode.c @@ -1,11 +1,32 @@ /* - * ctnode.c - * LAM-MPI - * - * Created by Rob Aulwes on Sun Dec 21 2003. - * Copyright (c) 2003 __MyCompanyName__. All rights reserved. - * + * Copyright 2002-2003. The Regents of the University of California. This material + * was produced under U.S. Government contract W-7405-ENG-36 for Los Alamos + * National Laboratory, which is operated by the University of California for + * the U.S. Department of Energy. The Government is granted for itself and + * others acting on its behalf a paid-up, nonexclusive, irrevocable worldwide + * license in this material to reproduce, prepare derivative works, and + * perform publicly and display publicly. Beginning five (5) years after + * October 10,2002 subject to additional five-year worldwide renewals, the + * Government is granted for itself and others acting on its behalf a paid-up, + * nonexclusive, irrevocable worldwide license in this material to reproduce, + * prepare derivative works, distribute copies to the public, perform publicly + * and display publicly, and to permit others to do so. NEITHER THE UNITED + * STATES NOR THE UNITED STATES DEPARTMENT OF ENERGY, NOR THE UNIVERSITY OF + * CALIFORNIA, NOR ANY OF THEIR EMPLOYEES, MAKES ANY WARRANTY, EXPRESS OR + * IMPLIED, OR ASSUMES ANY LEGAL LIABILITY OR RESPONSIBILITY FOR THE ACCURACY, + * COMPLETENESS, OR USEFULNESS OF ANY INFORMATION, APPARATUS, PRODUCT, OR + * PROCESS DISCLOSED, OR REPRESENTS THAT ITS USE WOULD NOT INFRINGE PRIVATELY + * OWNED RIGHTS. + + * Additionally, this program is free software; you can distribute it and/or + * modify it under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation; either version 2 of the License, + * or any later version. Accordingly, this program is distributed in the hope + * that it will be useful, but WITHOUT ANY WARRANTY; without even the implied + * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. */ +/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/ #include "ctnode.h" diff --git a/src/lam/ctnetwork/ctnode.h b/src/lam/ctnetwork/ctnode.h index 7c8e909d82..d776943a17 100644 --- a/src/lam/ctnetwork/ctnode.h +++ b/src/lam/ctnetwork/ctnode.h @@ -1,11 +1,32 @@ /* - * ctnode.h - * LAM-MPI - * - * Created by Rob Aulwes on Sun Dec 21 2003. - * Copyright (c) 2003 __MyCompanyName__. All rights reserved. - * + * Copyright 2002-2003. The Regents of the University of California. This material + * was produced under U.S. Government contract W-7405-ENG-36 for Los Alamos + * National Laboratory, which is operated by the University of California for + * the U.S. Department of Energy. The Government is granted for itself and + * others acting on its behalf a paid-up, nonexclusive, irrevocable worldwide + * license in this material to reproduce, prepare derivative works, and + * perform publicly and display publicly. Beginning five (5) years after + * October 10,2002 subject to additional five-year worldwide renewals, the + * Government is granted for itself and others acting on its behalf a paid-up, + * nonexclusive, irrevocable worldwide license in this material to reproduce, + * prepare derivative works, distribute copies to the public, perform publicly + * and display publicly, and to permit others to do so. NEITHER THE UNITED + * STATES NOR THE UNITED STATES DEPARTMENT OF ENERGY, NOR THE UNIVERSITY OF + * CALIFORNIA, NOR ANY OF THEIR EMPLOYEES, MAKES ANY WARRANTY, EXPRESS OR + * IMPLIED, OR ASSUMES ANY LEGAL LIABILITY OR RESPONSIBILITY FOR THE ACCURACY, + * COMPLETENESS, OR USEFULNESS OF ANY INFORMATION, APPARATUS, PRODUCT, OR + * PROCESS DISCLOSED, OR REPRESENTS THAT ITS USE WOULD NOT INFRINGE PRIVATELY + * OWNED RIGHTS. + + * Additionally, this program is free software; you can distribute it and/or + * modify it under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation; either version 2 of the License, + * or any later version. Accordingly, this program is distributed in the hope + * that it will be useful, but WITHOUT ANY WARRANTY; without even the implied + * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. */ +/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/ #ifndef CT_NODE_H #define CT_NODE_H @@ -13,6 +34,39 @@ #include "lam/lfc/object.h" #include "lam/lfc/hash_table.h" + +/* + * + * Abstract topology node class + * + */ + +#define CTNODE(obj) (lam_ctnode_t *)(obj) + +struct lam_ctnode; + +typedef struct lam_ctnode_class +{ + lam_class_info_t super; + uint32_t ctl_label_for_link(struct lam_ctnode *, uint32_t); + char *ctl_isa_neighbor(struct lam_ctnode *, uint32_t); +} lam_ctnode_class_t; + + + + +/* + * + * Available concrete topology classes + * + */ + + +extern lam_ctnode_class_t hypercube_cls; + + + + /* * * Abstract topology node interface @@ -31,7 +85,9 @@ typedef struct lam_ctnode lam_fast_hash_t ctn_bcast_cache; } lam_ctnode_t; -extern lam_class_info_t ctnode_cls; + +void lam_ctn_init(lam_ctnode_t *node); +void lam_ctn_destroy(lam_ctnode_t *node); /* * @@ -67,11 +123,20 @@ INLINE uint32_t lam_ctn_get_num_nodes(lam_ctnode_t *node) {return node->ctn_num_ /* * - * "Pure virtual" functions that must be implemented + * "PURE VIRTUAL" functions that must be implemented * by the concrete subclass. * */ +int lam_ctn_isa_neighbor(lam_ctnode_t *node, uint32_t label); +/* + POST: returns 1 if a node with specified label is a label for + a neighbor node. This does not imply that the get_neighbor() function + would return non-NULL; it only verifies that the label is a valid label + for a neighbor. + */ + + 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 @@ -80,11 +145,20 @@ uint32_t lam_ctn_label_for_link(lam_ctnode_t *node, uint32_t link); */ + +/* + * + * "PURE VIRTUAL" routing functions that must be implemented + * by the concrete subclass. + * + */ + + 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. + ctrl_size. Caller must free array. */