1 /* ---------------------------------------------------------------- */
2 /* (C)Copyright IBM Corp.  2007, 2008                               */
3 /* ---------------------------------------------------------------- */
4 /**
5  * \file ad_bg_aggrs.h
6  * \brief ???
7  */
8 
9 /*
10  * File: ad_bg_aggrs.h
11  *
12  * Declares functions specific for BG/L - GPFS parallel I/O solution. The implemented optimizations are:
13  * 	. Aligned file-domain partitioning, integrated in 7/28/2005
14  *
15  * In addition, following optimizations are planned:
16  * 	. Integrating multiple file-domain partitioning schemes
17  *	  (corresponding to Alok Chouhdary's persistent file domain work).
18  */
19 
20 #ifndef AD_BG_AGGRS_H_
21 #define AD_BG_AGGRS_H_
22 
23 #include "adio.h"
24 #include <sys/stat.h>
25 
26 #if !defined(GPFS_SUPER_MAGIC)
27   #define GPFS_SUPER_MAGIC (0x47504653)
28 #endif
29 
30     /* File system (BG) specific information -
31          hung off of ADIOI_FileD file descriptor (fd->fs_ptr) at open */
32     typedef struct ADIOI_BG_fs_s {
33       __blksize_t blksize;
34       int         fsync_aggr; /* "fsync aggregation" flags (below) */
35 #define ADIOI_BG_FSYNC_AGGREGATION_DISABLED  0x00
36 #define ADIOI_BG_FSYNC_AGGREGATION_ENABLED   0x01
37 #define ADIOI_BG_FSYNC_AGGREGATOR            0x10 /* This rank is an aggregator */
38     }  ADIOI_BG_fs;
39 
40     /* generate a list of I/O aggregators that utilizes BG-PSET orginization. */
41     int ADIOI_BG_gen_agg_ranklist(ADIO_File fd, int n_aggrs_per_pset);
42 
43     /* overriding ADIOI_Calc_file_domains() to apply 'aligned file domain partitioning'. */
44     void ADIOI_BG_GPFS_Calc_file_domains(ADIO_Offset *st_offsets,
45 				          ADIO_Offset *end_offsets,
46 				          int          nprocs,
47 				          int          nprocs_for_coll,
48 				          ADIO_Offset *min_st_offset_ptr,
49 				          ADIO_Offset **fd_start_ptr,
50 				          ADIO_Offset **fd_end_ptr,
51 				          ADIO_Offset *fd_size_ptr,
52                   void        *fs_ptr);
53 
54     /* a utilitiy function for debugging */
55     int ADIOI_BG_Aggrs_index(ADIO_File fd, int myrank );
56 
57     /* overriding ADIOI_Calc_aggregator() for the default implementation is specific for
58        static file domain partitioning */
59     int ADIOI_BG_Calc_aggregator(ADIO_File fd,
60 				  ADIO_Offset off,
61 				  ADIO_Offset min_off,
62 				  ADIO_Offset *len,
63 				  ADIO_Offset fd_size,
64 				  ADIO_Offset *fd_start,
65 				  ADIO_Offset *fd_end);
66 
67     /* overriding ADIOI_Calc_my_req for the default implementation is specific for
68        static file domain partitioning */
69     void ADIOI_BG_Calc_my_req ( ADIO_File fd, ADIO_Offset *offset_list, ADIO_Offset *len_list,
70 				 int contig_access_count, ADIO_Offset
71 				 min_st_offset, ADIO_Offset *fd_start,
72 				 ADIO_Offset *fd_end, ADIO_Offset fd_size,
73 				 int nprocs,
74 				 int *count_my_req_procs_ptr,
75 				 int **count_my_req_per_proc_ptr,
76 				 ADIOI_Access **my_req_ptr,
77 				 int **buf_idx_ptr);
78 
79     /*
80      * ADIOI_Calc_others_req
81      *
82      * param[in]  count_my_req_procs        Number of processes whose file domain my
83      *                                        request touches.
84      * param[in]  count_my_req_per_proc     count_my_req_per_proc[i] gives the no. of
85      *                                        contig. requests of this process in
86      *                                        process i's file domain.
87      * param[in]  my_req                    A structure defining my request
88      * param[in]  nprocs                    Number of nodes in the block
89      * param[in]  myrank                    Rank of this node
90      * param[out] count_others_req_proc_ptr Number of processes whose requests lie in
91      *                                        my process's file domain (including my
92      *                                        process itself)
93      * param[out] others_req_ptr            Array of other process' requests that lie
94      *                                        in my process's file domain
95      */
96      void ADIOI_BG_Calc_others_req(ADIO_File fd, int count_my_req_procs,
97 				    int *count_my_req_per_proc,
98 				    ADIOI_Access *my_req,
99 				    int nprocs, int myrank,
100 				    int *count_others_req_procs_ptr,
101 				    ADIOI_Access **others_req_ptr);
102 
103 
104 #endif  /* AD_BG_AGGRS_H_ */
105