DATAPOOL man page on IRIX

Man page or keyword search:  
man Server   31559 pages
apropos Keyword Search (all sections)
Output format
IRIX logo
[printable version]



DATAPOOL(5)							   DATAPOOL(5)

NAME
     DATAPOOL - Fortran Interprocess Data Sharing

TOPIC
     This man page is intended to be both a quick reference and a source of
     detailed information on Fortran datapool usage.  It is divided into 4
     sections:

     Datapool Definition and Syntax

     Rules and Usage Description

     Detailed Operation

     Useful Information

Datapool definition and syntax
     The Fortran DATAPOOL statement is a way for different processes to access
     the same pool of common symbols. Any processes can access the shared
     datapool by linking with the datapool DSO (Dynamic Shared Object).

     A DATAPOOL statement has the following syntax:

	  DATAPOOL [/[dp]/] nlist [[,]/[dp]/ nlist] ...

     where dp is the datapool name and nlist is a list of variable names,
     array names, array declarators, or records.  A blank datapool, which is
     unique by itself, is defined by omitting the name dp.

     Syntactically, a datapool has similar form to a common block declaration.
     However, in a common block, the common block variables are associated
     with the same common block declared in other program units by their
     relative position in the common block, regardless of the declared
     symbolic names.  In a datapool, the datapool variables are associated
     with declarations in other program units by their symbolic names,
     regardless of the relative order, sizes, and number of variables declared
     in the datapool for that particular program unit.	Also, no datapool
     variables can be initialized with a DATA statement.

Rules and Usage Description
     To use datapools, the user must follow these steps:

     * Put each blockdata containing one or more datapool definitions in a
       Fortran source file.

     * Compile the Fortran source file to create the object file (.o file).
       using the "-G 0" option.

									Page 1

DATAPOOL(5)							   DATAPOOL(5)

     * Run the ld command:

	  ld -soname datapoolfile.so -shared	   \
	       -noivpad -G 0 -o datapoolfile.so \
	       -init _init_dp_datapoolfile_	   \
	       -fini _unmap_dp__		   \
	       datapoolfile.o

       where datapoolfile is the name of the Fortran source file without the
       .f extension.  This will create the datapool DSO file datapoolfile.so.

     * Compile the rest of the Fortran program with "-G 0" option.

     * Link all the Fortran objects with the selected datapool DSO's.  Note
       that the .o files created from the datapool source files do need to be
       linked to create the executable.

     * When the program is run the default directory for the shared mapped
       data is /usr/tmp.  The user can change this by setting the environment
       variable DATAPOOL_DIR to point to the desired directory.

Detailed Operation
     Each datapool item, when compiled, will be turned into a separate
     external symbol so it can be correctly associated with the same symbol
     declared in other program units without being affected by its relative
     order in the datapool.

     In one blockdata subprogram, and in only one, a datapool must be defined
     as to its exact number of items, sizes, and relative order.   This will
     be used as the basis for sharing the datapool with other processes
     wishing to access the same data.

     Each blockdata can contain definitions for one or more datapools.
     However, each Fortran source file can contain only one such blockdata.
     Each of those source files is turned into a DSO which any programs can
     linked to if they want to access the datapools defined in that blockdata.
     In other words, all datapools defined in a single blockdata always go
     together as a single shared unit.	If the users want to choose the
     datapools separately then they have to be defined in different blockdata,
     and put into separate Fortran source files.

     All datapool variables defined in the blockdata are mapped to a data file
     which is shared between different processes.  The name of the mapped data
     file is the name of the corresponding Fortran source files preceded by
     "DP_".  This file is put into the /usr/tmp/ directory as the default, but
     this default directory can be changed with the DATAPOOL_DIR environment
     variable.	For example, datapools /a/, /b/, and /c/ are defined in
     blockdata dp_abc_def which is in the Fortran source file dpabc.f.	 After
     compilation, the file dpabc.f is converted into dpabc.so which an
     application can link with to share the datapools /a/, /b/, and /c/.  At
     runtime, a mapped data file /usr/tmp/DP_dpabc is created as the default.

									Page 2

