1 /*
2  *  gretl -- Gnu Regression, Econometrics and Time-series Library
3  *  Copyright (C) 2001 Allin Cottrell and Riccardo "Jack" Lucchetti
4  *
5  *  This program is free software: you can redistribute it and/or modify
6  *  it under the terms of the GNU General Public License as published by
7  *  the Free Software Foundation, either version 3 of the License, or
8  *  (at your option) any later version.
9  *
10  *  This program is distributed in the hope that it will be useful,
11  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
12  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13  *  GNU General Public License for more details.
14  *
15  *  You should have received a copy of the GNU General Public License
16  *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
17  *
18  */
19 
20 #ifndef GRETL_MPI_H
21 #define GRETL_MPI_H
22 
23 typedef enum {
24     GRETL_MPI_SUM = 1,
25     GRETL_MPI_PROD,
26     GRETL_MPI_MAX,
27     GRETL_MPI_MIN,
28     GRETL_MPI_HCAT,
29     GRETL_MPI_VCAT,
30     GRETL_MPI_ACAT,
31     GRETL_MPI_HSPLIT,
32     GRETL_MPI_VSPLIT
33 } Gretl_MPI_Op;
34 
35 int gretl_MPI_init (void);
36 
37 int gretl_mpi_initialized (void);
38 
39 int gretl_mpi_rank (void);
40 
41 int gretl_mpi_n_processes (void);
42 
43 int gretl_mpi_barrier (void);
44 
45 int gretl_mpi_bcast (void *p, GretlType type, int root);
46 
47 int gretl_mpi_send (void *p, GretlType type, int dest);
48 
49 int gretl_matrix_mpi_send (const gretl_matrix *m, int dest);
50 
51 gretl_matrix *gretl_matrix_mpi_receive (int source, int *err);
52 
53 int gretl_matrix_mpi_fill (gretl_matrix **pm, int source);
54 
55 int gretl_matrix_mpi_reduce (gretl_matrix *sm,
56 			     gretl_matrix **pm,
57 			     Gretl_MPI_Op op,
58 			     int root,
59 			     gretlopt opt);
60 
61 int gretl_scalar_mpi_reduce (double x,
62 			     double *xp,
63 			     Gretl_MPI_Op op,
64 			     int root,
65 			     gretlopt opt);
66 
67 int gretl_matrix_mpi_scatter (const gretl_matrix *m,
68 			      gretl_matrix **recvm,
69 			      Gretl_MPI_Op op,
70 			      int root);
71 
72 int gretl_array_mpi_reduce (gretl_array *sa,
73 			    gretl_array **pa,
74 			    Gretl_MPI_Op op,
75 			    int root);
76 
77 void *gretl_mpi_receive (int source, GretlType *type,
78 			 int *err);
79 
80 double gretl_mpi_time (void);
81 
82 int shm_write_matrix (const gretl_matrix *m,
83 		      const char *fname);
84 
85 gretl_matrix *shm_read_matrix (const char *fname,
86 			       int finalize,
87 			       int *err);
88 
89 int shm_finalize_matrix (const char *fname);
90 
91 #endif /* GRETL_MPI_H */
92