MACSio  0.9
Multi-purpose, Application-Centric, Scalable I/O Proxy App
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
macsio_mif.h
Go to the documentation of this file.
1 #ifndef _MACSIO_MIF_H
2 #define _MACSIO_MIF_H
3 /*
4 Copyright (c) 2015, Lawrence Livermore National Security, LLC.
5 Produced at the Lawrence Livermore National Laboratory.
6 Written by Mark C. Miller
7 
8 LLNL-CODE-676051. All rights reserved.
9 
10 This file is part of MACSio
11 
12 Please also read the LICENSE file at the top of the source code directory or
13 folder hierarchy.
14 
15 This program is free software; you can redistribute it and/or modify it under
16 the terms of the GNU General Public License (as published by the Free Software
17 Foundation) version 2, dated June 1991.
18 
19 This program is distributed in the hope that it will be useful, but WITHOUT
20 ANY WARRANTY; without even the IMPLIED WARRANTY OF MERCHANTABILITY or FITNESS
21 FOR A PARTICULAR PURPOSE. See the terms and conditions of the GNU General
22 Public License for more details.
23 
24 You should have received a copy of the GNU General Public License along with
25 this program; if not, write to the Free Software Foundation, Inc., 59 Temple
26 Place, Suite 330, Boston, MA 02111-1307 USA
27 */
28 
29 #include <stdlib.h>
30 
31 #ifdef HAVE_MPI
32 #include <mpi.h>
33 #endif
34 
144 #ifdef __cplusplus
145 extern "C" {
146 #endif
147 
148 #define MACSIO_MIF_READ 0
149 #define MACSIO_MIF_WRITE 1
150 #define MACSIO_MIF_SCR_OFF 0
151 #define MACSIO_MIF_SCR_ON 1
152 
153 typedef struct _MACSIO_MIF_ioFlags_t
154 {
155  unsigned int do_wr : 1;
156  unsigned int use_scr : 1;
158 
160 typedef void *(*MACSIO_MIF_CreateCB)(const char *fname, const char *nsname, void *udata);
161 typedef void *(*MACSIO_MIF_OpenCB) (const char *fname, const char *nsname,
162  MACSIO_MIF_ioFlags_t ioFlags, void *udata);
163 #warning MAKE CLOSE CALLBACK RETURN SUCCESS OR FAILURE
164 typedef void (*MACSIO_MIF_CloseCB) (void *file, void *udata);
165 
166 #warning ENSURE DIFFERENT INSTANCES USE DIFFERENT MPI TAGS
167 #ifdef HAVE_MPI
168 extern MACSIO_MIF_baton_t *MACSIO_MIF_Init(int numFiles, MACSIO_MIF_ioFlags_t ioFlags,
169  MPI_Comm mpiComm, int mpiTag,
171  void *userData);
172 #else
173 extern MACSIO_MIF_baton_t *MACSIO_MIF_Init(int numFiles, MACSIO_MIF_ioFlags_t ioFlags,
174  int mpiComm, int mpiTag,
176  void *userData);
177 #endif
178 extern void MACSIO_MIF_Finish(MACSIO_MIF_baton_t *bat);
179 extern void * MACSIO_MIF_WaitForBaton(MACSIO_MIF_baton_t *Bat, const char *fname, const char *nsname);
180 extern void MACSIO_MIF_HandOffBaton(const MACSIO_MIF_baton_t *Bat, void *file);
181 extern int MACSIO_MIF_RankOfGroup(const MACSIO_MIF_baton_t *Bat, int rankInComm);
182 extern int MACSIO_MIF_RankInGroup(const MACSIO_MIF_baton_t *Bat, int rankInComm);
183 
184 #ifdef __cplusplus
185 }
186 #endif
187 
190 #endif /* #ifndef _MACSIO_MIF_H */
unsigned int use_scr
Definition: macsio_mif.h:156
int MACSIO_MIF_RankOfGroup(MACSIO_MIF_baton_t const *Bat, int rankInComm)
Rank of the group in which a given (global) rank exists.
Definition: macsio_mif.c:311
struct _MACSIO_MIF_ioFlags_t MACSIO_MIF_ioFlags_t
unsigned int do_wr
Definition: macsio_mif.h:155
void * MACSIO_MIF_WaitForBaton(MACSIO_MIF_baton_t *Bat, char const *fname, char const *nsname)
Wait for exclusive access to the group's file.
Definition: macsio_mif.c:210
void *(* MACSIO_MIF_CreateCB)(const char *fname, const char *nsname, void *udata)
Definition: macsio_mif.h:160
MACSIO_MIF_CloseCB closeCb
Definition: macsio_mif.c:72
void MACSIO_MIF_Finish(MACSIO_MIF_baton_t *bat)
End a MACSIO_MIF I/O operation and free resources.
Definition: macsio_mif.c:191
MACSIO_MIF_ioFlags_t ioFlags
Definition: macsio_mif.c:53
void(* MACSIO_MIF_CloseCB)(void *file, void *udata)
Definition: macsio_mif.h:164
MACSIO_MIF_CreateCB createCb
Definition: macsio_mif.c:70
void *(* MACSIO_MIF_OpenCB)(const char *fname, const char *nsname, MACSIO_MIF_ioFlags_t ioFlags, void *udata)
Definition: macsio_mif.h:161
MACSIO_MIF_baton_t * MACSIO_MIF_Init(int numFiles, MACSIO_MIF_ioFlags_t ioFlags, MPI_Comm mpiComm, int mpiTag, MACSIO_MIF_CreateCB createCb, MACSIO_MIF_OpenCB openCb, MACSIO_MIF_CloseCB closeCb, void *clientData)
Initialize MACSIO_MIF for a MIF I/O operation.
Definition: macsio_mif.c:102
int MACSIO_MIF_RankInGroup(MACSIO_MIF_baton_t const *Bat, int rankInComm)
Rank within a group of a given (global) rank.
Definition: macsio_mif.c:339
MACSIO_MIF_OpenCB openCb
Definition: macsio_mif.c:71
void MACSIO_MIF_HandOffBaton(MACSIO_MIF_baton_t const *Bat, void *file)
Release exclusive access to the group's file.
Definition: macsio_mif.c:284