|
Packit Service |
c5cf8c |
/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */
|
|
Packit Service |
c5cf8c |
/*
|
|
Packit Service |
c5cf8c |
* (C) 2011 by Argonne National Laboratory.
|
|
Packit Service |
c5cf8c |
* See COPYRIGHT in top-level directory.
|
|
Packit Service |
c5cf8c |
*/
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
#include "mpiimpl.h"
|
|
Packit Service |
c5cf8c |
#include "utlist.h" /* For DL_FOREACH */
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
/* -- Begin Profiling Symbol Block for routine MPI_T_pvar_start */
|
|
Packit Service |
c5cf8c |
#if defined(HAVE_PRAGMA_WEAK)
|
|
Packit Service |
c5cf8c |
#pragma weak MPI_T_pvar_start = PMPI_T_pvar_start
|
|
Packit Service |
c5cf8c |
#elif defined(HAVE_PRAGMA_HP_SEC_DEF)
|
|
Packit Service |
c5cf8c |
#pragma _HP_SECONDARY_DEF PMPI_T_pvar_start MPI_T_pvar_start
|
|
Packit Service |
c5cf8c |
#elif defined(HAVE_PRAGMA_CRI_DUP)
|
|
Packit Service |
c5cf8c |
#pragma _CRI duplicate MPI_T_pvar_start as PMPI_T_pvar_start
|
|
Packit Service |
c5cf8c |
#elif defined(HAVE_WEAK_ATTRIBUTE)
|
|
Packit Service |
c5cf8c |
int MPI_T_pvar_start(MPI_T_pvar_session session, MPI_T_pvar_handle handle)
|
|
Packit Service |
c5cf8c |
__attribute__ ((weak, alias("PMPI_T_pvar_start")));
|
|
Packit Service |
c5cf8c |
#endif
|
|
Packit Service |
c5cf8c |
/* -- End Profiling Symbol Block */
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
/* Define MPICH_MPI_FROM_PMPI if weak symbols are not supported to build
|
|
Packit Service |
c5cf8c |
the MPI routines */
|
|
Packit Service |
c5cf8c |
#ifndef MPICH_MPI_FROM_PMPI
|
|
Packit Service |
c5cf8c |
#undef MPI_T_pvar_start
|
|
Packit Service |
c5cf8c |
#define MPI_T_pvar_start PMPI_T_pvar_start
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
/* any non-MPI functions go here, especially non-static ones */
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
#undef FUNCNAME
|
|
Packit Service |
c5cf8c |
#define FUNCNAME MPIR_T_pvar_start_impl
|
|
Packit Service |
c5cf8c |
#undef FCNAME
|
|
Packit Service |
c5cf8c |
#define FCNAME MPL_QUOTE(FUNCNAME)
|
|
Packit Service |
c5cf8c |
int MPIR_T_pvar_start_impl(MPI_T_pvar_session session, MPI_T_pvar_handle handle)
|
|
Packit Service |
c5cf8c |
{
|
|
Packit Service |
c5cf8c |
int mpi_errno = MPI_SUCCESS;
|
|
Packit Service |
c5cf8c |
MPIR_T_pvar_watermark_t *mark;
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
if (MPIR_T_pvar_is_sum(handle)) {
|
|
Packit Service |
c5cf8c |
/* To start SUM, we only need to cache its current value into offset.
|
|
Packit Service |
c5cf8c |
* If it has ever been started, accum holds correct value. Otherwise,
|
|
Packit Service |
c5cf8c |
* accum is zero since handle allocation.
|
|
Packit Service |
c5cf8c |
*/
|
|
Packit Service |
c5cf8c |
if (handle->get_value == NULL) {
|
|
Packit Service |
c5cf8c |
MPIR_Memcpy(handle->offset, handle->addr, handle->bytes * handle->count);
|
|
Packit Service |
c5cf8c |
} else {
|
|
Packit Service |
c5cf8c |
handle->get_value(handle->addr, handle->obj_handle, handle->count, handle->offset);
|
|
Packit Service |
c5cf8c |
}
|
|
Packit Service |
c5cf8c |
} else if (MPIR_T_pvar_is_watermark(handle)) {
|
|
Packit Service |
c5cf8c |
/* To start WATERMARK, if it has not ever been started,
|
|
Packit Service |
c5cf8c |
* we need to set its starting value properly.
|
|
Packit Service |
c5cf8c |
*/
|
|
Packit Service |
c5cf8c |
mark = (MPIR_T_pvar_watermark_t *) handle->addr;
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
if (MPIR_T_pvar_is_first(handle)) {
|
|
Packit Service |
c5cf8c |
MPIR_Assert(mark->first_used);
|
|
Packit Service |
c5cf8c |
mark->first_started = TRUE;
|
|
Packit Service |
c5cf8c |
if (!MPIR_T_pvar_is_oncestarted(handle))
|
|
Packit Service |
c5cf8c |
mark->watermark = mark->current;
|
|
Packit Service |
c5cf8c |
} else {
|
|
Packit Service |
c5cf8c |
if (!MPIR_T_pvar_is_oncestarted(handle))
|
|
Packit Service |
c5cf8c |
handle->watermark = mark->current;
|
|
Packit Service |
c5cf8c |
}
|
|
Packit Service |
c5cf8c |
}
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
/* OK, let's get started */
|
|
Packit Service |
c5cf8c |
MPIR_T_pvar_set_started(handle);
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
return mpi_errno;
|
|
Packit Service |
c5cf8c |
}
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
#endif /* MPICH_MPI_FROM_PMPI */
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
#undef FUNCNAME
|
|
Packit Service |
c5cf8c |
#define FUNCNAME MPI_T_pvar_start
|
|
Packit Service |
c5cf8c |
#undef FCNAME
|
|
Packit Service |
c5cf8c |
#define FCNAME MPL_QUOTE(FUNCNAME)
|
|
Packit Service |
c5cf8c |
/*@
|
|
Packit Service |
c5cf8c |
MPI_T_pvar_start - Start a performance variable
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
Input Parameters:
|
|
Packit Service |
c5cf8c |
+ session - identifier of performance experiment session (handle)
|
|
Packit Service |
c5cf8c |
- handle - handle of a performance variable (handle)
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
Notes:
|
|
Packit Service |
c5cf8c |
If the constant MPI_T_PVAR_ALL_HANDLES is passed in handle, the MPI implementation
|
|
Packit Service |
c5cf8c |
attempts to start all variables within the session identified by the parameter session for
|
|
Packit Service |
c5cf8c |
which handles have been allocated. In this case, the routine returns MPI_SUCCESS if all
|
|
Packit Service |
c5cf8c |
variables are started successfully, otherwise MPI_T_ERR_PVAR_NO_STARTSTOP is returned.
|
|
Packit Service |
c5cf8c |
Continuous variables and variables that are already started are ignored when
|
|
Packit Service |
c5cf8c |
MPI_T_PVAR_ALL_HANDLES is specified.
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
.N ThreadSafe
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
.N Errors
|
|
Packit Service |
c5cf8c |
.N MPI_SUCCESS
|
|
Packit Service |
c5cf8c |
.N MPI_T_ERR_NOT_INITIALIZED
|
|
Packit Service |
c5cf8c |
.N MPI_T_ERR_INVALID_SESSION
|
|
Packit Service |
c5cf8c |
.N MPI_T_ERR_INVALID_HANDLE
|
|
Packit Service |
c5cf8c |
.N MPI_T_ERR_PVAR_NO_STARTSTOP
|
|
Packit Service |
c5cf8c |
@*/
|
|
Packit Service |
c5cf8c |
int MPI_T_pvar_start(MPI_T_pvar_session session, MPI_T_pvar_handle handle)
|
|
Packit Service |
c5cf8c |
{
|
|
Packit Service |
c5cf8c |
int mpi_errno = MPI_SUCCESS;
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
MPIR_FUNC_TERSE_STATE_DECL(MPID_STATE_MPI_T_PVAR_START);
|
|
Packit Service |
c5cf8c |
MPIR_ERRTEST_MPIT_INITIALIZED(mpi_errno);
|
|
Packit Service |
c5cf8c |
MPIR_T_THREAD_CS_ENTER();
|
|
Packit Service |
c5cf8c |
MPIR_FUNC_TERSE_ENTER(MPID_STATE_MPI_T_PVAR_START);
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
/* Validate parameters, especially handles needing to be converted */
|
|
Packit Service |
c5cf8c |
#ifdef HAVE_ERROR_CHECKING
|
|
Packit Service |
c5cf8c |
{
|
|
Packit Service |
c5cf8c |
MPID_BEGIN_ERROR_CHECKS;
|
|
Packit Service |
c5cf8c |
{
|
|
Packit Service |
c5cf8c |
MPIR_ERRTEST_PVAR_SESSION(session, mpi_errno);
|
|
Packit Service |
c5cf8c |
MPIR_ERRTEST_PVAR_HANDLE(handle, mpi_errno);
|
|
Packit Service |
c5cf8c |
}
|
|
Packit Service |
c5cf8c |
MPID_END_ERROR_CHECKS;
|
|
Packit Service |
c5cf8c |
}
|
|
Packit Service |
c5cf8c |
#endif /* HAVE_ERROR_CHECKING */
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
/* ... body of routine ... */
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
if (handle == MPI_T_PVAR_ALL_HANDLES) {
|
|
Packit Service |
c5cf8c |
MPIR_T_pvar_handle_t *hnd;
|
|
Packit Service |
c5cf8c |
DL_FOREACH(session->hlist, hnd) {
|
|
Packit Service |
c5cf8c |
if (!MPIR_T_pvar_is_continuous(hnd) && !MPIR_T_pvar_is_started(hnd))
|
|
Packit Service |
c5cf8c |
mpi_errno = MPIR_T_pvar_start_impl(session, hnd);
|
|
Packit Service |
c5cf8c |
}
|
|
Packit Service |
c5cf8c |
} else {
|
|
Packit Service |
c5cf8c |
if (handle->session != session) {
|
|
Packit Service |
c5cf8c |
mpi_errno = MPI_T_ERR_INVALID_HANDLE;
|
|
Packit Service |
c5cf8c |
goto fn_fail;
|
|
Packit Service |
c5cf8c |
}
|
|
Packit Service |
c5cf8c |
if (MPIR_T_pvar_is_continuous(handle)) {
|
|
Packit Service |
c5cf8c |
mpi_errno = MPI_T_ERR_PVAR_NO_STARTSTOP;
|
|
Packit Service |
c5cf8c |
goto fn_fail;
|
|
Packit Service |
c5cf8c |
}
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
if (!MPIR_T_pvar_is_started(handle)) {
|
|
Packit Service |
c5cf8c |
mpi_errno = MPIR_T_pvar_start_impl(session, handle);
|
|
Packit Service |
c5cf8c |
if (mpi_errno != MPI_SUCCESS)
|
|
Packit Service |
c5cf8c |
goto fn_fail;
|
|
Packit Service |
c5cf8c |
}
|
|
Packit Service |
c5cf8c |
}
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
/* ... end of body of routine ... */
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
fn_exit:
|
|
Packit Service |
c5cf8c |
MPIR_FUNC_TERSE_EXIT(MPID_STATE_MPI_T_PVAR_START);
|
|
Packit Service |
c5cf8c |
MPIR_T_THREAD_CS_EXIT();
|
|
Packit Service |
c5cf8c |
return mpi_errno;
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
fn_fail:
|
|
Packit Service |
c5cf8c |
/* --BEGIN ERROR HANDLING-- */
|
|
Packit Service |
c5cf8c |
#ifdef HAVE_ERROR_CHECKING
|
|
Packit Service |
c5cf8c |
{
|
|
Packit Service |
c5cf8c |
mpi_errno =
|
|
Packit Service |
c5cf8c |
MPIR_Err_create_code(mpi_errno, MPIR_ERR_RECOVERABLE, FCNAME, __LINE__, MPI_ERR_OTHER,
|
|
Packit Service |
c5cf8c |
"**mpi_t_pvar_start", "**mpi_t_pvar_start %p %p", session, handle);
|
|
Packit Service |
c5cf8c |
}
|
|
Packit Service |
c5cf8c |
#endif
|
|
Packit Service |
c5cf8c |
mpi_errno = MPIR_Err_return_comm(NULL, FCNAME, mpi_errno);
|
|
Packit Service |
c5cf8c |
goto fn_exit;
|
|
Packit Service |
c5cf8c |
/* --END ERROR HANDLING-- */
|
|
Packit Service |
c5cf8c |
}
|