13
13
* Copyright (c) 2006 Sandia National Laboratories. All rights
14
14
* reserved.
15
15
* 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
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"
@@ -884,7 +886,11 @@ static int usnic_finalize(struct mca_btl_base_module_t* btl)
884
886
OBJ_DESTRUCT (& module -> chunk_segs );
885
887
OBJ_DESTRUCT (& module -> senders );
886
888
889
+ #if RCACHE_VERSION == 30
890
+ mca_rcache_base_module_destroy (module -> rcache );
891
+ #else
887
892
mca_mpool_base_module_destroy (module -> super .btl_mpool );
893
+ #endif
888
894
889
895
if (NULL != module -> av ) {
890
896
fi_close (& module -> av -> fid );
@@ -1736,9 +1742,9 @@ static int init_one_channel(opal_btl_usnic_module_t *module,
1736
1742
rd_num /* num erorments to alloc */ ,
1737
1743
rd_num /* max elements to alloc */ ,
1738
1744
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) */ ,
1740
1746
0 /* mpool reg flags */ ,
1741
- NULL /* unused0 */ ,
1747
+ module -> rcache /* registration cache for 2.1+ */ ,
1742
1748
NULL /* item_init */ ,
1743
1749
NULL /* item_init_context */ );
1744
1750
channel -> recv_segs .ctx = module ; /* must come after
@@ -2054,11 +2060,28 @@ static int init_mpool(opal_btl_usnic_module_t *module)
2054
2060
mpool_resources .sizeof_reg = sizeof (opal_btl_usnic_reg_t );
2055
2061
mpool_resources .register_mem = usnic_reg_mr ;
2056
2062
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
2057
2079
asprintf (& mpool_resources .pool_name , "%s" ,
2058
2080
module -> fabric_info -> fabric_attr -> name );
2059
2081
module -> super .btl_mpool =
2060
2082
mca_mpool_base_module_create (mca_btl_usnic_component .usnic_mpool_name ,
2061
2083
& module -> super , & mpool_resources );
2084
+ #endif
2062
2085
if (NULL == module -> super .btl_mpool ) {
2063
2086
opal_show_help ("help-mpi-btl-usnic.txt" ,
2064
2087
"internal error during init" ,
@@ -2232,7 +2255,7 @@ static void init_freelists(opal_btl_usnic_module_t *module)
2232
2255
module -> sd_num / 2 ,
2233
2256
module -> super .btl_mpool ,
2234
2257
0 /* mpool reg flags */ ,
2235
- NULL /* unused0 */ ,
2258
+ module -> rcache ,
2236
2259
NULL /* item_init */ ,
2237
2260
NULL /* item_init_context */ );
2238
2261
assert (OPAL_SUCCESS == rc );
@@ -2287,7 +2310,7 @@ static void init_freelists(opal_btl_usnic_module_t *module)
2287
2310
module -> sd_num / 2 ,
2288
2311
module -> super .btl_mpool ,
2289
2312
0 /* mpool reg flags */ ,
2290
- NULL /* unused0 */ ,
2313
+ module -> rcache ,
2291
2314
NULL /* item_init */ ,
2292
2315
NULL /* item_init_context */ );
2293
2316
assert (OPAL_SUCCESS == rc );
@@ -2309,7 +2332,7 @@ static void init_freelists(opal_btl_usnic_module_t *module)
2309
2332
module -> sd_num / 2 ,
2310
2333
module -> super .btl_mpool ,
2311
2334
0 /* mpool reg flags */ ,
2312
- NULL /* unused0 */ ,
2335
+ module -> rcache ,
2313
2336
NULL /* item_init */ ,
2314
2337
NULL /* item_init_context */ );
2315
2338
assert (OPAL_SUCCESS == rc );
@@ -2366,7 +2389,11 @@ int opal_btl_usnic_module_init(opal_btl_usnic_module_t *module)
2366
2389
int ret ;
2367
2390
if (OPAL_SUCCESS != (ret = init_mpool (module )) ||
2368
2391
OPAL_SUCCESS != (ret = init_channels (module ))) {
2392
+ #if RCACHE_VERSION == 30
2393
+ mca_rcache_base_module_destroy (module -> rcache );
2394
+ #else
2369
2395
mca_mpool_base_module_destroy (module -> super .btl_mpool );
2396
+ #endif
2370
2397
return ret ;
2371
2398
}
2372
2399
0 commit comments