DATAPOOL(5)							   DATAPOOL(5)

     After all processes sharing this mapped datapool have terminated the
     mapped file will be removed automatically.	 However, if for any reason a
     process using the datapool aborts abnormally before it can run to
     completion, then the mapped file will remain and it will be up to the
     user to remove the file; otherwise, the next fresh process using the
     datapool will pick up whatever values that have been mapped into that
     file.

Useful information
     1) To create a datapool DSO from the Fortran source file the following
     lines can be added to the Makefile:

     .SUFFIXES : .so
     FFLAGS = -G 0
     LDFLAGS = -G 0

     .f.so:
	  $(FC) $(FFLAGS) -c $*.f
	  $(LD) $(LDFLAGS) -soname $@ -shared -noivpad -o $@ \
	      -init _init_dp_$*_ -fini _unmap_dp__ $*.o

     2) For applications which rely on datapool variables being set to zeroes
     at the beginning of execution, it is prudent to check for the existence
     of the mapped data files /usr/tmp/DP_* which might have been left behind
     by an abnormal termination in previous runs.

     3) Programs running on different machines can share datapools across NFS
     by setting DATAPOOL_DIR to point to the same physical directory.
     However, since I/O operations are buffered across NFS, changing a
     datapool variable on one system does not cause the new value to be
     written immediately in the data file and so it is not known by a
     different process on another system.  It will be up to the user to create
     his own datapool status variable to ensure the update of the datapool
     variables by another process on a different system.

     4) At runtime, the datapool DSO's must be in the search path of rld for
     them to be found.	The default search path can be changed by setting the
     environment variable LD_LIBRARY_PATH [see man ld(1)].

     5) The datapool DSO's cannot be used with IRIX releases before 5.1.1.
     You can get an rld error message that the DSO's are not found when a
     datapool application is run on those releases even when the DSO's exist.

EXAMPLE
     ::::::::::::::
     testdp.f
     ::::::::::::::
     C
     C NAME
     C	     testdp.f - Shared DATAPOOL test case

									Page 3

DATAPOOL(5)							   DATAPOOL(5)

     C
     C	  Note that both the sizes and the relative order of the datapool
     C	  items are different from the defined sizes and order in the
     C	  blockdata

	     datapool /hello/ c, b, arr(100,100,3)
	     real*8 arr

	     print *, 'Read arr(1,1,1)', arr(1,1,1)
	     if (arr(1,1,1) .ne. 42) then
		 arr(1,1,1) = 42
	     endif

	     print *, "Address Offset = ", %loc(b)-%loc(arr), %loc(c) -%loc(b)
	     call sleep(10)
	     end

     ::::::::::::::
     hello.f
     ::::::::::::::
	     blockdata hellodef
     C	  The relative positions and sizes of the datapool items are
     C	  defined in this blockdata and nowhere else.
	     real*8 arr
	     datapool /hello/ arr(100,100,30), b, c
	     end

     ::::::::::::::
     Makefile
     ::::::::::::::
     .SUFFIXES : .so
     CFLAGS = -G 0
     FFLAGS = -G 0
     FFILES = testdp.f hello.f

     default: testdp

     testdp: testdp.o hello.so
	     $(FC) $(FFLAGS) -o testdp	       testdp.o hello.so

     .f.so:
	     $(FC) $(FFLAGS) -c $*.f
	     $(LD) -soname $@ -shared -noivpad $*.o -G 0 -o $@ \
	       -init _init_dp_$*_ -fini _unmap_dp__

     test: default
	     testdp &
	     @ sleep 1
	     testdp &

     clean:
	     rm -f *.o core a.out *.so

									Page 4

DATAPOOL(5)							   DATAPOOL(5)

     clobber: clean
	     rm -f testdp so_locations

AUTHOR
     Calvin Vu

									Page 5

[top]

List of man pages available for IRIX

Copyright (c) for man pages and the logo by the respective OS vendor.

For those who want to learn more, the polarhome community provides shell access and support.

[legal] [privacy] [GNU] [policy] [cookies] [netiquette] [sponsors] [FAQ]
Tweet
Polarhome, production since 1999.
Member of Polarhome portal.
Based on Fawad Halim's script.
....................................................................
Vote for polarhome
Free Shell Accounts :: the biggest list on the net