1 /*****************************************************************************/ 2 /* XDMF */ 3 /* eXtensible Data Model and Format */ 4 /* */ 5 /* Id : XdmfDSMDriver.hpp */ 6 /* */ 7 /* Author: */ 8 /* Andrew Burns */ 9 /* andrew.j.burns2@us.army.mil */ 10 /* US Army Research Laboratory */ 11 /* Aberdeen Proving Ground, MD */ 12 /* */ 13 /* Copyright @ 2013 US Army Research Laboratory */ 14 /* All Rights Reserved */ 15 /* See Copyright.txt for details */ 16 /* */ 17 /* This software is distributed WITHOUT ANY WARRANTY; without */ 18 /* even the implied warranty of MERCHANTABILITY or FITNESS */ 19 /* FOR A PARTICULAR PURPOSE. See the above copyright notice */ 20 /* for more information. */ 21 /* */ 22 /*****************************************************************************/ 23 24 /*========================================================================= 25 This code is derived from an earlier work and is distributed 26 with permission from, and thanks to ... 27 =========================================================================*/ 28 29 /*========================================================================= 30 31 Project : H5FDdsm 32 Module : H5FDdsmDriver.h H5FDdsm.h 33 34 Authors: 35 John Biddiscombe Jerome Soumagne 36 biddisco@cscs.ch soumagne@cscs.ch 37 38 Copyright (C) CSCS - Swiss National Supercomputing Centre. 39 You may use modify and and distribute this code freely providing 40 1) This copyright notice appears on all copies of source code 41 2) An acknowledgment appears with any substantial usage of the code 42 3) If this code is contributed to any other open source project, it 43 must not be reformatted such that the indentation, bracketing or 44 overall style is modified significantly. 45 46 This software is distributed WITHOUT ANY WARRANTY; without even the 47 implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 48 49 This work has received funding from the European Community's Seventh 50 Framework Programme (FP7/2007-2013) under grant agreement 225967 âxtMuSEâOB 51 =========================================================================*/ 52 53 #ifndef XDMFDSMDRIVER_HPP_ 54 #define XDMFDSMDRIVER_HPP_ 55 56 // Forward Declarations 57 58 // Includes 59 #include <XdmfDSMBuffer.hpp> 60 #include <XdmfDSMCommMPI.hpp> 61 //#include <XdmfDSMManager.hpp> 62 #include <XdmfDSM.hpp> 63 #include <mpi.h> 64 65 #include "H5Ipublic.h" 66 #include "H5FDpublic.h" 67 68 #ifndef H5_HAVE_PARALLEL 69 #pragma Error : The XdmfDSM virtual File Driver for HDF5 can only be compiled against an HDF5 library with parallel IO support 70 #endif 71 72 #define XDMF_DSM_NOTIFY_NONE 0x0000 73 #define XDMF_DSM_NOTIFY_DATA 0x0001 /* this is the default */ 74 #define XDMF_DSM_NOTIFY_INFORMATION 0x0002 75 /* Internal notifications */ 76 #define XDMF_DSM_NOTIFY_WAIT 0x0003 77 #define XDMF_DSM_NOTIFY_CONNECTED 0x0004 78 #define XDMF_DSM_NOTIFY_DISCONNECTED 0x0005 79 /* User notifications */ 80 #define XDMF_DSM_NOTIFY_USER 0x0010 81 82 #define XDMF_DSM (XDMF_dsm_init()) 83 84 #define IS_XDMF_DSM(f) /* (H5F_t *f) */ \ 85 (XDMF_DSM==H5F_DRIVER_ID(f)) 86 87 #ifndef H5_HAVE_VFD_EXTENSIONS 88 #include "H5FDmpio.h" 89 90 #ifndef H5FD_FEAT_HAS_MPI 91 // This is a temporary solution to allow interface with standard hdf5 in addition to hdf5vfd 92 // Hopefully a better solution will be made in the future 93 #define XDMF_dsm_init H5FD_mpio_init 94 //#pragma message(": warning Xdmf: H5FD mpiposix file driver replaced to enable dsm compatibility with hdf5") 95 #endif 96 #endif /* H5_HAVE_VFD_EXTENSIONS */ 97 98 extern "C" { 99 XDMFDSM_EXPORT hid_t XDMF_dsm_init(void); 100 #if H5_VERSION_GE(1,9,0) 101 XDMFDSM_EXPORT herr_t XDMF_dsm_term(void); 102 #else 103 XDMFDSM_EXPORT void XDMF_dsm_term(void); 104 #endif 105 // lock and unlock are currently disabled the user has to make allowances 106 // to prevent race conditions 107 XDMFDSM_EXPORT herr_t XDMF_dsm_lock(void); 108 XDMFDSM_EXPORT herr_t XDMF_dsm_unlock(unsigned long flag); 109 // Currently no options to set 110 XDMFDSM_EXPORT herr_t XDMF_dsm_set_options(unsigned long flags); 111 XDMFDSM_EXPORT herr_t XDMF_dsm_set_manager(void *manager); 112 XDMFDSM_EXPORT herr_t XDMFH5Pset_fapl_dsm(hid_t fapl_id, MPI_Comm intra_comm, 113 void *local_buf_ptr, size_t local_buf_len); 114 XDMFDSM_EXPORT herr_t XDMFH5Pget_fapl_dsm(hid_t fapl_id, MPI_Comm *intra_comm /* out */, 115 void **local_buf_ptr_ptr /* out */, size_t *local_buf_len_ptr /* out */); 116 117 118 119 120 XDMFDSM_EXPORT void *xdmf_dsm_get_manager(); 121 XDMFDSM_EXPORT herr_t xdmf_dsm_get_properties(MPI_Comm *intra_comm, 122 void **buf_ptr_ptr, size_t *buf_len_ptr); 123 XDMFDSM_EXPORT void xdmf_dsm_set_manager(void *manager); 124 125 /* 126 // Probably a bad idea to create managers automatically for the non-threaded version 127 XDMFDSM_EXPORT herr_t xdmf_dsm_alloc(MPI_Comm intra_comm, void *buf_ptr, size_t buf_len); 128 */ 129 XDMFDSM_EXPORT herr_t xdmf_dsm_free(); 130 131 XDMFDSM_EXPORT hbool_t xdmf_dsm_is_server(); 132 // Currently no options to set 133 XDMFDSM_EXPORT herr_t xdmf_dsm_set_options(unsigned long flags); 134 135 XDMFDSM_EXPORT hbool_t xdmf_dsm_is_connected(); 136 XDMFDSM_EXPORT herr_t xdmf_dsm_connect(); 137 138 XDMFDSM_EXPORT herr_t xdmf_dsm_lock(char * filename); 139 XDMFDSM_EXPORT herr_t xdmf_dsm_unlock(char * filename, unsigned long flag); 140 141 XDMFDSM_EXPORT herr_t xdmf_dsm_read(haddr_t addr, size_t len, void *buf_ptr); 142 XDMFDSM_EXPORT herr_t xdmf_dsm_read_pages(unsigned int * pages, unsigned int numPages, haddr_t addr, size_t len, void *buf_ptr); 143 XDMFDSM_EXPORT herr_t xdmf_dsm_write(haddr_t addr, size_t len, const void *buf_ptr); 144 XDMFDSM_EXPORT herr_t xdmf_dsm_write_pages(unsigned int * pages, unsigned int numPages, haddr_t addr, size_t len, const void *buf_ptr); 145 } 146 147 #endif /* XDMFDSMDRIVER_HPP_ */ 148