Completed Fortran wrappers.
Reviewer: George Bosilca This commit was SVN r1356.
Этот коммит содержится в:
родитель
07e298e248
Коммит
c537586ffb
@ -48,5 +48,11 @@ OMPI_GENERATE_F77_BINDINGS (MPI_TYPE_CONTIGUOUS,
|
||||
|
||||
void mpi_type_contiguous_f(MPI_Fint *count, MPI_Fint *oldtype, MPI_Fint *newtype, MPI_Fint *ierr)
|
||||
{
|
||||
MPI_Datatype c_old = MPI_Type_f2c(*oldtype);
|
||||
MPI_Datatype c_new;
|
||||
|
||||
*ierr = MPI_Type_contiguous(*count, c_old, &c_new);
|
||||
|
||||
if (*ierr == MPI_SUCCESS)
|
||||
*newtype = MPI_Type_c2f(c_new);
|
||||
}
|
||||
|
@ -48,5 +48,13 @@ OMPI_GENERATE_F77_BINDINGS (MPI_TYPE_CREATE_DARRAY,
|
||||
|
||||
void mpi_type_create_darray_f(MPI_Fint *size, MPI_Fint *rank, MPI_Fint *ndims, MPI_Fint *gsize_array, MPI_Fint *distrib_array, MPI_Fint *darg_array, MPI_Fint *psize_array, MPI_Fint *order, MPI_Fint *oldtype, MPI_Fint *newtype, MPI_Fint *ierr)
|
||||
{
|
||||
MPI_Datatype c_old = MPI_Type_f2c(*oldtype);
|
||||
MPI_Datatype c_new;
|
||||
|
||||
*ierr = MPI_Type_create_darray(*size, *rank, *ndims, gsize_array,
|
||||
distrib_array, darg_array, psize_array,
|
||||
*order, c_old, &c_new);
|
||||
|
||||
if (*ierr == MPI_SUCCESS)
|
||||
*newtype = MPI_Type_c2f(c_new);
|
||||
}
|
||||
|
@ -48,5 +48,25 @@ OMPI_GENERATE_F77_BINDINGS (MPI_TYPE_CREATE_HINDEXED,
|
||||
|
||||
void mpi_type_create_hindexed_f(MPI_Fint *count, MPI_Fint *array_of_blocklengths, MPI_Fint *array_of_displacements, MPI_Fint *oldtype, MPI_Fint *newtype, MPI_Fint *ierr)
|
||||
{
|
||||
MPI_Datatype c_old = MPI_Type_f2c(*oldtype);
|
||||
MPI_Datatype c_new = MPI_Type_f2c(*newtype);
|
||||
MPI_Aint *c_disp_array;
|
||||
int i;
|
||||
|
||||
c_disp_array = malloc(*count * sizeof(MPI_Aint));
|
||||
if (c_disp_array == (MPI_Aint *) NULL) {
|
||||
*ierr = MPI_ERR_INTERN;
|
||||
return;
|
||||
}
|
||||
for (i = 0; i < *count; i++) {
|
||||
c_disp_array[i] = (MPI_Aint) array_of_displacements[i];
|
||||
}
|
||||
|
||||
*ierr = MPI_Type_create_hindexed(*count, array_of_blocklengths,
|
||||
c_disp_array, c_old, &c_new);
|
||||
|
||||
if (*ierr == MPI_SUCCESS)
|
||||
*newtype = MPI_Type_c2f(c_new);
|
||||
|
||||
free(c_disp_array);
|
||||
}
|
||||
|
@ -48,5 +48,14 @@ OMPI_GENERATE_F77_BINDINGS (MPI_TYPE_CREATE_HVECTOR,
|
||||
|
||||
void mpi_type_create_hvector_f(MPI_Fint *count, MPI_Fint *blocklength, MPI_Fint *stride, MPI_Fint *oldtype, MPI_Fint *newtype, MPI_Fint *ierr)
|
||||
{
|
||||
MPI_Datatype c_old = MPI_Type_f2c(*oldtype);
|
||||
MPI_Datatype c_new;
|
||||
MPI_Aint c_stride = (MPI_Aint)*stride;
|
||||
|
||||
*ierr = MPI_Type_hvector(*count, *blocklength, c_stride,
|
||||
c_old, &c_new);
|
||||
|
||||
if (*ierr == MPI_SUCCESS){
|
||||
*newtype = MPI_Type_c2f(c_new);
|
||||
}
|
||||
}
|
||||
|
@ -48,5 +48,13 @@ OMPI_GENERATE_F77_BINDINGS (MPI_TYPE_CREATE_INDEXED_BLOCK,
|
||||
|
||||
void mpi_type_create_indexed_block_f(MPI_Fint *count, MPI_Fint *blocklength, MPI_Fint *array_of_displacements, MPI_Fint *oldtype, MPI_Fint *newtype, MPI_Fint *ierr)
|
||||
{
|
||||
MPI_Datatype c_old = MPI_Type_f2c(*oldtype);
|
||||
MPI_Datatype c_new;
|
||||
|
||||
*ierr = MPI_Type_create_indexed_block(*count, *blocklength, array_of_displacements,
|
||||
c_old, &c_new);
|
||||
|
||||
if (*ierr == MPI_SUCCESS)
|
||||
*newtype = MPI_Type_c2f(c_new);
|
||||
}
|
||||
|
||||
|
@ -48,5 +48,11 @@ OMPI_GENERATE_F77_BINDINGS (MPI_TYPE_CREATE_RESIZED,
|
||||
|
||||
void mpi_type_create_resized_f(MPI_Fint *oldtype, MPI_Fint *lb, MPI_Fint *extent, MPI_Fint *newtype, MPI_Fint *ierr)
|
||||
{
|
||||
MPI_Datatype c_old = MPI_Type_f2c(*oldtype);
|
||||
MPI_Datatype c_new;
|
||||
|
||||
*ierr = MPI_Type_create_resized(c_old, *lb, *extent, &c_new);
|
||||
|
||||
if (*ierr == MPI_SUCCESS)
|
||||
*newtype = MPI_Type_c2f(c_new);
|
||||
}
|
||||
|
@ -48,5 +48,35 @@ OMPI_GENERATE_F77_BINDINGS (MPI_TYPE_CREATE_STRUCT,
|
||||
|
||||
void mpi_type_create_struct_f(MPI_Fint *count, MPI_Fint *array_of_block_lengths, MPI_Fint *array_of_displacements, MPI_Fint *array_of_types, MPI_Fint *newtype, MPI_Fint *ierr)
|
||||
{
|
||||
MPI_Datatype c_new;
|
||||
MPI_Datatype *c_type_old_array;
|
||||
MPI_Aint *c_disp_array;
|
||||
int i;
|
||||
|
||||
c_type_old_array = malloc(*count * sizeof(MPI_Datatype));
|
||||
if (c_type_old_array == (MPI_Datatype *) NULL) {
|
||||
*ierr = MPI_ERR_INTERN;
|
||||
return;
|
||||
}
|
||||
|
||||
c_disp_array = malloc(*count * sizeof(MPI_Aint));
|
||||
if (c_disp_array == (MPI_Aint *) NULL) {
|
||||
if (c_type_old_array != (MPI_Datatype *) NULL)
|
||||
free(c_type_old_array);
|
||||
|
||||
*ierr = MPI_ERR_INTERN;
|
||||
return;
|
||||
}
|
||||
for (i = 0; i < *count; i++) {
|
||||
c_disp_array[i] = (MPI_Aint) array_of_displacements[i];
|
||||
c_type_old_array[i] = MPI_Type_f2c(array_of_types[i]);
|
||||
}
|
||||
|
||||
*ierr = MPI_Type_create_struct(*count, array_of_block_lengths, c_disp_array,
|
||||
c_type_old_array, &c_new);
|
||||
|
||||
if (*ierr == MPI_SUCCESS) {
|
||||
*newtype = MPI_Type_c2f(c_new);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -48,5 +48,11 @@ OMPI_GENERATE_F77_BINDINGS (MPI_TYPE_DUP,
|
||||
|
||||
void mpi_type_dup_f(MPI_Fint *type, MPI_Fint *newtype, MPI_Fint *ierr)
|
||||
{
|
||||
MPI_Datatype c_type = MPI_Type_f2c(*type);
|
||||
MPI_Datatype c_new;
|
||||
|
||||
*ierr = MPI_Type_dup(c_type, &c_new);
|
||||
|
||||
if (*ierr == MPI_SUCCESS)
|
||||
*newtype = MPI_Type_c2f(c_new);
|
||||
}
|
||||
|
@ -48,5 +48,11 @@ OMPI_GENERATE_F77_BINDINGS (MPI_TYPE_EXTENT,
|
||||
|
||||
void mpi_type_extent_f(MPI_Fint *type, MPI_Fint *extent, MPI_Fint *ierr)
|
||||
{
|
||||
MPI_Datatype c_type = MPI_Type_f2c(*type);
|
||||
MPI_Aint c_extent;
|
||||
|
||||
*ierr = MPI_Type_extent(c_type, &c_extent);
|
||||
|
||||
if (*ierr == MPI_SUCCESS)
|
||||
*extent = (MPI_Fint)c_extent;
|
||||
}
|
||||
|
@ -48,5 +48,10 @@ OMPI_GENERATE_F77_BINDINGS (MPI_TYPE_FREE,
|
||||
|
||||
void mpi_type_free_f(MPI_Fint *type, MPI_Fint *ierr)
|
||||
{
|
||||
MPI_Datatype c_type = MPI_DATATYPE_NULL;
|
||||
|
||||
*ierr = MPI_Type_free(&c_type);
|
||||
|
||||
if( *ierr == MPI_SUCCESS )
|
||||
type = (MPI_Fint)MPI_DATATYPE_NULL;
|
||||
}
|
||||
|
@ -48,5 +48,44 @@ OMPI_GENERATE_F77_BINDINGS (MPI_TYPE_GET_CONTENTS,
|
||||
|
||||
void mpi_type_get_contents_f(MPI_Fint *mtype, MPI_Fint *max_integers, MPI_Fint *max_addresses, MPI_Fint *max_datatypes, MPI_Fint *array_of_integers, MPI_Fint *array_of_addresses, MPI_Fint *array_of_datatypes, MPI_Fint *ierr)
|
||||
{
|
||||
|
||||
MPI_Aint *c_address_array = NULL;
|
||||
MPI_Datatype *c_datatype_array = NULL;
|
||||
MPI_Datatype c_mtype = MPI_Type_f2c(*mtype);
|
||||
int i;
|
||||
|
||||
if (*max_datatypes) {
|
||||
c_datatype_array = malloc(*max_datatypes * sizeof(MPI_Datatype));
|
||||
if (c_datatype_array == (MPI_Datatype*) NULL) {
|
||||
*ierr = MPI_ERR_INTERN;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (*max_addresses) {
|
||||
c_address_array = malloc(*max_addresses * sizeof(MPI_Aint));
|
||||
if (c_address_array == (MPI_Aint *) NULL) {
|
||||
/* prevent memory leaks */
|
||||
if (c_datatype_array != (MPI_Datatype*) NULL)
|
||||
free(c_datatype_array);
|
||||
|
||||
*ierr = MPI_ERR_INTERN;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
*ierr = MPI_Type_get_contents(c_mtype, *max_integers, *max_addresses,
|
||||
*max_datatypes, array_of_integers,
|
||||
c_address_array, c_datatype_array);
|
||||
|
||||
if (*ierr == MPI_SUCCESS) {
|
||||
for (i = 0; i < *max_addresses; i++) {
|
||||
array_of_addresses[i] = (MPI_Fint)c_address_array[i];
|
||||
}
|
||||
for (i = 0; i < *max_datatypes; i++) {
|
||||
array_of_datatypes[i] = MPI_Type_c2f(c_datatype_array[i]);
|
||||
}
|
||||
}
|
||||
free(c_address_array);
|
||||
free(c_datatype_array);
|
||||
}
|
||||
|
@ -48,5 +48,15 @@ OMPI_GENERATE_F77_BINDINGS (MPI_TYPE_GET_EXTENT,
|
||||
|
||||
void mpi_type_get_extent_f(MPI_Fint *type, MPI_Fint *lb, MPI_Fint *extent, MPI_Fint *ierr)
|
||||
{
|
||||
MPI_Datatype c_type = MPI_Type_f2c(*type);
|
||||
MPI_Aint c_lb;
|
||||
MPI_Aint c_extent;
|
||||
|
||||
*ierr = MPI_Type_get_extent(c_type, &c_lb, &c_extent);
|
||||
|
||||
if (*ierr == MPI_SUCCESS){
|
||||
*lb = (MPI_Fint) c_lb;
|
||||
*extent = (MPI_Fint) c_extent;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -48,5 +48,14 @@ OMPI_GENERATE_F77_BINDINGS (MPI_TYPE_GET_TRUE_EXTENT,
|
||||
|
||||
void mpi_type_get_true_extent_f(MPI_Fint *datatype, MPI_Fint *true_lb, MPI_Fint *true_extent, MPI_Fint *ierr)
|
||||
{
|
||||
MPI_Datatype c_type = MPI_Type_f2c(*datatype);
|
||||
MPI_Aint c_true_lb;
|
||||
MPI_Aint c_true_extent;
|
||||
|
||||
*ierr = MPI_Type_get_true_extent(c_type, &c_true_lb, &c_true_extent);
|
||||
|
||||
if (*ierr == MPI_SUCCESS){
|
||||
*true_lb = (MPI_Fint) c_true_lb;
|
||||
*true_extent = (MPI_Fint) c_true_extent;
|
||||
}
|
||||
}
|
||||
|
@ -48,5 +48,24 @@ OMPI_GENERATE_F77_BINDINGS (MPI_TYPE_HINDEXED,
|
||||
|
||||
void mpi_type_hindexed_f(MPI_Fint *count, MPI_Fint *array_of_blocklengths, MPI_Fint *array_of_displacements, MPI_Fint *oldtype, MPI_Fint *newtype, MPI_Fint *ierr)
|
||||
{
|
||||
MPI_Datatype c_old = MPI_Type_f2c(*oldtype);
|
||||
MPI_Datatype c_new;
|
||||
MPI_Aint *c_disp_array;
|
||||
int i;
|
||||
|
||||
c_disp_array = malloc(*count * sizeof(MPI_Aint));
|
||||
if (c_disp_array == (MPI_Aint *) NULL) {
|
||||
*ierr = MPI_ERR_INTERN;
|
||||
return;
|
||||
}
|
||||
for (i = 0; i < *count; i++) {
|
||||
c_disp_array[i] = (MPI_Aint) array_of_displacements[i];
|
||||
}
|
||||
*ierr = MPI_Type_hindexed(*count, array_of_blocklengths,
|
||||
c_disp_array, c_old, &c_new);
|
||||
|
||||
if (*ierr == MPI_SUCCESS)
|
||||
*newtype = MPI_Type_c2f(c_new);
|
||||
|
||||
free(c_disp_array);
|
||||
}
|
||||
|
@ -48,5 +48,12 @@ OMPI_GENERATE_F77_BINDINGS (MPI_TYPE_INDEXED,
|
||||
|
||||
void mpi_type_indexed_f(MPI_Fint *count, MPI_Fint *array_of_blocklengths, MPI_Fint *array_of_displacements, MPI_Fint *oldtype, MPI_Fint *newtype, MPI_Fint *ierr)
|
||||
{
|
||||
MPI_Datatype c_old = MPI_Type_f2c(*oldtype);
|
||||
MPI_Datatype c_new;
|
||||
|
||||
*ierr = MPI_Type_indexed(*count, array_of_blocklengths,
|
||||
array_of_displacements, c_old, &c_new);
|
||||
|
||||
if (*ierr == MPI_SUCCESS)
|
||||
*newtype = MPI_Type_c2f(c_new);
|
||||
}
|
||||
|
@ -48,5 +48,11 @@ OMPI_GENERATE_F77_BINDINGS (MPI_TYPE_LB,
|
||||
|
||||
void mpi_type_lb_f(MPI_Fint *type, MPI_Fint *lb, MPI_Fint *ierr)
|
||||
{
|
||||
MPI_Datatype c_type = MPI_Type_f2c(*type);
|
||||
MPI_Aint c_lb;
|
||||
|
||||
*ierr = MPI_Type_lb(c_type, &c_lb);
|
||||
|
||||
if (*ierr == MPI_SUCCESS)
|
||||
*lb = (MPI_Fint)c_lb;
|
||||
}
|
||||
|
@ -48,5 +48,10 @@ OMPI_GENERATE_F77_BINDINGS (MPI_TYPE_MATCH_SIZE,
|
||||
|
||||
void mpi_type_match_size_f(MPI_Fint *typeclass, MPI_Fint *size, MPI_Fint *type, MPI_Fint *ierr)
|
||||
{
|
||||
MPI_Datatype c_type;
|
||||
|
||||
*ierr = MPI_Type_match_size(*typeclass, *size, &c_type);
|
||||
|
||||
if (*ierr == MPI_SUCCESS)
|
||||
*type = MPI_Type_c2f(c_type);
|
||||
}
|
||||
|
@ -48,5 +48,11 @@ OMPI_GENERATE_F77_BINDINGS (MPI_TYPE_UB,
|
||||
|
||||
void mpi_type_ub_f(MPI_Fint *mtype, MPI_Fint *ub, MPI_Fint *ierr)
|
||||
{
|
||||
MPI_Datatype c_mtype = MPI_Type_f2c(*mtype);
|
||||
MPI_Aint c_ub;
|
||||
|
||||
*ierr = MPI_Type_ub(c_mtype, &c_ub);
|
||||
|
||||
if (*ierr == MPI_SUCCESS)
|
||||
*ub = (MPI_Fint)c_ub;
|
||||
}
|
||||
|
Загрузка…
x
Ссылка в новой задаче
Block a user