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

Add debug writer for edge nodes send

parent 68d16794
No related branches found
No related tags found
1 merge request!104Add Communication Hiding to GPU version
......@@ -17,6 +17,7 @@
#include "Output/MeasurePointWriter.hpp"
#include "Output/AnalysisData.hpp"
#include "Output/InterfaceDebugWriter.hpp"
#include "Output/EdgeNodeDebugWriter.hpp"
#include "Output/VeloASCIIWriter.hpp"
//////////////////////////////////////////////////////////////////////////
#include "Utilities/Buffer2D.hpp"
......@@ -389,12 +390,13 @@ void Simulation::init(SPtr<Parameter> para, SPtr<GridProvider> gridProvider, std
//InterfaceDebugWriter::writeInterfaceLinesDebugCF(para.get());
//InterfaceDebugWriter::writeInterfaceLinesDebugFC(para.get());
// writers for Version with communication hiding
// writers for version with communication hiding
if(para->getNumprocs() > 1 && para->getUseStreams()){
InterfaceDebugWriter::writeInterfaceFCC_Send(para.get());
InterfaceDebugWriter::writeInterfaceCFC_Recv(para.get());
InterfaceDebugWriter::writeSendNodesStream(para.get());
InterfaceDebugWriter::writeRecvNodesStream(para.get());
EdgeNodeDebugWriter::writeEdgeNodesXZ_Send(para.get());
}
}
......
#ifndef EDGENODEDEBUG_HPP
#define EDGENODEDEBUG_HPP
#include <fstream>
#include <sstream>
#include <stdio.h>
// #include <math.h>
#include "Core/StringUtilities/StringUtil.h"
#include "LBM/D3Q27.h"
#include "LBM/LB.h"
#include "Parameter/Parameter.h"
#include "basics/utilities/UbSystem.h"
#include <basics/writer/WbWriterVtkXmlBinary.h>
#include <cmath>
#include "VirtualFluids_GPU/Communication/Communicator.h"
namespace EdgeNodeDebugWriter
{
void writeEdgeNodesXZ_Send(Parameter *para)
{
std::vector<UbTupleFloat3> nodesVec;
// nodedata
std::vector<std::string> datanames = { "SparseIndex", "ProcessNeighbor", "IndexInSendVector", "AfterFtoC" };
std::vector<std::vector<double>> nodedata;
int numberOfNodes = 0;
for (int level = 0; level < para->getMaxLevel(); level++){
numberOfNodes += (int) para->getParH(level)->edgeNodesXtoZ.size();
}
nodesVec.resize(numberOfNodes);
nodedata.resize(datanames.size(), std::vector<double>(numberOfNodes));
int nodeCount = 0;
for (int level = 0; level < para->getMaxLevel(); level++) {
for (int u = 0; u < numberOfNodes; u++) {
// node data section
int indexOfProcessNeighborSend = para->getParH(level)->edgeNodesXtoZ[u].indexOfProcessNeighborSend;
int indexInSendBuffer = para->getParH(level)->edgeNodesXtoZ[u].indexInSendBuffer;
int sparseIndex = para->getParH(level)->sendProcessNeighborZ[indexOfProcessNeighborSend].index[indexInSendBuffer];
nodedata[0][nodeCount] = sparseIndex;
nodedata[1][nodeCount] = indexOfProcessNeighborSend;
nodedata[2][nodeCount] = indexInSendBuffer;
nodedata[3][nodeCount] = indexInSendBuffer < para->getParH(level)->sendProcessNeighborsAfterFtoCZ[indexOfProcessNeighborSend].numberOfNodes;
// coordinate section
double x1 = para->getParH(level)->coordX_SP[sparseIndex];
double x2 = para->getParH(level)->coordY_SP[sparseIndex];
double x3 = para->getParH(level)->coordZ_SP[sparseIndex];
nodesVec[nodeCount] = (makeUbTuple((float)(x1), (float)(x2), (float)(x3)));
nodeCount++;
}
std::string filenameVec = para->getFName() + "_writeEdgeNodesXZ_Send_PID_" +
std::to_string(vf::gpu::Communicator::getInstanz()->getPID()) + "_" +
StringUtil::toString<int>(level);
WbWriterVtkXmlBinary::getInstance()->writeNodesWithNodeData(filenameVec, nodesVec, datanames, nodedata);
}
}
} // namespace EdgeNodeDebugWriter
#endif
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