Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Initial build support for GNI provider #2

Merged
merged 2 commits into from
Jan 29, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,10 @@ endif HAVE_PSM

if HAVE_GNI
_gni_files = \
prov/gni/src/gnix_init.c
prov/gni/src/gnix.h \
prov/gni/src/gnix_init.c \
prov/gni/src/gnix_ep.c \
prov/gni/src/gnix_ep_rdm.c

if HAVE_GNI_DL
pkglib_LTLIBRARIES += libgnix-fi.la
Expand Down
11 changes: 11 additions & 0 deletions include/prov.h
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,17 @@
* not built: no-op call for ctor
*/

#if (HAVE_GNI) && (HAVE_GNI_DL)
# define GNI_INI FI_EXT_INI
# define GNI_INIT NULL
#elif (HAVE_GNI)
# define GNI_INI INI_SIG(fi_gni_ini)
# define GNI_INIT fi_gni_ini()
GNI_INI ;
#else
# define GNI_INIT NULL
#endif

#if (HAVE_VERBS) && (HAVE_VERBS_DL)
# define VERBS_INI FI_EXT_INI
# define VERBS_INIT NULL
Expand Down
76 changes: 76 additions & 0 deletions prov/gni/src/gnix.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
/*
* Copyright (c) 2015 Cray Inc. All rights reserved.
*
* This software is available to you under a choice of one of two
* licenses. You may choose to be licensed under the terms of the GNU
* General Public License (GPL) Version 2, available from the file
* COPYING in the main directory of this source tree, or the
* BSD license below:
*
* Redistribution and use in source and binary forms, with or
* without modification, are permitted provided that the following
* conditions are met:
*
* - Redistributions of source code must retain the above
* copyright notice, this list of conditions and the following
* disclaimer.
*
* - Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the following
* disclaimer in the documentation and/or other materials
* provided with the distribution.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
* BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
* ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/

#ifndef _GNIX_H_
#define _GNIX_H_

#ifdef __cplusplus
extern "C"
{
#endif

#if HAVE_CONFIG_H
#include <config.h>
#endif /* HAVE_CONFIG_H */

#include <rdma/fabric.h>
#include <rdma/fi_atomic.h>
#include <rdma/fi_cm.h>
#include <rdma/fi_domain.h>
#include <rdma/fi_endpoint.h>
#include <rdma/fi_eq.h>
#include <rdma/fi_errno.h>
#include <rdma/fi_prov.h>
#include <rdma/fi_rma.h>
#include <rdma/fi_tagged.h>
#include <rdma/fi_trigger.h>

#include <fi.h>
#include <fi_enosys.h>
#include <fi_indexer.h>
#include <fi_rbuf.h>
#include <fi_list.h>

#define GNI_MAJOR_VERSION 0
#define GNI_MINOR_VERSION 5

int gnix_rdm_getinfo(uint32_t version, const char *node, const char *service,
uint64_t flags, struct fi_info *hints,
struct fi_info **info);

struct fi_info *gnix_fi_info(enum fi_ep_type ep_type, struct fi_info *hints);

#ifdef __cplusplus
} /* extern "C" */
#endif

