Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
cmakelists cleanup
[simgrid.git] / teshsuite / smpi / mpich3-test / f77 / ext / allocmemf.f
1 C -*- Mode: Fortran; -*- 
2 C
3 C  (C) 2004 by Argonne National Laboratory.
4 C      See COPYRIGHT in top-level directory.
5 C
6         program main
7         implicit none
8         include 'mpif.h'
9 C
10 C This program makes use of a common (but not universal; g77 doesn't 
11 C have it) extension: the "Cray" pointer.  This allows MPI_Alloc_mem
12 C to allocate memory and return it to Fortran, where it can be used.
13 C As this is not standard Fortran, this test is not run by default.
14 C To run it, build (with a suitable compiler) and run with
15 C   mpiexec -n 1 ./allocmemf
16 C
17         real a
18         pointer (p,a(100,100))
19         include 'add1size.h'
20         integer ierr, sizeofreal, errs
21         integer i,j
22 C
23         errs = 0
24         call mtest_init(ierr)
25         call mpi_type_size( MPI_REAL, sizeofreal, ierr )
26 C Make sure we pass in an integer of the correct type
27         asize = sizeofreal * 100 * 100
28         call mpi_alloc_mem( asize,MPI_INFO_NULL,p,ierr )
29
30         do i=1,100
31             do j=1,100
32                 a(i,j) = -1
33             enddo
34         enddo
35         a(3,5) = 10.0
36
37         call mpi_free_mem( a, ierr )
38         call mtest_finalize(errs)
39         call mpi_finalize(ierr)
40
41         end