This repository has been archived by the owner on Nov 7, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 3
/
FreeIPC_create.f90
48 lines (41 loc) · 1.75 KB
/
FreeIPC_create.f90
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
! FreeIPC - A library to allow Fortran programs that use MPI
! to easily access shared memory within multicore nodes
! Date - 23rd Oct Version 0.0
! Copyright(C) 2009 Ian Bush
!
! This library is free software; you can redistribute it and/or
! modify it under the terms of the GNU Lesser General Public
! License as published by the Free Software Foundation; either
! version 3.0 of the License, or (at your option) any later version.
!
! This library is distributed in the hope that it will be useful,
! but WITHOUT ANY WARRANTY; without even the implied warranty of
! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
! Lesser General Public License for more details.
!
! You should have received a copy of the GNU Lesser General Public
! License along with this library; if not, write to the Free Software
! Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
!
!
! This library is released under LGPL. The full text of LGPL may be found
! at http://www.gnu.org/licenses/lgpl-3.0.txt
!
! In particular, the terms of the GNU LGPL imply that you CAN use this library with
! proprietary code with some restrictions (you can link, but not use the code directly).
! Please consult the above URL for exact details.
Type( c_ptr ) :: shmaddr
! Check things are initialized
If( .Not. Associated( FIPC_ctxt_world%initialized ) ) Then
error = FIPC_not_initialized
Return
End If
If( Size( n ) < rank ) Then
error = FIPC_insufficient_dims
End If
Call segment_create( type, rank, Int( n( 1:rank ), c_long ), ctxt, shmaddr, error )
If( error /= 0 ) Then
Return
End If
Call c_f_pointer( shmaddr, a, Int( n( 1:rank ), c_long ) )
error = FIPC_success