1
1

OSHMEM: fixes crash during initialization

Do not call mpi comm_dup() if mpi failed to initialize. Also do not set
signal handlers.
Small code styling fixes.

Signed-off-by: Alex Mikheev <alexm@mellanox.com>
Этот коммит содержится в:
Alex Mikheev 2016-10-26 11:15:06 +03:00
родитель b1aedf457f
Коммит f630b43285
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 0F964A1EF0579522

Просмотреть файл

@ -149,13 +149,17 @@ int oshmem_shmem_init(int argc, char **argv, int requested, int *provided)
if (!ompi_mpi_initialized && !ompi_mpi_finalized) {
ret = ompi_mpi_init(argc, argv, requested, provided);
}
PMPI_Comm_dup(MPI_COMM_WORLD, &oshmem_comm_world);
if (OSHMEM_SUCCESS == ret) {
ret = _shmem_init(argc, argv, requested, provided);
if (OSHMEM_SUCCESS != ret) {
return ret;
}
if (OSHMEM_SUCCESS == ret) {
PMPI_Comm_dup(MPI_COMM_WORLD, &oshmem_comm_world);
ret = _shmem_init(argc, argv, requested, provided);
if (OSHMEM_SUCCESS != ret) {
return ret;
}
oshmem_shmem_initialized = true;
if (OSHMEM_SUCCESS != shmem_lock_init()) {
@ -171,14 +175,12 @@ int oshmem_shmem_init(int argc, char **argv, int requested, int *provided)
pthread_t thread_id;
int perr;
perr = pthread_create(&thread_id, NULL, &shmem_opal_thread, NULL);
if (perr != 0)
{
if (0 != perr) {
SHMEM_API_ERROR("cannot creat opal thread for SHMEM");
return OSHMEM_ERROR;
}
#endif
}
}
#ifdef SIGUSR1
signal(SIGUSR1,sighandler__SIGUSR1);
signal(SIGTERM,sighandler__SIGTERM);