Commit 7a245e13 authored by Thomas Jahns's avatar Thomas Jahns 🤸
Browse files

Fix Fortran/C core wrapper function locations.

* Some routines only called by Fortran were in the C-only compilation unit
  and some routines the C functions are dependent on were in the Fortran
  wrapper compilation unit.
parent 38aa82f6
......@@ -61,48 +61,30 @@
MPI_Comm SymPrefix(default_comm) = MPI_COMM_WORLD;
static void
SymPrefix(set_default_comm_f)(MPI_Fint *comm_f)
#define PPMF2C_Data COMMON_BLOCK(PPMF2C_DATA,ppmf2c_data)
typedef struct
{
#if defined(USE_MPI)
int flag = 0;
MPI_Comm comm_c;
#if defined (__xlC__) && defined (_AIX)
#pragma omp critical
#endif
comm_c = (MPI_Initialized(&flag) == MPI_SUCCESS && flag)?
MPI_Comm_f2c(*comm_f):SymPrefix(default_comm);
#else
MPI_Comm comm_c = *comm_f;
#endif
SymPrefix(default_comm) = comm_c;
}
MPI_Fint ppm_default_comm;
} PPMF2C_Def;
FCALLSCSUB1(SymPrefix(set_default_comm_f), SYMPREFIX(SET_DEFAULT_COMM),
symprefix(set_default_comm), PVOID)
COMMON_BLOCK_DEF(PPMF2C_Def,PPMF2C_Data);
PPMF2C_Def PPMF2C_Data;
static void
SymPrefix(abort_f)(MPI_Fint *comm_f, const char *msg,
const char *source, int line)
void
SymPrefix(set_default_comm)(MPI_Comm comm)
{
MPI_Comm comm_c = MPI_COMM_NULL;
MPI_Fint comm_f;
#if defined(USE_MPI)
int flag = 0;
#if defined (__xlC__) && defined (_AIX)
#pragma omp critical
#endif
if (MPI_Initialized(&flag) == MPI_SUCCESS && flag)
comm_c = MPI_Comm_f2c(*comm_f);
comm_f = MPI_Comm_c2f(comm);
#else
comm_c = *comm_f;
comm_f = comm;
#endif
SymPrefix(abort)(comm_c, msg, source, line);
SYMPREFIX(default_comm) = comm;
PPMF2C_Data.ppm_default_comm = comm_f;
}
FCALLSCSUB4(SymPrefix(abort_f), SYMPREFIX(ABORT), symprefix(abort),
PVOID, STRING, STRING, INT)
void
SymPrefix(abort_default)(MPI_Comm comm, const char *msg, const char *source, int line)
{
......
......@@ -45,30 +45,47 @@
#include <cfortran.h>
#include "core.h"
#define PPMF2C_Data COMMON_BLOCK(PPMF2C_DATA,ppmf2c_data)
typedef struct
static void
SymPrefix(set_default_comm_f)(MPI_Fint *comm_f)
{
MPI_Fint ppm_default_comm;
} PPMF2C_Def;
COMMON_BLOCK_DEF(PPMF2C_Def,PPMF2C_Data);
#if defined(USE_MPI)
int flag = 0;
MPI_Comm comm_c;
#if defined (__xlC__) && defined (_AIX)
#pragma omp critical
#endif
comm_c = (MPI_Initialized(&flag) == MPI_SUCCESS && flag)?
MPI_Comm_f2c(*comm_f):SymPrefix(default_comm);
#else
MPI_Comm comm_c = *comm_f;
#endif
SymPrefix(default_comm) = comm_c;
}
PPMF2C_Def PPMF2C_Data;
FCALLSCSUB1(SymPrefix(set_default_comm_f), SYMPREFIX(SET_DEFAULT_COMM),
symprefix(set_default_comm), PVOID)
void
SymPrefix(set_default_comm)(MPI_Comm comm)
static void
SymPrefix(abort_f)(MPI_Fint *comm_f, const char *msg,
const char *source, int line)
{
MPI_Fint comm_f;
MPI_Comm comm_c = MPI_COMM_NULL;
#if defined(USE_MPI)
comm_f = MPI_Comm_c2f(comm);
int flag = 0;
#if defined (__xlC__) && defined (_AIX)
#pragma omp critical
#endif
if (MPI_Initialized(&flag) == MPI_SUCCESS && flag)
comm_c = MPI_Comm_f2c(*comm_f);
#else
comm_f = comm;
comm_c = *comm_f;
#endif
SymPrefix(default_comm) = comm;
PPMF2C_Data.ppm_default_comm = comm_f;
SymPrefix(abort)(comm_c, msg, source, line);
}
FCALLSCSUB4(SymPrefix(abort_f), SYMPREFIX(ABORT), symprefix(abort),
PVOID, STRING, STRING, INT)
static void
abort_ppm_handler_wrapper(MPI_Comm comm, const char msg[],
const char source[], int line)
......
Supports Markdown
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