1
1

Added channel and controller classes. Added more function prototypes.

This commit was SVN r13.
Этот коммит содержится в:
Rob Awles 2003-12-23 18:21:32 +00:00
родитель e5929aeb8e
Коммит f8ed5be4bf
8 изменённых файлов: 373 добавлений и 28 удалений

11
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"

71
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 */

32
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"

48
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 */

Просмотреть файл

@ -1,11 +1,32 @@
/* /*
* ctmessage.c * Copyright 2002-2003. The Regents of the University of California. This material
* LAM-MPI * 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
* Created by Rob Aulwes on Sun Dec 21 2003. * the U.S. Department of Energy. The Government is granted for itself and
* Copyright (c) 2003 __MyCompanyName__. All rights reserved. * 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" #include "ctmessage.h"

Просмотреть файл

@ -1,16 +1,83 @@
/* /*
* ctmessage.h * Copyright 2002-2003. The Regents of the University of California. This material
* LAM-MPI * 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
* Created by Rob Aulwes on Sun Dec 21 2003. * the U.S. Department of Energy. The Government is granted for itself and
* Copyright (c) 2003 __MyCompanyName__. All rights reserved. * 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 #ifndef CT_MESSAGE_H
#define 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 */ #endif /* CT_MESSAGE_H */

Просмотреть файл

@ -1,11 +1,32 @@
/* /*
* ctnode.c * Copyright 2002-2003. The Regents of the University of California. This material
* LAM-MPI * 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
* Created by Rob Aulwes on Sun Dec 21 2003. * the U.S. Department of Energy. The Government is granted for itself and
* Copyright (c) 2003 __MyCompanyName__. All rights reserved. * 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" #include "ctnode.h"

Просмотреть файл

@ -1,11 +1,32 @@
/* /*
* ctnode.h * Copyright 2002-2003. The Regents of the University of California. This material
* LAM-MPI * 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
* Created by Rob Aulwes on Sun Dec 21 2003. * the U.S. Department of Energy. The Government is granted for itself and
* Copyright (c) 2003 __MyCompanyName__. All rights reserved. * 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 #ifndef CT_NODE_H
#define CT_NODE_H #define CT_NODE_H
@ -13,6 +34,39 @@
#include "lam/lfc/object.h" #include "lam/lfc/object.h"
#include "lam/lfc/hash_table.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 * Abstract topology node interface
@ -31,7 +85,9 @@ typedef struct lam_ctnode
lam_fast_hash_t ctn_bcast_cache; lam_fast_hash_t ctn_bcast_cache;
} lam_ctnode_t; } 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. * 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); 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 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); 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 POST: Returns pointer to byte array for control data for routing
messages. The length of the control array is stored in messages. The length of the control array is stored in
ctrl_size. ctrl_size. Caller must free array.
*/ */