Esempio n. 1
0
static void
monitor_thread_name_init(void)
{
    MONITOR_RUN_ONCE(thread_name_init);

    MONITOR_GET_REAL_NAME_WRAP(real_pthread_create, pthread_create);
    MONITOR_GET_REAL_NAME(real_pthread_attr_init, pthread_attr_init);
    MONITOR_GET_REAL_NAME(real_pthread_attr_destroy, pthread_attr_destroy);
    MONITOR_GET_REAL_NAME(real_pthread_attr_getstacksize, pthread_attr_getstacksize);
    MONITOR_GET_REAL_NAME(real_pthread_attr_setstacksize, pthread_attr_setstacksize);
#ifdef MONITOR_PTHREAD_EQUAL_IS_FCN
    MONITOR_GET_REAL_NAME(real_pthread_equal, pthread_equal);
#endif
    MONITOR_GET_REAL_NAME(real_pthread_key_create, pthread_key_create);
    MONITOR_GET_REAL_NAME(real_pthread_key_delete, pthread_key_delete);
    MONITOR_GET_REAL_NAME(real_pthread_kill, pthread_kill);
    MONITOR_GET_REAL_NAME(real_pthread_self, pthread_self);
    MONITOR_GET_REAL_NAME(real_pthread_getspecific,  pthread_getspecific);
    MONITOR_GET_REAL_NAME(real_pthread_setspecific,  pthread_setspecific);
#ifdef MONITOR_PTHREAD_CLEANUP_PUSH_IS_FCN
    MONITOR_GET_REAL_NAME(real_pthread_cleanup_push, pthread_cleanup_push);
    MONITOR_GET_REAL_NAME(real_pthread_cleanup_pop,  pthread_cleanup_pop);
#endif
    MONITOR_GET_REAL_NAME(real_pthread_setcancelstate, pthread_setcancelstate);
#ifdef MONITOR_USE_SIGNALS
    MONITOR_GET_REAL_NAME_WRAP(real_sigaction, sigaction);
    MONITOR_GET_REAL_NAME_WRAP(real_pthread_sigmask, pthread_sigmask);
#else
    MONITOR_GET_REAL_NAME(real_sigaction, sigaction);
    MONITOR_GET_REAL_NAME(real_pthread_sigmask, pthread_sigmask);
#endif
    MONITOR_GET_REAL_NAME_WRAP(real_sigwaitinfo, sigwaitinfo);
    MONITOR_GET_REAL_NAME_WRAP(real_sigtimedwait, sigtimedwait);
}
Esempio n. 2
0
/*
 * In C, MPI_Comm is not always void *, but that seems to be
 * compatible with most libraries.
 */
int
MONITOR_WRAP_NAME(PMPI_Comm_rank)(void *comm, int *rank)
{
    int size = -1, ret;

    MONITOR_DEBUG("comm = %p\n", comm);
    MONITOR_GET_REAL_NAME(real_pmpi_comm_size, PMPI_Comm_size);
    MONITOR_GET_REAL_NAME_WRAP(real_pmpi_comm_rank, PMPI_Comm_rank);
    ret = (*real_pmpi_comm_size)(comm, &size);
    ret = (*real_pmpi_comm_rank)(comm, rank);
    monitor_set_mpi_size_rank(size, *rank);

    return (ret);
}
Esempio n. 3
0
/*
 *  Pthread_exit() from the main thread exits the process, and this
 *  bypasses our other exit-catching methods, so we have to override
 *  it here.
 */
