Commit 607000a3 authored by whitlocb's avatar whitlocb

Improved Fortran MPI communicator code for Libsim.

git-svn-id: http://visit.ilight.com/svn/visit/trunk/src@26749 18c085ea-50e0-402c-830e-de6fd14e8384
parent dad07a23
......@@ -40,7 +40,7 @@ enhancements and bug-fixes that were added to this release.</p>
<a name="Advanced_Features"></a>
<p><b><font size="4">Advanced features added in version 2.10</font></b></p>
<ul>
<li></li>
<li>Libsim's Fortran bindings were enhanced so the <i>visitsetmpicommunicator</i> function passes an MPI communicator by its integer handle. Thank you to William T. Jones for this improvement.</li>
<li></li>
<li></li>
<li></li>
......
......@@ -143,6 +143,7 @@ typedef struct
int (*save_window)(void*,const char *, int, int, int);
void (*debug_logs)(int,const char *);
int (*set_mpicomm)(void *);
int (*set_mpicomm_f)(int *);
int (*add_plot)(void *, const char *, const char *);
int (*add_operator)(void *, const char *, int);
......@@ -233,6 +234,7 @@ static void (*visit_slave_process_callback2)(void *) = NULL;
static void *visit_slave_process_callback2_data = NULL;
static void *visit_communicator = NULL;
static int visit_batch_mode = 0;
static int *visit_communicator_f = NULL;
/*******************************************************************************
*******************************************************************************
......@@ -1154,6 +1156,15 @@ static int CreateEngine(int batch)
#endif
}
if(visit_communicator != NULL)
{
VisItSetMPICommunicator(visit_communicator);
}
else if(visit_communicator_f != NULL)
{
VisItSetMPICommunicator_f(visit_communicator_f);
}
LIBSIM_MESSAGE_STRINGLIST("Calling visit_initialize: argv=",
engine_argc, engine_argv);
if(batch && callbacks->control.initialize_batch != NULL)
......@@ -1896,6 +1907,7 @@ static int LoadVisItLibrary(void)
CONTROL_DLSYM(save_window, int, (void*,const char *,int,int,int));
CONTROL_DLSYM(debug_logs, void, (int,const char *));
CONTROL_DLSYM(set_mpicomm, int, (void *));
CONTROL_DLSYM(set_mpicomm_f, int, (int *));
CONTROL_DLSYM_OPTIONAL(add_plot, int, (void *, const char *, const char *));
CONTROL_DLSYM_OPTIONAL(add_operator, int, (void *, const char *, int));
......@@ -3791,6 +3803,31 @@ VisItSetMPICommunicator(void *comm)
return retval;
}
/******************************************************************************
*
* Name: VisItSetMPICommunicator_f
*
* Purpose: Let the Fortran user set the MPI communicator that VisIt will use.
*
* Programmer: William T. Jones
* Date: Fri Jul 12 18:13:24 EDT 2013
*
* Modifications:
*
******************************************************************************/
int
VisItSetMPICommunicator_f(int *comm)
{
int retval = VISIT_OKAY;
LIBSIM_API_ENTER(VisItSetMPICommunicator_f);
visit_communicator_f = comm;
if(engine && callbacks != NULL && callbacks->control.set_mpicomm_f != NULL)
retval = (*callbacks->control.set_mpicomm_f)(comm);
LIBSIM_API_LEAVE(VisItSetMPICommunicator_f);
return retval;
}
/******************************************************************************
*
* Name: VisItInitializeRuntime
......
......@@ -819,6 +819,26 @@ int VisItSaveWindow(const char *filename, int width, int height, int format);
* ****************************************************************************/
int VisItSetMPICommunicator(void *mpicom);
/******************************************************************************
* Function: VisItSetMPICommunicator_f
*
* Purpose:
* This function sets the communicator that VisIt should use for parallel
* operations from a Fortran handle. Note that you may want to temporarily
* install a communicator for vis operations and then revert to the default
* communicator for when VisIt needs to communicate commands to other
* processes.
*
* Arguments:
* mpicom : A pointer to the FORTRAN communicator that we should use.
*
* Returns: VISIT_OKAY on success; otherwise VISIT_ERROR
*
* Note: use VisItSetMPICommunicator to revert to its copy of MPI_COMM_WORLD.
*
* ****************************************************************************/
int VisItSetMPICommunicator_f(int *mpicom);
/******************************************************************************
* Function: VisItInitializeRuntime
*
......
......@@ -275,7 +275,7 @@ F_VISITSETMPICOMMUNICATOR(int *comm)
{
int ret = VISIT_ERROR;
if(comm != NULL)
ret = VisItSetMPICommunicator((void *)comm);
ret = VisItSetMPICommunicator_f(comm);
return ret;
}
......
......@@ -536,6 +536,39 @@ simv2_set_mpicomm(void *comm)
#endif
}
// ****************************************************************************
// Method: simv2_set_mpicomm_f
//
// Purpose:
// SimV2 runtime function that sets the MPI communicator from Fortran which
// uses an integer communicator handle.
//
// Arguments:
// comm : The Fortran MPI communicator handle (integer).
//
// Returns: VISIT_OKAY, VISIT_ERROR
//
// Note:
//
// Programmer: William T. Jones
// Creation: Wed Sep 4 10:27:03 PDT 2013
//
// Modifications:
//
// ****************************************************************************
int
simv2_set_mpicomm_f(int *comm)
{
#ifdef PARALLEL
MPI_Fint *commF = (MPI_Fint*)comm;
static MPI_Comm commC = MPI_Comm_f2c(*commF);
return PAR_SetComm((void*)&commC) ? VISIT_OKAY : VISIT_ERROR;
#else
return VISIT_ERROR;
#endif
}
///////////////////////////////////////////////////////////////////////////////
/// THESE FUNCTIONS ARE MORE EXPERIMENTAL
///////////////////////////////////////////////////////////////////////////////
......
......@@ -58,6 +58,9 @@ extern "C" {
// Brad Whitlock, Fri Aug 26 09:52:11 PDT 2011
// I added simv2_set_mpicomm.
//
// William T. Jones, Fri Jul 12 17:42:31 EST 2013
// I added simv2_set_mpicomm_f.
//
// Brad Whitlock, Thu Sep 18 16:16:29 PDT 2014
// I added simv2_initialize_batch, simv2_exportdatabase, simv2_restoresession.
//
......@@ -80,6 +83,7 @@ SIMV2_API void simv2_set_command_callback(void*,void(*)(const char*,const cha
SIMV2_API int simv2_save_window(void*, const char *, int, int, int);
SIMV2_API void simv2_debug_logs(int level, const char *msg);
SIMV2_API int simv2_set_mpicomm(void *);
SIMV2_API int simv2_set_mpicomm_f(int *);
SIMV2_API int simv2_add_plot(void *, const char *, const char *);
SIMV2_API int simv2_add_operator(void *, const char *, int);
......
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