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

Use new logger in IndexRearrangementForStreams

parent a283a377
No related branches found
No related tags found
1 merge request!167Add some tests to GridGenerator in VFGPU
#include "IndexRearrangementForStreams.h" #include "IndexRearrangementForStreams.h"
#include "Communication/Communicator.h" #include "Communication/Communicator.h"
#include "Logger.h"
#include "Parameter/Parameter.h" #include "Parameter/Parameter.h"
#include <GridGenerator/grid/Grid.h> #include <GridGenerator/grid/Grid.h>
#include <GridGenerator/grid/GridBuilder/GridBuilder.h> #include <GridGenerator/grid/GridBuilder/GridBuilder.h>
...@@ -19,60 +20,63 @@ void IndexRearrangementForStreams::initCommunicationArraysForCommAfterFinetoCoar ...@@ -19,60 +20,63 @@ void IndexRearrangementForStreams::initCommunicationArraysForCommAfterFinetoCoar
int indexOfProcessNeighbor, int indexOfProcessNeighbor,
int direction) const int direction) const
{ {
std::cout << "communication: reorder send indices X "; VF_LOG_INFO("Communication: reorder send indices in x direction");
// std::cout << "communication: reorder send indices X ";
std::vector<uint> sendIndicesForCommAfterFtoCPositions = std::vector<uint> sendIndicesForCommAfterFtoCPositions =
initSendIndicesForCommAfterFToCX(level, indexOfProcessNeighbor, direction); initSendIndicesForCommAfterFToCX(level, indexOfProcessNeighbor, direction);
std::cout << "mpi send and receive "; // std::cout << "mpi send and receive ";
std::vector<uint> recvIndicesForCommAfterFtoCPositions = exchangeIndicesForCommAfterFtoCX( std::vector<uint> recvIndicesForCommAfterFtoCPositions = exchangeIndicesForCommAfterFtoCX(
level, indexOfProcessNeighbor, sendIndicesForCommAfterFtoCPositions); level, indexOfProcessNeighbor, sendIndicesForCommAfterFtoCPositions);
std::cout << "reorder receive indices "; // std::cout << "reorder receive indices ";
initRecvIndicesForCommAfterFToCX(level, indexOfProcessNeighbor, direction, recvIndicesForCommAfterFtoCPositions); initRecvIndicesForCommAfterFToCX(level, indexOfProcessNeighbor, direction, recvIndicesForCommAfterFtoCPositions);
copyProcessNeighborToCommAfterFtoCX(level, indexOfProcessNeighbor); copyProcessNeighborToCommAfterFtoCX(level, indexOfProcessNeighbor);
std::cout << "done." << std::endl; // std::cout << "done." << std::endl;
} }
void IndexRearrangementForStreams::initCommunicationArraysForCommAfterFinetoCoarseY(uint level, void IndexRearrangementForStreams::initCommunicationArraysForCommAfterFinetoCoarseY(uint level,
int indexOfProcessNeighbor, int indexOfProcessNeighbor,
int direction) const int direction) const
{ {
std::cout << "communication: reorder send indices Y "; VF_LOG_INFO("Communication: reorder send indices in x direction");
// std::cout << "communication: reorder send indices Y ";
std::vector<uint> sendIndicesForCommAfterFtoCPositions = std::vector<uint> sendIndicesForCommAfterFtoCPositions =
initSendIndicesForCommAfterFToCY(level, indexOfProcessNeighbor, direction); initSendIndicesForCommAfterFToCY(level, indexOfProcessNeighbor, direction);
std::cout << "mpi send and receive "; // std::cout << "mpi send and receive ";
std::vector<uint> recvIndicesForCommAfterFtoCPositions = exchangeIndicesForCommAfterFtoCY( std::vector<uint> recvIndicesForCommAfterFtoCPositions = exchangeIndicesForCommAfterFtoCY(
level, indexOfProcessNeighbor, sendIndicesForCommAfterFtoCPositions); level, indexOfProcessNeighbor, sendIndicesForCommAfterFtoCPositions);
std::cout << "reorder receive indices "; // std::cout << "reorder receive indices ";
initRecvIndicesForCommAfterFToCY(level, indexOfProcessNeighbor, direction, recvIndicesForCommAfterFtoCPositions); initRecvIndicesForCommAfterFToCY(level, indexOfProcessNeighbor, direction, recvIndicesForCommAfterFtoCPositions);
copyProcessNeighborToCommAfterFtoCY(level, indexOfProcessNeighbor); copyProcessNeighborToCommAfterFtoCY(level, indexOfProcessNeighbor);
std::cout << "done." << std::endl; // std::cout << "done." << std::endl;
} }
void IndexRearrangementForStreams::initCommunicationArraysForCommAfterFinetoCoarseZ(uint level, void IndexRearrangementForStreams::initCommunicationArraysForCommAfterFinetoCoarseZ(uint level,
int indexOfProcessNeighbor, int indexOfProcessNeighbor,
int direction) const int direction) const
{ {
std::cout << "communication: reorder send indices Z "; VF_LOG_INFO("Communication: reorder send indices in z direction");
// std::cout << "communication: reorder send indices Z ";
std::vector<uint> sendIndicesForCommAfterFtoCPositions = std::vector<uint> sendIndicesForCommAfterFtoCPositions =
initSendIndicesForCommAfterFToCZ(level, indexOfProcessNeighbor, direction); initSendIndicesForCommAfterFToCZ(level, indexOfProcessNeighbor, direction);
std::cout << "mpi send and receive "; // std::cout << "mpi send and receive ";
std::vector<uint> recvIndicesForCommAfterFtoCPositions = exchangeIndicesForCommAfterFtoCZ( std::vector<uint> recvIndicesForCommAfterFtoCPositions = exchangeIndicesForCommAfterFtoCZ(
level, indexOfProcessNeighbor, sendIndicesForCommAfterFtoCPositions); level, indexOfProcessNeighbor, sendIndicesForCommAfterFtoCPositions);
std::cout << "reorder receive indices "; // std::cout << "reorder receive indices ";
initRecvIndicesForCommAfterFToCZ(level, indexOfProcessNeighbor, direction, recvIndicesForCommAfterFtoCPositions); initRecvIndicesForCommAfterFToCZ(level, indexOfProcessNeighbor, direction, recvIndicesForCommAfterFtoCPositions);
copyProcessNeighborToCommAfterFtoCZ(level, indexOfProcessNeighbor); copyProcessNeighborToCommAfterFtoCZ(level, indexOfProcessNeighbor);
std::cout << "done." << std::endl; // std::cout << "done." << std::endl;
} }
std::vector<uint> IndexRearrangementForStreams::initSendIndicesForCommAfterFToCX(uint level, int indexOfProcessNeighbor, std::vector<uint> IndexRearrangementForStreams::initSendIndicesForCommAfterFToCX(uint level, int indexOfProcessNeighbor,
...@@ -318,14 +322,11 @@ void IndexRearrangementForStreams::reorderSendIndicesForCommAfterFtoC( ...@@ -318,14 +322,11 @@ void IndexRearrangementForStreams::reorderSendIndicesForCommAfterFtoC(
int *sendIndices, int &numberOfSendNodesAfterFtoC, int direction, int level, int *sendIndices, int &numberOfSendNodesAfterFtoC, int direction, int level,
std::vector<uint> &sendIndicesForCommAfterFtoCPositions) const std::vector<uint> &sendIndicesForCommAfterFtoCPositions) const
{ {
*logging::out << logging::Logger::INFO_INTERMEDIATE VF_LOG_INFO("Reorder send indices for communication after fine to coarse: level: {} direction: {}", level,
<< "reorder send indices for communication after fine to coarse: level: " << level direction);
<< " direction: " << direction;
if (para->getParH(level)->intCF.kCF == 0 || para->getParH(level)->intFC.kFC == 0) if (para->getParH(level)->intCF.kCF == 0 || para->getParH(level)->intFC.kFC == 0)
*logging::out << logging::Logger::LOGGER_ERROR VF_LOG_CRITICAL("reorderSendIndicesForCommAfterFtoC(): para->getParH(level)->intCF needs to be initialized "
<< "reorderSendIndicesForCommAfterFtoC(): para->getParH(level)->intCF needs to be initialized before calling " "before calling this function");
"this function "
<< "\n";
int sparseIndexSend; int sparseIndexSend;
std::vector<int> sendIndicesAfterFtoC; std::vector<int> sendIndicesAfterFtoC;
...@@ -358,17 +359,13 @@ void IndexRearrangementForStreams::reorderSendIndicesForCommAfterFtoC( ...@@ -358,17 +359,13 @@ void IndexRearrangementForStreams::reorderSendIndicesForCommAfterFtoC(
for (uint i = 0; i < (uint)sendIndicesOther.size(); i++) for (uint i = 0; i < (uint)sendIndicesOther.size(); i++)
sendIndices[i + numberOfSendNodesAfterFtoC] = sendIndicesOther[i]; sendIndices[i + numberOfSendNodesAfterFtoC] = sendIndicesOther[i];
*logging::out << logging::Logger::INFO_INTERMEDIATE << "... Process " VF_LOG_INFO("Reorder send indices: process {}, numberOfSendNodesAfterFtoC {}", communicator.getPID(),
<< " " << communicator.getPID() numberOfSendNodesAfterFtoC);
<< " numberOfSendNodesAfterFtoC: " << numberOfSendNodesAfterFtoC << "\n ";
if (numberOfSendNodesAfterFtoC + sendIndicesOther.size() != numberOfSendIndices) { if (numberOfSendNodesAfterFtoC + sendIndicesOther.size() != numberOfSendIndices) {
*logging::out << logging::Logger::LOGGER_ERROR VF_LOG_CRITICAL("reorderSendIndicesForCommAfterFtoC(): incorrect number of nodes");
<< "reorderSendIndicesForCommAfterFtoC(): incorrect number of nodes" VF_LOG_CRITICAL("numberOfSendNodesAfterFtoC = {}, sendIndicesOther.size() = {}, numberOfSendIndices = {}",
<< "\n"; numberOfSendNodesAfterFtoC, sendIndicesOther.size(), numberOfSendIndices);
std::cout << "numberOfSendNodesAfterFtoC = " << numberOfSendNodesAfterFtoC
<< ", sendOrIndicesOther.size() = " << sendIndicesOther.size()
<< ", numberOfSendOrRecvIndices = " << numberOfSendIndices << std::endl;
} }
} }
...@@ -482,15 +479,11 @@ void IndexRearrangementForStreams::reorderRecvIndicesForCommAfterFtoC( ...@@ -482,15 +479,11 @@ void IndexRearrangementForStreams::reorderRecvIndicesForCommAfterFtoC(
int *recvIndices, int &numberOfRecvNodesAfterFtoC, int direction, int level, int *recvIndices, int &numberOfRecvNodesAfterFtoC, int direction, int level,
std::vector<uint> &sendIndicesForCommAfterFtoCPositions) const std::vector<uint> &sendIndicesForCommAfterFtoCPositions) const
{ {
*logging::out << logging::Logger::INFO_INTERMEDIATE VF_LOG_INFO("Reorder recv indices for communication after fine to coarse: level: {} direction: {}", level,
<< "reorder receive indices for communication after fine to coarse: level: " << level direction);
<< " direction: " << direction;
std::cout << "\n n send indices: " << (uint)sendIndicesForCommAfterFtoCPositions.size() << std::endl; if (sendIndicesForCommAfterFtoCPositions.size() <= 0)
if (sendIndicesForCommAfterFtoCPositions.size() == 0) VF_LOG_WARNING("ReorderRecvIndicesForCommAfterFtoC(): sendIndicesForCommAfterFtoCPositions is empty.");
*logging::out << logging::Logger::INFO_HIGH
<< "reorderRecvIndicesForCommAfterFtoC(): sendIndicesForCommAfterFtoCPositions is empty."
<< "\n";
uint numberOfRecvIndices = builder->getNumberOfReceiveIndices(direction, level); uint numberOfRecvIndices = builder->getNumberOfReceiveIndices(direction, level);
std::vector<int> recvIndicesAfterFtoC; std::vector<int> recvIndicesAfterFtoC;
...@@ -510,16 +503,12 @@ void IndexRearrangementForStreams::reorderRecvIndicesForCommAfterFtoC( ...@@ -510,16 +503,12 @@ void IndexRearrangementForStreams::reorderRecvIndicesForCommAfterFtoC(
for (uint i = 0; i < (uint)recvIndicesOther.size(); i++) for (uint i = 0; i < (uint)recvIndicesOther.size(); i++)
recvIndices[i + numberOfRecvNodesAfterFtoC] = recvIndicesOther[i]; recvIndices[i + numberOfRecvNodesAfterFtoC] = recvIndicesOther[i];
*logging::out << logging::Logger::INFO_INTERMEDIATE << "... Process " VF_LOG_INFO("Reorder send indices: process {}, numberOfRecvNodesAfterFtoC {}", communicator.getPID(),
<< " " << communicator.getPID() numberOfRecvNodesAfterFtoC);
<< " numberOfRecvNodesAfterFtoC: " << numberOfRecvNodesAfterFtoC << "\n ";
if (numberOfRecvNodesAfterFtoC + recvIndicesOther.size() != numberOfRecvIndices) { if (numberOfRecvNodesAfterFtoC + recvIndicesOther.size() != numberOfRecvIndices) {
*logging::out << logging::Logger::LOGGER_ERROR VF_LOG_CRITICAL("reorderRecvIndicesForCommAfterFtoC(): incorrect number of nodes");
<< "reorderRecvIndicesForCommAfterFtoC(): incorrect number of nodes" VF_LOG_CRITICAL("numberOfRecvNodesAfterFtoC = {}, recvIndicesOther.size() = {}, numberOfRecvIndices = {}",
<< "\n"; numberOfRecvNodesAfterFtoC, recvIndicesOther.size(), numberOfRecvIndices);
std::cout << "numberOfRecvNodesAfterFtoC = " << numberOfRecvNodesAfterFtoC
<< ", recvIndicesOther.size() = " << recvIndicesOther.size()
<< ", numberOfRecvIndices = " << numberOfRecvIndices << std::endl;
} }
} }
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