Blame test/mpi/f90/io/c2f90multio.c
|
Packit Service |
c5cf8c |
/* This file created from f77/io/c2fmultio.c with f77tof90 */
|
|
Packit Service |
c5cf8c |
/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */
|
|
Packit Service |
c5cf8c |
/*
|
|
Packit Service |
c5cf8c |
* (C) 2001 by Argonne National Laboratory.
|
|
Packit Service |
c5cf8c |
* See COPYRIGHT in top-level directory.
|
|
Packit Service |
c5cf8c |
*/
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
/*
|
|
Packit Service |
c5cf8c |
Check that MPI_File_c2f, applied to the same object several times,
|
|
Packit Service |
c5cf8c |
yields the same handle. We do this because when MPI handles in
|
|
Packit Service |
c5cf8c |
C are a different length than those in Fortran, care needs to
|
|
Packit Service |
c5cf8c |
be exercised to ensure that the mapping from one to another is unique.
|
|
Packit Service |
c5cf8c |
(Test added to test a potential problem in ROMIO for handling MPI_File
|
|
Packit Service |
c5cf8c |
on 64-bit systems)
|
|
Packit Service |
c5cf8c |
*/
|
|
Packit Service |
c5cf8c |
#include "mpi.h"
|
|
Packit Service |
c5cf8c |
#include <stdio.h>
|
|
Packit Service |
c5cf8c |
#include "mpitest.h"
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
int main(int argc, char *argv[])
|
|
Packit Service |
c5cf8c |
{
|
|
Packit Service |
c5cf8c |
MPI_Fint handleA, handleB;
|
|
Packit Service |
c5cf8c |
int rc;
|
|
Packit Service |
c5cf8c |
int errs = 0;
|
|
Packit Service |
c5cf8c |
int rank;
|
|
Packit Service |
c5cf8c |
MPI_File cFile;
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
MTest_Init(&argc, &argv);
|
|
Packit Service |
c5cf8c |
MPI_Comm_rank(MPI_COMM_WORLD, &rank;;
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
/* File */
|
|
Packit Service |
c5cf8c |
rc = MPI_File_open(MPI_COMM_WORLD, (char *) "temp",
|
|
Packit Service |
c5cf8c |
MPI_MODE_RDWR | MPI_MODE_DELETE_ON_CLOSE | MPI_MODE_CREATE,
|
|
Packit Service |
c5cf8c |
MPI_INFO_NULL, &cFile);
|
|
Packit Service |
c5cf8c |
if (rc) {
|
|
Packit Service |
c5cf8c |
errs++;
|
|
Packit Service |
c5cf8c |
printf("Unable to open file \"temp\"\n");
|
|
Packit Service |
c5cf8c |
} else {
|
|
Packit Service |
c5cf8c |
handleA = MPI_File_c2f(cFile);
|
|
Packit Service |
c5cf8c |
handleB = MPI_File_c2f(cFile);
|
|
Packit Service |
c5cf8c |
if (handleA != handleB) {
|
|
Packit Service |
c5cf8c |
errs++;
|
|
Packit Service |
c5cf8c |
printf("MPI_File_c2f does not give the same handle twice on the same MPI_File\n");
|
|
Packit Service |
c5cf8c |
}
|
|
Packit Service |
c5cf8c |
}
|
|
Packit Service |
c5cf8c |
MPI_File_close(&cFile);
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
MTest_Finalize(errs);
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
return MTestReturnValue(errs);
|
|
Packit Service |
c5cf8c |
}
|