Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
remove f77 attr tests
[simgrid.git] / teshsuite / smpi / mpich3-test / f77 / ext / c2fmult.c
1 /* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */
2 /*
3  *  (C) 2001 by Argonne National Laboratory.
4  *      See COPYRIGHT in top-level directory.
5  */
6
7 /*
8   Check that MPI_xxxx_c2f, applied to the same object several times,
9   yields the same handle.  We do this because when MPI handles in 
10   C are a different length than those in Fortran, care needs to 
11   be exercised to ensure that the mapping from one to another is unique.
12   (Test added to test a potential problem in ROMIO for handling MPI_File
13   on 64-bit systems)
14 */
15 #include "mpi.h"
16 #include <stdio.h>
17 #include "mpitest.h"
18
19 int main( int argc, char *argv[] )
20 {
21     MPI_Fint handleA, handleB;
22     int      rc;
23     int      errs = 0;
24     int      buf[1];
25     MPI_Request cRequest;
26     MPI_Status st;
27     int        tFlag;
28
29     MTest_Init( &argc, &argv );
30
31     /* Request */
32     rc = MPI_Irecv( buf, 1, MPI_INT, 0, 0, MPI_COMM_WORLD, &cRequest );
33     if (rc) {
34         errs++;
35         printf( "Unable to create request\n" );
36     }
37     else {
38         handleA = MPI_Request_c2f( cRequest );
39         handleB = MPI_Request_c2f( cRequest );
40         if (handleA != handleB) {
41             errs++;
42             printf( "MPI_Request_c2f does not give the same handle twice on the same MPI_Request\n" );
43         }
44     }
45     MPI_Cancel( &cRequest );
46     MPI_Test( &cRequest, &tFlag, &st );
47     MPI_Test_cancelled( &st, &tFlag );
48     if (!tFlag) {
49         errs++;
50         printf( "Unable to cancel MPI_Irecv request\n" );
51     }
52     /* Using MPI_Request_free should be ok, but some MPI implementations
53        object to it imediately after the cancel and that isn't essential to
54        this test */
55
56     MTest_Finalize( errs );
57     MPI_Finalize();
58     
59     return 0;
60 }