13
13
* Copyright (c) 2006 Sandia National Laboratories. All rights
14
14
* reserved.
15
15
* 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
17
17
* reserved.
18
18
* Copyright (c) 2014 Intel, Inc. All rights reserved
19
19
* $COPYRIGHT$
44
44
#include "opal/mca/btl/base/btl_base_error.h"
45
45
#include "opal/mca/mpool/base/base.h"
46
46
#include "opal/mca/mpool/mpool.h"
47
+ #include "opal/mca/rcache/base/base.h"
48
+ #include "opal/mca/rcache/rcache.h"
47
49
#else
48
50
#include "ompi/mca/btl/btl.h"
49
51
#include "ompi/mca/btl/base/btl_base_error.h"
@@ -805,7 +807,11 @@ static int usnic_finalize(struct mca_btl_base_module_t* btl)
805
807
OBJ_DESTRUCT (& module -> chunk_segs );
806
808
OBJ_DESTRUCT (& module -> senders );
807
809
810
+ #if RCACHE_VERSION == 30
811
+ mca_rcache_base_module_destroy (module -> rcache );
812
+ #else
808
813
mca_mpool_base_module_destroy (module -> super .btl_mpool );
814
+ #endif
809
815
810
816
if (NULL != module -> av ) {
811
817
fi_close (& module -> av -> fid );
@@ -1657,9 +1663,9 @@ static int init_one_channel(opal_btl_usnic_module_t *module,
1657
1663
rd_num /* num erorments to alloc */ ,
1658
1664
rd_num /* max elements to alloc */ ,
1659
1665
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) */ ,
1661
1667
0 /* mpool reg flags */ ,
1662
- NULL /* unused0 */ ,
1668
+ module -> rcache /* registration cache for 2.1+ */ ,
1663
1669
NULL /* item_init */ ,
1664
1670
NULL /* item_init_context */ );
1665
1671
channel -> recv_segs .ctx = module ; /* must come after
@@ -1976,9 +1982,26 @@ static int init_mpool(opal_btl_usnic_module_t *module)
1976
1982
mpool_resources .deregister_mem = usnic_dereg_mr ;
1977
1983
asprintf (& mpool_resources .pool_name , "%s" ,
1978
1984
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
1979
2001
module -> super .btl_mpool =
1980
2002
mca_mpool_base_module_create (mca_btl_usnic_component .usnic_mpool_name ,
1981
2003
& module -> super , & mpool_resources );
2004
+ #endif
1982
2005
if (NULL == module -> super .btl_mpool ) {
1983
2006
opal_show_help ("help-mpi-btl-usnic.txt" ,
1984
2007
"internal error during init" ,
@@ -2149,7 +2172,7 @@ static void init_freelists(opal_btl_usnic_module_t *module)
2149
2172
module -> sd_num / 2 ,
2150
2173
module -> super .btl_mpool ,
2151
2174
0 /* mpool reg flags */ ,
2152
- NULL /* unused0 */ ,
2175
+ module -> rcache ,
2153
2176
NULL /* item_init */ ,
2154
2177
NULL /* item_init_context */ );
2155
2178
assert (OPAL_SUCCESS == rc );
@@ -2204,7 +2227,7 @@ static void init_freelists(opal_btl_usnic_module_t *module)
2204
2227
module -> sd_num / 2 ,
2205
2228
module -> super .btl_mpool ,
2206
2229
0 /* mpool reg flags */ ,
2207
- NULL /* unused0 */ ,
2230
+ module -> rcache ,
2208
2231
NULL /* item_init */ ,
2209
2232
NULL /* item_init_context */ );
2210
2233
assert (OPAL_SUCCESS == rc );
@@ -2226,7 +2249,7 @@ static void init_freelists(opal_btl_usnic_module_t *module)
2226
2249
module -> sd_num / 2 ,
2227
2250
module -> super .btl_mpool ,
2228
2251
0 /* mpool reg flags */ ,
2229
- NULL /* unused0 */ ,
2252
+ module -> rcache ,
2230
2253
NULL /* item_init */ ,
2231
2254
NULL /* item_init_context */ );
2232
2255
assert (OPAL_SUCCESS == rc );
@@ -2283,7 +2306,11 @@ int opal_btl_usnic_module_init(opal_btl_usnic_module_t *module)
2283
2306
int ret ;
2284
2307
if (OPAL_SUCCESS != (ret = init_mpool (module )) ||
2285
2308
OPAL_SUCCESS != (ret = init_channels (module ))) {
2309
+ #if RCACHE_VERSION == 30
2310
+ mca_rcache_base_module_destroy (module -> rcache );
2311
+ #else
2286
2312
mca_mpool_base_module_destroy (module -> super .btl_mpool );
2313
+ #endif
2287
2314
return ret ;
2288
2315
}
2289
2316
0 commit comments