FreeNOS
MpiPing.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 __BIN_MPIPING_MPIPING_H
19 #define __BIN_MPIPING_MPIPING_H
20 
21 #include <POSIXApplication.h>
22 
31 class MpiPing : public POSIXApplication
32 {
33  private:
34 
36  static const int PingMagicNumber = 0xaabbccdd;
37 
39  static const int PongMagicNumber = 0x12345678;
40 
41  public:
42 
49  MpiPing(int argc, char **argv);
50 
54  virtual ~MpiPing();
55 
61  virtual Result initialize();
62 
68  virtual Result exec();
69 
70  private:
71 
81  const int number) const;
82 
92  const int expectedNumber) const;
93 
94  private:
95 
98 
100  int m_id;
101 };
102 
107 #endif /* __BIN_MPIPING_MPIPING_H */
MpiPing::exec
virtual Result exec()
Execute the application.
Definition: MpiPing.cpp:53
MpiPing::receiveNumber
Result receiveNumber(const Size coreId, const int expectedNumber) const
Receive a message containing a number.
Definition: MpiPing.cpp:132
MpiPing::PongMagicNumber
static const int PongMagicNumber
Magic number send for the pong message.
Definition: MpiPing.h:39
MpiPing
Send a ping message via MPI to all available nodes.
Definition: MpiPing.h:31
POSIXApplication
POSIX-compatible application.
Definition: POSIXApplication.h:35
MpiPing::~MpiPing
virtual ~MpiPing()
Destructor.
Definition: MpiPing.cpp:30
POSIXApplication.h
MpiPing::initialize
virtual Result initialize()
Initialize the application.
Definition: MpiPing.cpp:35
Size
unsigned int Size
Any sane size indicator cannot go negative.
Definition: Types.h:128
Application::Result
Result
Result codes.
Definition: Application.h:53
MpiPing::sendNumber
Result sendNumber(const Size coreId, const int number) const
Send a message containing a number.
Definition: MpiPing.cpp:115
MpiPing::m_mpiInitResult
int m_mpiInitResult
Result of MPI initialization.
Definition: MpiPing.h:97
MpiPing::PingMagicNumber
static const int PingMagicNumber
Magic number to send as ping message.
Definition: MpiPing.h:36
coreId
u8 coreId
Definition: IntelACPI.h:64
MpiPing::MpiPing
MpiPing(int argc, char **argv)
Constructor.
Definition: MpiPing.cpp:22
MpiPing::m_id
int m_id
MPI core identifier (rank) of the current process.
Definition: MpiPing.h:100