00001 00002 /******************************************************* 00003 * 00004 * Copyright (c) 2003-2009 by University of Queensland 00005 * Earth Systems Science Computational Center (ESSCC) 00006 * http://www.uq.edu.au/esscc 00007 * 00008 * Primary Business: Queensland, Australia 00009 * Licensed under the Open Software License version 3.0 00010 * http://www.opensource.org/licenses/osl-3.0.php 00011 * 00012 *******************************************************/ 00013 00014 00015 /**************************************************************/ 00016 00017 /* Paso: coupler */ 00018 00019 /**************************************************************/ 00020 00021 /* Author: gross@access.edu.au */ 00022 00023 /**************************************************************/ 00024 00025 #ifndef INC_PASO_COUPLER 00026 #define INC_PASO_COUPLER 00027 00028 #include "SharedComponents.h" 00029 /**************************************************************/ 00030 00031 typedef struct Paso_Connector { 00032 00033 Paso_SharedComponents* send; 00034 Paso_SharedComponents* recv; 00035 dim_t reference_counter; 00036 Paso_MPIInfo *mpi_info; 00037 00038 } Paso_Connector; 00039 typedef struct Paso_Coupler { 00040 00041 dim_t block_size; 00042 00043 Paso_Connector* connector; 00044 00045 double *data; /* unmanaged pointer to data be send */ 00046 double *send_buffer; 00047 double *recv_buffer; 00048 #ifdef PASO_MPI 00049 MPI_Request* mpi_requests; 00050 MPI_Status* mpi_stati; 00051 #else 00052 void* mpi_requests; 00053 void* mpi_stati; 00054 #endif 00055 00056 dim_t reference_counter; 00057 Paso_MPIInfo *mpi_info; 00058 00059 } Paso_Coupler; 00060 00061 00062 00063 PASO_DLL_API 00064 Paso_Connector* Paso_Connector_alloc(Paso_SharedComponents * send, Paso_SharedComponents* recv); 00065 00066 PASO_DLL_API 00067 Paso_Connector* Paso_Connector_getReference(Paso_Connector*); 00068 00069 PASO_DLL_API 00070 Paso_Connector* Paso_Connector_unroll(Paso_Connector* in, index_t block_size); 00071 00072 PASO_DLL_API 00073 Paso_Connector* Paso_Connector_copy(Paso_Connector* in); 00074 00075 PASO_DLL_API 00076 void Paso_Connector_free(Paso_Connector*); 00077 00078 00079 PASO_DLL_API 00080 Paso_Coupler* Paso_Coupler_alloc(Paso_Connector*, dim_t blockSize); 00081 00082 PASO_DLL_API 00083 Paso_Coupler* Paso_Coupler_getReference(Paso_Coupler*); 00084 00085 PASO_DLL_API 00086 void Paso_Coupler_startCollect(Paso_Coupler* self,const double* in); 00087 00088 PASO_DLL_API 00089 double* Paso_Coupler_finishCollect(Paso_Coupler* self); 00090 00091 PASO_DLL_API 00092 void Paso_Coupler_free(Paso_Coupler* in); 00093 00094 #define Paso_Coupler_borrowLocalData(_in_) (_in_)->data 00095 #define Paso_Coupler_borrowRemoteData(_in_) (_in_)->recv_buffer 00096 00097 PASO_DLL_API 00098 void Paso_Coupler_copyAll(const Paso_Coupler* src, Paso_Coupler* target); 00099 00100 PASO_DLL_API 00101 dim_t Paso_Coupler_getLocalLength(const Paso_Coupler* in); 00102 #endif