2015-02-19 23:41:41 +03:00
|
|
|
/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */
|
2005-05-31 23:07:27 +04:00
|
|
|
/*
|
2005-11-05 22:57:48 +03:00
|
|
|
* Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana
|
|
|
|
* University Research and Technology
|
|
|
|
* Corporation. All rights reserved.
|
2006-08-24 20:38:08 +04:00
|
|
|
* Copyright (c) 2004-2006 The University of Tennessee and The University
|
2005-11-05 22:57:48 +03:00
|
|
|
* of Tennessee Research Foundation. All rights
|
|
|
|
* reserved.
|
2005-05-31 23:07:27 +04:00
|
|
|
* Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
|
|
|
|
* University of Stuttgart. All rights reserved.
|
|
|
|
* Copyright (c) 2004-2005 The Regents of the University of California.
|
|
|
|
* All rights reserved.
|
2009-02-24 20:17:33 +03:00
|
|
|
* Copyright (c) 2009 Sun Microsystems, Inc. All rights reserved.
|
2010-03-25 06:29:27 +03:00
|
|
|
* Copyright (c) 2010 IBM Corporation. All rights reserved.
|
2015-02-19 23:41:41 +03:00
|
|
|
* Copyright (c) 2015 Los Alamos National Security, LLC. All rights
|
|
|
|
* reserved.
|
2005-05-31 23:07:27 +04:00
|
|
|
* $COPYRIGHT$
|
|
|
|
*
|
|
|
|
* Additional copyrights may follow
|
|
|
|
*
|
|
|
|
* $HEADER$
|
|
|
|
*/
|
|
|
|
|
George did the work and deserves all the credit for it. Ralph did the merge, and deserves whatever blame results from errors in it :-)
WHAT: Open our low-level communication infrastructure by moving all necessary components (btl/rcache/allocator/mpool) down in OPAL
All the components required for inter-process communications are currently deeply integrated in the OMPI layer. Several groups/institutions have express interest in having a more generic communication infrastructure, without all the OMPI layer dependencies. This communication layer should be made available at a different software level, available to all layers in the Open MPI software stack. As an example, our ORTE layer could replace the current OOB and instead use the BTL directly, gaining access to more reactive network interfaces than TCP. Similarly, external software libraries could take advantage of our highly optimized AM (active message) communication layer for their own purpose. UTK with support from Sandia, developped a version of Open MPI where the entire communication infrastucture has been moved down to OPAL (btl/rcache/allocator/mpool). Most of the moved components have been updated to match the new schema, with few exceptions (mainly BTLs where I have no way of compiling/testing them). Thus, the completion of this RFC is tied to being able to completing this move for all BTLs. For this we need help from the rest of the Open MPI community, especially those supporting some of the BTLs. A non-exhaustive list of BTLs that qualify here is: mx, portals4, scif, udapl, ugni, usnic.
This commit was SVN r32317.
2014-07-26 04:47:28 +04:00
|
|
|
#include "opal_config.h"
|
2005-05-31 23:07:27 +04:00
|
|
|
#include <stdint.h>
|
|
|
|
#include <string.h>
|
George did the work and deserves all the credit for it. Ralph did the merge, and deserves whatever blame results from errors in it :-)
WHAT: Open our low-level communication infrastructure by moving all necessary components (btl/rcache/allocator/mpool) down in OPAL
All the components required for inter-process communications are currently deeply integrated in the OMPI layer. Several groups/institutions have express interest in having a more generic communication infrastructure, without all the OMPI layer dependencies. This communication layer should be made available at a different software level, available to all layers in the Open MPI software stack. As an example, our ORTE layer could replace the current OOB and instead use the BTL directly, gaining access to more reactive network interfaces than TCP. Similarly, external software libraries could take advantage of our highly optimized AM (active message) communication layer for their own purpose. UTK with support from Sandia, developped a version of Open MPI where the entire communication infrastucture has been moved down to OPAL (btl/rcache/allocator/mpool). Most of the moved components have been updated to match the new schema, with few exceptions (mainly BTLs where I have no way of compiling/testing them). Thus, the completion of this RFC is tied to being able to completing this move for all BTLs. For this we need help from the rest of the Open MPI community, especially those supporting some of the BTLs. A non-exhaustive list of BTLs that qualify here is: mx, portals4, scif, udapl, ugni, usnic.
This commit was SVN r32317.
2014-07-26 04:47:28 +04:00
|
|
|
#include "opal/mca/mpool/mpool.h"
|
2006-06-08 08:29:27 +04:00
|
|
|
#include "base.h"
|
|
|
|
#include "mpool_base_tree.h"
|
2014-08-31 12:06:35 +04:00
|
|
|
#include "opal/threads/mutex.h"
|
|
|
|
|
|
|
|
struct opal_info_t {
|
|
|
|
opal_list_t super;
|
|
|
|
/**< generic list pointer which is the container for (key,value)
|
|
|
|
pairs */
|
|
|
|
int i_f_to_c_index;
|
|
|
|
/**< fortran handle for info. This is needed for translation from
|
|
|
|
fortran to C and vice versa */
|
|
|
|
opal_mutex_t *i_lock;
|
|
|
|
/**< Mutex for thread safety */
|
|
|
|
bool i_freed;
|
|
|
|
/**< Whether this info has been freed or not */
|
|
|
|
};
|
|
|
|
typedef struct opal_info_t opal_info_t;
|
2006-06-17 22:34:41 +04:00
|
|
|
|
2005-05-31 23:07:27 +04:00
|
|
|
|
2007-07-08 15:44:58 +04:00
|
|
|
static void unregister_tree_item(mca_mpool_base_tree_item_t *mpool_tree_item)
|
|
|
|
{
|
|
|
|
mca_mpool_base_module_t *mpool;
|
2015-06-24 06:59:57 +03:00
|
|
|
|
2015-11-02 22:07:08 +03:00
|
|
|
mpool = mpool_tree_item->mpool;
|
|
|
|
mpool->mpool_free(mpool, mpool_tree_item->key);
|
2007-07-08 15:44:58 +04:00
|
|
|
}
|
|
|
|
|
2005-05-31 23:07:27 +04:00
|
|
|
/**
|
|
|
|
* Function to allocate special memory according to what the user requests in
|
|
|
|
* the info object.
|
|
|
|
*
|
|
|
|
* If the info parameter is MPI_INFO_NULL, then this function will try to allocate
|
2015-11-02 22:07:08 +03:00
|
|
|
* the memory with the optionally named mpool or malloc and try to register the
|
|
|
|
* pointer with as many registration caches as possible. Registration caches that
|
|
|
|
* fail to register the region will be ignored. The mpool name can optionally be
|
|
|
|
* specified in the info object.
|
2005-05-31 23:07:27 +04:00
|
|
|
*
|
|
|
|
* @param size the size of the memory area to allocate
|
|
|
|
* @param info an info object which tells us what kind of memory to allocate
|
|
|
|
*
|
|
|
|
* @retval pointer to the allocated memory
|
|
|
|
* @retval NULL on failure
|
|
|
|
*/
|
2015-11-02 22:07:08 +03:00
|
|
|
void *mca_mpool_base_alloc(size_t size, opal_info_t *info, const char *hints)
|
2005-05-31 23:07:27 +04:00
|
|
|
{
|
2015-11-02 22:07:08 +03:00
|
|
|
mca_mpool_base_tree_item_t *mpool_tree_item = NULL;
|
2006-12-17 15:26:41 +03:00
|
|
|
mca_mpool_base_module_t *mpool;
|
2015-11-02 22:07:08 +03:00
|
|
|
void *mem = NULL;
|
George did the work and deserves all the credit for it. Ralph did the merge, and deserves whatever blame results from errors in it :-)
WHAT: Open our low-level communication infrastructure by moving all necessary components (btl/rcache/allocator/mpool) down in OPAL
All the components required for inter-process communications are currently deeply integrated in the OMPI layer. Several groups/institutions have express interest in having a more generic communication infrastructure, without all the OMPI layer dependencies. This communication layer should be made available at a different software level, available to all layers in the Open MPI software stack. As an example, our ORTE layer could replace the current OOB and instead use the BTL directly, gaining access to more reactive network interfaces than TCP. Similarly, external software libraries could take advantage of our highly optimized AM (active message) communication layer for their own purpose. UTK with support from Sandia, developped a version of Open MPI where the entire communication infrastucture has been moved down to OPAL (btl/rcache/allocator/mpool). Most of the moved components have been updated to match the new schema, with few exceptions (mainly BTLs where I have no way of compiling/testing them). Thus, the completion of this RFC is tied to being able to completing this move for all BTLs. For this we need help from the rest of the Open MPI community, especially those supporting some of the BTLs. A non-exhaustive list of BTLs that qualify here is: mx, portals4, scif, udapl, ugni, usnic.
This commit was SVN r32317.
2014-07-26 04:47:28 +04:00
|
|
|
#if defined(TODO_BTL_GB)
|
2006-08-15 13:21:40 +04:00
|
|
|
int flag = 0;
|
George did the work and deserves all the credit for it. Ralph did the merge, and deserves whatever blame results from errors in it :-)
WHAT: Open our low-level communication infrastructure by moving all necessary components (btl/rcache/allocator/mpool) down in OPAL
All the components required for inter-process communications are currently deeply integrated in the OMPI layer. Several groups/institutions have express interest in having a more generic communication infrastructure, without all the OMPI layer dependencies. This communication layer should be made available at a different software level, available to all layers in the Open MPI software stack. As an example, our ORTE layer could replace the current OOB and instead use the BTL directly, gaining access to more reactive network interfaces than TCP. Similarly, external software libraries could take advantage of our highly optimized AM (active message) communication layer for their own purpose. UTK with support from Sandia, developped a version of Open MPI where the entire communication infrastucture has been moved down to OPAL (btl/rcache/allocator/mpool). Most of the moved components have been updated to match the new schema, with few exceptions (mainly BTLs where I have no way of compiling/testing them). Thus, the completion of this RFC is tied to being able to completing this move for all BTLs. For this we need help from the rest of the Open MPI community, especially those supporting some of the BTLs. A non-exhaustive list of BTLs that qualify here is: mx, portals4, scif, udapl, ugni, usnic.
This commit was SVN r32317.
2014-07-26 04:47:28 +04:00
|
|
|
#endif /* defined(TODO_BTL_GB) */
|
2006-06-17 22:34:41 +04:00
|
|
|
|
2015-11-02 22:07:08 +03:00
|
|
|
mpool_tree_item = mca_mpool_base_tree_item_get ();
|
|
|
|
if (!mpool_tree_item) {
|
|
|
|
return NULL;
|
2005-09-25 21:04:03 +04:00
|
|
|
}
|
|
|
|
|
2007-08-02 01:33:25 +04:00
|
|
|
mpool_tree_item->num_bytes = size;
|
2006-12-17 15:26:41 +03:00
|
|
|
mpool_tree_item->count = 0;
|
2015-06-24 06:59:57 +03:00
|
|
|
|
2015-11-02 22:07:08 +03:00
|
|
|
mpool = mca_mpool_base_module_lookup (hints);
|
|
|
|
if (NULL != mpool) {
|
|
|
|
mem = mpool->mpool_alloc (mpool, size, 0, 0);
|
2007-07-08 15:44:58 +04:00
|
|
|
}
|
|
|
|
|
2015-11-02 22:07:08 +03:00
|
|
|
if (NULL == mem) {
|
|
|
|
/* fall back on malloc */
|
2007-07-08 15:44:58 +04:00
|
|
|
mem = malloc(size);
|
2006-12-17 15:26:41 +03:00
|
|
|
|
2015-11-02 22:07:08 +03:00
|
|
|
mca_mpool_base_tree_item_put (mpool_tree_item);
|
|
|
|
} else {
|
|
|
|
mpool_tree_item->mpool = mpool;
|
|
|
|
mca_mpool_base_tree_insert (mpool_tree_item);
|
|
|
|
}
|
2006-12-17 15:26:41 +03:00
|
|
|
|
2005-05-31 23:07:27 +04:00
|
|
|
return mem;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Function to free memory previously allocated by mca_mpool_base_alloc
|
|
|
|
*
|
|
|
|
* @param base pointer to the memory to free
|
|
|
|
*
|
George did the work and deserves all the credit for it. Ralph did the merge, and deserves whatever blame results from errors in it :-)
WHAT: Open our low-level communication infrastructure by moving all necessary components (btl/rcache/allocator/mpool) down in OPAL
All the components required for inter-process communications are currently deeply integrated in the OMPI layer. Several groups/institutions have express interest in having a more generic communication infrastructure, without all the OMPI layer dependencies. This communication layer should be made available at a different software level, available to all layers in the Open MPI software stack. As an example, our ORTE layer could replace the current OOB and instead use the BTL directly, gaining access to more reactive network interfaces than TCP. Similarly, external software libraries could take advantage of our highly optimized AM (active message) communication layer for their own purpose. UTK with support from Sandia, developped a version of Open MPI where the entire communication infrastucture has been moved down to OPAL (btl/rcache/allocator/mpool). Most of the moved components have been updated to match the new schema, with few exceptions (mainly BTLs where I have no way of compiling/testing them). Thus, the completion of this RFC is tied to being able to completing this move for all BTLs. For this we need help from the rest of the Open MPI community, especially those supporting some of the BTLs. A non-exhaustive list of BTLs that qualify here is: mx, portals4, scif, udapl, ugni, usnic.
This commit was SVN r32317.
2014-07-26 04:47:28 +04:00
|
|
|
* @retval OPAL_SUCCESS
|
|
|
|
* @retval OPAL_ERR_BAD_PARAM if the passed base pointer was invalid
|
2005-05-31 23:07:27 +04:00
|
|
|
*/
|
2006-12-17 15:26:41 +03:00
|
|
|
int mca_mpool_base_free(void *base)
|
2005-05-31 23:07:27 +04:00
|
|
|
{
|
2006-12-17 15:26:41 +03:00
|
|
|
mca_mpool_base_tree_item_t *mpool_tree_item = NULL;
|
2007-07-08 15:44:58 +04:00
|
|
|
int rc;
|
2006-12-17 15:26:41 +03:00
|
|
|
|
|
|
|
if(!base) {
|
George did the work and deserves all the credit for it. Ralph did the merge, and deserves whatever blame results from errors in it :-)
WHAT: Open our low-level communication infrastructure by moving all necessary components (btl/rcache/allocator/mpool) down in OPAL
All the components required for inter-process communications are currently deeply integrated in the OMPI layer. Several groups/institutions have express interest in having a more generic communication infrastructure, without all the OMPI layer dependencies. This communication layer should be made available at a different software level, available to all layers in the Open MPI software stack. As an example, our ORTE layer could replace the current OOB and instead use the BTL directly, gaining access to more reactive network interfaces than TCP. Similarly, external software libraries could take advantage of our highly optimized AM (active message) communication layer for their own purpose. UTK with support from Sandia, developped a version of Open MPI where the entire communication infrastucture has been moved down to OPAL (btl/rcache/allocator/mpool). Most of the moved components have been updated to match the new schema, with few exceptions (mainly BTLs where I have no way of compiling/testing them). Thus, the completion of this RFC is tied to being able to completing this move for all BTLs. For this we need help from the rest of the Open MPI community, especially those supporting some of the BTLs. A non-exhaustive list of BTLs that qualify here is: mx, portals4, scif, udapl, ugni, usnic.
This commit was SVN r32317.
2014-07-26 04:47:28 +04:00
|
|
|
return OPAL_ERROR;
|
2005-05-31 23:07:27 +04:00
|
|
|
}
|
2006-06-08 20:27:59 +04:00
|
|
|
|
2006-12-17 15:26:41 +03:00
|
|
|
mpool_tree_item = mca_mpool_base_tree_find(base);
|
2006-06-17 22:34:41 +04:00
|
|
|
|
2015-06-24 06:59:57 +03:00
|
|
|
if(!mpool_tree_item) {
|
2006-12-17 15:26:41 +03:00
|
|
|
/* nothing in the tree this was just plain old malloc'd memory */
|
2006-06-08 18:23:20 +04:00
|
|
|
free(base);
|
George did the work and deserves all the credit for it. Ralph did the merge, and deserves whatever blame results from errors in it :-)
WHAT: Open our low-level communication infrastructure by moving all necessary components (btl/rcache/allocator/mpool) down in OPAL
All the components required for inter-process communications are currently deeply integrated in the OMPI layer. Several groups/institutions have express interest in having a more generic communication infrastructure, without all the OMPI layer dependencies. This communication layer should be made available at a different software level, available to all layers in the Open MPI software stack. As an example, our ORTE layer could replace the current OOB and instead use the BTL directly, gaining access to more reactive network interfaces than TCP. Similarly, external software libraries could take advantage of our highly optimized AM (active message) communication layer for their own purpose. UTK with support from Sandia, developped a version of Open MPI where the entire communication infrastucture has been moved down to OPAL (btl/rcache/allocator/mpool). Most of the moved components have been updated to match the new schema, with few exceptions (mainly BTLs where I have no way of compiling/testing them). Thus, the completion of this RFC is tied to being able to completing this move for all BTLs. For this we need help from the rest of the Open MPI community, especially those supporting some of the BTLs. A non-exhaustive list of BTLs that qualify here is: mx, portals4, scif, udapl, ugni, usnic.
This commit was SVN r32317.
2014-07-26 04:47:28 +04:00
|
|
|
return OPAL_SUCCESS;
|
2006-06-08 18:23:20 +04:00
|
|
|
}
|
2006-12-17 15:26:41 +03:00
|
|
|
|
2006-06-08 08:29:27 +04:00
|
|
|
rc = mca_mpool_base_tree_delete(mpool_tree_item);
|
George did the work and deserves all the credit for it. Ralph did the merge, and deserves whatever blame results from errors in it :-)
WHAT: Open our low-level communication infrastructure by moving all necessary components (btl/rcache/allocator/mpool) down in OPAL
All the components required for inter-process communications are currently deeply integrated in the OMPI layer. Several groups/institutions have express interest in having a more generic communication infrastructure, without all the OMPI layer dependencies. This communication layer should be made available at a different software level, available to all layers in the Open MPI software stack. As an example, our ORTE layer could replace the current OOB and instead use the BTL directly, gaining access to more reactive network interfaces than TCP. Similarly, external software libraries could take advantage of our highly optimized AM (active message) communication layer for their own purpose. UTK with support from Sandia, developped a version of Open MPI where the entire communication infrastucture has been moved down to OPAL (btl/rcache/allocator/mpool). Most of the moved components have been updated to match the new schema, with few exceptions (mainly BTLs where I have no way of compiling/testing them). Thus, the completion of this RFC is tied to being able to completing this move for all BTLs. For this we need help from the rest of the Open MPI community, especially those supporting some of the BTLs. A non-exhaustive list of BTLs that qualify here is: mx, portals4, scif, udapl, ugni, usnic.
This commit was SVN r32317.
2014-07-26 04:47:28 +04:00
|
|
|
if(OPAL_SUCCESS == rc) {
|
2007-09-03 14:56:55 +04:00
|
|
|
unregister_tree_item(mpool_tree_item);
|
2010-03-25 06:29:27 +03:00
|
|
|
mca_mpool_base_tree_item_put(mpool_tree_item);
|
|
|
|
}
|
2015-06-24 06:59:57 +03:00
|
|
|
|
2005-07-01 19:04:42 +04:00
|
|
|
return rc;
|
2005-05-31 23:07:27 +04:00
|
|
|
}
|