Skip to content
Snippets Groups Projects
Commit b52af263 authored by Anna Wellmann's avatar Anna Wellmann
Browse files

Gather NUPS of all GPUs and print to console

parent 8acb1a2c
No related branches found
No related tags found
1 merge request!104Add Communication Hiding to GPU version
......@@ -205,5 +205,17 @@ int Communicator::mapCudaDevice(const int &rank, const int &size, const std::vec
return device;
}
std::vector<double> Communicator::gatherNUPS(double processNups)
{
double *buffer_send = &processNups;
double *buffer_recv = buffer_recv = (double *)malloc(sizeof(double) * this->numprocs);
MPI_Gather(buffer_send, 1, MPI_DOUBLE, buffer_recv, 1, MPI_DOUBLE, 0, commGPU);
if (this->PID == 0)
return std::vector<double>(buffer_recv, buffer_recv + this->numprocs);
return std::vector<double>();
}
} // namespace GPU
} // namespace VF
......@@ -60,6 +60,8 @@ public:
void stopTimer();
double getTime();
int mapCudaDevice(const int &rank, const int &size, const std::vector<unsigned int> &devices, const int &maxdev);
std::vector<double> gatherNUPS(double processNups);
protected:
private:
static Communicator* instanz;
......
......@@ -988,6 +988,21 @@ void Simulation::run()
output << "Nups in Mio: " << fnups << "\n";
output << "Durchsatz in GB/sec: " << durchsatz << "\n";
//////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////
// When using multiple GPUs, get Nups of all processes
if (para->getMaxDev() > 1) {
std::vector<double> nups = comm->gatherNUPS(fnups);
if (comm->getPID() == 0) {
double sum = 0;
for (uint pid = 0; pid < nups.size(); pid++) {
output << "Process " << pid << ": Nups in Mio: " << nups[pid] << "\n";
sum += nups[pid];
}
output << "Sum of all processes: Nups in Mio: " << sum << "\n";
}
}
//////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
//printDragLift(para);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment