1313 * Copyright (c) 2006 Sandia National Laboratories. All rights
1414 * reserved.
1515 * Copyright (c) 2009-2015 Cisco Systems, Inc. All rights reserved.
16- * Copyright (c) 2014 Los Alamos National Security, LLC. All rights
16+ * Copyright (c) 2014-2015 Los Alamos National Security, LLC. All rights
1717 * reserved.
1818 * Copyright (c) 2014 Intel, Inc. All rights reserved
1919 * $COPYRIGHT$
4444#include "opal/mca/btl/base/btl_base_error.h"
4545#include "opal/mca/mpool/base/base.h"
4646#include "opal/mca/mpool/mpool.h"
47+ #include "opal/mca/rcache/base/base.h"
48+ #include "opal/mca/rcache/rcache.h"
4749#else
4850#include "ompi/mca/btl/btl.h"
4951#include "ompi/mca/btl/base/btl_base_error.h"
@@ -805,7 +807,11 @@ static int usnic_finalize(struct mca_btl_base_module_t* btl)
805807 OBJ_DESTRUCT (& module -> chunk_segs );
806808 OBJ_DESTRUCT (& module -> senders );
807809
810+ #if RCACHE_VERSION == 30
811+ mca_rcache_base_module_destroy (module -> rcache );
812+ #else
808813 mca_mpool_base_module_destroy (module -> super .btl_mpool );
814+ #endif
809815
810816 if (NULL != module -> av ) {
811817 fi_close (& module -> av -> fid );
@@ -1657,9 +1663,9 @@ static int init_one_channel(opal_btl_usnic_module_t *module,
16571663 rd_num /* num erorments to alloc */ ,
16581664 rd_num /* max elements to alloc */ ,
16591665 rd_num /* num elements per alloc */ ,
1660- module -> super .btl_mpool /* mpool for reg */ ,
1666+ module -> super .btl_mpool /* mpool for (1.x, 2.0: reg, 2.1+: allocation) */ ,
16611667 0 /* mpool reg flags */ ,
1662- NULL /* unused0 */ ,
1668+ module -> rcache /* registration cache for 2.1+ */ ,
16631669 NULL /* item_init */ ,
16641670 NULL /* item_init_context */ );
16651671 channel -> recv_segs .ctx = module ; /* must come after
@@ -1976,9 +1982,26 @@ static int init_mpool(opal_btl_usnic_module_t *module)
19761982 mpool_resources .deregister_mem = usnic_dereg_mr ;
19771983 asprintf (& mpool_resources .pool_name , "%s" ,
19781984 module -> fabric_info -> fabric_attr -> name );
1985+ #if RCACHE_VERSION == 30
1986+ module -> rcache =
1987+ mca_rcache_base_module_create (mca_btl_usnic_component .usnic_rcache_name ,
1988+ & module -> super , & mpool_resources );
1989+ if (NULL == module -> rcache ) {
1990+ opal_show_help ("help-mpi-btl-usnic.txt" ,
1991+ "internal error during init" ,
1992+ true,
1993+ opal_process_info .nodename ,
1994+ module -> fabric_info -> fabric_attr -> name ,
1995+ "create rcache" , __FILE__ , __LINE__ );
1996+ return OPAL_ERROR ;
1997+ }
1998+ module -> super .btl_mpool =
1999+ mca_mpool_base_module_lookup (mca_btl_usnic_component .usnic_mpool_hints );
2000+ #else
19792001 module -> super .btl_mpool =
19802002 mca_mpool_base_module_create (mca_btl_usnic_component .usnic_mpool_name ,
19812003 & module -> super , & mpool_resources );
2004+ #endif
19822005 if (NULL == module -> super .btl_mpool ) {
19832006 opal_show_help ("help-mpi-btl-usnic.txt" ,
19842007 "internal error during init" ,
@@ -2149,7 +2172,7 @@ static void init_freelists(opal_btl_usnic_module_t *module)
21492172 module -> sd_num / 2 ,
21502173 module -> super .btl_mpool ,
21512174 0 /* mpool reg flags */ ,
2152- NULL /* unused0 */ ,
2175+ module -> rcache ,
21532176 NULL /* item_init */ ,
21542177 NULL /* item_init_context */ );
21552178 assert (OPAL_SUCCESS == rc );
@@ -2204,7 +2227,7 @@ static void init_freelists(opal_btl_usnic_module_t *module)
22042227 module -> sd_num / 2 ,
22052228 module -> super .btl_mpool ,
22062229 0 /* mpool reg flags */ ,
2207- NULL /* unused0 */ ,
2230+ module -> rcache ,
22082231 NULL /* item_init */ ,
22092232 NULL /* item_init_context */ );
22102233 assert (OPAL_SUCCESS == rc );
@@ -2226,7 +2249,7 @@ static void init_freelists(opal_btl_usnic_module_t *module)
22262249 module -> sd_num / 2 ,
22272250 module -> super .btl_mpool ,
22282251 0 /* mpool reg flags */ ,
2229- NULL /* unused0 */ ,
2252+ module -> rcache ,
22302253 NULL /* item_init */ ,
22312254 NULL /* item_init_context */ );
22322255 assert (OPAL_SUCCESS == rc );
@@ -2283,7 +2306,11 @@ int opal_btl_usnic_module_init(opal_btl_usnic_module_t *module)
22832306 int ret ;
22842307 if (OPAL_SUCCESS != (ret = init_mpool (module )) ||
22852308 OPAL_SUCCESS != (ret = init_channels (module ))) {
2309+ #if RCACHE_VERSION == 30
2310+ mca_rcache_base_module_destroy (module -> rcache );
2311+ #else
22862312 mca_mpool_base_module_destroy (module -> super .btl_mpool );
2313+ #endif
22872314 return ret ;
22882315 }
22892316
0 commit comments