mirror of
https://github.com/NGSolve/netgen.git
synced 2025-01-13 06:30:34 +05:00
mpiwrapper
This commit is contained in:
parent
7aa5c536a8
commit
9b8f273b14
@ -100,18 +100,19 @@ namespace ngcore
|
|||||||
|
|
||||||
|
|
||||||
#else
|
#else
|
||||||
|
class MPI_Comm { };
|
||||||
|
|
||||||
class NgMPI_Comm
|
class NgMPI_Comm
|
||||||
{
|
{
|
||||||
|
|
||||||
public:
|
public:
|
||||||
NgMPI_Comm (int _comm, bool owns = false)
|
NgMPI_Comm (MPI_Comm _comm, bool owns = false)
|
||||||
{ ; }
|
{ ; }
|
||||||
|
|
||||||
size_t Rank() const { return 0; }
|
size_t Rank() const { return 0; }
|
||||||
size_t Size() const { return 1; }
|
size_t Size() const { return 1; }
|
||||||
|
|
||||||
|
operator MPI_Comm() const { return MPI_Comm(); }
|
||||||
|
|
||||||
template<typename T>
|
template<typename T>
|
||||||
void Send( T & val, int dest, int tag) { ; }
|
void Send( T & val, int dest, int tag) { ; }
|
||||||
|
@ -43,6 +43,9 @@ namespace netgen
|
|||||||
return string(buf);
|
return string(buf);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#else
|
||||||
|
MPI_Comm MPI_COMM_WORLD, MPI_COMM_NULL;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
@ -19,7 +19,7 @@ namespace netgen
|
|||||||
|
|
||||||
#ifndef PARALLEL
|
#ifndef PARALLEL
|
||||||
/** without MPI, we need a dummy typedef **/
|
/** without MPI, we need a dummy typedef **/
|
||||||
typedef int MPI_Comm;
|
// typedef int MPI_Comm;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/** This is the "standard" communicator that will be used for netgen-objects. **/
|
/** This is the "standard" communicator that will be used for netgen-objects. **/
|
||||||
@ -39,7 +39,8 @@ namespace netgen
|
|||||||
return id;
|
return id;
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
enum { MPI_COMM_WORLD = 12345, MPI_COMM_NULL = 0};
|
// enum { MPI_COMM_WORLD = 12345, MPI_COMM_NULL = 0};
|
||||||
|
extern MPI_Comm MPI_COMM_WORLD, MPI_COMM_NULL;
|
||||||
inline int MyMPI_GetNTasks (MPI_Comm comm = ng_comm) { return 1; }
|
inline int MyMPI_GetNTasks (MPI_Comm comm = ng_comm) { return 1; }
|
||||||
inline int MyMPI_GetId (MPI_Comm comm = ng_comm) { return 0; }
|
inline int MyMPI_GetId (MPI_Comm comm = ng_comm) { return 0; }
|
||||||
#endif
|
#endif
|
||||||
|
@ -37,10 +37,10 @@
|
|||||||
// max number of nodes per surface element
|
// max number of nodes per surface element
|
||||||
#define NG_SURFACE_ELEMENT_MAXPOINTS 8
|
#define NG_SURFACE_ELEMENT_MAXPOINTS 8
|
||||||
|
|
||||||
#ifndef PARALLEL
|
// #ifndef PARALLEL
|
||||||
typedef int MPI_Comm;
|
// typedef int MPI_Comm;
|
||||||
#endif
|
// #endif
|
||||||
namespace netgen { extern DLL_HEADER MPI_Comm ng_comm; }
|
namespace netgen { extern DLL_HEADER NgMPI_Comm ng_comm; }
|
||||||
|
|
||||||
|
|
||||||
// implemented element types:
|
// implemented element types:
|
||||||
@ -66,7 +66,7 @@ extern "C" {
|
|||||||
DLL_HEADER void Ng_LoadGeometry (const char * filename);
|
DLL_HEADER void Ng_LoadGeometry (const char * filename);
|
||||||
|
|
||||||
// load netgen mesh
|
// load netgen mesh
|
||||||
DLL_HEADER void Ng_LoadMesh (const char * filename, MPI_Comm comm = netgen::ng_comm);
|
DLL_HEADER void Ng_LoadMesh (const char * filename, ngcore::NgMPI_Comm comm = netgen::ng_comm);
|
||||||
|
|
||||||
// load netgen mesh
|
// load netgen mesh
|
||||||
DLL_HEADER void Ng_LoadMeshFromString (const char * mesh_as_string);
|
DLL_HEADER void Ng_LoadMeshFromString (const char * mesh_as_string);
|
||||||
|
@ -26,9 +26,9 @@ enum NG_ELEMENT_TYPE {
|
|||||||
enum NG_REFINEMENT_TYPE { NG_REFINE_H = 0, NG_REFINE_P = 1, NG_REFINE_HP = 2 };
|
enum NG_REFINEMENT_TYPE { NG_REFINE_H = 0, NG_REFINE_P = 1, NG_REFINE_HP = 2 };
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef PARALLEL
|
// #ifndef PARALLEL
|
||||||
typedef int MPI_Comm;
|
// typedef int MPI_Comm;
|
||||||
#endif
|
// #endif
|
||||||
|
|
||||||
|
|
||||||
namespace netgen
|
namespace netgen
|
||||||
@ -36,7 +36,7 @@ namespace netgen
|
|||||||
using namespace std;
|
using namespace std;
|
||||||
using namespace ngcore;
|
using namespace ngcore;
|
||||||
|
|
||||||
extern DLL_HEADER MPI_Comm ng_comm;
|
extern DLL_HEADER NgMPI_Comm ng_comm;
|
||||||
|
|
||||||
static constexpr int POINTINDEX_BASE = 1;
|
static constexpr int POINTINDEX_BASE = 1;
|
||||||
|
|
||||||
|
@ -32,7 +32,7 @@ namespace netgen
|
|||||||
// TraceGlobal glob2("global2");
|
// TraceGlobal glob2("global2");
|
||||||
|
|
||||||
// global communicator for netgen
|
// global communicator for netgen
|
||||||
DLL_HEADER MyMPI_Comm ng_comm = MPI_COMM_WORLD;
|
DLL_HEADER NgMPI_Comm ng_comm = MPI_COMM_WORLD;
|
||||||
|
|
||||||
weak_ptr<Mesh> global_mesh;
|
weak_ptr<Mesh> global_mesh;
|
||||||
void SetGlobalMesh (shared_ptr<Mesh> m)
|
void SetGlobalMesh (shared_ptr<Mesh> m)
|
||||||
|
@ -61,7 +61,7 @@ namespace netgen
|
|||||||
DLL_HEADER void SetGlobalMesh (shared_ptr<Mesh> m);
|
DLL_HEADER void SetGlobalMesh (shared_ptr<Mesh> m);
|
||||||
|
|
||||||
// global communicator for netgen (dummy if no MPI)
|
// global communicator for netgen (dummy if no MPI)
|
||||||
extern DLL_HEADER MPI_Comm ng_comm;
|
extern DLL_HEADER NgMPI_Comm ng_comm;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -83,7 +83,7 @@ namespace netgen
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void Mesh :: SetCommunicator(MPI_Comm acomm)
|
void Mesh :: SetCommunicator(NgMPI_Comm acomm)
|
||||||
{
|
{
|
||||||
this->comm = acomm;
|
this->comm = acomm;
|
||||||
}
|
}
|
||||||
|
@ -33,7 +33,7 @@ namespace netgen
|
|||||||
T_POINTS points;
|
T_POINTS points;
|
||||||
|
|
||||||
// The communicator for this mesh. Just a dummy if compiled without MPI.
|
// The communicator for this mesh. Just a dummy if compiled without MPI.
|
||||||
NgMPI_Comm comm;
|
NgMPI_Comm comm = MPI_COMM_NULL;
|
||||||
|
|
||||||
/// line-segments at edges
|
/// line-segments at edges
|
||||||
Array<Segment, 0, size_t> segments;
|
Array<Segment, 0, size_t> segments;
|
||||||
|
Loading…
Reference in New Issue
Block a user