100% compatible with f2c translation table. I create the table in the ddt_init and populate it with
all fortran predefined datatypes. There are several datatypes that are not accesible from fortran, their f2c index is set to -1 actually. This commit was SVN r1340.
Этот коммит содержится в:
родитель
fee3b071c2
Коммит
39b0070742
@ -20,8 +20,11 @@
|
||||
#include "errhandler/errhandler.h"
|
||||
#include "class/ompi_object.h"
|
||||
#include "class/ompi_hash_table.h"
|
||||
#include "class/ompi_pointer_array.h"
|
||||
#include "mpi.h"
|
||||
|
||||
extern ompi_pointer_array_t *ompi_datatype_f_to_c_table;
|
||||
|
||||
/* if there are more basic datatypes than the number of bytes in the int type
|
||||
* the bdt_used field of the data description struct should be changed to long.
|
||||
*/
|
||||
|
@ -26,6 +26,7 @@ static void __get_free_dt_struct( dt_desc_t* pData )
|
||||
pData->true_ub = LONG_MIN;
|
||||
pData->lb = LONG_MAX;
|
||||
pData->ub = LONG_MIN;
|
||||
pData->d_f_to_c_index = ompi_pointer_array_add(ompi_datatype_f_to_c_table, pData);
|
||||
}
|
||||
|
||||
static void __destroy_ddt_struct( dt_desc_t* pData )
|
||||
@ -40,6 +41,10 @@ static void __destroy_ddt_struct( dt_desc_t* pData )
|
||||
pData->opt_desc.used = 0;
|
||||
if( pData->args != NULL ) free( pData->args );
|
||||
pData->args = NULL;
|
||||
if( NULL != ompi_pointer_array_get_item(ompi_datatype_f_to_c_table, pData->d_f_to_c_index) ){
|
||||
ompi_pointer_array_set_item( ompi_datatype_f_to_c_table, pData->d_f_to_c_index, NULL );
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
OBJ_CLASS_INSTANCE(ompi_datatype_t, ompi_object_t, __get_free_dt_struct, __destroy_ddt_struct );
|
||||
|
@ -4,7 +4,7 @@
|
||||
#include "datatype_internal.h"
|
||||
|
||||
/* other fields starting after bdt_used (index of DT_LOOP should be ONE) */
|
||||
#define EMPTY_DATA(NAME) NULL, 0, "MPI_" # NAME, {0, 0, NULL}, {0, 0, NULL}, NULL, { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }
|
||||
#define EMPTY_DATA(NAME) NULL, -1, "MPI_" # NAME, {0, 0, NULL}, {0, 0, NULL}, NULL, { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }
|
||||
#define BASEOBJ_DATA { OBJ_CLASS(ompi_datatype_t), 1 }
|
||||
#define INIT_BASIC_DATA( TYPE, ALIGN, NAME ) \
|
||||
{ BASEOBJ_DATA, sizeof(TYPE), 0, sizeof(TYPE), ALIGN, \
|
||||
@ -120,6 +120,8 @@ ompi_datatype_t* ompi_mpi_cxx_bool;
|
||||
ompi_datatype_t* ompi_mpi_2cplex = basicDatatypes + DT_2COMPLEX;
|
||||
ompi_datatype_t* ompi_mpi_2dblcplex = basicDatatypes + DT_2DOUBLE_COMPLEX;
|
||||
|
||||
ompi_pointer_array_t *ompi_datatype_f_to_c_table = NULL;
|
||||
|
||||
int local_sizes[DT_MAX_PREDEFINED];
|
||||
|
||||
/* VPS: fake convertor for time being / to provide pack/unpack functions */
|
||||
@ -237,6 +239,38 @@ int ompi_ddt_init( void )
|
||||
/* VPS: Create a fake convertor. No error checking here now, since
|
||||
this will be removed sometime */
|
||||
ompi_convertor = ompi_convertor_create(0,0);
|
||||
|
||||
/* Create the f2c translation table */
|
||||
ompi_datatype_f_to_c_table = OBJ_NEW(ompi_pointer_array_t);
|
||||
if (NULL == ompi_datatype_f_to_c_table) {
|
||||
return OMPI_ERROR;
|
||||
}
|
||||
|
||||
/* Start to populate the f2c index translation table */
|
||||
ompi_pointer_array_add( ompi_datatype_f_to_c_table, NULL ); /* why not ? */
|
||||
ompi_pointer_array_add(ompi_datatype_f_to_c_table, ompi_mpi_byte );
|
||||
ompi_pointer_array_add(ompi_datatype_f_to_c_table, ompi_mpi_packed );
|
||||
ompi_pointer_array_add(ompi_datatype_f_to_c_table, ompi_mpi_ub );
|
||||
ompi_pointer_array_add(ompi_datatype_f_to_c_table, ompi_mpi_lb );
|
||||
ompi_pointer_array_add(ompi_datatype_f_to_c_table, ompi_mpi_character );
|
||||
ompi_pointer_array_add(ompi_datatype_f_to_c_table, ompi_mpi_logic );
|
||||
ompi_pointer_array_add(ompi_datatype_f_to_c_table, ompi_mpi_integer );
|
||||
ompi_pointer_array_add(ompi_datatype_f_to_c_table, ompi_mpi_char );
|
||||
ompi_pointer_array_add(ompi_datatype_f_to_c_table, ompi_mpi_short );
|
||||
ompi_pointer_array_add(ompi_datatype_f_to_c_table, ompi_mpi_int );
|
||||
ompi_pointer_array_add(ompi_datatype_f_to_c_table, ompi_mpi_long_long );
|
||||
ompi_pointer_array_add(ompi_datatype_f_to_c_table, ompi_mpi_real );
|
||||
ompi_pointer_array_add(ompi_datatype_f_to_c_table, ompi_mpi_real );
|
||||
ompi_pointer_array_add(ompi_datatype_f_to_c_table, ompi_mpi_real );
|
||||
ompi_pointer_array_add(ompi_datatype_f_to_c_table, ompi_mpi_double );
|
||||
ompi_pointer_array_add(ompi_datatype_f_to_c_table, ompi_mpi_long_double );
|
||||
ompi_pointer_array_add(ompi_datatype_f_to_c_table, ompi_mpi_dblprec );
|
||||
ompi_pointer_array_add(ompi_datatype_f_to_c_table, ompi_mpi_cplex );
|
||||
ompi_pointer_array_add(ompi_datatype_f_to_c_table, ompi_mpi_dblcplex );
|
||||
ompi_pointer_array_add(ompi_datatype_f_to_c_table, ompi_mpi_2real );
|
||||
ompi_pointer_array_add(ompi_datatype_f_to_c_table, ompi_mpi_2dblcplex );
|
||||
ompi_pointer_array_add(ompi_datatype_f_to_c_table, ompi_mpi_2integer );
|
||||
|
||||
return OMPI_SUCCESS;
|
||||
}
|
||||
|
||||
@ -254,6 +288,9 @@ int ompi_ddt_finalize( void )
|
||||
if( pDumpConv != NULL ) {
|
||||
OBJ_RELEASE( pDumpConv );
|
||||
}
|
||||
/* Get rid of the Fortran2C translation table */
|
||||
OBJ_RELEASE(ompi_datatype_f_to_c_table);
|
||||
|
||||
return OMPI_SUCCESS;
|
||||
}
|
||||
|
||||
|
Загрузка…
x
Ссылка в новой задаче
Block a user