#endif /* _GNIX_H_ */
55 changes: 55 additions & 0 deletions prov/gni/src/gnix_ep.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
/*
* Copyright (c) 2015 Cray Inc. All rights reserved.
*
* This software is available to you under a choice of one of two
* licenses. You may choose to be licensed under the terms of the GNU
* General Public License (GPL) Version 2, available from the file
* COPYING in the main directory of this source tree, or the
* BSD license below:
*
* Redistribution and use in source and binary forms, with or
* without modification, are permitted provided that the following
* conditions are met:
*
* - Redistributions of source code must retain the above
* copyright notice, this list of conditions and the following
* disclaimer.
*
* - Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the following
* disclaimer in the documentation and/or other materials
* provided with the distribution.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
* BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
* ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/

//
// Endpoint common code
//

#include <stdlib.h>
#include <string.h>

#include "gnix.h"

struct fi_info *
gnix_fi_info(enum fi_ep_type ep_type, struct fi_info *hints)
{
struct fi_info *_info = fi_allocinfo_internal();
if (!_info) return NULL;

// fill in attributes common to all GNI endpoints
_info->ep_type = ep_type;
_info->ep_attr->protocol = FI_PROTO_UNSPEC; // should we define FI_PROTO_GNI?

return _info;
}


53 changes: 53 additions & 0 deletions prov/gni/src/gnix_ep_rdm.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
/*
* Copyright (c) 2015 Cray Inc. All rights reserved.
*
* This software is available to you under a choice of one of two
* licenses. You may choose to be licensed under the terms of the GNU
* General Public License (GPL) Version 2, available from the file
* COPYING in the main directory of this source tree, or the
* BSD license below:
*
* Redistribution and use in source and binary forms, with or
* without modification, are permitted provided that the following
* conditions are met:
*
* - Redistributions of source code must retain the above
* copyright notice, this list of conditions and the following
* disclaimer.
*
* - Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the following
* disclaimer in the documentation and/or other materials
* provided with the distribution.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
* BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
* ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/

#include <stdlib.h>
#include <string.h>

#include "gnix.h"

int
gnix_rdm_getinfo(uint32_t version, const char *node, const char *service,
uint64_t flags, struct fi_info *hints,
struct fi_info **info)
{
struct fi_info *_info = gnix_fi_info(FI_EP_RDM, hints);
if (!_info) return FI_ENOMEM;

// fill in RDM attributes

*info = _info;

return 0;
}


64 changes: 63 additions & 1 deletion prov/gni/src/gnix_init.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
/*
* Copyright (c) 2014 Los Alamos National Security, LLC. Allrights reserved.
* Copyright (c) 2015 Cray Inc. All rights reserved.
*
* This software is available to you under a choice of one of two
* licenses. You may choose to be licensed under the terms of the GNU
Expand Down Expand Up @@ -30,12 +31,73 @@
* SOFTWARE.
*/

#include "gni_pub.h"
#include <stdio.h>
#include <stdlib.h>
#include <gni_pub.h>
#include "gnix.h"
#include "fi.h"
#include "prov.h"

// This is useful for making sure we have the gni headers and lib
// paths right. Remove when we get some real code in here.
int gnix_foobar(void){
uint32_t version;
GNI_GetVersion(&version);
return 0;
}


static int
gnix_getinfo(uint32_t version, const char *node, const char *service,
uint64_t flags, struct fi_info *hints, struct fi_info **info)
{
// Do some verification of hints here

int err = -FI_ENODATA;

if (hints) {
switch (hints->ep_type) {
case FI_EP_RDM:
return gnix_rdm_getinfo(version, node, service, flags, hints, info);
case FI_EP_DGRAM:
return err;
case FI_EP_MSG:
return err;
default:
break;
}
}

// Chain together info from all supported endpoint types
// Currently, we only support RDM
err = gnix_rdm_getinfo(version, node, service, flags, hints, info);

return err;
}

static int
gnix_fabric(struct fi_fabric_attr *attr,
struct fid_fabric **fabric, void *context)
{
return 0;
}

static void
gnix_fini(void)
{
return;
}

struct fi_provider gnix_prov = {
.name = "GNI",
.version = FI_VERSION(GNI_MAJOR_VERSION, GNI_MINOR_VERSION),
.fi_version = FI_VERSION(FI_MAJOR_VERSION, FI_MINOR_VERSION),
.getinfo = gnix_getinfo,
.fabric = gnix_fabric,
.cleanup = gnix_fini
};

GNI_INI
{
return (&gnix_prov);
}
2 changes: 2 additions & 0 deletions src/fabric.c
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,8 @@ static void fi_ini(void)

fi_register_provider(VERBS_INIT);
fi_register_provider(SOCKETS_INIT);

fi_register_provider(GNI_INIT);
init = 1;

unlock:
Expand Down