void
MONITOR_WRAP_NAME(pthread_exit)(void *data)
{
    struct monitor_thread_node *tn;

    tn = monitor_get_tn();
    if (tn == NULL || tn->tn_is_main) {
	MONITOR_DEBUG1("pthread_exit called from main thread\n");
	monitor_end_process_fcn(MONITOR_EXIT_NORMAL);
    }

    MONITOR_GET_REAL_NAME_WRAP(real_pthread_exit, pthread_exit);
    (*real_pthread_exit)(data);

    /* Never reached, but silence a compiler warning. */
    exit(0);
}
Esempio n. 4
0
void
MONITOR_WRAP_NAME(mpi_finalize__)(int *ierror)
{
    int count;

    MONITOR_DEBUG1("\n");
    MONITOR_GET_REAL_NAME_WRAP(real_mpi_finalize, mpi_finalize__);
    count = monitor_mpi_fini_count(1);
    if (count == 1) {
	MONITOR_DEBUG("calling monitor_fini_mpi(), size = %d, rank = %d ...\n",
		      monitor_mpi_comm_size(), monitor_mpi_comm_rank());
	monitor_fini_mpi();
    }
    (*real_mpi_finalize)(ierror);
    if (count == 1) {
	MONITOR_DEBUG1("calling monitor_mpi_post_fini() ...\n");
	monitor_mpi_post_fini();
    }
    monitor_mpi_fini_count(-1);
}
Esempio n. 5
0
void
MONITOR_WRAP_NAME(mpi_init_thread_)(int *required, int *provided, int *ierror)
{
    int argc, count;
    char **argv;

    MONITOR_DEBUG1("\n");
    MONITOR_GET_REAL_NAME_WRAP(real_mpi_init_thread, mpi_init_thread_);
    count = monitor_mpi_init_count(1);
    if (count == 1) {
	MONITOR_DEBUG1("calling monitor_mpi_pre_init() ...\n");
	monitor_mpi_pre_init();
    }
    (*real_mpi_init_thread)(required, provided, ierror);
    if (count == 1) {
	MONITOR_DEBUG1("calling monitor_init_mpi() ...\n");
	monitor_get_main_args(&argc, &argv, NULL);
	monitor_init_mpi(&argc, &argv);
    }
    monitor_mpi_init_count(-1);
}
Esempio n. 6
0
int
MONITOR_WRAP_NAME(MPI_Init)(int *argc, char ***argv)
{
    int ret, count;

    MONITOR_DEBUG1("\n");
    MONITOR_GET_REAL_NAME_WRAP(real_mpi_init, MPI_Init);
    count = monitor_mpi_init_count(1);
    if (count == 1) {
	MONITOR_DEBUG1("calling monitor_mpi_pre_init() ...\n");
	monitor_mpi_pre_init();
    }
    ret = (*real_mpi_init)(argc, argv);
    if (count == 1) {
	MONITOR_DEBUG1("calling monitor_init_mpi() ...\n");
	monitor_init_mpi(argc, argv);
    }
    monitor_mpi_init_count(-1);

    return (ret);
}
Esempio n. 7
0
int
MONITOR_WRAP_NAME(PMPI_Finalize)(void)
{
    int ret, count;

    MONITOR_DEBUG1("\n");
    MONITOR_GET_REAL_NAME_WRAP(real_pmpi_finalize, PMPI_Finalize);
    count = monitor_mpi_fini_count(1);
    if (count == 1) {
	MONITOR_DEBUG("calling monitor_fini_mpi(), size = %d, rank = %d ...\n",
		      monitor_mpi_comm_size(), monitor_mpi_comm_rank());
	monitor_fini_mpi();
    }
    ret = (*real_pmpi_finalize)();
    if (count == 1) {
	MONITOR_DEBUG1("calling monitor_mpi_post_fini() ...\n");
	monitor_mpi_post_fini();
    }
    monitor_mpi_fini_count(-1);

    return (ret);
}
Esempio n. 8
0
int
MONITOR_WRAP_NAME(PMPI_Init_thread)(int *argc, char ***argv,
				    int required, int *provided)
{
    int ret, count;

    MONITOR_DEBUG1("\n");
    MONITOR_GET_REAL_NAME_WRAP(real_pmpi_init_thread, PMPI_Init_thread);
    count = monitor_mpi_init_count(1);
    if (count == 1) {
	MONITOR_DEBUG1("calling monitor_mpi_pre_init() ...\n");
	monitor_mpi_pre_init();
    }
    ret = (*real_pmpi_init_thread)(argc, argv, required, provided);
    if (count == 1) {
	MONITOR_DEBUG1("calling monitor_init_mpi() ...\n");
	monitor_init_mpi(argc, argv);
    }
    monitor_mpi_init_count(-1);

    return (ret);
}