Convert all ompi_bitmap_t and ompi_pointer_array_t indexing from
size_t to int. This is in recognition of the fact that these two classes are primarily used for fortran<-->c convertsion of various entities (attributes, MPI objects), and MPI defines that an int must be used to hold MPI fortran handles. Hence, why use size_t internally? See the comment in src/class/ompi_pointer_array.h for a better description. Mixed in a few attribute fixes in this commit as well. This commit, therefore: - converts the indexing from size_t to int - changes all locations in the code that I could find that used size_t as the interface to ompi_bitmap_t or ompi_pointer_array_t - convert to use OMPI_FINT_2_INT / OMPI_INT_2_FINT macros in various src/mpi/c/*f2c.c and src/mpi/c/*c2f.c files - check the return code of ompi_comm_free() to ensure that everything worked properly before returning MPI_SUCCESS - unified all src/mpi/c/*f2c.c functions (i.e., they all do the same thing) - tie up some loose ends w.r.t. MPI_Request handling in fortran; set the req_f_to_c_index to MPI_UNDEFINED when it does not have a fortran index - still need to add a configure test to find OMPI_FORTRAN_HANDLE_MAX for ompi_bitmap.c and ompi_pointer_array.c (hard-wired to INT_MAX right now) - re-organized, consolidated, and unified some ompi_pointer_array.c code -- fixed a few minor bugs w.r.t. lowest_free (could have left some unintentional holes in the array) This commit was SVN r3302.
Этот коммит содержится в:
родитель
6705865f91
Коммит
113ce723e1
@ -5,6 +5,8 @@
|
|||||||
#include "ompi_config.h"
|
#include "ompi_config.h"
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
#include <limits.h>
|
||||||
|
#define OMPI_FORTRAN_HANDLE_MAX INT_MAX
|
||||||
|
|
||||||
#include "include/constants.h"
|
#include "include/constants.h"
|
||||||
#include "class/ompi_bitmap.h"
|
#include "class/ompi_bitmap.h"
|
||||||
@ -38,11 +40,11 @@ ompi_bitmap_destruct(ompi_bitmap_t *bm)
|
|||||||
|
|
||||||
|
|
||||||
int
|
int
|
||||||
ompi_bitmap_init(ompi_bitmap_t *bm, size_t size)
|
ompi_bitmap_init(ompi_bitmap_t *bm, int size)
|
||||||
{
|
{
|
||||||
size_t actual_size;
|
int actual_size;
|
||||||
|
|
||||||
if (((int)size <= 0) || (NULL == bm)) {
|
if ((size <= 0) || (size > OMPI_FORTRAN_HANDLE_MAX) || (NULL == bm)) {
|
||||||
return OMPI_ERR_BAD_PARAM;
|
return OMPI_ERR_BAD_PARAM;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -62,11 +64,12 @@ ompi_bitmap_init(ompi_bitmap_t *bm, size_t size)
|
|||||||
|
|
||||||
|
|
||||||
int
|
int
|
||||||
ompi_bitmap_set_bit(ompi_bitmap_t *bm, size_t bit)
|
ompi_bitmap_set_bit(ompi_bitmap_t *bm, int bit)
|
||||||
{
|
{
|
||||||
size_t index, offset, new_size, i;
|
int index, offset, new_size, i;
|
||||||
|
size_t new_size_large;
|
||||||
|
|
||||||
if ((bit < 0) || (NULL == bm)) {
|
if ((bit < 0) || (bit > OMPI_FORTRAN_HANDLE_MAX) || (NULL == bm)) {
|
||||||
return OMPI_ERR_BAD_PARAM;
|
return OMPI_ERR_BAD_PARAM;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -74,15 +77,36 @@ ompi_bitmap_set_bit(ompi_bitmap_t *bm, size_t bit)
|
|||||||
offset = bit % SIZE_OF_CHAR;
|
offset = bit % SIZE_OF_CHAR;
|
||||||
|
|
||||||
if (index >= bm->array_size) {
|
if (index >= bm->array_size) {
|
||||||
|
|
||||||
|
/* If we're already full, return "No vacancy!" */
|
||||||
|
|
||||||
|
if (bm->array_size >= OMPI_FORTRAN_HANDLE_MAX) {
|
||||||
|
return OMPI_ERR_OUT_OF_RESOURCE;
|
||||||
|
}
|
||||||
|
|
||||||
/* We need to allocate more space for the bitmap, since we are
|
/* We need to allocate more space for the bitmap, since we are
|
||||||
out of range. We dont throw any error here, because this is
|
out of range. We dont throw any error here, because this is
|
||||||
valid and we simply expand the bitmap */
|
valid and we simply expand the bitmap */
|
||||||
|
|
||||||
new_size = (index / bm->array_size + 1 ) * bm->array_size;
|
new_size_large = (index / bm->array_size + 1 ) * bm->array_size;
|
||||||
/* New size is just a multiple of the original size to fit in
|
|
||||||
the index */
|
|
||||||
|
|
||||||
bm->bitmap = (unsigned char *) realloc(bm->bitmap, new_size);
|
/* Check to be sure that we still have less than
|
||||||
|
OMPI_FORTRAN_HANDLE_MAX bits */
|
||||||
|
|
||||||
|
if (new_size_large > OMPI_FORTRAN_HANDLE_MAX) {
|
||||||
|
new_size_large = OMPI_FORTRAN_HANDLE_MAX;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Note that new_size is guaranteed to be <=
|
||||||
|
OMPI_FORTRAN_HANDLE_MAX, which is guaranteed to fit in a
|
||||||
|
[signed] int. */
|
||||||
|
|
||||||
|
new_size = (int) new_size_large;
|
||||||
|
|
||||||
|
/* New size is just a multiple of the original size to fit in
|
||||||
|
the index. */
|
||||||
|
|
||||||
|
bm->bitmap = (unsigned char *) realloc(bm->bitmap, (int) new_size);
|
||||||
if (NULL == bm->bitmap) {
|
if (NULL == bm->bitmap) {
|
||||||
return OMPI_ERR_OUT_OF_RESOURCE;
|
return OMPI_ERR_OUT_OF_RESOURCE;
|
||||||
}
|
}
|
||||||
@ -105,9 +129,9 @@ ompi_bitmap_set_bit(ompi_bitmap_t *bm, size_t bit)
|
|||||||
|
|
||||||
|
|
||||||
int
|
int
|
||||||
ompi_bitmap_clear_bit(ompi_bitmap_t *bm, size_t bit)
|
ompi_bitmap_clear_bit(ompi_bitmap_t *bm, int bit)
|
||||||
{
|
{
|
||||||
size_t index, offset;
|
int index, offset;
|
||||||
|
|
||||||
if ((bit < 0) || (bit > bm->legal_numbits - 1) || (NULL == bm)) {
|
if ((bit < 0) || (bit > bm->legal_numbits - 1) || (NULL == bm)) {
|
||||||
return OMPI_ERR_BAD_PARAM;
|
return OMPI_ERR_BAD_PARAM;
|
||||||
@ -126,9 +150,9 @@ ompi_bitmap_clear_bit(ompi_bitmap_t *bm, size_t bit)
|
|||||||
|
|
||||||
|
|
||||||
int
|
int
|
||||||
ompi_bitmap_is_set_bit(ompi_bitmap_t *bm, size_t bit)
|
ompi_bitmap_is_set_bit(ompi_bitmap_t *bm, int bit)
|
||||||
{
|
{
|
||||||
size_t index, offset;
|
int index, offset;
|
||||||
|
|
||||||
if ((bit < 0) || (bit > bm->legal_numbits - 1) || (NULL == bm)) {
|
if ((bit < 0) || (bit > bm->legal_numbits - 1) || (NULL == bm)) {
|
||||||
return OMPI_ERR_BAD_PARAM;
|
return OMPI_ERR_BAD_PARAM;
|
||||||
@ -164,7 +188,7 @@ ompi_bitmap_clear_all_bits(ompi_bitmap_t *bm)
|
|||||||
int
|
int
|
||||||
ompi_bitmap_set_all_bits(ompi_bitmap_t *bm)
|
ompi_bitmap_set_all_bits(ompi_bitmap_t *bm)
|
||||||
{
|
{
|
||||||
size_t i;
|
int i;
|
||||||
|
|
||||||
if (NULL == bm) {
|
if (NULL == bm) {
|
||||||
return OMPI_ERR_BAD_PARAM;
|
return OMPI_ERR_BAD_PARAM;
|
||||||
@ -178,9 +202,9 @@ ompi_bitmap_set_all_bits(ompi_bitmap_t *bm)
|
|||||||
|
|
||||||
|
|
||||||
int
|
int
|
||||||
ompi_bitmap_find_and_set_first_unset_bit(ompi_bitmap_t *bm, size_t *position)
|
ompi_bitmap_find_and_set_first_unset_bit(ompi_bitmap_t *bm, int *position)
|
||||||
{
|
{
|
||||||
size_t i = 0;
|
int i = 0;
|
||||||
unsigned char temp;
|
unsigned char temp;
|
||||||
unsigned char all_ones = 0xff;
|
unsigned char all_ones = 0xff;
|
||||||
|
|
||||||
@ -197,8 +221,7 @@ ompi_bitmap_find_and_set_first_unset_bit(ompi_bitmap_t *bm, size_t *position)
|
|||||||
if (i == bm->array_size) {
|
if (i == bm->array_size) {
|
||||||
/* increase the bitmap size then */
|
/* increase the bitmap size then */
|
||||||
*position = bm->array_size * SIZE_OF_CHAR;
|
*position = bm->array_size * SIZE_OF_CHAR;
|
||||||
ompi_bitmap_set_bit(bm, *position);
|
return ompi_bitmap_set_bit(bm, *position);
|
||||||
return OMPI_SUCCESS;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* This one has an unset bit, find its bit number */
|
/* This one has an unset bit, find its bit number */
|
||||||
|
@ -13,14 +13,20 @@
|
|||||||
* bit is set -- so the valid functions are set_bit and
|
* bit is set -- so the valid functions are set_bit and
|
||||||
* find_and_set_bit. Other functions like clear, if passed a bit
|
* find_and_set_bit. Other functions like clear, if passed a bit
|
||||||
* outside the initialized range will result in an error.
|
* outside the initialized range will result in an error.
|
||||||
|
*
|
||||||
|
* Since these bitmaps are only used to track fortran handles (which
|
||||||
|
* MPI defines to be int's), it is assumed that we can never have more
|
||||||
|
* than OMPI_FORTRAN_HANDLE_MAX (which is min(INT_MAX, fortran
|
||||||
|
* INTEGER max)).
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef OMPI_BITMAP_H
|
#ifndef OMPI_BITMAP_H
|
||||||
#define OMPI_BITMAP_H
|
#define OMPI_BITMAP_H
|
||||||
|
|
||||||
|
#include "ompi_config.h"
|
||||||
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
#include "ompi_config.h"
|
|
||||||
#include "include/types.h"
|
#include "include/types.h"
|
||||||
#include "class/ompi_object.h"
|
#include "class/ompi_object.h"
|
||||||
|
|
||||||
@ -30,8 +36,8 @@ extern "C" {
|
|||||||
struct ompi_bitmap_t {
|
struct ompi_bitmap_t {
|
||||||
ompi_object_t super; /**< Subclass of ompi_object_t */
|
ompi_object_t super; /**< Subclass of ompi_object_t */
|
||||||
unsigned char *bitmap; /**< The actual bitmap array of characters */
|
unsigned char *bitmap; /**< The actual bitmap array of characters */
|
||||||
size_t array_size; /**< The actual array size that maintains the bitmap */
|
int array_size; /**< The actual array size that maintains the bitmap */
|
||||||
size_t legal_numbits; /**< The number of bits which are legal (the
|
int legal_numbits; /**< The number of bits which are legal (the
|
||||||
actual bitmap may contain more bits, since
|
actual bitmap may contain more bits, since
|
||||||
it needs to be rounded to the nearest
|
it needs to be rounded to the nearest
|
||||||
char */
|
char */
|
||||||
@ -50,7 +56,7 @@ OMPI_DECLSPEC OBJ_CLASS_DECLARATION(ompi_bitmap_t);
|
|||||||
* @return OMPI error code or success
|
* @return OMPI error code or success
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
OMPI_DECLSPEC int ompi_bitmap_init (ompi_bitmap_t *bm, size_t size);
|
OMPI_DECLSPEC int ompi_bitmap_init (ompi_bitmap_t *bm, int size);
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -63,7 +69,7 @@ OMPI_DECLSPEC int ompi_bitmap_init (ompi_bitmap_t *bm, size_t size);
|
|||||||
* @return OMPI error code or success
|
* @return OMPI error code or success
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
OMPI_DECLSPEC int ompi_bitmap_set_bit(ompi_bitmap_t *bm, size_t bit);
|
OMPI_DECLSPEC int ompi_bitmap_set_bit(ompi_bitmap_t *bm, int bit);
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -75,7 +81,7 @@ OMPI_DECLSPEC int ompi_bitmap_set_bit(ompi_bitmap_t *bm, size_t bit);
|
|||||||
* @return OMPI error code if the bit is out of range, else success
|
* @return OMPI error code if the bit is out of range, else success
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
OMPI_DECLSPEC int ompi_bitmap_clear_bit(ompi_bitmap_t *bm, size_t bit);
|
OMPI_DECLSPEC int ompi_bitmap_clear_bit(ompi_bitmap_t *bm, int bit);
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -88,7 +94,7 @@ OMPI_DECLSPEC int ompi_bitmap_clear_bit(ompi_bitmap_t *bm, size_t bit);
|
|||||||
* 0 if the bit is not set
|
* 0 if the bit is not set
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
OMPI_DECLSPEC int ompi_bitmap_is_set_bit(ompi_bitmap_t *bm, size_t bit);
|
OMPI_DECLSPEC int ompi_bitmap_is_set_bit(ompi_bitmap_t *bm, int bit);
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -100,7 +106,7 @@ OMPI_DECLSPEC int ompi_bitmap_is_set_bit(ompi_bitmap_t *bm, size_t bit);
|
|||||||
* @return err OMPI_SUCCESS on success
|
* @return err OMPI_SUCCESS on success
|
||||||
*/
|
*/
|
||||||
OMPI_DECLSPEC int ompi_bitmap_find_and_set_first_unset_bit(ompi_bitmap_t *bm,
|
OMPI_DECLSPEC int ompi_bitmap_find_and_set_first_unset_bit(ompi_bitmap_t *bm,
|
||||||
size_t *position);
|
int *position);
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -130,7 +136,7 @@ OMPI_DECLSPEC int ompi_bitmap_set_all_bits(ompi_bitmap_t *bm);
|
|||||||
* @return OMPI error code if bm is NULL
|
* @return OMPI error code if bm is NULL
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
static inline size_t ompi_bitmap_size(ompi_bitmap_t *bm)
|
static inline int ompi_bitmap_size(ompi_bitmap_t *bm)
|
||||||
{
|
{
|
||||||
return (NULL == bm) ? 0 : bm->legal_numbits;
|
return (NULL == bm) ? 0 : bm->legal_numbits;
|
||||||
}
|
}
|
||||||
|
@ -1,34 +1,31 @@
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
* $HEADER$
|
* $HEADER$
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
|
||||||
* Utility functions to manage fortran <-> c opaque object translation
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include "ompi_config.h"
|
#include "ompi_config.h"
|
||||||
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
|
|
||||||
|
#include <limits.h>
|
||||||
|
#define OMPI_FORTRAN_HANDLE_MAX INT_MAX
|
||||||
|
|
||||||
#include "include/constants.h"
|
#include "include/constants.h"
|
||||||
#include "class/ompi_pointer_array.h"
|
#include "class/ompi_pointer_array.h"
|
||||||
#include "util/output.h"
|
#include "util/output.h"
|
||||||
|
|
||||||
static void ompi_pointer_array_construct(ompi_pointer_array_t *);
|
|
||||||
static void ompi_pointer_array_destruct(ompi_pointer_array_t *);
|
|
||||||
enum { TABLE_INIT = 1, TABLE_GROW = 2 };
|
enum { TABLE_INIT = 1, TABLE_GROW = 2 };
|
||||||
|
|
||||||
ompi_class_t ompi_pointer_array_t_class = {
|
static void ompi_pointer_array_construct(ompi_pointer_array_t *);
|
||||||
"ompi_pointer_array_t",
|
static void ompi_pointer_array_destruct(ompi_pointer_array_t *);
|
||||||
OBJ_CLASS(ompi_object_t),
|
static bool grow_table(ompi_pointer_array_t *table, size_t soft, size_t hard);
|
||||||
(ompi_construct_t) ompi_pointer_array_construct,
|
|
||||||
(ompi_destruct_t) ompi_pointer_array_destruct
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
OBJ_CLASS_INSTANCE(ompi_pointer_array_t, ompi_object_t,
|
||||||
|
ompi_pointer_array_construct,
|
||||||
|
ompi_pointer_array_destruct);
|
||||||
|
|
||||||
|
/*
|
||||||
* ompi_pointer_array constructor
|
* ompi_pointer_array constructor
|
||||||
*/
|
*/
|
||||||
void ompi_pointer_array_construct(ompi_pointer_array_t *array)
|
void ompi_pointer_array_construct(ompi_pointer_array_t *array)
|
||||||
@ -40,17 +37,17 @@ void ompi_pointer_array_construct(ompi_pointer_array_t *array)
|
|||||||
array->addr = 0;
|
array->addr = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* ompi_pointer_array destructor
|
* ompi_pointer_array destructor
|
||||||
*/
|
*/
|
||||||
void ompi_pointer_array_destruct(ompi_pointer_array_t *array){
|
void ompi_pointer_array_destruct(ompi_pointer_array_t *array)
|
||||||
|
{
|
||||||
/* free table */
|
/* free table */
|
||||||
if( NULL != array->addr)
|
if( NULL != array->addr) {
|
||||||
free(array->addr);
|
free(array->addr);
|
||||||
|
}
|
||||||
|
|
||||||
OBJ_DESTRUCT(&array->lock);
|
OBJ_DESTRUCT(&array->lock);
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -61,11 +58,11 @@ void ompi_pointer_array_destruct(ompi_pointer_array_t *array){
|
|||||||
*
|
*
|
||||||
* @return Array index where ptr is inserted or OMPI_ERROR if it fails
|
* @return Array index where ptr is inserted or OMPI_ERROR if it fails
|
||||||
*/
|
*/
|
||||||
size_t ompi_pointer_array_add(ompi_pointer_array_t *table, void *ptr)
|
int ompi_pointer_array_add(ompi_pointer_array_t *table, void *ptr)
|
||||||
{
|
{
|
||||||
void **p;
|
void **p;
|
||||||
size_t i;
|
int i;
|
||||||
size_t index;
|
int index;
|
||||||
|
|
||||||
if (0) {
|
if (0) {
|
||||||
ompi_output(0,"ompi_pointer_array_add: IN: "
|
ompi_output(0,"ompi_pointer_array_add: IN: "
|
||||||
@ -89,10 +86,10 @@ size_t ompi_pointer_array_add(ompi_pointer_array_t *table, void *ptr)
|
|||||||
ompi_output(0,"ompi_pointer_array_add: INIT: table %p\n", table);
|
ompi_output(0,"ompi_pointer_array_add: INIT: table %p\n", table);
|
||||||
}
|
}
|
||||||
|
|
||||||
p = (void **)malloc(TABLE_INIT * sizeof(void *));
|
p = (void **) malloc(TABLE_INIT * sizeof(void *));
|
||||||
if (p == NULL) {
|
if (p == NULL) {
|
||||||
OMPI_THREAD_UNLOCK(&(table->lock));
|
OMPI_THREAD_UNLOCK(&(table->lock));
|
||||||
return OMPI_ERROR;
|
return OMPI_ERROR;
|
||||||
}
|
}
|
||||||
table->lowest_free = 0;
|
table->lowest_free = 0;
|
||||||
table->number_free = TABLE_INIT;
|
table->number_free = TABLE_INIT;
|
||||||
@ -104,26 +101,12 @@ size_t ompi_pointer_array_add(ompi_pointer_array_t *table, void *ptr)
|
|||||||
|
|
||||||
} else if (table->number_free == 0) {
|
} else if (table->number_free == 0) {
|
||||||
|
|
||||||
/*
|
/* need to grow table */
|
||||||
* grow table
|
|
||||||
*/
|
|
||||||
|
|
||||||
if (0) {
|
if (!grow_table(table, table->size * TABLE_GROW,
|
||||||
ompi_output(0,"ompi_pointer_array_add: GROW: table %p growing %d -> %d\n",
|
OMPI_FORTRAN_HANDLE_MAX)) {
|
||||||
table, table->size, table->size * TABLE_GROW);
|
OMPI_THREAD_UNLOCK(&(table->lock));
|
||||||
}
|
return OMPI_ERR_OUT_OF_RESOURCE;
|
||||||
|
|
||||||
p = (void **)realloc(table->addr, TABLE_GROW * table->size * sizeof(void *));
|
|
||||||
if (p == NULL) {
|
|
||||||
OMPI_THREAD_UNLOCK(&(table->lock));
|
|
||||||
return OMPI_ERROR;
|
|
||||||
}
|
|
||||||
table->lowest_free = table->size;
|
|
||||||
table->number_free += (TABLE_GROW - 1) * table->size;
|
|
||||||
table->size *= TABLE_GROW;
|
|
||||||
table->addr = p;
|
|
||||||
for (i = table->lowest_free; i < table->size; i++) {
|
|
||||||
table->addr[i] = NULL;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -163,7 +146,6 @@ size_t ompi_pointer_array_add(ompi_pointer_array_t *table, void *ptr)
|
|||||||
}
|
}
|
||||||
|
|
||||||
OMPI_THREAD_UNLOCK(&(table->lock));
|
OMPI_THREAD_UNLOCK(&(table->lock));
|
||||||
|
|
||||||
return index;
|
return index;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -178,8 +160,8 @@ size_t ompi_pointer_array_add(ompi_pointer_array_t *table, void *ptr)
|
|||||||
*
|
*
|
||||||
* Assumption: NULL element is free element.
|
* Assumption: NULL element is free element.
|
||||||
*/
|
*/
|
||||||
int ompi_pointer_array_set_item(ompi_pointer_array_t *table, size_t index,
|
int ompi_pointer_array_set_item(ompi_pointer_array_t *table, int index,
|
||||||
void * value)
|
void * value)
|
||||||
{
|
{
|
||||||
assert(table != NULL);
|
assert(table != NULL);
|
||||||
|
|
||||||
@ -192,20 +174,14 @@ int ompi_pointer_array_set_item(ompi_pointer_array_t *table, size_t index,
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* expand table if required to set a specific index */
|
/* expand table if required to set a specific index */
|
||||||
|
|
||||||
OMPI_THREAD_LOCK(&(table->lock));
|
OMPI_THREAD_LOCK(&(table->lock));
|
||||||
if(table->size <= index) {
|
if (table->size <= index) {
|
||||||
size_t i, new_size = (((index / TABLE_GROW) + 1) * TABLE_GROW);
|
if (!grow_table(table, ((index / TABLE_GROW) + 1) * TABLE_GROW,
|
||||||
void *p = realloc(table->addr, new_size * sizeof(void *));
|
index)) {
|
||||||
if (p == NULL) {
|
|
||||||
OMPI_THREAD_UNLOCK(&(table->lock));
|
OMPI_THREAD_UNLOCK(&(table->lock));
|
||||||
return OMPI_ERROR;
|
return OMPI_ERROR;
|
||||||
}
|
|
||||||
table->number_free += new_size - table->size;
|
|
||||||
table->addr = (void **) p;
|
|
||||||
for (i = table->size; i < new_size; i++) {
|
|
||||||
table->addr[i] = NULL;
|
|
||||||
}
|
}
|
||||||
table->size = new_size;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -224,7 +200,7 @@ int ompi_pointer_array_set_item(ompi_pointer_array_t *table, size_t index,
|
|||||||
table->number_free--;
|
table->number_free--;
|
||||||
/* Reset lowest_free if required */
|
/* Reset lowest_free if required */
|
||||||
if ( index == table->lowest_free ) {
|
if ( index == table->lowest_free ) {
|
||||||
size_t i;
|
int i;
|
||||||
|
|
||||||
table->lowest_free=table->size;
|
table->lowest_free=table->size;
|
||||||
for ( i=index; i<table->size; i++) {
|
for ( i=index; i<table->size; i++) {
|
||||||
@ -248,7 +224,7 @@ int ompi_pointer_array_set_item(ompi_pointer_array_t *table, size_t index,
|
|||||||
else {
|
else {
|
||||||
/* Reset lowest_free if required */
|
/* Reset lowest_free if required */
|
||||||
if ( index == table->lowest_free ) {
|
if ( index == table->lowest_free ) {
|
||||||
size_t i;
|
int i;
|
||||||
|
|
||||||
table->lowest_free=table->size;
|
table->lowest_free=table->size;
|
||||||
for ( i=index; i<table->size; i++) {
|
for ( i=index; i<table->size; i++) {
|
||||||
@ -288,11 +264,9 @@ int ompi_pointer_array_set_item(ompi_pointer_array_t *table, size_t index,
|
|||||||
* In contrary to array_set, this function does not allow to overwrite
|
* In contrary to array_set, this function does not allow to overwrite
|
||||||
* a value, unless the previous value is NULL ( equiv. to free ).
|
* a value, unless the previous value is NULL ( equiv. to free ).
|
||||||
*/
|
*/
|
||||||
int ompi_pointer_array_test_and_set_item (ompi_pointer_array_t *table, size_t index,
|
bool ompi_pointer_array_test_and_set_item (ompi_pointer_array_t *table,
|
||||||
void *value)
|
int index, void *value)
|
||||||
{
|
{
|
||||||
int flag=true;
|
|
||||||
|
|
||||||
assert(table != NULL);
|
assert(table != NULL);
|
||||||
assert(index >= 0);
|
assert(index >= 0);
|
||||||
|
|
||||||
@ -308,24 +282,18 @@ int ompi_pointer_array_test_and_set_item (ompi_pointer_array_t *table, size_t in
|
|||||||
OMPI_THREAD_LOCK(&(table->lock));
|
OMPI_THREAD_LOCK(&(table->lock));
|
||||||
if ( index < table->size && table->addr[index] != NULL ) {
|
if ( index < table->size && table->addr[index] != NULL ) {
|
||||||
/* This element is already in use */
|
/* This element is already in use */
|
||||||
flag = false;
|
|
||||||
OMPI_THREAD_UNLOCK(&(table->lock));
|
OMPI_THREAD_UNLOCK(&(table->lock));
|
||||||
return flag;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(table->size <= index) {
|
/* Do we need to grow the table? */
|
||||||
size_t i, new_size = (((index / TABLE_GROW) + 1) * TABLE_GROW);
|
|
||||||
void *p = realloc(table->addr, new_size * sizeof(void *));
|
if (table->size <= index) {
|
||||||
if (p == NULL) {
|
if (!grow_table(table, (((index / TABLE_GROW) + 1) * TABLE_GROW),
|
||||||
|
index)) {
|
||||||
OMPI_THREAD_UNLOCK(&(table->lock));
|
OMPI_THREAD_UNLOCK(&(table->lock));
|
||||||
return OMPI_ERROR;
|
return false;
|
||||||
}
|
|
||||||
table->number_free += new_size - table->size;
|
|
||||||
table->addr = (void **)p;
|
|
||||||
for (i = table->size; i < new_size; i++) {
|
|
||||||
table->addr[i] = NULL;
|
|
||||||
}
|
}
|
||||||
table->size = new_size;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -335,7 +303,7 @@ int ompi_pointer_array_test_and_set_item (ompi_pointer_array_t *table, size_t in
|
|||||||
table->number_free--;
|
table->number_free--;
|
||||||
/* Reset lowest_free if required */
|
/* Reset lowest_free if required */
|
||||||
if ( index == table->lowest_free ) {
|
if ( index == table->lowest_free ) {
|
||||||
size_t i;
|
int i;
|
||||||
|
|
||||||
table->lowest_free = table->size;
|
table->lowest_free = table->size;
|
||||||
for ( i=index; i<table->size; i++) {
|
for ( i=index; i<table->size; i++) {
|
||||||
@ -355,5 +323,49 @@ int ompi_pointer_array_test_and_set_item (ompi_pointer_array_t *table, size_t in
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
OMPI_THREAD_UNLOCK(&(table->lock));
|
OMPI_THREAD_UNLOCK(&(table->lock));
|
||||||
return flag;
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static bool grow_table(ompi_pointer_array_t *table, size_t soft, size_t hard)
|
||||||
|
{
|
||||||
|
size_t new_size;
|
||||||
|
int i, new_size_int;
|
||||||
|
void *p;
|
||||||
|
|
||||||
|
/* Ensure that we have room to grow -- stay less than
|
||||||
|
OMPI_FORTRAN_HANDLE_MAX. Note that OMPI_FORTRAN_HANDLE_MAX
|
||||||
|
is min(INT_MAX, fortran INTEGER max), so it's guaranteed to
|
||||||
|
fit within a [signed] int. */
|
||||||
|
|
||||||
|
if (table->size >= OMPI_FORTRAN_HANDLE_MAX) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (soft > OMPI_FORTRAN_HANDLE_MAX) {
|
||||||
|
if (hard > OMPI_FORTRAN_HANDLE_MAX) {
|
||||||
|
return false;
|
||||||
|
} else {
|
||||||
|
new_size = hard;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
new_size = soft;
|
||||||
|
}
|
||||||
|
|
||||||
|
p = (void **) realloc(table->addr, new_size * sizeof(void *));
|
||||||
|
if (p == NULL) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* We've already established (above) that the arithimetic
|
||||||
|
below will be less than OMPI_FORTRAN_HANDLE_MAX */
|
||||||
|
|
||||||
|
new_size_int = (int) new_size;
|
||||||
|
table->number_free += new_size_int - table->size;
|
||||||
|
table->addr = p;
|
||||||
|
for (i = table->size; i < new_size_int; ++i) {
|
||||||
|
table->addr[i] = NULL;
|
||||||
|
}
|
||||||
|
table->size = new_size_int;
|
||||||
|
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -1,39 +1,57 @@
|
|||||||
/*
|
/*
|
||||||
* $HEADER$
|
* $HEADER$
|
||||||
*/
|
*/
|
||||||
|
/** @file
|
||||||
|
*
|
||||||
|
* Utility functions to manage fortran <-> c opaque object
|
||||||
|
* translation. Note that since MPI defines fortran handles as
|
||||||
|
* [signed] int's, we use int everywhere in here where you would
|
||||||
|
* normally expect size_t. There's some code that makes sure indices
|
||||||
|
* don't go above FORTRAN_HANDLE_MAX (which is min(INT_MAX, fortran
|
||||||
|
* INTEGER max)), just to be sure.
|
||||||
|
*/
|
||||||
|
|
||||||
#ifndef OMPI_POINTER_ARRAY_H
|
#ifndef OMPI_POINTER_ARRAY_H
|
||||||
#define OMPI_POINTER_ARRAY_H
|
#define OMPI_POINTER_ARRAY_H
|
||||||
|
|
||||||
|
#include "ompi_config.h"
|
||||||
|
|
||||||
#include "threads/mutex.h"
|
#include "threads/mutex.h"
|
||||||
#include "class/ompi_object.h"
|
#include "class/ompi_object.h"
|
||||||
|
|
||||||
#if defined(c_plusplus) || defined(__cplusplus)
|
#if defined(c_plusplus) || defined(__cplusplus)
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
/*
|
|
||||||
* typedefs
|
|
||||||
*/
|
|
||||||
typedef struct ompi_pointer_array_t ompi_pointer_array_t;
|
|
||||||
OMPI_DECLSPEC extern ompi_class_t ompi_pointer_array_t_class;
|
|
||||||
|
|
||||||
/*
|
/**
|
||||||
* dynamic pointer array
|
* dynamic pointer array
|
||||||
*/
|
*/
|
||||||
struct ompi_pointer_array_t {
|
struct ompi_pointer_array_t {
|
||||||
/* base class */
|
/** base class */
|
||||||
ompi_object_t super;
|
ompi_object_t super;
|
||||||
/* synchronization object */
|
/** synchronization object */
|
||||||
ompi_mutex_t lock;
|
ompi_mutex_t lock;
|
||||||
/* index of lowest free element */
|
/** Index of lowest free element. NOTE: This is only an
|
||||||
size_t lowest_free;
|
optimization to know where to search for the first free slot.
|
||||||
/* number of fee elements in the list */
|
It does \em not necessarily imply indices all above this index
|
||||||
size_t number_free;
|
are not taken! */
|
||||||
/* size of list, i.e. number of elements in addr */
|
int lowest_free;
|
||||||
size_t size;
|
/** number of fee elements in the list */
|
||||||
/* pointer to array of pointers */
|
int number_free;
|
||||||
|
/** size of list, i.e. number of elements in addr */
|
||||||
|
int size;
|
||||||
|
/** pointer to array of pointers */
|
||||||
void **addr;
|
void **addr;
|
||||||
};
|
};
|
||||||
|
/**
|
||||||
|
* Convenience typedef
|
||||||
|
*/
|
||||||
|
typedef struct ompi_pointer_array_t ompi_pointer_array_t;
|
||||||
|
/**
|
||||||
|
* Class declaration
|
||||||
|
*/
|
||||||
|
OMPI_DECLSPEC OBJ_CLASS_DECLARATION(ompi_pointer_array_t);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -43,9 +61,9 @@ struct ompi_pointer_array_t {
|
|||||||
* @param ptr Pointer value (IN)
|
* @param ptr Pointer value (IN)
|
||||||
*
|
*
|
||||||
* @return Index of inserted array element. Return value of
|
* @return Index of inserted array element. Return value of
|
||||||
* (size_t)(-1) indicates an error.
|
* (-1) indicates an error.
|
||||||
*/
|
*/
|
||||||
size_t ompi_pointer_array_add(ompi_pointer_array_t *array, void *ptr);
|
int ompi_pointer_array_add(ompi_pointer_array_t *array, void *ptr);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the value of an element in array
|
* Set the value of an element in array
|
||||||
@ -57,7 +75,7 @@ size_t ompi_pointer_array_add(ompi_pointer_array_t *array, void *ptr);
|
|||||||
* @return Error code. (-1) indicates an error.
|
* @return Error code. (-1) indicates an error.
|
||||||
*/
|
*/
|
||||||
int ompi_pointer_array_set_item(ompi_pointer_array_t *array,
|
int ompi_pointer_array_set_item(ompi_pointer_array_t *array,
|
||||||
size_t index, void *value);
|
int index, void *value);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the value of an element in array
|
* Get the value of an element in array
|
||||||
@ -68,7 +86,8 @@ int ompi_pointer_array_set_item(ompi_pointer_array_t *array,
|
|||||||
* @return Error code. NULL indicates an error.
|
* @return Error code. NULL indicates an error.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
static inline void *ompi_pointer_array_get_item(ompi_pointer_array_t *table, size_t index)
|
static inline void *ompi_pointer_array_get_item(ompi_pointer_array_t *table,
|
||||||
|
int index)
|
||||||
{
|
{
|
||||||
void *p;
|
void *p;
|
||||||
OMPI_THREAD_LOCK(&(table->lock));
|
OMPI_THREAD_LOCK(&(table->lock));
|
||||||
@ -88,11 +107,12 @@ static inline void *ompi_pointer_array_get_item(ompi_pointer_array_t *table, siz
|
|||||||
* Simple inline function to return the size of the array in order to
|
* Simple inline function to return the size of the array in order to
|
||||||
* hide the member field from external users.
|
* hide the member field from external users.
|
||||||
*/
|
*/
|
||||||
static inline size_t ompi_pointer_array_get_size(ompi_pointer_array_t *array)
|
static inline int ompi_pointer_array_get_size(ompi_pointer_array_t *array)
|
||||||
{
|
{
|
||||||
return array->size;
|
return array->size;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Test whether a certain element is already in use. If not yet
|
* Test whether a certain element is already in use. If not yet
|
||||||
* in use, reserve it.
|
* in use, reserve it.
|
||||||
@ -102,13 +122,14 @@ static inline size_t ompi_pointer_array_get_size(ompi_pointer_array_t *array)
|
|||||||
* @param value New value to be set at element index (IN)
|
* @param value New value to be set at element index (IN)
|
||||||
*
|
*
|
||||||
* @return true/false True if element could be reserved
|
* @return true/false True if element could be reserved
|
||||||
* False if element could not be reserved (e.g.in use).
|
* False if element could not be reserved (e.g., in use).
|
||||||
*
|
*
|
||||||
* In contrary to array_set, this function does not allow to overwrite
|
* In contrary to array_set, this function does not allow to overwrite
|
||||||
* a value, unless the previous value is NULL ( equiv. to free ).
|
* a value, unless the previous value is NULL ( equiv. to free ).
|
||||||
*/
|
*/
|
||||||
int ompi_pointer_array_test_and_set_item (ompi_pointer_array_t *table, size_t index,
|
bool ompi_pointer_array_test_and_set_item (ompi_pointer_array_t *table,
|
||||||
void *value);
|
int index,
|
||||||
|
void *value);
|
||||||
#if defined(c_plusplus) || defined(__cplusplus)
|
#if defined(c_plusplus) || defined(__cplusplus)
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@ -88,7 +88,7 @@ typedef struct ompi_datatype_t {
|
|||||||
|
|
||||||
/* Attribute fields */
|
/* Attribute fields */
|
||||||
ompi_hash_table_t *d_keyhash;
|
ompi_hash_table_t *d_keyhash;
|
||||||
size_t d_f_to_c_index;
|
int d_f_to_c_index;
|
||||||
char name[MPI_MAX_OBJECT_NAME];
|
char name[MPI_MAX_OBJECT_NAME];
|
||||||
dt_type_desc_t desc; /**< the data description */
|
dt_type_desc_t desc; /**< the data description */
|
||||||
dt_type_desc_t opt_desc; /**< short description of the data used when conversion is useless
|
dt_type_desc_t opt_desc; /**< short description of the data used when conversion is useless
|
||||||
|
@ -72,7 +72,7 @@ struct ompi_errhandler_t {
|
|||||||
ompi_errhandler_fortran_handler_fn_t *eh_fort_fn;
|
ompi_errhandler_fortran_handler_fn_t *eh_fort_fn;
|
||||||
|
|
||||||
/* index in Fortran <-> C translation array */
|
/* index in Fortran <-> C translation array */
|
||||||
size_t eh_f_to_c_index;
|
int eh_f_to_c_index;
|
||||||
};
|
};
|
||||||
typedef struct ompi_errhandler_t ompi_errhandler_t;
|
typedef struct ompi_errhandler_t ompi_errhandler_t;
|
||||||
|
|
||||||
|
@ -6,6 +6,7 @@
|
|||||||
|
|
||||||
#include "mpi.h"
|
#include "mpi.h"
|
||||||
#include "mpi/c/bindings.h"
|
#include "mpi/c/bindings.h"
|
||||||
|
#include "mpi/f77/fint_2_int.h"
|
||||||
#include "errhandler/errhandler.h"
|
#include "errhandler/errhandler.h"
|
||||||
#include "communicator/communicator.h"
|
#include "communicator/communicator.h"
|
||||||
|
|
||||||
@ -22,17 +23,13 @@ static const char FUNC_NAME[] = "MPI_Comm_c2f";
|
|||||||
|
|
||||||
MPI_Fint MPI_Comm_c2f(MPI_Comm comm)
|
MPI_Fint MPI_Comm_c2f(MPI_Comm comm)
|
||||||
{
|
{
|
||||||
ompi_communicator_t *cptr=(ompi_communicator_t *)comm;
|
|
||||||
|
|
||||||
if ( MPI_PARAM_CHECK) {
|
if ( MPI_PARAM_CHECK) {
|
||||||
OMPI_ERR_INIT_FINALIZE(FUNC_NAME);
|
OMPI_ERR_INIT_FINALIZE(FUNC_NAME);
|
||||||
|
|
||||||
/* mapping an invalid handle to a null handle */
|
if (ompi_comm_invalid (comm)) {
|
||||||
/* not invoking an error handler */
|
comm = MPI_COMM_NULL;
|
||||||
if ( ompi_comm_invalid (cptr)) {
|
}
|
||||||
cptr = (ompi_communicator_t *) MPI_COMM_NULL;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return ((MPI_Fint) comm->c_f_to_c_index);
|
return OMPI_INT_2_FINT(comm->c_f_to_c_index);
|
||||||
}
|
}
|
||||||
|
@ -6,6 +6,7 @@
|
|||||||
|
|
||||||
#include "mpi.h"
|
#include "mpi.h"
|
||||||
#include "mpi/c/bindings.h"
|
#include "mpi/c/bindings.h"
|
||||||
|
#include "mpi/f77/fint_2_int.h"
|
||||||
#include "errhandler/errhandler.h"
|
#include "errhandler/errhandler.h"
|
||||||
#include "communicator/communicator.h"
|
#include "communicator/communicator.h"
|
||||||
|
|
||||||
@ -22,7 +23,7 @@ static const char FUNC_NAME[] = "MPI_Comm_f2c";
|
|||||||
|
|
||||||
MPI_Comm MPI_Comm_f2c(MPI_Fint comm)
|
MPI_Comm MPI_Comm_f2c(MPI_Fint comm)
|
||||||
{
|
{
|
||||||
size_t o_index= (size_t) comm;
|
int o_index= OMPI_FINT_2_INT(comm);
|
||||||
|
|
||||||
if ( MPI_PARAM_CHECK ) {
|
if ( MPI_PARAM_CHECK ) {
|
||||||
OMPI_ERR_INIT_FINALIZE(FUNC_NAME);
|
OMPI_ERR_INIT_FINALIZE(FUNC_NAME);
|
||||||
|
@ -19,19 +19,22 @@
|
|||||||
static const char FUNC_NAME[] = "MPI_Comm_free";
|
static const char FUNC_NAME[] = "MPI_Comm_free";
|
||||||
|
|
||||||
|
|
||||||
int MPI_Comm_free(MPI_Comm *comm) {
|
int MPI_Comm_free(MPI_Comm *comm)
|
||||||
|
{
|
||||||
|
int ret;
|
||||||
|
|
||||||
if ( MPI_PARAM_CHECK ) {
|
if ( MPI_PARAM_CHECK ) {
|
||||||
OMPI_ERR_INIT_FINALIZE(FUNC_NAME);
|
OMPI_ERR_INIT_FINALIZE(FUNC_NAME);
|
||||||
|
|
||||||
if ( NULL == *comm || MPI_COMM_WORLD == *comm ||
|
if ( NULL == *comm || MPI_COMM_WORLD == *comm ||
|
||||||
MPI_COMM_SELF == *comm || ompi_comm_invalid (*comm))
|
MPI_COMM_SELF == *comm || ompi_comm_invalid (*comm)) {
|
||||||
return OMPI_ERRHANDLER_INVOKE(MPI_COMM_WORLD, MPI_ERR_COMM,
|
return OMPI_ERRHANDLER_INVOKE(MPI_COMM_WORLD, MPI_ERR_COMM,
|
||||||
FUNC_NAME);
|
FUNC_NAME);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ompi_comm_free ( comm );
|
ret = ompi_comm_free ( comm );
|
||||||
|
OMPI_ERRHANDLER_CHECK(ret, *comm, ret, FUNC_NAME);
|
||||||
|
|
||||||
*comm = MPI_COMM_NULL;
|
|
||||||
return MPI_SUCCESS;
|
return MPI_SUCCESS;
|
||||||
}
|
}
|
||||||
|
@ -6,6 +6,7 @@
|
|||||||
|
|
||||||
#include "mpi.h"
|
#include "mpi.h"
|
||||||
#include "mpi/c/bindings.h"
|
#include "mpi/c/bindings.h"
|
||||||
|
#include "mpi/f77/fint_2_int.h"
|
||||||
#include "errhandler/errhandler.h"
|
#include "errhandler/errhandler.h"
|
||||||
#include "communicator/communicator.h"
|
#include "communicator/communicator.h"
|
||||||
|
|
||||||
@ -32,10 +33,10 @@ MPI_Fint MPI_Errhandler_c2f(MPI_Errhandler errhandler)
|
|||||||
/* not invoking an error handler */
|
/* not invoking an error handler */
|
||||||
if (NULL == errhandler ||
|
if (NULL == errhandler ||
|
||||||
OMPI_ERRHANDLER_TYPE_COMM != errhandler->eh_mpi_object_type) {
|
OMPI_ERRHANDLER_TYPE_COMM != errhandler->eh_mpi_object_type) {
|
||||||
errhandler = MPI_ERRHANDLER_NULL;
|
errhandler = MPI_ERRHANDLER_NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
return (MPI_Fint) errhandler->eh_f_to_c_index;
|
return OMPI_INT_2_FINT(errhandler->eh_f_to_c_index);
|
||||||
}
|
}
|
||||||
|
@ -6,6 +6,7 @@
|
|||||||
|
|
||||||
#include "mpi.h"
|
#include "mpi.h"
|
||||||
#include "mpi/c/bindings.h"
|
#include "mpi/c/bindings.h"
|
||||||
|
#include "mpi/f77/fint_2_int.h"
|
||||||
#include "errhandler/errhandler.h"
|
#include "errhandler/errhandler.h"
|
||||||
#include "communicator/communicator.h"
|
#include "communicator/communicator.h"
|
||||||
|
|
||||||
@ -22,7 +23,7 @@ static const char FUNC_NAME[] = "MPI_Errhandler_f2c";
|
|||||||
|
|
||||||
MPI_Errhandler MPI_Errhandler_f2c(MPI_Fint errhandler_f)
|
MPI_Errhandler MPI_Errhandler_f2c(MPI_Fint errhandler_f)
|
||||||
{
|
{
|
||||||
size_t eh_index = (size_t) errhandler_f;
|
int eh_index = OMPI_FINT_2_INT(errhandler_f);
|
||||||
|
|
||||||
/* Error checking */
|
/* Error checking */
|
||||||
|
|
||||||
|
@ -6,6 +6,7 @@
|
|||||||
|
|
||||||
#include "mpi.h"
|
#include "mpi.h"
|
||||||
#include "mpi/c/bindings.h"
|
#include "mpi/c/bindings.h"
|
||||||
|
#include "mpi/f77/fint_2_int.h"
|
||||||
#include "communicator/communicator.h"
|
#include "communicator/communicator.h"
|
||||||
#include "errhandler/errhandler.h"
|
#include "errhandler/errhandler.h"
|
||||||
#include "file/file.h"
|
#include "file/file.h"
|
||||||
@ -26,11 +27,9 @@ MPI_Fint MPI_File_c2f(MPI_File file)
|
|||||||
if (MPI_PARAM_CHECK) {
|
if (MPI_PARAM_CHECK) {
|
||||||
OMPI_ERR_INIT_FINALIZE(FUNC_NAME);
|
OMPI_ERR_INIT_FINALIZE(FUNC_NAME);
|
||||||
if (ompi_file_invalid(file)) {
|
if (ompi_file_invalid(file)) {
|
||||||
return (MPI_Fint) OMPI_ERRHANDLER_INVOKE(MPI_FILE_NULL,
|
file = MPI_FILE_NULL;
|
||||||
MPI_ERR_FILE,
|
|
||||||
FUNC_NAME);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return (MPI_Fint) file->f_f_to_c_index;
|
return OMPI_INT_2_FINT(file->f_f_to_c_index);
|
||||||
}
|
}
|
||||||
|
@ -6,6 +6,7 @@
|
|||||||
|
|
||||||
#include "mpi.h"
|
#include "mpi.h"
|
||||||
#include "mpi/c/bindings.h"
|
#include "mpi/c/bindings.h"
|
||||||
|
#include "mpi/f77/fint_2_int.h"
|
||||||
#include "communicator/communicator.h"
|
#include "communicator/communicator.h"
|
||||||
#include "errhandler/errhandler.h"
|
#include "errhandler/errhandler.h"
|
||||||
#include "file/file.h"
|
#include "file/file.h"
|
||||||
@ -23,7 +24,7 @@ static const char FUNC_NAME[] = "MPI_File_f2c";
|
|||||||
|
|
||||||
MPI_File MPI_File_f2c(MPI_Fint file_f)
|
MPI_File MPI_File_f2c(MPI_Fint file_f)
|
||||||
{
|
{
|
||||||
size_t file_index = (size_t) file_f;
|
int file_index = OMPI_FINT_2_INT(file_f);
|
||||||
|
|
||||||
if (MPI_PARAM_CHECK) {
|
if (MPI_PARAM_CHECK) {
|
||||||
OMPI_ERR_INIT_FINALIZE(FUNC_NAME);
|
OMPI_ERR_INIT_FINALIZE(FUNC_NAME);
|
||||||
|
@ -6,6 +6,7 @@
|
|||||||
|
|
||||||
#include "mpi.h"
|
#include "mpi.h"
|
||||||
#include "mpi/c/bindings.h"
|
#include "mpi/c/bindings.h"
|
||||||
|
#include "mpi/f77/fint_2_int.h"
|
||||||
#include "group/group.h"
|
#include "group/group.h"
|
||||||
#include "errhandler/errhandler.h"
|
#include "errhandler/errhandler.h"
|
||||||
#include "communicator/communicator.h"
|
#include "communicator/communicator.h"
|
||||||
@ -21,24 +22,15 @@
|
|||||||
static const char FUNC_NAME[] = "MPI_Group_c2f";
|
static const char FUNC_NAME[] = "MPI_Group_c2f";
|
||||||
|
|
||||||
|
|
||||||
MPI_Fint MPI_Group_c2f(MPI_Group group) {
|
MPI_Fint MPI_Group_c2f(MPI_Group group)
|
||||||
|
{
|
||||||
/* local variables */
|
if ( MPI_PARAM_CHECK ) {
|
||||||
ompi_group_t *group_c;
|
|
||||||
|
|
||||||
/* error checking */
|
|
||||||
if( MPI_PARAM_CHECK ) {
|
|
||||||
OMPI_ERR_INIT_FINALIZE(FUNC_NAME);
|
OMPI_ERR_INIT_FINALIZE(FUNC_NAME);
|
||||||
|
|
||||||
/* mapping an invalid handle to a null handle */
|
|
||||||
/* not invoking an error handler */
|
|
||||||
|
|
||||||
if( (NULL == group) ) {
|
if( (NULL == group) ) {
|
||||||
group = MPI_GROUP_NULL;
|
group = MPI_GROUP_NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
group_c=(ompi_group_t *)group;
|
return OMPI_INT_2_FINT(group->grp_f_to_c_index) ;
|
||||||
|
|
||||||
return (MPI_Fint) (group_c->grp_f_to_c_index) ;
|
|
||||||
}
|
}
|
||||||
|
@ -3,8 +3,10 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include "ompi_config.h"
|
#include "ompi_config.h"
|
||||||
|
|
||||||
#include "mpi.h"
|
#include "mpi.h"
|
||||||
#include "mpi/c/bindings.h"
|
#include "mpi/c/bindings.h"
|
||||||
|
#include "mpi/f77/fint_2_int.h"
|
||||||
#include "group/group.h"
|
#include "group/group.h"
|
||||||
#include "errhandler/errhandler.h"
|
#include "errhandler/errhandler.h"
|
||||||
#include "communicator/communicator.h"
|
#include "communicator/communicator.h"
|
||||||
@ -22,10 +24,7 @@ static const char FUNC_NAME[] = "MPI_Group_f2c";
|
|||||||
|
|
||||||
MPI_Group MPI_Group_f2c(MPI_Fint group_f)
|
MPI_Group MPI_Group_f2c(MPI_Fint group_f)
|
||||||
{
|
{
|
||||||
/* local variables */
|
int group_index = OMPI_FINT_2_INT(group_f);
|
||||||
size_t group_index;
|
|
||||||
|
|
||||||
group_index = (size_t) group_f;
|
|
||||||
|
|
||||||
if (MPI_PARAM_CHECK) {
|
if (MPI_PARAM_CHECK) {
|
||||||
OMPI_ERR_INIT_FINALIZE(FUNC_NAME);
|
OMPI_ERR_INIT_FINALIZE(FUNC_NAME);
|
||||||
|
@ -6,6 +6,7 @@
|
|||||||
|
|
||||||
#include "mpi.h"
|
#include "mpi.h"
|
||||||
#include "mpi/c/bindings.h"
|
#include "mpi/c/bindings.h"
|
||||||
|
#include "mpi/f77/fint_2_int.h"
|
||||||
#include "class/ompi_list.h"
|
#include "class/ompi_list.h"
|
||||||
#include "info/info.h"
|
#include "info/info.h"
|
||||||
#include "errhandler/errhandler.h"
|
#include "errhandler/errhandler.h"
|
||||||
@ -22,28 +23,15 @@
|
|||||||
static const char FUNC_NAME[] = "MPI_Info_c2f";
|
static const char FUNC_NAME[] = "MPI_Info_c2f";
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Converts info into a fortan handle
|
|
||||||
*
|
|
||||||
* @param info The C handle which has to be converted
|
|
||||||
* @retval Fortran handle corresponding to info.
|
|
||||||
*
|
|
||||||
* If info is a valid C handle, the MPI_Info_c2f returns a valid
|
|
||||||
* fortran handle to the same MPI_INFO object.
|
|
||||||
*/
|
|
||||||
MPI_Fint MPI_Info_c2f(MPI_Info info)
|
MPI_Fint MPI_Info_c2f(MPI_Info info)
|
||||||
{
|
{
|
||||||
/* check the arguments */
|
|
||||||
if (MPI_PARAM_CHECK) {
|
if (MPI_PARAM_CHECK) {
|
||||||
OMPI_ERR_INIT_FINALIZE(FUNC_NAME);
|
OMPI_ERR_INIT_FINALIZE(FUNC_NAME);
|
||||||
|
|
||||||
/* mapping an invalid handle to a null handle */
|
|
||||||
/* not invoking an error handler */
|
|
||||||
if (NULL == info || ompi_info_is_freed(info)) {
|
if (NULL == info || ompi_info_is_freed(info)) {
|
||||||
info = MPI_INFO_NULL;
|
info = MPI_INFO_NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* return the index */
|
return OMPI_INT_2_FINT(info->i_f_to_c_index);
|
||||||
return (MPI_Fint)(info->i_f_to_c_index);
|
|
||||||
}
|
}
|
||||||
|
@ -6,6 +6,7 @@
|
|||||||
|
|
||||||
#include "mpi.h"
|
#include "mpi.h"
|
||||||
#include "mpi/c/bindings.h"
|
#include "mpi/c/bindings.h"
|
||||||
|
#include "mpi/f77/fint_2_int.h"
|
||||||
#include "class/ompi_list.h"
|
#include "class/ompi_list.h"
|
||||||
#include "info/info.h"
|
#include "info/info.h"
|
||||||
#include "errhandler/errhandler.h"
|
#include "errhandler/errhandler.h"
|
||||||
@ -30,7 +31,7 @@ static const char FUNC_NAME[] = "MPI_Info_f2c";
|
|||||||
*/
|
*/
|
||||||
MPI_Info MPI_Info_f2c(MPI_Fint info)
|
MPI_Info MPI_Info_f2c(MPI_Fint info)
|
||||||
{
|
{
|
||||||
size_t info_index = (size_t) info;
|
int info_index = OMPI_FINT_2_INT(info);
|
||||||
|
|
||||||
/* check the arguments */
|
/* check the arguments */
|
||||||
|
|
||||||
|
@ -6,6 +6,7 @@
|
|||||||
|
|
||||||
#include "mpi.h"
|
#include "mpi.h"
|
||||||
#include "mpi/c/bindings.h"
|
#include "mpi/c/bindings.h"
|
||||||
|
#include "mpi/f77/fint_2_int.h"
|
||||||
#include "op/op.h"
|
#include "op/op.h"
|
||||||
#include "errhandler/errhandler.h"
|
#include "errhandler/errhandler.h"
|
||||||
#include "communicator/communicator.h"
|
#include "communicator/communicator.h"
|
||||||
@ -23,19 +24,13 @@ static const char FUNC_NAME[] = "MPI_Op_c2f";
|
|||||||
|
|
||||||
MPI_Fint MPI_Op_c2f(MPI_Op op)
|
MPI_Fint MPI_Op_c2f(MPI_Op op)
|
||||||
{
|
{
|
||||||
/* Error checking */
|
if (MPI_PARAM_CHECK) {
|
||||||
|
OMPI_ERR_INIT_FINALIZE(FUNC_NAME);
|
||||||
|
|
||||||
if (MPI_PARAM_CHECK) {
|
if (NULL == op) {
|
||||||
OMPI_ERR_INIT_FINALIZE(FUNC_NAME);
|
op = MPI_OP_NULL;
|
||||||
|
}
|
||||||
/* mapping an invalid handle to a null handle */
|
|
||||||
/* not invoking an error handler */
|
|
||||||
if (NULL == op) {
|
|
||||||
op = MPI_OP_NULL;
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
/* All done */
|
return OMPI_INT_2_FINT(op->o_f_to_c_index);
|
||||||
|
|
||||||
return (MPI_Fint) op->o_f_to_c_index;
|
|
||||||
}
|
}
|
||||||
|
@ -2,10 +2,10 @@
|
|||||||
* $HEADER$
|
* $HEADER$
|
||||||
*/
|
*/
|
||||||
#include "ompi_config.h"
|
#include "ompi_config.h"
|
||||||
#include <stdio.h>
|
|
||||||
|
|
||||||
#include "mpi.h"
|
#include "mpi.h"
|
||||||
#include "mpi/c/bindings.h"
|
#include "mpi/c/bindings.h"
|
||||||
|
#include "mpi/f77/fint_2_int.h"
|
||||||
#include "op/op.h"
|
#include "op/op.h"
|
||||||
#include "errhandler/errhandler.h"
|
#include "errhandler/errhandler.h"
|
||||||
#include "communicator/communicator.h"
|
#include "communicator/communicator.h"
|
||||||
@ -23,7 +23,7 @@ static const char FUNC_NAME[] = "MPI_Op_f2c";
|
|||||||
|
|
||||||
MPI_Op MPI_Op_f2c(MPI_Fint op_f)
|
MPI_Op MPI_Op_f2c(MPI_Fint op_f)
|
||||||
{
|
{
|
||||||
size_t op_index = (size_t) op_f;
|
int op_index = OMPI_FINT_2_INT(op_f);
|
||||||
|
|
||||||
/* Error checking */
|
/* Error checking */
|
||||||
|
|
||||||
|
@ -6,6 +6,7 @@
|
|||||||
|
|
||||||
#include "mpi.h"
|
#include "mpi.h"
|
||||||
#include "mpi/c/bindings.h"
|
#include "mpi/c/bindings.h"
|
||||||
|
#include "mpi/f77/fint_2_int.h"
|
||||||
#include "request/request.h"
|
#include "request/request.h"
|
||||||
#include "errhandler/errhandler.h"
|
#include "errhandler/errhandler.h"
|
||||||
#include "communicator/communicator.h"
|
#include "communicator/communicator.h"
|
||||||
@ -23,13 +24,9 @@ static const char FUNC_NAME[] = "MPI_Request_f2c";
|
|||||||
|
|
||||||
MPI_Fint MPI_Request_c2f(MPI_Request request)
|
MPI_Fint MPI_Request_c2f(MPI_Request request)
|
||||||
{
|
{
|
||||||
/* error checking */
|
if ( MPI_PARAM_CHECK ) {
|
||||||
if( MPI_PARAM_CHECK ) {
|
|
||||||
OMPI_ERR_INIT_FINALIZE(FUNC_NAME);
|
OMPI_ERR_INIT_FINALIZE(FUNC_NAME);
|
||||||
|
|
||||||
/* mapping an invalid handle to a null handle */
|
|
||||||
/* not invoking an error handler */
|
|
||||||
|
|
||||||
if (NULL == request) {
|
if (NULL == request) {
|
||||||
request = MPI_REQUEST_NULL;
|
request = MPI_REQUEST_NULL;
|
||||||
}
|
}
|
||||||
@ -48,10 +45,10 @@ MPI_Fint MPI_Request_c2f(MPI_Request request)
|
|||||||
fortran integer.
|
fortran integer.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if (-1 == request->req_f_to_c_index) {
|
if (MPI_UNDEFINED == request->req_f_to_c_index) {
|
||||||
request->req_f_to_c_index =
|
request->req_f_to_c_index =
|
||||||
ompi_pointer_array_add(&ompi_request_f_to_c_table, request);
|
ompi_pointer_array_add(&ompi_request_f_to_c_table, request);
|
||||||
}
|
}
|
||||||
|
|
||||||
return (MPI_Fint) (request->req_f_to_c_index) ;
|
return OMPI_INT_2_FINT(request->req_f_to_c_index) ;
|
||||||
}
|
}
|
||||||
|
@ -2,10 +2,10 @@
|
|||||||
* $HEADER$
|
* $HEADER$
|
||||||
*/
|
*/
|
||||||
#include "ompi_config.h"
|
#include "ompi_config.h"
|
||||||
#include <stdio.h>
|
|
||||||
|
|
||||||
#include "mpi.h"
|
#include "mpi.h"
|
||||||
#include "mpi/c/bindings.h"
|
#include "mpi/c/bindings.h"
|
||||||
|
#include "mpi/f77/fint_2_int.h"
|
||||||
#include "request/request.h"
|
#include "request/request.h"
|
||||||
#include "errhandler/errhandler.h"
|
#include "errhandler/errhandler.h"
|
||||||
#include "communicator/communicator.h"
|
#include "communicator/communicator.h"
|
||||||
@ -23,9 +23,7 @@ static const char FUNC_NAME[] = "MPI_Request_f2c";
|
|||||||
|
|
||||||
MPI_Request MPI_Request_f2c(MPI_Fint request)
|
MPI_Request MPI_Request_f2c(MPI_Fint request)
|
||||||
{
|
{
|
||||||
size_t request_index;
|
int request_index = OMPI_FINT_2_INT(request);
|
||||||
|
|
||||||
request_index = (size_t) request;
|
|
||||||
|
|
||||||
if (MPI_PARAM_CHECK) {
|
if (MPI_PARAM_CHECK) {
|
||||||
OMPI_ERR_INIT_FINALIZE(FUNC_NAME);
|
OMPI_ERR_INIT_FINALIZE(FUNC_NAME);
|
||||||
|
@ -6,6 +6,7 @@
|
|||||||
|
|
||||||
#include "mpi.h"
|
#include "mpi.h"
|
||||||
#include "mpi/c/bindings.h"
|
#include "mpi/c/bindings.h"
|
||||||
|
#include "mpi/f77/fint_2_int.h"
|
||||||
#include "mpi/f77/constants.h"
|
#include "mpi/f77/constants.h"
|
||||||
#include "communicator/communicator.h"
|
#include "communicator/communicator.h"
|
||||||
#include "errhandler/errhandler.h"
|
#include "errhandler/errhandler.h"
|
||||||
@ -36,13 +37,10 @@ int MPI_Status_c2f(MPI_Status *c_status, MPI_Fint *f_status)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* We can't use OMPI_INT_2_FINT here because of some complications
|
f_status[0] = OMPI_INT_2_FINT(c_status->MPI_SOURCE);
|
||||||
with include files. :-( So just do the casting manually. */
|
f_status[1] = OMPI_INT_2_FINT(c_status->MPI_TAG);
|
||||||
|
f_status[2] = OMPI_INT_2_FINT(c_status->MPI_ERROR);
|
||||||
f_status[0] = (MPI_Fint) c_status->MPI_SOURCE;
|
f_status[3] = OMPI_INT_2_FINT(c_status->_count);
|
||||||
f_status[1] = (MPI_Fint) c_status->MPI_TAG;
|
|
||||||
f_status[2] = (MPI_Fint) c_status->MPI_ERROR;
|
|
||||||
f_status[3] = (MPI_Fint) c_status->_count;
|
|
||||||
|
|
||||||
return MPI_SUCCESS;
|
return MPI_SUCCESS;
|
||||||
}
|
}
|
||||||
|
@ -2,10 +2,10 @@
|
|||||||
* $HEADER$
|
* $HEADER$
|
||||||
*/
|
*/
|
||||||
#include "ompi_config.h"
|
#include "ompi_config.h"
|
||||||
#include <stdio.h>
|
|
||||||
|
|
||||||
#include "mpi.h"
|
#include "mpi.h"
|
||||||
#include "mpi/c/bindings.h"
|
#include "mpi/c/bindings.h"
|
||||||
|
#include "mpi/f77/fint_2_int.h"
|
||||||
#include "mpi/f77/constants.h"
|
#include "mpi/f77/constants.h"
|
||||||
#include "communicator/communicator.h"
|
#include "communicator/communicator.h"
|
||||||
#include "errhandler/errhandler.h"
|
#include "errhandler/errhandler.h"
|
||||||
|
@ -6,6 +6,7 @@
|
|||||||
|
|
||||||
#include "mpi.h"
|
#include "mpi.h"
|
||||||
#include "mpi/c/bindings.h"
|
#include "mpi/c/bindings.h"
|
||||||
|
#include "mpi/f77/fint_2_int.h"
|
||||||
#include "datatype/datatype.h"
|
#include "datatype/datatype.h"
|
||||||
#include "communicator/communicator.h"
|
#include "communicator/communicator.h"
|
||||||
#include "errhandler/errhandler.h"
|
#include "errhandler/errhandler.h"
|
||||||
@ -23,17 +24,13 @@ static const char FUNC_NAME[] = "MPI_Type_c2f";
|
|||||||
|
|
||||||
MPI_Fint MPI_Type_c2f(MPI_Datatype datatype)
|
MPI_Fint MPI_Type_c2f(MPI_Datatype datatype)
|
||||||
{
|
{
|
||||||
if (MPI_PARAM_CHECK) {
|
if (MPI_PARAM_CHECK) {
|
||||||
OMPI_ERR_INIT_FINALIZE(FUNC_NAME);
|
OMPI_ERR_INIT_FINALIZE(FUNC_NAME);
|
||||||
|
|
||||||
/* mapping an invalid handle to a null handle */
|
if (NULL == datatype) {
|
||||||
/* not invoking an error handler */
|
datatype = MPI_DATATYPE_NULL;
|
||||||
if (NULL == datatype) {
|
}
|
||||||
datatype = MPI_DATATYPE_NULL;
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
/* Simple */
|
return OMPI_INT_2_FINT(datatype->d_f_to_c_index);
|
||||||
|
|
||||||
return (MPI_Fint)(datatype->d_f_to_c_index);
|
|
||||||
}
|
}
|
||||||
|
@ -2,10 +2,10 @@
|
|||||||
* $HEADER$
|
* $HEADER$
|
||||||
*/
|
*/
|
||||||
#include "ompi_config.h"
|
#include "ompi_config.h"
|
||||||
#include <stdio.h>
|
|
||||||
|
|
||||||
#include "mpi.h"
|
#include "mpi.h"
|
||||||
#include "mpi/c/bindings.h"
|
#include "mpi/c/bindings.h"
|
||||||
|
#include "mpi/f77/fint_2_int.h"
|
||||||
#include "errhandler/errhandler.h"
|
#include "errhandler/errhandler.h"
|
||||||
#include "communicator/communicator.h"
|
#include "communicator/communicator.h"
|
||||||
#include "datatype/datatype.h"
|
#include "datatype/datatype.h"
|
||||||
@ -23,7 +23,7 @@ static const char FUNC_NAME[] = "MPI_Type_f2c";
|
|||||||
|
|
||||||
MPI_Datatype MPI_Type_f2c(MPI_Fint datatype)
|
MPI_Datatype MPI_Type_f2c(MPI_Fint datatype)
|
||||||
{
|
{
|
||||||
size_t datatype_index = (size_t) datatype;
|
int datatype_index = OMPI_FINT_2_INT(datatype);
|
||||||
|
|
||||||
if (MPI_PARAM_CHECK) {
|
if (MPI_PARAM_CHECK) {
|
||||||
OMPI_ERR_INIT_FINALIZE(FUNC_NAME);
|
OMPI_ERR_INIT_FINALIZE(FUNC_NAME);
|
||||||
|
@ -6,6 +6,7 @@
|
|||||||
|
|
||||||
#include "mpi.h"
|
#include "mpi.h"
|
||||||
#include "mpi/c/bindings.h"
|
#include "mpi/c/bindings.h"
|
||||||
|
#include "mpi/f77/fint_2_int.h"
|
||||||
#include "communicator/communicator.h"
|
#include "communicator/communicator.h"
|
||||||
#include "errhandler/errhandler.h"
|
#include "errhandler/errhandler.h"
|
||||||
|
|
||||||
@ -22,11 +23,11 @@ static const char FUNC_NAME[] = "MPI_Win_c2f";
|
|||||||
|
|
||||||
MPI_Fint MPI_Win_c2f(MPI_Win win)
|
MPI_Fint MPI_Win_c2f(MPI_Win win)
|
||||||
{
|
{
|
||||||
if (MPI_PARAM_CHECK) {
|
if (MPI_PARAM_CHECK) {
|
||||||
OMPI_ERR_INIT_FINALIZE(FUNC_NAME);
|
OMPI_ERR_INIT_FINALIZE(FUNC_NAME);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* This function is not yet implemented */
|
/* This function is not yet implemented */
|
||||||
|
|
||||||
return (MPI_Fint) OMPI_ERRHANDLER_INVOKE(MPI_COMM_WORLD, MPI_ERR_OTHER, FUNC_NAME);
|
return (MPI_Fint) OMPI_ERRHANDLER_INVOKE(MPI_COMM_WORLD, MPI_ERR_OTHER, FUNC_NAME);
|
||||||
}
|
}
|
||||||
|
@ -2,10 +2,10 @@
|
|||||||
* $HEADER$
|
* $HEADER$
|
||||||
*/
|
*/
|
||||||
#include "ompi_config.h"
|
#include "ompi_config.h"
|
||||||
#include <stdio.h>
|
|
||||||
|
|
||||||
#include "mpi.h"
|
#include "mpi.h"
|
||||||
#include "mpi/c/bindings.h"
|
#include "mpi/c/bindings.h"
|
||||||
|
#include "mpi/f77/fint_2_int.h"
|
||||||
#include "communicator/communicator.h"
|
#include "communicator/communicator.h"
|
||||||
#include "errhandler/errhandler.h"
|
#include "errhandler/errhandler.h"
|
||||||
|
|
||||||
|
@ -22,6 +22,7 @@ static void ompi_request_construct(ompi_request_t* req)
|
|||||||
req->req_fini = NULL;
|
req->req_fini = NULL;
|
||||||
req->req_free = NULL;
|
req->req_free = NULL;
|
||||||
req->req_cancel = NULL;
|
req->req_cancel = NULL;
|
||||||
|
req->req_f_to_c_index = MPI_UNDEFINED;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void ompi_request_destruct(ompi_request_t* req)
|
static void ompi_request_destruct(ompi_request_t* req)
|
||||||
|
@ -96,8 +96,8 @@ typedef struct ompi_request_t ompi_request_t;
|
|||||||
do { \
|
do { \
|
||||||
(request)->req_state = OMPI_REQUEST_INACTIVE; \
|
(request)->req_state = OMPI_REQUEST_INACTIVE; \
|
||||||
(request)->req_complete = false; \
|
(request)->req_complete = false; \
|
||||||
(request)->req_f_to_c_index = -1; \
|
(request)->req_f_to_c_index = MPI_UNDEFINED; \
|
||||||
} while(0);
|
} while (0);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Finalize a request. This is a macro to avoid function call
|
* Finalize a request. This is a macro to avoid function call
|
||||||
@ -113,9 +113,10 @@ typedef struct ompi_request_t ompi_request_t;
|
|||||||
#define OMPI_REQUEST_FINI(request) \
|
#define OMPI_REQUEST_FINI(request) \
|
||||||
do { \
|
do { \
|
||||||
(request)->req_state = OMPI_REQUEST_INVALID; \
|
(request)->req_state = OMPI_REQUEST_INVALID; \
|
||||||
if (-1 != (request)->req_f_to_c_index) { \
|
if (MPI_UNDEFINED != (request)->req_f_to_c_index) { \
|
||||||
ompi_pointer_array_set_item(&ompi_request_f_to_c_table, \
|
ompi_pointer_array_set_item(&ompi_request_f_to_c_table, \
|
||||||
(request)->req_f_to_c_index, NULL); \
|
(request)->req_f_to_c_index, NULL); \
|
||||||
|
(request)->req_f_to_c_index = MPI_UNDEFINED; \
|
||||||
} \
|
} \
|
||||||
} while (0);
|
} while (0);
|
||||||
|
|
||||||
|
@ -233,7 +233,8 @@ static int output(bool want_error_header, ompi_pointer_array_t *lines,
|
|||||||
const char *base, const char *topic,
|
const char *base, const char *topic,
|
||||||
va_list arglist)
|
va_list arglist)
|
||||||
{
|
{
|
||||||
size_t i, len;
|
int i;
|
||||||
|
size_t len;
|
||||||
char *tmp, *concat, *formatted;
|
char *tmp, *concat, *formatted;
|
||||||
|
|
||||||
/* See how much space we need */
|
/* See how much space we need */
|
||||||
@ -297,7 +298,7 @@ static int output(bool want_error_header, ompi_pointer_array_t *lines,
|
|||||||
*/
|
*/
|
||||||
static int destroy_message(ompi_pointer_array_t *lines)
|
static int destroy_message(ompi_pointer_array_t *lines)
|
||||||
{
|
{
|
||||||
size_t i;
|
int i;
|
||||||
char *tmp;
|
char *tmp;
|
||||||
|
|
||||||
for (i = 0; i < ompi_pointer_array_get_size(lines); ++i) {
|
for (i = 0; i < ompi_pointer_array_get_size(lines); ++i) {
|
||||||
|
Загрузка…
x
Ссылка в новой задаче
Block a user