Commit 1681cf22 authored by jayesh's avatar jayesh
Browse files

SMPD now correctly locks the global thread lock before using the MPID util functions

parent 76f64b5c
......@@ -7,6 +7,7 @@
#include <stdio.h>
#include "mpiexec.h"
#include "smpd.h"
#include "smpd_implthread.h"
#ifdef HAVE_WINDOWS_H
void timeout_thread(void *p)
......@@ -151,6 +152,7 @@ int main(int argc, char* argv[])
/* initialize */
result = PMPI_Init(&argc, &argv);
SMPD_CS_ENTER();
if (result != MPI_SUCCESS)
{
smpd_err_printf("MPI_Init failed,\nerror: %d\n", result);
......@@ -464,6 +466,7 @@ quit_job:
smpd_cancel_stdin_thread();
#endif
smpd_exit_fn("main");
SMPD_CS_EXIT();
return smpd_exit(smpd_process.mpiexec_exit_code);
}
......@@ -8,6 +8,7 @@
#include <stdlib.h>
#include "smpd.h"
#include "mpi.h"
#include "smpd_implthread.h"
#ifdef HAVE_WINDOWS_H
#include "smpd_service.h"
#endif
......@@ -48,6 +49,7 @@ int main(int argc, char* argv[])
/* initialization */
result = PMPI_Init(&argc, &argv);
SMPD_CS_ENTER();
if (result != MPI_SUCCESS)
{
smpd_err_printf("MPI_Init failed,\n error: %d\n", result);
......@@ -165,6 +167,7 @@ int main(int argc, char* argv[])
smpd_finalize_printf();
SMPD_CS_EXIT();
smpd_exit(result);
smpd_exit_fn(FCNAME);
return result;
......
/* -*- Mode: C; c-basic-offset:4 ; -*- */
/*
* (C) 2001 by Argonne National Laboratory.
* See COPYRIGHT in top-level directory.
*/
/* This header file contains utils for SMPD to access the MPID util functions
* *correctly*
*/
/* FIXME: SMPD internally calls the utils defined for the MPID device
* eg: MPIDU_Sock_wait() -- Remove this dependency by copying the required
* socket code to smpd
*/
#include "mpiimpl.h"
#include "mpiimplthread.h"
/* Macros to be used before/after calling any MPID util funcs,
* eg: MPIDU_Sock_wait().
* Since SMPD is single threaded we do not need extra functionalities
* provided by the MPID_CS_ENTER() macros
*/
#if !defined(MPICH_IS_THREADED)
#define SMPD_CS_ENTER()
#define SMPD_CS_EXIT()
#else
#define SMPD_CS_ENTER() \
MPID_Thread_mutex_lock(&MPIR_ThreadInfo.global_mutex)
#define SMPD_CS_EXIT() \
MPID_Thread_mutex_unlock(&MPIR_ThreadInfo.global_mutex)
#endif
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