From 6b052f54c0c43ed565caf24dcdfa7239781f3ce3 Mon Sep 17 00:00:00 2001 From: George Bosilca Date: Sat, 9 Apr 2005 06:10:16 +0000 Subject: [PATCH] Add the file containing the wrapper around the memory registration. The idea is that on OSes without the possibility to register memory these functions will return some pre-allocated PTL buffers and pack the data inside. This commit was SVN r5239. --- src/mca/ptl/gm/src/ptl_gm_memory.c | 50 ++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) create mode 100644 src/mca/ptl/gm/src/ptl_gm_memory.c diff --git a/src/mca/ptl/gm/src/ptl_gm_memory.c b/src/mca/ptl/gm/src/ptl_gm_memory.c new file mode 100644 index 0000000000..a41ae7f874 --- /dev/null +++ b/src/mca/ptl/gm/src/ptl_gm_memory.c @@ -0,0 +1,50 @@ +/* -*- Mode: C; c-basic-offset:4 ; -*- */ + +/* + * Copyright (c) 2004-2005 The Trustees of Indiana University. + * All rights reserved. + * Copyright (c) 2004-2005 The Trustees of the University of Tennessee. + * All rights reserved. + * Copyright (c) 2004 The Ohio State University. + * All rights reserved. + * 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. + * $COPYRIGHT$ + * + * Additional copyrights may follow + * + * $HEADER$ + */ +#include "ompi_config.h" + +#include "ptl_gm.h" +#include "ptl_gm_priv.h" + +gm_status_t mca_ptl_gm_register_memory(struct gm_port *port, void *ptr, unsigned len) +{ +#if OMPI_MCA_PTL_GM_SUPPORT_REGISTERING +#if OMPI_MCA_PTL_GM_CACHE_ENABLE + gmpi_use_interval( port, (gm_up_t)ptr, len ); + return GM_SUCCESS; +#else + return gm_register_memory( port, ptr, len ); +#endif /* OMPI_MCA_PTL_GM_CACHE_ENABLE */ +#else + return GM_FAILURE; +#endif /* OMPI_MCA_PTL_GM_SUPPORT_REGISTERING */ +} + +gm_status_t mca_ptl_gm_deregister_memory( struct gm_port *port, void *ptr, unsigned len ) +{ +#if OMPI_MCA_PTL_GM_SUPPORT_REGISTERING +#if OMPI_MCA_PTL_GM_CACHE_ENABLE + return gmpi_unuse_interval( port, (gm_up_t)ptr, len ); +#else + return gm_deregister_memory( port, ptr, len ); +#endif /* OMPI_MCA_PTL_GM_CACHE_ENABLE */ +#else + return GM_FAILURE; +#endif /* OMPI_MCA_PTL_GM_SUPPORT_REGISTERING */ +}