Check ngcards agains ranks per node

This commit is contained in:
Gallo Alejandro 2022-08-14 15:36:22 +02:00
parent 7241bbe9fb
commit 76a785044d

View File

@ -71,16 +71,18 @@ Atrip::Output Atrip::run(Atrip::Input<F> const& in) {
#if defined(HAVE_CUDA) #if defined(HAVE_CUDA)
int ngcards; int ngcards;
const auto clusterInfo = getClusterInfo(Atrip::communicator);
cuDeviceGetCount(&ngcards); cuDeviceGetCount(&ngcards);
LOG(0,"Atrip") << "ngcards: " << ngcards << "\n"; LOG(0,"Atrip") << "ngcards: " << ngcards << "\n";
if (np > ngcards) { if (clusterInfo.ranksPerNode > ngcards) {
std::cerr << "ATRIP: You are running on more ranks than the number of graphic cards\n" std::cerr << "ATRIP: You are running on more ranks per node than the number of graphic cards\n"
<< "You have " << ngcards << " cards at your disposal\n"; << "You have " << ngcards << " cards at your disposal\n";
throw ""; throw "";
} }
if (np < ngcards) { if (clusterInfo.ranksPerNode < ngcards) {
std::cerr << "You have " << ngcards << " cards at your disposal\n" std::cerr << "You have " << ngcards << " cards at your disposal\n"
<< "You will be only using " << np << ", i.e., the nubmer of ranks.\n"; << "You will be only using " << clusterInfo.ranksPerNode
<< ", i.e., the nubmer of ranks.\n";
} }