root/ompi/mca/common/ompio/common_ompio_buffer.h

/* [<][>][^][v][top][bottom][index][help] */

INCLUDED FROM


   1 /* -*- Mode: C; c-basic-offset:4 ; -*- */
   2 /*
   3  * Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana
   4  *                         University Research and Technology
   5  *                         Corporation.  All rights reserved.
   6  * Copyright (c) 2004-2007 The University of Tennessee and The University
   7  *                         of Tennessee Research Foundation.  All rights
   8  *                         reserved.
   9  * Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
  10  *                         University of Stuttgart.  All rights reserved.
  11  * Copyright (c) 2004-2005 The Regents of the University of California.
  12  *                         All rights reserved.
  13  * Copyright (c) 2008-2019 University of Houston. All rights reserved.
  14  * $COPYRIGHT$
  15  *
  16  * Additional copyrights may follow
  17  *
  18  * $HEADER$
  19  */
  20 
  21 #ifndef MCA_COMMON_OMPIO_CUDA_H
  22 #define MCA_COMMON_OMPIO_CUDA_H
  23 
  24 
  25 #define OMPIO_PREPARE_BUF(_fh,_buf,_count,_datatype,_tbuf,_convertor,_max_data,_decoded_iov,_iov_count){ \
  26         OBJ_CONSTRUCT( _convertor, opal_convertor_t);                                    \
  27     opal_convertor_copy_and_prepare_for_send ( _fh->f_file_convertor,  &(_datatype->super), _count, _buf, CONVERTOR_SEND_CONVERSION, _convertor ); \
  28     opal_convertor_get_packed_size( _convertor, &_max_data );           \
  29     _tbuf = mca_common_ompio_alloc_buf (_fh, _max_data);                \
  30     if ( NULL == _tbuf ) {                                              \
  31         opal_output(1, "common_ompio: error allocating memory\n");      \
  32         return OMPI_ERR_OUT_OF_RESOURCE;                                \
  33     }                                                                   \
  34     _decoded_iov = (struct iovec *) malloc ( sizeof ( struct iovec ));  \
  35     if ( NULL == _decoded_iov ) {                                       \
  36         opal_output(1, "common_ompio: could not allocate memory.\n");   \
  37         return OMPI_ERR_OUT_OF_RESOURCE;                                \
  38     }                                                                   \
  39     _decoded_iov->iov_base = _tbuf;                                     \
  40     _decoded_iov->iov_len  = _max_data;                                 \
  41     _iov_count=1;}
  42 
  43 #define OMPIO_PREPARE_READ_BUF(_fh,_buf,_count,_datatype,_tbuf,_convertor,_max_data,_decoded_iov,_iov_count){ \
  44         OBJ_CONSTRUCT( _convertor, opal_convertor_t);                                    \
  45     opal_convertor_copy_and_prepare_for_recv ( _fh->f_file_convertor,  &(_datatype->super), _count, _buf, 0, _convertor ); \
  46     opal_convertor_get_packed_size( _convertor, &_max_data );           \
  47     _tbuf = mca_common_ompio_alloc_buf (_fh, _max_data);                \
  48     if ( NULL == _tbuf ) {                                              \
  49         opal_output(1, "common_ompio: error allocating memory\n");      \
  50         return OMPI_ERR_OUT_OF_RESOURCE;                                \
  51     }                                                                   \
  52     _decoded_iov = (struct iovec *) malloc ( sizeof ( struct iovec ));  \
  53     if ( NULL == _decoded_iov ) {                                       \
  54         opal_output(1, "common_ompio: could not allocate memory.\n");   \
  55         return OMPI_ERR_OUT_OF_RESOURCE;                                \
  56     }                                                                   \
  57     _decoded_iov->iov_base = _tbuf;                                     \
  58     _decoded_iov->iov_len  = _max_data;                                 \
  59     _iov_count=1;}
  60 
  61 #if OPAL_CUDA_SUPPORT
  62 void mca_common_ompio_check_gpu_buf ( ompio_file_t *fh, const void *buf, 
  63                                       int *is_gpu, int *is_managed);
  64 #endif
  65 int mca_common_ompio_buffer_alloc_init ( void );
  66 int mca_common_ompio_buffer_alloc_fini ( void );
  67 
  68 
  69 void* mca_common_ompio_alloc_buf ( ompio_file_t *fh, size_t bufsize);
  70 void mca_common_ompio_release_buf ( ompio_file_t *fh,  void *buf );
  71 
  72 #endif

/* [<][>][^][v][top][bottom][index][help] */