1 | .\"Copyright 2006-2008 Sun Microsystems, Inc. |
---|
2 | .\" Copyright (c) 1996 Thinking Machines Corporation |
---|
3 | .TH MPI_Alloc_mem 3 "Dec 08, 2009" "1.4" "Open MPI" |
---|
4 | .SH NAME |
---|
5 | \fBMPI_Alloc_mem \fP \- Allocates a specified memory segment. |
---|
6 | |
---|
7 | .SH SYNTAX |
---|
8 | .ft R |
---|
9 | .SH C Syntax |
---|
10 | .nf |
---|
11 | #include <mpi.h> |
---|
12 | int MPI_Alloc_mem(MPI_Aint \fIsize\fP, MPI_Info \fIinfo\fP, void *\fIbaseptr\fP) |
---|
13 | |
---|
14 | .SH Fortran Syntax (see FORTRAN NOTES) |
---|
15 | .nf |
---|
16 | INCLUDE 'mpif.h' |
---|
17 | MPI_ALLOC_MEM(\fISIZE, INFO, BASEPTR, IERROR\fP) |
---|
18 | INTEGER \fIINFO, IERROR\fP |
---|
19 | INTEGER(KIND=MPI_ADDRESS_KIND) \fISIZE, BASEPTR\fP |
---|
20 | |
---|
21 | .SH C++ Syntax |
---|
22 | .nf |
---|
23 | #include <mpi.h> |
---|
24 | void* MPI::Alloc_mem(MPI::Aint \fIsize\fP, const MPI::Info& \fIinfo\fP) |
---|
25 | |
---|
26 | .SH INPUT PARAMETERS |
---|
27 | .ft R |
---|
28 | .TP 1i |
---|
29 | size |
---|
30 | Size of memory segment in bytes (nonnegative integer). |
---|
31 | .ft R |
---|
32 | .TP 1i |
---|
33 | info |
---|
34 | Info argument (handle). |
---|
35 | |
---|
36 | .SH OUTPUT PARAMETERS |
---|
37 | .ft R |
---|
38 | .TP 1i |
---|
39 | baseptr |
---|
40 | Pointer to beginning of memory segment allocated. |
---|
41 | .TP 1i |
---|
42 | IERROR |
---|
43 | Fortran only: Error status (integer). |
---|
44 | |
---|
45 | .SH DESCRIPTION |
---|
46 | .ft R |
---|
47 | MPI_Alloc_mem allocates \fIsize\fP bytes of memory. The starting address |
---|
48 | of this memory is returned in the variable \fIbase\fP. |
---|
49 | .sp |
---|
50 | |
---|
51 | .SH FORTRAN NOTES |
---|
52 | .ft R |
---|
53 | There is no portable FORTRAN 77 syntax for using MPI_Alloc_mem. |
---|
54 | There is no portable Fortran syntax for using pointers returned |
---|
55 | from MPI_Alloc_mem. However, MPI_Alloc_mem can be used with Sun |
---|
56 | Fortran compilers. |
---|
57 | .sp |
---|
58 | From FORTRAN 77, you can use the following non-standard |
---|
59 | declarations for the SIZE and BASEPTR arguments: |
---|
60 | .nf |
---|
61 | INCLUDE "mpif.h" |
---|
62 | INTEGER*MPI_ADDRESS_KIND SIZE, BASEPTR |
---|
63 | .fi |
---|
64 | .sp |
---|
65 | From either FORTRAN 77 or Fortran 90, you can use "Cray pointers" |
---|
66 | for the BASEPTR argument. Cray pointers are described further in |
---|
67 | the Fortran User's Guide and are supported by many Fortran compilers. |
---|
68 | For example, |
---|
69 | .sp |
---|
70 | .nf |
---|
71 | INCLUDE "mpif.h" |
---|
72 | REAL*4 A(100,100) |
---|
73 | POINTER (BASEPTR, A) |
---|
74 | INTEGER*MPI_ADDRESS_KIND SIZE |
---|
75 | |
---|
76 | SIZE = 4 * 100 * 100 |
---|
77 | CALL MPI_ALLOC_MEM(SIZE,MPI_INFO_NULL,BASEPTR,IERR) |
---|
78 | |
---|
79 | ! use A |
---|
80 | |
---|
81 | CALL MPI_FREE_MEM(A, IERR) |
---|
82 | .fi |
---|
83 | |
---|
84 | .SH ERRORS |
---|
85 | Almost all MPI routines return an error value; C routines as the value of the function and Fortran routines in the last argument. C++ functions do not return errors. If the default error handler is set to MPI::ERRORS_THROW_EXCEPTIONS, then on error the C++ exception mechanism will be used to throw an MPI:Exception object. |
---|
86 | .sp |
---|
87 | Before the error value is returned, the current MPI error handler is |
---|
88 | called. By default, this error handler aborts the MPI job, except for I/O function errors. The error handler |
---|
89 | may be changed with MPI_Comm_set_errhandler; the predefined error handler MPI_ERRORS_RETURN may be used to cause error values to be returned. Note that MPI does not guarantee that an MPI program can continue past an error. |
---|
90 | |
---|
91 | .SH SEE ALSO |
---|
92 | .ft R |
---|
93 | .sp |
---|
94 | MPI_Free_mem |
---|