Skip to content

Commit

Permalink
Convert C++ types to C types
Browse files Browse the repository at this point in the history
  • Loading branch information
mdjurfeldt committed Jul 19, 2022
1 parent 9e96a6c commit 6f629b7
Show file tree
Hide file tree
Showing 12 changed files with 34 additions and 32 deletions.
2 changes: 1 addition & 1 deletion examples/waveconsumer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ main (int args, char* argv[])

// Declare where in memory to put data
MUSIC::ArrayData dmap (data,
MPI::DOUBLE,
MPI_DOUBLE,
rank * nLocalVars,
nLocalVars);
wavedata->map (&dmap);
Expand Down
4 changes: 2 additions & 2 deletions examples/waveproducer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ main (int argc, char* argv[])

// Declare what data we have to export
MUSIC::ArrayData dmap (data,
MPI::DOUBLE,
MPI_DOUBLE,
rank * nLocalVars,
nLocalVars);
wavedata->map (&dmap);
Expand All @@ -55,7 +55,7 @@ main (int argc, char* argv[])
}

// Broadcast these data out to all nodes
MPI_Bcast (data, nLocalVars, MPI::DOUBLE, 0, comm);
MPI_Bcast (data, nLocalVars, MPI_DOUBLE, 0, comm);
}

runtime->finalize ();
Expand Down
14 changes: 8 additions & 6 deletions src/connector.cc
Original file line number Diff line number Diff line change
Expand Up @@ -213,11 +213,13 @@ namespace MUSIC {
void
OutputConnector::tick ()
{
std::vector<MPI::Request>requests;
for (std::vector<Subconnector*>::iterator s = rsubconn.begin (); s != rsubconn.end ();
++s){
(*s)->maybeCommunicate(requests);
}
std::vector<MPI_Request> requests;
for (std::vector<Subconnector*>::iterator s = rsubconn.begin ();
s != rsubconn.end ();
++s)
{
(*s)->maybeCommunicate (requests);
}
//The spec guarantees vectors store their elements contiguously:
MPI_Waitall(requests.size(), (MPI_Request *)&requests[0], MPI_STATUSES_IGNORE);
}
Expand Down Expand Up @@ -745,7 +747,7 @@ error( "LOCAL Indices are not supported with MUSIC_ANYSOURCE");
EventInputConnector::tick ()
{
//SPIKE_BUFFER_MAX size
//MPI::BYTE type
//MPI_BYTE type
//SPIKE_MSG tag
int size = rsubconn.size();
char data[SPIKE_BUFFER_MAX];
Expand Down
6 changes: 3 additions & 3 deletions src/multibuffer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ namespace MUSIC {
setupRankMap (mpi_get_rank (comm), rankMap);
#if 0
std::ostringstream ostr;
ostr << "Rank " << mpi_get_rank (MPI::COMM_WORLD) << ": rankMap ";
ostr << "Rank " << mpi_get_rank (MPI_COMM_WORLD) << ": rankMap ";
for (RankMap::iterator i = rankMap->begin ();
i != rankMap->end ();
++i)
Expand Down Expand Up @@ -190,7 +190,7 @@ namespace MUSIC {
#if 0
{
std::ostringstream ostr;
ostr << "Rank " << mpi_get_rank (MPI::COMM_WORLD) << ": block_ ranks ";
ostr << "Rank " << mpi_get_rank (MPI_COMM_WORLD) << ": block_ ranks ";
for (Blocks::iterator b = block_.begin (); b != block_.end (); ++b)
ostr << b->rank () << ' ';
std::cout << ostr.str () << std::endl;
Expand Down Expand Up @@ -300,7 +300,7 @@ namespace MUSIC {
// compute required total size
unsigned int summedSize = 0;
unsigned int thisRankSize = 0;
int thisRank = mpi_get_rank (MPI::COMM_WORLD);
int thisRank = mpi_get_rank (MPI_COMM_WORLD);
for (Blocks::iterator b = block_.begin (); b != block_.end (); ++b)
{
unsigned int size;
Expand Down
6 changes: 3 additions & 3 deletions src/music/subconnector.hh
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ namespace MUSIC {

public:
//*fixme* should not create subconnectors with uninitialized members
Subconnector ():type_(MPI::BYTE), flushed(false){};
Subconnector () : type_ (MPI_BYTE), flushed (false) {};
Subconnector (MPI_Datatype type):type_ (type), flushed(false) { }
Subconnector (MPI_Datatype type,
MPI_Comm intercomm,
Expand Down Expand Up @@ -172,10 +172,10 @@ namespace MUSIC {
int remoteRank,
int receiverPortCode);
void maybeCommunicate ();
void maybeCommunicate (std::vector<MPI::Request> &);
void maybeCommunicate (std::vector<MPI_Request> &);

void send ();
void send (std::vector<MPI::Request> &);
void send (std::vector<MPI_Request> &);
void flush (bool& dataStillFlowing);

};
Expand Down
4 changes: 2 additions & 2 deletions src/sampler.cc
Original file line number Diff line number Diff line change
Expand Up @@ -188,10 +188,10 @@ namespace MUSIC {
{
int localIndex = i->begin () - i->local ();
int iSize = i->end () - i->begin ();
if (dataMap->type () == MPI::DOUBLE)
if (dataMap->type () == MPI_DOUBLE)
interpolate (pos, iSize, interpolationCoefficient,
static_cast<double*> (dataMap->base ()) + localIndex);
else if (dataMap->type () == MPI::FLOAT)
else if (dataMap->type () == MPI_FLOAT)
interpolate (pos, iSize, interpolationCoefficient,
static_cast<float*> (dataMap->base ()) + localIndex);
else
Expand Down
16 changes: 8 additions & 8 deletions src/subconnector.cc
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,7 @@ namespace MUSIC {
int remoteLeader,
int remoteRank,
int receiverPortCode)
: Subconnector (MPI::BYTE,
: Subconnector (MPI_BYTE,
intercomm,
remoteLeader,
remoteRank,
Expand All @@ -267,14 +267,14 @@ namespace MUSIC {


void
EventOutputSubconnector::maybeCommunicate (std::vector<MPI::Request> &requests)
EventOutputSubconnector::maybeCommunicate (std::vector<MPI_Request> &requests)
{
send (requests);
}


void
EventOutputSubconnector::send (std::vector<MPI::Request> &requests)
EventOutputSubconnector::send (std::vector<MPI_Request> &requests)
{
MUSIC_LOGRE ("ISend");
void* data;
Expand Down Expand Up @@ -355,7 +355,7 @@ namespace MUSIC {
int remoteRank,
int receiverRank,
int receiverPortCode)
: Subconnector (MPI::BYTE,
: Subconnector (MPI_BYTE,
intercomm,
remoteLeader,
remoteRank,
Expand All @@ -374,7 +374,7 @@ namespace MUSIC {
int receiverRank,
int receiverPortCode,
EventHandlerGlobalIndex* eh)
: Subconnector (MPI::BYTE,
: Subconnector (MPI_BYTE,
intercomm,
remoteLeader,
remoteRank,
Expand Down Expand Up @@ -405,7 +405,7 @@ namespace MUSIC {
int receiverRank,
int receiverPortCode,
EventHandlerLocalIndex* eh)
: Subconnector (MPI::BYTE,
: Subconnector (MPI_BYTE,
intercomm,
remoteLeader,
remoteRank,
Expand Down Expand Up @@ -584,7 +584,7 @@ namespace MUSIC {
int remoteRank,
int receiverPortCode,
FIBO* buffer)
: Subconnector (MPI::BYTE,
: Subconnector (MPI_BYTE,
intercomm,
remoteLeader,
remoteRank,
Expand Down Expand Up @@ -653,7 +653,7 @@ namespace MUSIC {
int receiverRank,
int receiverPortCode,
MessageHandler* mh)
: Subconnector (MPI::BYTE,
: Subconnector (MPI_BYTE,
intercomm,
remoteLeader,
remoteRank,
Expand Down
2 changes: 1 addition & 1 deletion testsuite/sanitytests/clocksource.cc
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ main (int argc, char *argv[])


MUSIC::ArrayData dmap (dataarray,
MPI::DOUBLE,
MPI_DOUBLE,
0,
1);

Expand Down
2 changes: 1 addition & 1 deletion testsuite/sanitytests/constsource.cc
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ main (int argc, char *argv[])


MUSIC::ArrayData dmap (dataarray,
MPI::DOUBLE,
MPI_DOUBLE,
rank * localWidth,
myWidth);

Expand Down
6 changes: 3 additions & 3 deletions testsuite/sanitytests/contdelay.cc
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ main (int argc, char *argv[])
}

MUSIC::ArrayData inMap (&inData,
MPI::DOUBLE,
MPI_DOUBLE,
0,
1);
in->map (&inMap, delay, maxbuffered);
Expand All @@ -153,7 +153,7 @@ main (int argc, char *argv[])
}

MUSIC::ArrayData outMap (&outData,
MPI::DOUBLE,
MPI_DOUBLE,
0,
1);
out->map (&outMap, maxbuffered);
Expand All @@ -165,7 +165,7 @@ main (int argc, char *argv[])
if (aux->isConnected ())
{
MUSIC::ArrayData auxMap (&auxData,
MPI::DOUBLE,
MPI_DOUBLE,
0,
1);
aux->map (&auxMap, delay, maxbuffered);
Expand Down
2 changes: 1 addition & 1 deletion utils/contsink.cc
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ main (int argc, char* argv[])

// Declare where in memory to put data
MUSIC::ArrayData dmap (data,
MPI::DOUBLE,
MPI_DOUBLE,
rank * localWidth,
myWidth);
contdata->map (&dmap, delay, interpolate);
Expand Down
2 changes: 1 addition & 1 deletion utils/eventlogger.cc
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ extern "C" {

const double DEFAULT_TIMESTEP = 0.01;

MPI::Intracomm comm;
MPI_Comm comm;

void
usage (int rank)
Expand Down

0 comments on commit 6f629b7

Please sign in to comment.