Skip to content

Commit

Permalink
Add basic types and functions, initial makefile, and smoke test.
Browse files Browse the repository at this point in the history
  • Loading branch information
yosefe committed Oct 26, 2014
1 parent 20bf38e commit 4671c5a
Show file tree
Hide file tree
Showing 15 changed files with 304 additions and 1 deletion.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,5 @@
.project
.cproject
.settings
test/test
libuct.so
32 changes: 32 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@

LIBMOPSYTL = libuct.so
TEST = test/test
CC = gcc
RM = rm -f
CPPFLAGS = -Isrc
CFLAGS = -O3 -g

LIBMOPSY_HEADERS = \
src/uct/api/tl_base.h \
src/uct/api/tl_def.h \
src/uct/api/tl.h

LIBMOPSY_SOURCES = \
src/uct/tl/tl.c

TEST_SOURCES = \
test/test.c

.PHONY: clean all

all: $(LIBMOPSYTL) $(TEST)

clean:
$(RM) $(LIBMOPSYTL) $(TEST)

$(LIBMOPSYTL): $(LIBMOPSY_SOURCES) $(LIBMOPSY_HEADERS) Makefile
$(CC) $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) $(LIBMOPSY_SOURCES) -o $(LIBMOPSYTL) -shared -fPIC

$(TEST): $(TEST_SOURCES) $(TEST_HEADERS) $(LIBMOPSYTL) Makefile
$(CC) $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) $(TEST_SOURCES) -o $(TEST) $(LIBMOPSYTL) -Wl,-rpath $(PWD)

7 changes: 6 additions & 1 deletion README
Original file line number Diff line number Diff line change
@@ -1 +1,6 @@
This is the MOPSY project, the best HPC communication library ever made!
This is the UCX project, the best HPC communication library ever made!

UCX - Unified Communication X
UCP - UCX Protocol
UCT - UCX Transport

Empty file added contrib/dummy
Empty file.
Empty file added src/ucp/dummy
Empty file.
37 changes: 37 additions & 0 deletions src/uct/api/tl.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
/**
* Copyright (C) Mellanox Technologies Ltd. 2001-2014. ALL RIGHTS RESERVED.
*
* $COPYRIGHT$
* $HEADER$
*/

#ifndef MOPSY_TL_H_
#define MOPSY_TL_H_


#include "tl_base.h"

#include <util/sys/error.h>


/**
* @ingroup CONTEXT
* @brief Initialize global context.
*
* @param [out] context_p Filled with context handle.
*
* @return Error code.
*/
mopsy_status_t mopsy_tl_init(mopsy_tl_context_h *context_p);


/**
* @ingroup CONTEXT
* @brief Destroy global context.
*
* @param [in] context Handle to context.
*/
void mopsy_tl_cleanup(mopsy_tl_context_h context);


#endif
84 changes: 84 additions & 0 deletions src/uct/api/tl_base.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
/**
* Copyright (C) Mellanox Technologies Ltd. 2001-2014. ALL RIGHTS RESERVED.
*
* $COPYRIGHT$
* $HEADER$
*/

#ifndef TL_BASE_H_
#define TL_BASE_H_

#include "tl_def.h"

#include <util/sys/error.h>
#include <stddef.h>


/**
* Communication interface context
*/
typedef struct mopsy_tl_iface {
} mopsy_tl_iface_t;


/**
* Remote endpoint
*/
typedef struct mopsy_tl_ep {
mopsy_tl_ops_t *ops;
} mopsy_tl_ep_t;


/**
* Send completion callback.
*/
typedef void (*mopsy_tl_completion_cb_t)(mopsy_tl_req_h req,
mopsy_status_t status);


/**
* Interface attributes: capabilities and limitations.
*/
typedef struct mopsy_tl_iface_attr {
size_t max_short;
size_t max_bcopy;
size_t max_zcopy;
size_t iface_addr_len;
size_t ep_addr_len;
unsigned flags;
} mopsy_tl_iface_attr_t;


/**
* Transport operations.
*/
struct mopsy_tl_ops {

mopsy_status_t (*iface_open)(mopsy_tl_context_h *context, mopsy_tl_iface_h *iface_p);
void (*iface_close)(mopsy_tl_iface_h iface);

mopsy_status_t (*iface_query)(mopsy_tl_iface_h iface,
mopsy_tl_iface_attr_t *iface_attr);
mopsy_status_t (*iface_get_address)(mopsy_tl_iface_h iface,
mopsy_tl_iface_addr_t *iface_addr);

mopsy_status_t (*ep_create)(mopsy_tl_ep_h *ep_p);
void (*ep_destroy)(mopsy_tl_ep_h ep);

mopsy_status_t (*ep_get_address)(mopsy_tl_ep_h *ep,
mopsy_tl_ep_addr_t *ep_addr);
mopsy_status_t (*ep_connect_to_iface)(mopsy_tl_iface_addr_t *iface_addr);
mopsy_status_t (*ep_connect_to_ep)(mopsy_tl_iface_addr_t *iface_addr,
mopsy_tl_ep_addr_t *ep_addr);

mopsy_status_t (*ep_put_short)(mopsy_tl_ep_h ep, void *buffer, unsigned length,
mopsy_tl_rkey_t rkey, mopsy_tl_req_h *req_p,
mopsy_tl_completion_cb_t cb);

mopsy_status_t (*iface_flush)(mopsy_tl_iface_h iface, mopsy_tl_req_h *req_p,
mopsy_tl_completion_cb_t cb);

};


#endif
25 changes: 25 additions & 0 deletions src/uct/api/tl_def.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
/**
* Copyright (C) Mellanox Technologies Ltd. 2001-2014. ALL RIGHTS RESERVED.
*
* $COPYRIGHT$
* $HEADER$
*/

#ifndef TL_DEF_H_
#define TL_DEF_H_

#include <stdint.h>


typedef struct mopsy_tl_context *mopsy_tl_context_h;
typedef struct mopsy_tl_iface *mopsy_tl_iface_h;
typedef struct mopsy_tl_iface_addr mopsy_tl_iface_addr_t;
typedef struct mopsy_tl_ep *mopsy_tl_ep_h;
typedef struct mopsy_tl_ep_addr mopsy_tl_ep_addr_t;
typedef struct mopsy_tl_ops mopsy_tl_ops_t;
typedef uint64_t mopsy_tl_lkey_t;
typedef uint64_t mopsy_tl_rkey_t;
typedef struct mopsy_tl_req *mopsy_tl_req_h;


#endif
Empty file added src/uct/ib/dummy
Empty file.
18 changes: 18 additions & 0 deletions src/uct/tl/tl.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
/**
* Copyright (C) Mellanox Technologies Ltd. 2001-2014. ALL RIGHTS RESERVED.
*
* $COPYRIGHT$
* $HEADER$
*/

#include <uct/api/tl.h>


mopsy_status_t mopsy_tl_init(mopsy_tl_context_h *context_p)
{
return MOPSY_SUCCESS;
}

void mopsy_tl_cleanup(mopsy_tl_context_h context)
{
}
Empty file added src/uct/ugni/dummy
Empty file.
31 changes: 31 additions & 0 deletions src/util/debug/log.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
/**
* Copyright (C) Mellanox Technologies Ltd. 2001-2014. ALL RIGHTS RESERVED.
*
* $COPYRIGHT$
* $HEADER$
*/

#ifndef _SYS_LOG_H_
#define _SYS_LOG_H_


/**
* Logging levels
*/
typedef enum {
MOPSY_LOG_LEVEL_FATAL,
MOPSY_LOG_LEVEL_ERROR,
MOPSY_LOG_LEVEL_WARN,
MOPSY_LOG_LEVEL_INFO,
MOPSY_LOG_LEVEL_DEBUG,
MOPSY_LOG_LEVEL_TRACE,
MOPSY_LOG_LEVEL_TRACE_REQ,
MOPSY_LOG_LEVEL_TRACE_DATA,
MOPSY_LOG_LEVEL_TRACE_ASYNC,
MOPSY_LOG_LEVEL_TRACE_FUNC,
MOPSY_LOG_LEVEL_TRACE_POLL,
MOPSY_LOG_LEVEL_LAST
} mopsy_log_level_t;


#endif
21 changes: 21 additions & 0 deletions src/util/sys/compiler.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
/**
* Copyright (C) Mellanox Technologies Ltd. 2001-2014. ALL RIGHTS RESERVED.
*
* $COPYRIGHT$
* $HEADER$
*/

#ifndef _SYS_COMPILER_H_
#define _SYS_COMPILER_H_


#ifdef __cplusplus
# define BEGIN_C_DECLS extern "C" {
# define END_C_DECLS }
#else
# define BEGIN_C_DECLS
# define END_C_DECLS
#endif


#endif
22 changes: 22 additions & 0 deletions src/util/sys/error.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
/**
* Copyright (C) Mellanox Technologies Ltd. 2001-2014. ALL RIGHTS RESERVED.
*
* $COPYRIGHT$
* $HEADER$
*/

#ifndef _SYS_ERROR_H_
#define _SYS_ERROR_H_


/**
* Status codes
*/
typedef enum {
MOPSY_SUCCESS = 0,
MOPSY_ERR_INPROGRESS = 1,
MOPSY_ERR_INVALID_PARAM = -1
} mopsy_status_t;


#endif
26 changes: 26 additions & 0 deletions test/test.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
/**
* Copyright (C) Mellanox Technologies Ltd. 2001-2014. ALL RIGHTS RESERVED.
*
* $COPYRIGHT$
* $HEADER$
*/

#include <uct/api/tl.h>
#include <stdio.h>


int main(int argc, char **argv)
{
mopsy_status_t status;
mopsy_tl_context_h context;

status = mopsy_tl_init(&context);
if (status != MOPSY_SUCCESS) {
fprintf(stderr, "mopsy_tl_init() failed\n");
return -1;
}

mopsy_tl_cleanup(context);
return 0;
}

0 comments on commit 4671c5a

Please sign in to comment.