Commit b4cc79fe authored by Florian Goth's avatar Florian Goth
Browse files

-add debug flag to CMAKELIST

-add documentation for MPIServer functions
-add anyMessagefrom function (untested)
parent 256d9596
......@@ -8,7 +8,7 @@ Find_Package(SDL)
SET(CMAKE_CXX_FLAGS_RELEASE "-march=core2 -O3 -mmmx -finline-functions -fopenmp -Wconversion")
SET(CMAKE_C_FLAGS_RELEASE "-march=core2 -O3 -mmmx -finline-functions -fopenmp -Wconversion")
SET(CMAKE_CXX_FLAGS_DEBUG "-march=core2 -gstabs+ -Wall -Wabi -Wconversion")
SET(CMAKE_C_FLAGS_DEBUG "-march=core2 -O3 -mmmx -finline-functions -Wconversion")
SET(CMAKE_C_FLAGS_DEBUG "-march=core2 -O3 -mmmx -finline-functions -Wconversion -gstabs+")
SET(CMAKE_CXX_FLAGS_PROFILED "-O2 -march=core2 -pg -Wconversion")
SET(CMAKE_C_FLAGS_PROFILED "-O3 -march=core2 -pg -Wconversion")
......
......@@ -92,7 +92,7 @@ public:
*/
inline int checkActivity();
/**
Constructor call. it needs argc and argv from the command line, to pass it on to MPI
Constructor call. It needs argc and argv from the command line, to pass it on to MPI
@param argc argc as given from the main funtion
@param argv argv as given from the main function
*/
......@@ -118,7 +118,8 @@ public:
*/
inline const Client& addClient();
/**
this function removes a client(this event can't happen MPI)
This function removes a client(this event can't happen MPI)
@return It returns alwys zero right now...
*/
inline int removeClient(const Client&);
/**
......@@ -131,17 +132,34 @@ public:
*/
template <typename T>
inline bool sendtoallclients(T);
/** This function enables checking for a message from a particular client.
* @param client The client for which to check.
* @return true if MPI_Probe finds some message, else false.
*/
inline bool anyMessagefrom(const Client& client);
private:
bool juststarted;
bool hasdata;
int MPInrofclients;
int alreadyaddedclients;
vector<Client> clients;
MPI_Status status;
MPI_Status status;///< here we store the state of the MPI_Status variable. It enables fetching things like size.
bool status_is_uptodate;
/** checks the status of the internal status variable
*/
void status_valid();
};
bool MPIServer::anyMessagefrom(const Client& client)
{
bool retval;
MPI_Iprobe(client.id, MPI_ANY_TAG, MPI_COMM_WORLD, &retval, &status);
if (!retval) status_is_uptodate = false;
else
status_is_uptodate = true;
return retval;
}
void MPIServer::status_valid()
{
if (!status_is_uptodate) throw MPI_Error("[MPIServer] MPI_Status not up to date!!");
......@@ -174,12 +192,12 @@ Client MPIServer::peekNextOriginator()
bool MPIServer::datapending()
{
int flag;
MPI_Iprobe(MPI_ANY_SOURCE, MPI_ANY_TAG, MPI_COMM_WORLD, &flag, &status);
if (!flag) status_is_uptodate = false;
else
status_is_uptodate = true;
return flag;
int flag;
MPI_Iprobe(MPI_ANY_SOURCE, MPI_ANY_TAG, MPI_COMM_WORLD, &flag, &status);
if (!flag) status_is_uptodate = false;
else
status_is_uptodate = true;
return flag;
}
bool MPIServer::clientringing()
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment