Skip to content
Snippets Groups Projects
Commit 654c35f7 authored by Robert Klöfkorn's avatar Robert Klöfkorn
Browse files

also call STAR_Init and STAR_Finalize


git-svn-id: https://dune.mathematik.uni-freiburg.de/svn/alugrid/trunk@1243 0d966ed9-3843-0410-af09-ebfb50bd7c74
parent dcb6b591
No related branches found
No related tags found
No related merge requests found
......@@ -14,6 +14,9 @@ extern "C" {
STAR_Allgatherv(void * send_buff, int send_count, MPI_Datatype send_type,
void * recv_buff, int * recv_counts, int * disps,
MPI_Datatype recv_type, MPI_Comm comm, int call_site_id);
extern void InitializeStarMPI();
extern void FinalizeStarMPI();
}
#ifndef NDEBUG
......@@ -32,6 +35,16 @@ static int getNextCallSiteId()
// workarround for old member variable
#define _mpiComm (getMPICommunicator(_mpiCommPtr))
void MpAccessSTAR_MPI :: initStarMPI()
{
InitializeStarMPI();
}
MpAccessSTAR_MPI :: ~MpAccessSTAR_MPI ()
{
FinalizeStarMPI();
}
// the last parameter is the `call_site_id`. Each call has to have its own unique
// call_site_id
......
......@@ -15,6 +15,8 @@ protected:
int star_allgather (int *, int , int *, int) const ;
int star_allgather (char *, int, char *, int) const ;
int star_allgather (double *, int, double *, int ) const ;
void initStarMPI();
public :
// constructor taking MPI_Comm
// to avoid MPI types here this is a template constructor
......@@ -22,8 +24,12 @@ public :
inline MpAccessSTAR_MPI (MPICommunicator mpicomm )
: BaseType( mpicomm )
{
initStarMPI();
}
// destructor
~MpAccessSTAR_MPI();
// copy constructor
inline MpAccessSTAR_MPI (const MpAccessSTAR_MPI &a )
: BaseType( a )
......
......@@ -9,6 +9,26 @@ extern "C" {
// include STAR-MPI sources to compile object file
#include <star-mpi.c>
void InitializeStarMPI()
{
static int initialized = 0;
if( ! initialized )
{
STAR_Init();
initialized = 1;
}
}
void FinalizeStarMPI()
{
static int finalized = 0;
if( ! finalized )
{
STAR_Finalize();
finalized = 1;
}
}
#if defined(__cplusplus)
}
#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