1313 * Copyright (c) 2006 Sandia National Laboratories. All rights
1414 * reserved.
1515 * Copyright (c) 2009-2016 Cisco Systems, Inc. All rights reserved.
16- * Copyright (c) 2014 Los Alamos National Security, LLC. All rights
16+ * Copyright (c) 2014-2016 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"
@@ -884,7 +886,11 @@ static int usnic_finalize(struct mca_btl_base_module_t* btl)
884886 OBJ_DESTRUCT (& module -> chunk_segs );
885887 OBJ_DESTRUCT (& module -> senders );
886888
889+ #if RCACHE_VERSION == 30
890+ mca_rcache_base_module_destroy (module -> rcache );
891+ #else
887892 mca_mpool_base_module_destroy (module -> super .btl_mpool );
893+ #endif
888894
889895 if (NULL != module -> av ) {
890896 fi_close (& module -> av -> fid );
@@ -1736,9 +1742,9 @@ static int init_one_channel(opal_btl_usnic_module_t *module,
17361742 rd_num /* num erorments to alloc */ ,
17371743 rd_num /* max elements to alloc */ ,
17381744 rd_num /* num elements per alloc */ ,
1739- module -> super .btl_mpool /* mpool for reg */ ,
1745+ module -> super .btl_mpool /* mpool for (1.x, 2.0: reg, 2.1+: allocation) */ ,
17401746 0 /* mpool reg flags */ ,
1741- NULL /* unused0 */ ,
1747+ module -> rcache /* registration cache for 2.1+ */ ,
17421748 NULL /* item_init */ ,
17431749 NULL /* item_init_context */ );
17441750 channel -> recv_segs .ctx = module ; /* must come after
@@ -2054,11 +2060,28 @@ static int init_mpool(opal_btl_usnic_module_t *module)
20542060 mpool_resources .sizeof_reg = sizeof (opal_btl_usnic_reg_t );
20552061 mpool_resources .register_mem = usnic_reg_mr ;
20562062 mpool_resources .deregister_mem = usnic_dereg_mr ;
2063+ #if RCACHE_VERSION == 30
2064+ module -> rcache =
2065+ mca_rcache_base_module_create (mca_btl_usnic_component .usnic_rcache_name ,
2066+ & module -> super , & mpool_resources );
2067+ if (NULL == module -> rcache ) {
2068+ opal_show_help ("help-mpi-btl-usnic.txt" ,
2069+ "internal error during init" ,
2070+ true,
2071+ opal_process_info .nodename ,
2072+ module -> fabric_info -> fabric_attr -> name ,
2073+ "create rcache" , __FILE__ , __LINE__ );
2074+ return OPAL_ERROR ;
2075+ }
2076+ module -> super .btl_mpool =
2077+ mca_mpool_base_module_lookup (mca_btl_usnic_component .usnic_mpool_hints );
2078+ #else
20572079 asprintf (& mpool_resources .pool_name , "%s" ,
20582080 module -> fabric_info -> fabric_attr -> name );
20592081 module -> super .btl_mpool =
20602082 mca_mpool_base_module_create (mca_btl_usnic_component .usnic_mpool_name ,
20612083 & module -> super , & mpool_resources );
2084+ #endif
20622085 if (NULL == module -> super .btl_mpool ) {
20632086 opal_show_help ("help-mpi-btl-usnic.txt" ,
20642087 "internal error during init" ,
@@ -2232,7 +2255,7 @@ static void init_freelists(opal_btl_usnic_module_t *module)
22322255 module -> sd_num / 2 ,
22332256 module -> super .btl_mpool ,
22342257 0 /* mpool reg flags */ ,
2235- NULL /* unused0 */ ,
2258+ module -> rcache ,
22362259 NULL /* item_init */ ,
22372260 NULL /* item_init_context */ );
22382261 assert (OPAL_SUCCESS == rc );
@@ -2287,7 +2310,7 @@ static void init_freelists(opal_btl_usnic_module_t *module)
22872310 module -> sd_num / 2 ,
22882311 module -> super .btl_mpool ,
22892312 0 /* mpool reg flags */ ,
2290- NULL /* unused0 */ ,
2313+ module -> rcache ,
22912314 NULL /* item_init */ ,
22922315 NULL /* item_init_context */ );
22932316 assert (OPAL_SUCCESS == rc );
@@ -2309,7 +2332,7 @@ static void init_freelists(opal_btl_usnic_module_t *module)
23092332 module -> sd_num / 2 ,
23102333 module -> super .btl_mpool ,
23112334 0 /* mpool reg flags */ ,
2312- NULL /* unused0 */ ,
2335+ module -> rcache ,
23132336 NULL /* item_init */ ,
23142337 NULL /* item_init_context */ );
23152338 assert (OPAL_SUCCESS == rc );
@@ -2366,7 +2389,11 @@ int opal_btl_usnic_module_init(opal_btl_usnic_module_t *module)
23662389 int ret ;
23672390 if (OPAL_SUCCESS != (ret = init_mpool (module )) ||
23682391 OPAL_SUCCESS != (ret = init_channels (module ))) {
2392+ #if RCACHE_VERSION == 30
2393+ mca_rcache_base_module_destroy (module -> rcache );
2394+ #else
23692395 mca_mpool_base_module_destroy (module -> super .btl_mpool );
2396+ #endif
23702397 return ret ;
23712398 }
23722399
0 commit comments