FreeNOS
MpiBackend.h
Go to the documentation of this file.
1/*
2 * Copyright (C) 2020 Niek Linnenbank
3 *
4 * This program is free software: you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation, either version 3 of the License, or
7 * (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program. If not, see <http://www.gnu.org/licenses/>.
16 */
17
18#ifndef __LIB_LIBMPI_MPIBACKEND_H
19#define __LIB_LIBMPI_MPIBACKEND_H
20
21#include <Types.h>
22#include <Factory.h>
23#include "mpi.h"
24
36class MpiBackend : public AbstractFactory<MpiBackend>
37{
38 public:
39
47 typedef int Result;
48
49 public:
50
59 virtual Result initialize(int *argc,
60 char ***argv) = 0;
61
67 virtual Result terminate() = 0;
68
78 int *rank) = 0;
79
89 int *size) = 0;
90
103 virtual Result send(const void *buf,
104 int count,
105 MPI_Datatype datatype,
106 int dest,
107 int tag,
108 MPI_Comm comm) = 0;
109
123 virtual Result receive(void *buf,
124 int count,
125 MPI_Datatype datatype,
126 int source,
127 int tag,
128 MPI_Comm comm,
129 MPI_Status *status) = 0;
130};
131
137#endif /* __LIB_LIBMPI_MPIBACKEND_H */
Abstract Factory pattern providing a creation function declaration.
Definition Factory.h:51
Represents a Message Passing Interface (MPI) implementation backend.
Definition MpiBackend.h:37
virtual Result getCommSize(MPI_Comm comm, int *size)=0
Retrieve communication size (total cores)
virtual Result terminate()=0
Terminate the backend.
virtual Result receive(void *buf, int count, MPI_Datatype datatype, int source, int tag, MPI_Comm comm, MPI_Status *status)=0
Synchronous receive data.
virtual Result getCommRank(MPI_Comm comm, int *rank)=0
Retrieve communication rank (core id)
virtual Result send(const void *buf, int count, MPI_Datatype datatype, int dest, int tag, MPI_Comm comm)=0
Synchronous send data.
int Result
Result code.
Definition MpiBackend.h:47
virtual Result initialize(int *argc, char ***argv)=0
Initialize the backend.
MPI_Datatype
Named Predefined Datatypes.
Definition mpi.h:47
uint MPI_Status
Status holder.
Definition mpi.h:41
uint MPI_Comm
Communicator identifier.
Definition mpi.h:38