Commit 30a676b7 authored by Kirill Terekhov's avatar Kirill Terekhov

Fixes

Fix for possibility of race condition in point-to-point MPI
communications.

Fixes for warnings produced by clang.
parent ae0bf6b1
......@@ -149,7 +149,7 @@ int main(int argc,char ** argv)
if( cell->GetStatus() != Element::Ghost )
{
unsigned pid = cell->Integer(id);
unsigned pid2 = cell->GlobalID();
//unsigned pid2 = cell->GlobalID();
if( pid < idmin ) idmin = pid;
if( pid+1 > idmax ) idmax = pid+1;
}
......@@ -174,7 +174,6 @@ int main(int argc,char ** argv)
((!r2->isValid() || (s2 = r2->GetStatus()) == Element::Ghost)?0:1) == 0) continue;
Storage::real f_nrm[3], r1_cnt[3], r2_cnt[3], f_cnt[3], d1[3], Coef;
Storage::real f_area = face->Area(); // Get the face area
Storage::real vol1 = r1->Volume(), vol2; // Get the cell volume
Storage::integer id1 = r1->Integer(id), id2;
Storage::real K1 = r1->Real(tensor_K), K2, Kav;
face->Normal(f_nrm); // Get the face normal
......@@ -200,7 +199,6 @@ int main(int argc,char ** argv)
}
else
{
vol2 = r2->Volume();
K2 = r2->Real(tensor_K);
id2 = r2->Integer(id);
r2->Barycenter(r2_cnt);
......
......@@ -15,7 +15,7 @@ using namespace INMOST;
int main(int argc, char ** argv)
{
if( argc < 3 || argc > 1 && ( atoi(argv[1]) < 0 || atoi(argv[1]) > 11 ) )
if( (argc < 3 || argc > 1) && ( atoi(argv[1]) < 0 || atoi(argv[1]) > 11 ) )
{
std::cout << "Usage: " << argv[0] << " method_number<0:INNER_ILU2,1:INNER_DDPQILUC,2:INNER_MPTILUC,3:INNER_MPTILU2,4:Trilinos_Aztec,5:Trilinos_Belos,6:Trilinos_ML,7:Trilinos_Ifpack,8:PETSc,9:ANI,10:FCBIILU2,11:K3BIILU2> matrix.mtx [right_hand_side.rhs] [exact_solution] [solver_options.txt]" << std::endl;
std::cout << "Example: " << argv[0] << " 0 a.mtx b.rhs" << std::endl;
......
......@@ -930,7 +930,7 @@ public:
{
if( colors.empty() )
{
double cc[4] = {c[0],c[1],c[2],alpha};
//double cc[4] = {c[0],c[1],c[2],alpha};
glColor4dv(c);
for(unsigned k = 0; k < verts.size(); k+=3)
{
......@@ -1287,7 +1287,7 @@ public:
}
*/
printf("number of points %d\n",points.size());
printf("number of points %d\n",(int)points.size());
}
void camera(double pos[3], int interactive)
{
......@@ -2757,7 +2757,7 @@ public:
Input(double * val, std::string comment) : comment(comment) {input_link = val; type = Double; canceled = false; done = false; str = "";}
Input(char * val, std::string comment) : comment(comment) {input_link = val; type = String; canceled = false; done = false; str = "";}
Input(void * link, InputType type, std::string comment) : comment(comment), input_link(link), type(type) {canceled = false; done = false; str = "";}
Input(const Input & other):comment(comment), input_link(other.input_link), str(other.str), type(other.type), canceled(other.canceled), done(other.done) {}
Input(const Input & other):str(other.str),comment(other.comment), input_link(other.input_link), type(other.type), done(other.done), canceled(other.canceled) {}
Input & operator =(Input const & other) {comment = other.comment; input_link = other.input_link; str = other.str; type = other.type; canceled = other.canceled; done = other.done; return *this;}
~Input() {}
void KeyPress(char c)
......@@ -2782,7 +2782,7 @@ public:
done = true;
glutPostRedisplay();
}
else if( type == String || ( (c >= '0' && c <= '9') || ((str.empty() || tolower(*str.rbegin()) == 'e') && c=='+' || c=='-') || (type == Double && (c=='.' || c=='e' || c == 'E'))) )
else if( type == String || ( (c >= '0' && c <= '9') || ((str.empty() || tolower(*str.rbegin()) == 'e') && (c=='+' || c=='-')) || (type == Double && (c=='.' || c=='e' || c == 'E'))) )
{
str += c;
glutPostRedisplay();
......@@ -2814,7 +2814,7 @@ public:
//printtext(str.c_str());
char oldval[4096];
if( type == Double ) sprintf(oldval,"%g",*(double*)input_link);
else if( type == Integer ) sprintf(oldval,"%g",*(int*)input_link);
else if( type == Integer ) sprintf(oldval,"%d",*(int*)input_link);
else if( type == String ) sprintf(oldval,"%s",(char *)input_link);
printtext("input number (%s[%s]:%s): %s",comment.c_str(),oldval,type == Integer ? "integer": (type == Double ? "double" : "string"), str.c_str());
}
......@@ -3512,6 +3512,23 @@ void draw_screen()
}
break;
}
case DATA_VARIABLE:
{
Storage::var_array arr = e->VariableArray(*t);
for(INMOST_DATA_ENUM_TYPE k = 0; k < arr.size(); k++)
{
std::stringstream stream;
stream << arr[k].GetValue() << " {[" << arr[k].GetRow().Size() << "] ";
for(INMOST_DATA_ENUM_TYPE q = 0; q < arr[k].GetRow().Size(); ++q)
{
stream << "(" << arr[k].GetRow().GetValue(q) << "," << arr[k].GetRow().GetIndex(q) << ") ";
}
stream << "}";
sprintf(temp,"%s %s",str,stream.str().c_str());
strcpy(str,temp);
}
break;
}
}
sprintf(temp,"%s %s %s",t->GetTagName().c_str(),DataTypeName(t->GetDataType()),str);
strcpy(str,temp);
......@@ -4009,7 +4026,7 @@ int main(int argc, char ** argv)
streamlines.push_back(Streamline(octsearch,xyz,vel,cell_size,velmin,velmax,-1.0,0));
}
}
printf("done from %d by %d grid, total streamlines = %d\n",numlines,numlines,streamlines.size());
printf("done from %d by %d grid, total streamlines = %d\n",numlines,numlines,(int)streamlines.size());
mesh->DeleteTag(cell_size);
printf("done, total streamlines = %d\n",streamlines.size());
printf("killing octree, was sets %d\n",mesh->NumberOfSets());
......
......@@ -51,7 +51,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
......@@ -107,6 +107,7 @@
#define INMOST_MPI_Request int
#define INMOST_MPI_Type int
#define INMOST_MPI_Comm int
#define INMOST_MPI_Group int
#define INMOST_MPI_COMM_WORLD 0
#define INMOST_MPI_BYTE 0
#define INMOST_MPI_INT 0
......@@ -114,10 +115,12 @@
#define INMOST_MPI_UNSIGNED 0
#define INMOST_MPI_Win int
#define INMOST_MPI_DATATYPE_NULL 0
#define INMOST_MPI_GROUP_EMPTY 0
#else
#define INMOST_MPI_Request MPI_Request
#define INMOST_MPI_Type MPI_Datatype
#define INMOST_MPI_Comm MPI_Comm
#define INMOST_MPI_Group MPI_Group
#define INMOST_MPI_COMM_WORLD MPI_COMM_WORLD
#define INMOST_MPI_BYTE MPI_BYTE
#define INMOST_MPI_INT MPI_INT
......@@ -125,10 +128,11 @@
#define INMOST_MPI_UNSIGNED MPI_UNSIGNED
#define INMOST_MPI_Win MPI_Win
#define INMOST_MPI_DATATYPE_NULL MPI_DATATYPE_NULL
#define INMOST_MPI_GROUP_EMPTY MPI_GROUP_EMPTY
#endif
#define INMOST_MPI_SIZE int //in case MPI standard changes and compiler gives tons of warning
#define INMOST_MPI_SIZE int //in case MPI standard changes and compiler gives tons of warnings
#define INMOST_DATA_INTEGER_TYPE int
#define INMOST_DATA_REAL_TYPE double
......
......@@ -207,7 +207,7 @@ namespace INMOST
}
__INLINE multivar_expression & operator /=(basic_expression const & expr)
{
INMOST_DATA_REAL_TYPE lval = value, rval = expr.GetValue();
INMOST_DATA_REAL_TYPE rval = expr.GetValue();
INMOST_DATA_REAL_TYPE reciprocial_rval = 1.0/rval;
value *= reciprocial_rval;
if( CheckCurrentAutomatizator() )
......@@ -1044,18 +1044,22 @@ namespace INMOST
name = _name;
size = _size;
vals = new INMOST_DATA_REAL_TYPE[size];
std::copy(_vals,_vals+size,vals);
memcpy(vals,_vals,sizeof(INMOST_DATA_REAL_TYPE)*size);
//std::copy(_vals,_vals+size,vals);
args = new INMOST_DATA_REAL_TYPE[size];
std::copy(_args,_args+size,args);
memcpy(args,_args,sizeof(INMOST_DATA_REAL_TYPE)*size);
//std::copy(_args,_args+size,args);
}
keyval_table(const keyval_table & other)
{
name = other.name;
size = other.size;
vals = new INMOST_DATA_REAL_TYPE[size];
std::copy(other.vals,other.vals+size,vals);
memcpy(vals,other.vals,sizeof(INMOST_DATA_REAL_TYPE)*size);
//std::copy(other.vals,other.vals+size,vals);
args = new INMOST_DATA_REAL_TYPE[size];
std::copy(other.args,other.args+size,args);
memcpy(args,other.args,sizeof(INMOST_DATA_REAL_TYPE)*size);
//std::copy(other.args,other.args+size,args);
}
keyval_table & operator = (keyval_table const & other)
{
......@@ -1063,9 +1067,11 @@ namespace INMOST
name = other.name;
size = other.size;
vals = new INMOST_DATA_REAL_TYPE[size];
std::copy(other.vals,other.vals+size,vals);
memcpy(vals,other.vals,sizeof(INMOST_DATA_REAL_TYPE)*size);
//std::copy(other.vals,other.vals+size,vals);
args = new INMOST_DATA_REAL_TYPE[size];
std::copy(other.args,other.args+size,args);
memcpy(args,other.args,sizeof(INMOST_DATA_REAL_TYPE)*size);
//std::copy(other.args,other.args+size,args);
return * this;
}
~keyval_table()
......
......@@ -1240,6 +1240,7 @@ namespace INMOST
ElementType have_global_id;
INMOST_DATA_BIG_ENUM_TYPE parallel_mesh_unique_id;
INMOST_MPI_Comm comm;
//INMOST_MPI_Group group;
Tag tag_shared;
Tag tag_owner;
Tag tag_processors;
......@@ -2355,6 +2356,8 @@ namespace INMOST
int GetProcessorsNumber();
/// Retrieve MPI communicator
INMOST_MPI_Comm GetCommunicator ();
/// Retrieve MPI group corresponding to the communicator
INMOST_MPI_Group GetGroup ();
/// Set MPI communicator
void SetCommunicator (INMOST_MPI_Comm _comm);
void ResolveShared ();
......
......@@ -349,7 +349,7 @@ namespace INMOST
const INMOST_DATA_REAL_TYPE * operator ->() const {return &(*LinkedList)[pos].second;}
iterator & operator ++(){ pos = (*LinkedList)[pos].first; return *this;}
iterator operator ++(int){ iterator ret(LinkedList); ret.pos = (*LinkedList)[pos].first; return ret; }
iterator & operator = (const iterator & other) {LinkedList = other.LinkedList; pos = other.pos;}
iterator & operator = (const iterator & other) {LinkedList = other.LinkedList; pos = other.pos; return *this;}
bool operator ==(const iterator & other) const {return LinkedList == other.LinkedList && pos == other.pos;}
bool operator !=(const iterator & other) const {return LinkedList != other.LinkedList || pos != other.pos;}
bool operator < (const iterator & other) const {return LinkedList == other.LinkedList && pos < other.pos;}
......
......@@ -156,6 +156,7 @@ namespace INMOST
virtual void GetVariation(const Storage & e, Sparse::Row & r) const = 0;
virtual void GetVariation(const Storage & e, Sparse::RowMerger & r) const = 0;
virtual abstract_dynamic_variable * Copy() const = 0;
virtual ~abstract_dynamic_variable() {}
};
template<typename RetType>
......@@ -210,6 +211,7 @@ namespace INMOST
virtual void GetVariation(const Storage & e, Sparse::Row & r) const = 0;
virtual void GetVariation(const Storage & e, Sparse::RowMerger & r) const = 0;
virtual abstract_dynamic_variable * Copy() const = 0;
virtual ~basic_dynamic_variable() {}
};
template<class VariableType, class Derived>
......
......@@ -134,7 +134,7 @@ namespace INMOST
template<typename float_type>
fType convert_bytes_to_float(unsigned char * fbytes, unsigned char size, fByteOrder forder)
{
float_type ret;
float_type ret = 0;
if( size == 4 )
{
unsigned char S; int E; unsigned long F;
......@@ -187,7 +187,7 @@ namespace INMOST
if ( S == 0 ) F1 = 1.0;
else F1 = -1.0;
if ( 0 < E ) ret = F1 * ( C + M ) * ::pow ( A, E - B ) ;
else if ( E == 0 && S == 0 ) ret = 0;
else if ( E == 0 && S == 0 ) ret = 0;
else if ( E == 0 && S == 1 ) ret = 0; // reserved
break;
default: throw "not implemented";
......@@ -241,9 +241,14 @@ namespace INMOST
if ( S == 0 && E == 0 && M == 0 ) ret = 0;
else ret = F1 * M * ::pow ( A, E - B );
break;
default: throw "not implemented";
default: throw NotImplemented;
}
}
else
{
std::cout << "Converter for float of size " << size << " do not exist" << std::endl;
throw NotImplemented;
}
return static_cast<fType>(ret);
}
fType load_fp_test_bytes(const char * bytes, unsigned char size)
......
......@@ -22,7 +22,7 @@
namespace INMOST
{
typedef char HeaderType;
const HeaderType EndOfData = 0x01;
//const HeaderType EndOfData = 0x01;
const HeaderType NodeHeader = 0x02;
const HeaderType EdgeHeader = 0x03;
const HeaderType FaceHeader = 0x04;
......
......@@ -251,7 +251,7 @@ class XMLReader
}
double Evaluate(std::string & str)
{
const char * debug_str = str.c_str();
//const char * debug_str = str.c_str();
std::vector<std::string> decompose = Expand(str);
std::vector<std::string> polish = MakePolish(decompose);
//Print(polish);
......@@ -551,6 +551,7 @@ public:
break;
case EndOfFile: Report("Unexpected end of file while reading XML tag name"); done = true; break;
case Failure: Report("Unrecoverable error while reading XML tag name"); done = true; break;
default: Report("Unexpected state %s",StateName(_state).c_str()); done = true; break;
}
}
if( verbose ) Report("info: opened tag %s",ret.c_str());
......@@ -589,7 +590,6 @@ public:
std::string name;
bool done = false;
char c;
int inner_state = 0;
if( !(_state == Intro || _state == ReadCloseTagSlash) )
{
Report("Cannot read finish tag from state %s",StateName(_state).c_str());
......@@ -644,6 +644,8 @@ public:
case Failure:
Report("Unexpected failure while searching for </%s>",TagName.c_str());
return false;
default: Report("Unexpected state %s",StateName(_state).c_str()); return false;
}
}
if( verbose ) Report("info: finished tag %s",name.c_str());
......@@ -725,6 +727,7 @@ public:
Report("Unexpected failure while reading attribute name");
done = true;
break;
default: Report("Unexpected state %s",StateName(_state).c_str()); done = true; break;
}
}
if( verbose ) Report("info: attribute name %s",ret.c_str());
......@@ -799,6 +802,7 @@ public:
Report("Unexpected failure while reading attribute name");
done = true;
break;
default: Report("Unexpected state %s",StateName(_state).c_str()); done = true; break;
}
}
if( verbose ) Report("info: attribute value %s",ret.c_str());
......@@ -869,9 +873,6 @@ public:
std::string ret;
char c;
bool done = false;
bool vector = false;
bool multpart = false;
bool quotes = false;
int testend = 0;
if( _state == EndContents ) return "";
if( _state != WaitContents )
......@@ -999,6 +1000,7 @@ public:
Report("Unexpected failure while reading attribute name");
done = true;
break;
default: Report("Unexpected state %s",StateName(_state).c_str()); done = true; break;
}
}
return ret;
......@@ -1907,7 +1909,7 @@ namespace INMOST
if( matchsets && nsets != nsets_read ) reader.Report("Number %d of XML tags Set read do not match to the number %d specified",nsets_read,nsets);
//correct links between sets
for(int q = 0; q < new_sets.size(); ++q)
for(int q = 0; q < (int)new_sets.size(); ++q)
{
Element::adj_type & lc = HighConn(new_sets[q]);
for(Element::adj_type::iterator jt = lc.begin(); jt != lc.end(); ++jt)
......@@ -1997,10 +1999,6 @@ namespace INMOST
HandleType * set_elems = NULL, *it = NULL;
enumerator set_size = 0;
const char * debug_setname = setname.c_str();
const char * debug_tagname = tagname.c_str();
if( setname != "" )
{
if( etype != NONE ) reader.Report("Warning: SetType should be SetData for data specified for set.");
......@@ -2051,7 +2049,6 @@ namespace INMOST
it = set_elems + atoi(val.c_str());
val = reader.GetContentsWord();
}
const char * debug_val2 = val.c_str();
switch(t.GetDataType())
{
case DATA_REAL:
......@@ -2074,7 +2071,7 @@ namespace INMOST
if( !sparse_read && t.GetSize() != ENUMUNDEF && (q + l*((int)Vector.size())+1)%t.GetSize() == 0 )
{
++it;
if( it-set_elems < set_size ) data = RealArray(*it,t);
if( ((int)(it-set_elems)) < (int)set_size ) data = RealArray(*it,t);
}
}
}
......@@ -2099,7 +2096,7 @@ namespace INMOST
if( !sparse_read && t.GetSize() != ENUMUNDEF && (q + l*((int)Vector.size())+1)%t.GetSize() == 0 )
{
++it;
if( it-set_elems < set_size ) data = IntegerArray(*it,t);
if( ((int)(it-set_elems)) < (int)set_size ) data = IntegerArray(*it,t);
}
}
}
......@@ -2124,7 +2121,7 @@ namespace INMOST
if( !sparse_read && t.GetSize() != ENUMUNDEF && (q + l*((int)Vector.size())+1)%t.GetSize() == 0 )
{
++it;
if( it-set_elems < set_size ) data = BulkArray(*it,t);
if( ((int)(it-set_elems)) < (int)set_size ) data = BulkArray(*it,t);
}
}
}
......@@ -2149,7 +2146,7 @@ namespace INMOST
if( !sparse_read && t.GetSize() != ENUMUNDEF && (q + l*((int)Vector.size())+1)%t.GetSize() == 0 )
{
++it;
if( it-set_elems < set_size ) data = ReferenceArray(*it,t);
if( ((int)(it-set_elems)) < (int)set_size ) data = ReferenceArray(*it,t);
}
}
}
......@@ -2177,7 +2174,7 @@ namespace INMOST
if( !sparse_read && t.GetSize() != ENUMUNDEF && (q + l*((int)Vector.size())+1)%t.GetSize() == 0 )
{
++it;
if( it-set_elems < set_size ) data = RemoteReferenceArray(*it,t);
if( ((int)(it-set_elems)) < (int)set_size ) data = RemoteReferenceArray(*it,t);
}
}
}
......@@ -2203,7 +2200,7 @@ namespace INMOST
if( !sparse_read && t.GetSize() != ENUMUNDEF && (q + l*((int)Vector.size())+1)%t.GetSize() == 0 )
{
++it;
if( it-set_elems < set_size ) data = RemoteReferenceArray(*it,t);
if( ((int)(it-set_elems)) < (int)set_size ) data = RemoteReferenceArray(*it,t);
}
}
}
......@@ -2230,7 +2227,7 @@ namespace INMOST
if( !sparse_read && t.GetSize() != ENUMUNDEF && (q + l*((int)Vector.size())+1)%t.GetSize() == 0 )
{
++it;
if( it-set_elems < set_size ) data = VariableArray(*it,t);
if( ((int)(it-set_elems)) < (int)set_size ) data = VariableArray(*it,t);
}
}
}
......
......@@ -120,7 +120,7 @@ namespace INMOST
{
HandleType temp = lc[1];
lc[1] = lc[jt];
lc[jt] = lc[1];
lc[jt] = temp;
temp = first;
first = last;
last = temp;
......@@ -130,7 +130,7 @@ namespace INMOST
{
HandleType temp = lc[1];
lc[1] = lc[jt];
lc[jt] = lc[1];
lc[jt] = temp;
break;
}
++jt;
......@@ -173,7 +173,7 @@ namespace INMOST
//check that the loop is closed
adj_type const & ilc = m->LowConn(lc[iend]);
if( ilc.size() != 2 ) return false;
if( !( ilc[0] == last && ilc[1] == first || ilc[0] == first && ilc[1] == last ) )
if( !( (ilc[0] == last && ilc[1] == first) || (ilc[0] == first && ilc[1] == last) ) )
return false;
}
else
......@@ -217,7 +217,7 @@ namespace INMOST
{
HandleType temp = lc[i];
lc[i] = lc[jt];
lc[jt] = lc[i];
lc[jt] = temp;
temp = first;
first = last;
last = temp;
......@@ -227,7 +227,7 @@ namespace INMOST
{
HandleType temp = lc[i];
lc[i] = lc[jt];
lc[jt] = lc[i];
lc[jt] = temp;
break;
}
++jt;
......@@ -279,7 +279,7 @@ namespace INMOST
k1 = ENUMUNDEF;
k1 = m->getNext(ilc.data(),static_cast<enumerator>(ilc.size()),k1,hm);
k2 = m->getNext(ilc.data(),static_cast<enumerator>(ilc.size()),k1,hm);
if( !( ilc[k1] == last && ilc[k2] == first || ilc[k1] == first && ilc[k2] == last ) )
if( !( (ilc[k1] == last && ilc[k2] == first) || (ilc[k1] == first && ilc[k2] == last) ) )
return false;
}
}
......
......@@ -270,7 +270,7 @@ namespace INMOST
{
HandleType temp = lc[1];
lc[1] = lc[jt];
lc[jt] = lc[1];
lc[jt] = temp;
temp = first;
first = last;
last = temp;
......@@ -280,7 +280,7 @@ namespace INMOST
{
HandleType temp = lc[1];
lc[1] = lc[jt];
lc[jt] = lc[1];
lc[jt] = temp;
break;
}
++jt;
......@@ -323,7 +323,7 @@ namespace INMOST
//check that the loop is closed
adj_type const & ilc = m->LowConn(lc[iend]);
if( ilc.size() != 2 ) return false;
if( !( ilc[0] == last && ilc[1] == first || ilc[0] == first && ilc[1] == last ) )
if( !( (ilc[0] == last && ilc[1] == first) || (ilc[0] == first && ilc[1] == last) ) )
return false;
}
else
......@@ -367,7 +367,7 @@ namespace INMOST
{
HandleType temp = lc[i];
lc[i] = lc[jt];
lc[jt] = lc[i];
lc[jt] = temp;
temp = first;
first = last;
last = temp;
......@@ -377,7 +377,7 @@ namespace INMOST
{
HandleType temp = lc[i];
lc[i] = lc[jt];
lc[jt] = lc[i];
lc[jt] = temp;
break;
}
++jt;
......@@ -429,7 +429,7 @@ namespace INMOST
k1 = ENUMUNDEF;
k1 = m->getNext(ilc.data(),static_cast<enumerator>(ilc.size()),k1,hm);
k2 = m->getNext(ilc.data(),static_cast<enumerator>(ilc.size()),k1,hm);
if( !( ilc[k1] == last && ilc[k2] == first || ilc[k1] == first && ilc[k2] == last ) )
if( !( (ilc[k1] == last && ilc[k2] == first) || (ilc[k1] == first && ilc[k2] == last) ) )
return false;
}
}
......
......@@ -570,7 +570,7 @@ namespace INMOST
if (allocated_meshes[q] == this)
allocated_meshes[q] = NULL;
std::sort(allocated_meshes.rbegin(), allocated_meshes.rend());
while(allocated_meshes.back() == NULL) allocated_meshes.pop_back();
while(!allocated_meshes.empty() && allocated_meshes.back() == NULL) allocated_meshes.pop_back();
}
//arrays for data are deallocated inside ~TagManager()
}
......
......@@ -571,7 +571,14 @@ namespace INMOST
#endif //USE_MPI
}
INMOST_MPI_Group Mesh::GetGroup()
{
INMOST_MPI_Group ret = INMOST_MPI_GROUP_EMPTY;
#if defined(USE_MPI)
MPI_Comm_group(GetCommunicator(), &ret);
#endif
return ret;
}
void Mesh::SetCommunicator(INMOST_MPI_Comm _comm)
{
......@@ -1009,10 +1016,10 @@ namespace INMOST
//~ #if defined(USE_MPI_P2P)
//~ unsigned * sendsizeall = shared_space;
//~ unsigned usend[2] = {sendsize,pack_real.size()};
//~ REPORT_MPI(MPI_Win_fence(MPI_MODE_NOPRECEDE,window)); //start exchange session
//~ REPORT_MPI(MPI_Win_fence(0,window)); //start exchange session
//~ for(unsigned k = 0; k < procs.size(); k++)
//~ REPORT_MPI(MPI_Put(usend,2,MPI_UNSIGNED,procs[k],mpirank*2,2,MPI_UNSIGNED,window));
//~ REPORT_MPI(MPI_Win_fence(MPI_MODE_NOSUCCEED,window)); //end exchange session
//~ REPORT_MPI(MPI_Win_fence(MPI_MODE_NOSTORE | MPI_MODE_NOSUCCEED,window)); //end exchange session
//~ #else
std::vector<unsigned> sendsizeall(mpisize*2);
int pack_size2 = 0;
......@@ -3101,6 +3108,7 @@ namespace INMOST
std::vector<Storage::integer> global_ids;
integer dim = GetDimensions();
REPORT_STR("unpack number of nodes");
num = 0;
if( !buffer.empty() ) MPI_Unpack(&buffer[0],static_cast<INMOST_MPI_SIZE>(buffer.size()),&position,&num,1,INMOST_MPI_DATA_ENUM_TYPE,comm);
REPORT_VAL("number of nodes",num);
REPORT_STR("unpack nodes coordinates");
......@@ -3580,11 +3588,12 @@ namespace INMOST
#if defined(USE_MPI_P2P) && defined(PREFFER_MPI_P2P)
int mpirank = GetProcessorRank(),mpisize = GetProcessorsNumber();
unsigned i, end = send_bufs.size();
REPORT_MPI(MPI_Win_fence(MPI_MODE_NOPRECEDE,window)); //start exchange session
memset(shared_space,0,sizeof(unsigned)*mpisize); //zero bits where we receive data
REPORT_MPI(MPI_Win_fence(MPI_MODE_NOPRECEDE,window)); //start exchange session
REPORT_MPI(MPI_Win_fence(0,window)); //wait memset finish
for(i = 0; i < end; i++) shared_space[mpisize+i] = send_bufs[i].second.size()+1; //put data to special part of the memory
for(i = 0; i < end; i++) REPORT_MPI(MPI_Put(&shared_space[mpisize+i],1,MPI_UNSIGNED,send_bufs[i].first,mpirank,1,MPI_UNSIGNED,window)); //request rdma
REPORT_MPI(MPI_Win_fence(MPI_MODE_NOSUCCEED,window)); //end exchange session
REPORT_MPI(MPI_Win_fence(MPI_MODE_NOSTORE | MPI_MODE_NOSUCCEED,window)); //end exchange session
if( parallel_strategy == 0 )
{
unsigned num = 0;
......@@ -3656,14 +3665,19 @@ namespace INMOST
#if defined(USE_MPI_P2P)
int mpirank = GetProcessorRank(),mpisize = GetProcessorsNumber();
unsigned i, end = static_cast<unsigned>(send_bufs.size());
REPORT_MPI(MPI_Win_fence(MPI_MODE_NOPRECEDE,window)); //start exchange session
memset(shared_space,0,sizeof(unsigned)*mpisize); //zero bits where we receive data
REPORT_MPI(MPI_Win_fence(MPI_MODE_NOPRECEDE,window)); //start exchange session
//REPORT_MPI(MPI_Win_fence( MPI_MODE_NOPRECEDE,window)); //start exchange session
REPORT_MPI(MPI_Win_fence( 0,window)); //wait memset finish
for(i = 0; i < end; i++) shared_space[mpisize+i] = static_cast<unsigned>(send_bufs[i].second.size()+1); //put data to special part of the memory
for(i = 0; i < end; i++)
{
REPORT_VAL("put value", shared_space[mpisize+i]);
REPORT_VAL("destination", send_bufs[i].first);
REPORT_VAL("displacement", mpirank);
REPORT_MPI(MPI_Put(&shared_space[mpisize+i],1,MPI_UNSIGNED,send_bufs[i].first,mpirank,1,MPI_UNSIGNED,window)); //request rdma to target processors for each value
}
REPORT_MPI(MPI_Win_fence(MPI_MODE_NOSUCCEED,window)); //end exchange session
REPORT_MPI(MPI_Win_fence(MPI_MODE_NOSTORE | MPI_MODE_NOSUCCEED,window)); //end exchange session
if( parallel_strategy == 0 )
{
unsigned num = 0;
......@@ -3681,7 +3695,12 @@ namespace INMOST
recv_bufs.clear();
for(int ii = 0; ii < mpisize; ii++)
if( shared_space[ii] > 0 )
{
REPORT_VAL("position", ii);
REPORT_VAL("value", shared_space[ii]);
recv_bufs.push_back(proc_buffer_type(ii,std::vector<INMOST_DATA_BULK_TYPE>(shared_space[ii]-1))); // this call would be optimized by compiler
}
REPORT_VAL("recvs",recv_bufs.size());
}
#else //USE_MPI_P2P
int mpisize = GetProcessorsNumber(),mpirank = GetProcessorRank();
......
......@@ -1235,7 +1235,7 @@ namespace INMOST
#if defined(USE_PARTITIONER_PARMETIS)
#endif
}
weight_tag == Tag();
weight_tag = Tag();
}
Mesh * Partitioner::GetMesh()
{
......
......@@ -46,8 +46,8 @@
//#define USE_OMP
#define KSOLVER BCGSL_solver
//#define KSOLVER BCGS_solver
//#define KSOLVER BCGSL_solver
#define KSOLVER BCGS_solver
//#define ACCELERATED_CONDEST
//#define PRINT_CONDEST
......@@ -1121,6 +1121,7 @@ namespace INMOST
prec = NULL;
#endif
}
else prec = NULL;
solver_data = new KSOLVER(prec, info);
}
}
......@@ -1867,7 +1868,7 @@ namespace INMOST
if( _pack == INNER_ILU2 || _pack == INNER_DDPQILUC || _pack == INNER_MPTILU2 || _pack == INNER_MPTILUC )
{
Sparse::Matrix & A = *(Sparse::Matrix *)matrix_data;
IterativeMethod & sol = *(IterativeMethod *)solver_data;
//IterativeMethod & sol = *(IterativeMethod *)solver_data;
INMOST_DATA_ENUM_TYPE lbeg, lend, l, iter;
INMOST_DATA_REAL_TYPE norm, sum[2], norm_prev, lambda_min, lambda_max;
bool diverged_max = false, diverged_min = false;
......@@ -1979,7 +1980,7 @@ namespace INMOST
if( _pack == INNER_ILU2 || _pack == INNER_DDPQILUC || _pack == INNER_MPTILU2 || _pack == INNER_MPTILUC )
{
Sparse::Matrix & A = *(Sparse::Matrix *)matrix_data;
IterativeMethod & sol = *(IterativeMethod *)solver_data;
//IterativeMethod & sol = *(IterativeMethod *)solver_data;