2013-04-24 19:59:23 +04:00
|
|
|
/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */
|
|
|
|
/*
|
2015-06-02 18:04:10 +03:00
|
|
|
* Copyright (c) 2012-2015 Los Alamos National Security, LLC. All rights
|
2013-04-24 19:59:23 +04:00
|
|
|
* reserved.
|
2015-05-08 03:19:02 +03:00
|
|
|
* Copyright (c) 2015 Research Organization for Information Science
|
|
|
|
* and Technology (RIST). All rights reserved.
|
2013-04-24 19:59:23 +04:00
|
|
|
* $COPYRIGHT$
|
|
|
|
*
|
|
|
|
* Additional copyrights may follow
|
|
|
|
*
|
|
|
|
* $HEADER$
|
|
|
|
*/
|
|
|
|
|
2013-07-16 20:03:33 +04:00
|
|
|
#include "ompi/mpi/tool/mpit-internal.h"
|
2013-04-24 19:59:23 +04:00
|
|
|
|
2015-05-08 03:19:02 +03:00
|
|
|
opal_mutex_t mpit_big_lock = {{0}};
|
2013-04-24 19:59:23 +04:00
|
|
|
|
|
|
|
volatile uint32_t mpit_init_count = 0;
|
2013-07-16 20:03:33 +04:00
|
|
|
volatile int32_t initted = 0;
|
2013-04-24 19:59:23 +04:00
|
|
|
|
|
|
|
void mpit_lock (void)
|
|
|
|
{
|
|
|
|
if (initted) {
|
|
|
|
opal_mutex_lock (&mpit_big_lock);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void mpit_unlock (void)
|
|
|
|
{
|
|
|
|
if (initted) {
|
|
|
|
opal_mutex_unlock (&mpit_big_lock);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-07-16 20:02:13 +04:00
|
|
|
int ompit_var_type_to_datatype (mca_base_var_type_t type, MPI_Datatype *datatype)
|
|
|
|
{
|
2015-06-25 01:05:34 +03:00
|
|
|
if (!datatype) {
|
|
|
|
return OMPI_SUCCESS;
|
|
|
|
}
|
|
|
|
|
2013-07-16 20:02:13 +04:00
|
|
|
switch (type) {
|
|
|
|
case MCA_BASE_VAR_TYPE_INT:
|
|
|
|
*datatype = MPI_INT;
|
|
|
|
break;
|
|
|
|
case MCA_BASE_VAR_TYPE_UNSIGNED_INT:
|
|
|
|
*datatype = MPI_UNSIGNED;
|
|
|
|
break;
|
|
|
|
case MCA_BASE_VAR_TYPE_UNSIGNED_LONG:
|
|
|
|
*datatype = MPI_UNSIGNED_LONG;
|
|
|
|
break;
|
|
|
|
case MCA_BASE_VAR_TYPE_UNSIGNED_LONG_LONG:
|
|
|
|
*datatype = MPI_UNSIGNED_LONG_LONG;
|
|
|
|
break;
|
|
|
|
case MCA_BASE_VAR_TYPE_SIZE_T:
|
|
|
|
if (sizeof (size_t) == sizeof (unsigned)) {
|
|
|
|
*datatype = MPI_UNSIGNED;
|
|
|
|
} else if (sizeof (size_t) == sizeof (unsigned long)) {
|
|
|
|
*datatype = MPI_UNSIGNED_LONG;
|
|
|
|
} else if (sizeof (size_t) == sizeof (unsigned long long)) {
|
|
|
|
*datatype = MPI_UNSIGNED_LONG_LONG;
|
|
|
|
} else {
|
|
|
|
/* not supported -- fixme */
|
|
|
|
assert (0);
|
|
|
|
}
|
|
|
|
|
|
|
|
break;
|
|
|
|
case MCA_BASE_VAR_TYPE_STRING:
|
|
|
|
*datatype = MPI_CHAR;
|
|
|
|
break;
|
|
|
|
case MCA_BASE_VAR_TYPE_BOOL:
|
2014-05-01 02:10:30 +04:00
|
|
|
*datatype = MPI_INT;
|
2013-07-16 20:02:13 +04:00
|
|
|
break;
|
|
|
|
case MCA_BASE_VAR_TYPE_DOUBLE:
|
|
|
|
*datatype = MPI_DOUBLE;
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
/* not supported -- fixme */
|
|
|
|
assert (0);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
return OMPI_SUCCESS;
|
|
|
|
}
|
2013-10-23 19:47:15 +04:00
|
|
|
|
|
|
|
int ompit_opal_to_mpit_error (int rc)
|
|
|
|
{
|
2015-06-02 18:04:10 +03:00
|
|
|
if (rc >= 0) {
|
|
|
|
/* Already an MPI error (always >= 0) */
|
|
|
|
return rc;
|
|
|
|
}
|
|
|
|
|
2013-10-23 19:47:15 +04:00
|
|
|
switch (rc) {
|
|
|
|
case OPAL_ERR_OUT_OF_RESOURCE:
|
|
|
|
return MPI_T_ERR_MEMORY;
|
|
|
|
case OPAL_ERR_VALUE_OUT_OF_BOUNDS:
|
|
|
|
case OPAL_ERR_NOT_BOUND:
|
|
|
|
return MPI_T_ERR_INVALID_HANDLE;
|
|
|
|
default:
|
|
|
|
return MPI_ERR_UNKNOWN;
|
|
|
|
}
|
|
|
|
}
|