Commit 2f8bd434 by Kirill Terekhov

Debug crash with threephase

parent 07f25538
......@@ -50,7 +50,7 @@ namespace INMOST
template<> struct make_unsigned<unsigned long> {typedef unsigned long type;};
template<> struct make_unsigned<unsigned long long> {typedef unsigned long long type;};
#define USE_OPTIMIZED_ARRAY_ALLOCATION
//#define USE_OPTIMIZED_ARRAY_ALLOCATION
#if defined(PACK_ARRAY)
#pragma pack(push,r1,4)
#endif
......
......@@ -54,7 +54,7 @@
// output xml files for debugging of parallel algorithms
// search for style.xsl within examples for comfortable
// view of generated xml files
//#define USE_PARALLEL_WRITE_TIME
#define USE_PARALLEL_WRITE_TIME
// this will revert Mesh::PrepareReceiveInner to always
// use MPI point to point functionality disregarding problem type
......
......@@ -3,6 +3,17 @@
#if defined(USE_MESH)
#define WAITNL {char c;scanf("%c",&c);}
#if defined(__LINUX__) || defined(__linux__) || defined(__APPLE__)
#include <unistd.h>
#define PROCESSID getpid()
#elif defined(_WIN32)
#include <windows.h>
#define PROCESSID GetCurrentProcessId()
#else
#define PROCESSID -1
#endif
namespace INMOST
{
static std::vector<Mesh *> allocated_meshes;
......@@ -187,7 +198,7 @@ namespace INMOST
out_time.open(temp.str().c_str(),std::ios::out);
out_time << "<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?>" << std::endl;
out_time << "<?xml-stylesheet type=\"text/xsl\" href=\"style.xsl\"?>" << std::endl;
out_time << "<Debug>" << std::endl;
out_time << "<Debug ProcessID=" << PROCESSID << ">" << std::endl;
tab = 1;
func_id = 0;
#endif
......
......@@ -35,6 +35,14 @@ static INMOST_DATA_BIG_ENUM_TYPE pmid = 0;
#define EXIT_FUNC_DIE() {}
#endif
#if defined(__LINUX__) || defined(__linux__) || defined(__APPLE__)
#include <unistd.h>
#define PROCESSID getpid()
#else
#define PROCESSID -1
#endif
namespace INMOST
{
static int block_recursion = 0;
......@@ -2289,9 +2297,10 @@ namespace INMOST
void Mesh::PackTagData(const Tag & tag, const elements_by_type & elements, int destination, ElementType mask, MarkerType select, buffer_type & buffer)
{
if( tag.GetDataType() == DATA_REMOTE_REFERENCE ) return; //NOT IMPLEMENTED TODO 14
if( tag.GetDataType() == DATA_REMOTE_REFERENCE ) return; //NOT IMPLEMENTED TODO 14
ENTER_FUNC();
#if defined(USE_MPI)
REPORT_VAL("Processor",destination);
REPORT_VAL("Buffer size before pack",buffer.size());
ElementType pack_types[2] = {NONE,NONE};
element_set::const_iterator eit;
......@@ -2316,6 +2325,8 @@ namespace INMOST
if( (!select || GetMarker(*eit,select)) && HaveData(*eit,tag) )
{
//REPORT_STR("element type " << ElementTypeName(GetHandleElementType(*eit)) << " global id " << Integer(*eit,GlobalIDTag()));
REPORT_VAL("element index", static_cast<INMOST_DATA_ENUM_TYPE>(eit-elements[i].begin()));
array_size_send.push_back(static_cast<INMOST_DATA_ENUM_TYPE>(eit-elements[i].begin()));
array_size_send[count]++;
INMOST_DATA_ENUM_TYPE s = GetDataSize(*eit,tag);
......@@ -2340,6 +2351,8 @@ namespace INMOST
if( size == ENUMUNDEF ) array_size_send.push_back(s);
++total_packed;
}
REPORT_VAL("count",array_size_send[count]);
REPORT_VAL("index", count);
}
else
{
......@@ -2381,13 +2394,16 @@ namespace INMOST
}
REPORT_VAL("total packed records",total_packed);
}
static INMOST_DATA_ENUM_TYPE tail = 1;
REPORT_VAL("add tail",tail);
array_size_send.push_back(tail++);
INMOST_DATA_ENUM_TYPE size_send, data_send;
size_send = static_cast<INMOST_DATA_ENUM_TYPE>(array_size_send.size());
data_send = static_cast<INMOST_DATA_ENUM_TYPE>(array_data_send.size());
REPORT_VAL("tag defined on",static_cast<int>(pack_types[0]));
REPORT_VAL("tag sparse on",static_cast<int>(pack_types[1]));
REPORT_VAL("size_size",array_size_send[0]);
REPORT_VAL("data_size",array_size_send[1]);
REPORT_VAL("size_send",size_send);
REPORT_VAL("data_send",data_send);
int buffer_size = 0,position = static_cast<int>(buffer.size()),temp,bytes;
bytes = tag.GetPackedBytesSize();
MPI_Pack_size(2 ,INMOST_MPI_DATA_BULK_TYPE,comm,&temp); buffer_size+= temp;
......@@ -2403,6 +2419,13 @@ namespace INMOST
if( !array_data_send.empty() ) MPI_Pack(&array_data_send[0],static_cast<INMOST_MPI_SIZE>(array_data_send.size()/bytes),tag.GetBulkDataType(),&buffer[0],static_cast<INMOST_MPI_SIZE>(buffer.size()),&position,comm);
buffer.resize(position);
REPORT_VAL("Buffer size after pack",buffer.size());
if( size_send < 6 )
{
for(INMOST_DATA_ENUM_TYPE qq = 0; qq < size_send; ++qq)
{
REPORT_VAL("array_size_send["<<qq<<"]",array_size_send[qq]);
}
}
#else
(void) tag;
(void) elements;
......@@ -2472,7 +2495,12 @@ namespace INMOST
REPORT_VAL("size of data array",data_recv);
array_size_recv.resize(size_recv);
array_data_recv.resize(data_recv);
if( !array_size_recv.empty() ) MPI_Unpack(&buffer[0],static_cast<INMOST_MPI_SIZE>(buffer.size()),&position,&array_size_recv[0],static_cast<INMOST_MPI_SIZE>(array_size_recv.size()),INMOST_MPI_DATA_ENUM_TYPE,comm);
if( !array_size_recv.empty() )
{
MPI_Unpack(&buffer[0],static_cast<INMOST_MPI_SIZE>(buffer.size()),&position,&array_size_recv[0],static_cast<INMOST_MPI_SIZE>(array_size_recv.size()),INMOST_MPI_DATA_ENUM_TYPE,comm);
REPORT_VAL("size array last", array_size_recv.back());
}
if( !array_data_recv.empty() )
{
int bytes = tag.GetPackedBytesSize();
......@@ -2485,6 +2513,7 @@ namespace INMOST
REPORT_VAL("calculated size of data",array_data_recv.size()/sizeof(Sparse::Row::entry));
MPI_Unpack(&buffer[0],static_cast<INMOST_MPI_SIZE>(buffer.size()),&position,&array_data_recv[0],static_cast<INMOST_MPI_SIZE>(array_data_recv.size()/bytes),tag.GetBulkDataType(),comm);
}
REPORT_VAL("Position after unpack",position);
for(int i = ElementNum(NODE); i <= ElementNum(ESET); i++) if( (recv_mask[0] & ElementTypeFromDim(i)) )
{
REPORT_VAL("unpack for type",ElementTypeName(ElementTypeFromDim(i)));
......@@ -2498,6 +2527,9 @@ namespace INMOST
if( tag.isSparseByDim(i) )
{
REPORT_VAL("sparse for type",ElementTypeName(ElementTypeFromDim(i)));
REPORT_VAL("index", k);
REPORT_VAL("count", array_size_recv[k]);
REPORT_VAL("pos",pos);
unsigned count = static_cast<unsigned>(array_size_recv[k++]);
if( size == ENUMUNDEF )
{
......@@ -2524,8 +2556,25 @@ namespace INMOST
REPORT_STR("fixed size");
for(unsigned j = 0; j < count; j++)
{
REPORT_VAL("element index",array_size_recv[k]);
REPORT_VAL("pos",pos);
eit = elements[i].begin() + array_size_recv[k++];
assert( !select || GetMarker(*eit,select) ); //if fires then very likely that marker was not synchronized
if( pos >= array_data_recv.size() )
{
REPORT_STR("ERROR!");
REPORT_VAL("pos", pos );
REPORT_VAL("array_size", array_size_recv.size());
REPORT_VAL("array_data", array_data_recv.size());
REPORT_VAL("size_recv", size_recv);
REPORT_VAL("data_recv", data_recv);
REPORT_VAL("count", count);
REPORT_VAL("buffer position",position);
REPORT_VAL("size[0]", array_size_recv[0]);
REPORT_VAL("size[1]", array_size_recv[1]);
REPORT_VAL("size[2]", array_size_recv[2]);
REPORT_VAL("k",k);
}
op(tag,Element(this,*eit),&array_data_recv[pos],size);
pos += GetDataCapacity(&array_data_recv[pos],size,tag);
//pos += size*tag.GetBytesSize();
......@@ -2719,6 +2768,7 @@ namespace INMOST
}
if( call_exchange )
{
REPORT_STR("call to ExchangeMarked");
block_recursion = 1;
ExchangeMarked();
block_recursion = 0;
......@@ -2727,12 +2777,12 @@ namespace INMOST
///////////
for(p = procs.begin(); p != procs.end(); p++ )
{
REPORT_VAL("for processor",p-procs.begin());
REPORT_VAL("for processor",*p);//p-procs.begin());
REPORT_VAL("send size",send_size[p-procs.begin()]);
REPORT_VAL("recv size",recv_size[p-procs.begin()]);
if( send_size[p-procs.begin()] )
{
for(unsigned int k = 0; k < tags.size(); k++)
for(unsigned int k = 0; k < tags.size(); k++)
PackTagData(tags[k],from.find(*p)->second,*p,mask,select,storage.send_buffers[num_send].second);
storage.send_buffers[num_send].first = *p;
num_send++;
......@@ -2756,7 +2806,11 @@ namespace INMOST
}
storage.send_buffers.resize(num_send);
storage.recv_buffers.resize(num_recv);
if( unknown_size && parallel_strategy != 0 ) PrepareReceiveInner(UnknownSize,storage.send_buffers,storage.recv_buffers);
if( unknown_size && parallel_strategy != 0 )
{
REPORT_STR("prepare receive with unknown size");
PrepareReceiveInner(UnknownSize,storage.send_buffers,storage.recv_buffers);
}
ExchangeBuffersInner(storage.send_buffers,storage.recv_buffers,storage.send_reqs,storage.recv_reqs);
#else
(void) tags;
......
......@@ -5,7 +5,7 @@
#include "../Misc/utils.h"
#include "solver_prototypes.hpp"
#include "solver_bcgsl.hpp"
#define KSOLVER BCGS_solver
#define KSOLVER BCGSL_solver
namespace INMOST {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment