home *** CD-ROM | disk | FTP | other *** search
/ IRIX Base Documentation 2002 November / SGI IRIX Base Documentation 2002 November.iso / usr / share / catman / p_man / cat3 / shmem_ptr.z / shmem_ptr
Encoding:
Text File  |  2002-10-03  |  4.8 KB  |  115 lines

  1.  
  2. SHMEM_PTR(3)                                                   SHMEM_PTR(3)
  3.  
  4.  
  5. NNNNAAAAMMMMEEEE
  6.      sssshhhhmmmmeeeemmmm____ppppttttrrrr - Returns a pointer to a data object on a specified
  7.      processing element (PE)
  8.  
  9. SSSSYYYYNNNNOOOOPPPPSSSSIIIISSSS
  10.      C or C++:
  11.  
  12.         ####iiiinnnncccclllluuuuddddeeee <<<<mmmmpppppppp////sssshhhhmmmmeeeemmmm....hhhh>>>>
  13.  
  14.         vvvvooooiiiidddd ****sssshhhhmmmmeeeemmmm____ppppttttrrrr((((vvvvooooiiiidddd ****_t_a_r_g_e_t,,,, iiiinnnntttt _p_e))));;;;
  15.  
  16.      Fortran:
  17.  
  18.         IIIINNNNCCCCLLLLUUUUDDDDEEEE """"mmmmpppppppp////sssshhhhmmmmeeeemmmm....ffffhhhh""""
  19.  
  20.         PPPPOOOOIIIINNNNTTTTEEEERRRR ((((PPPPTTTTRRRR,,,, PPPPOOOOIIIINNNNTTTTEEEEEEEE))))
  21.         IIIINNNNTTTTEEEEGGGGEEEERRRR _p_e
  22.         PPPPTTTTRRRR ==== SSSSHHHHMMMMEEEEMMMM____PPPPTTTTRRRR((((_t_a_r_g_e_t,,,, _p_e))))
  23.  
  24. DDDDEEEESSSSCCCCRRRRIIIIPPPPTTTTIIIIOOOONNNN
  25.      sssshhhhmmmmeeeemmmm____ppppttttrrrr returns the address of _t_a_r_g_e_t on the specified PE.  This
  26.      address can be assigned to a pointer.  After that, ordinary loads and
  27.      stores to this remote address may be performed.
  28.  
  29.      When a sequence of loads (gets) and stores (puts) to a data object on
  30.      a remote PE does not match the access pattern provided in a SHMEM data
  31.      transfer routine like sssshhhhmmmmeeeemmmm____ppppuuuutttt33332222(3) or sssshhhhmmmmeeeemmmm____rrrreeeeaaaallll____iiiiggggeeeetttt(3), the
  32.      sssshhhhmmmmeeeemmmm____ppppttttrrrr function can provide an efficient means to accomplish the
  33.      communication.
  34.  
  35.      The arguments are as follows:
  36.  
  37.      _t_a_r_g_e_t    The remotely accessible integer data object on the remote
  38.                PE.
  39.  
  40.      _p_e        An integer that indicates the PE number on which _t_a_r_g_e_t is
  41.                to be accessed.  If you are using Fortran, it must be a
  42.                default integer value.
  43.  
  44. EEEEXXXXAAAAMMMMPPPPLLLLEEEESSSS
  45.      This two-PE Fortran program calls sssshhhhmmmmeeeemmmm____ppppttttrrrr:
  46.  
  47.           PROGRAM PEEK
  48.           INCLUDE 'mpp/shmem.fh'
  49.  
  50.           INTEGER BIGD(100)
  51.           SAVE BIGD
  52.  
  53.           INTEGER POINTEE(*)
  54.           POINTER (PTR,POINTEE)
  55.  
  56.           CALL START_PES(2)
  57.  
  58.  
  59.           IF (MY_PE() .EQ. 0) THEN
  60.                                           ! initialize PE 1's BIGD array
  61.              PTR = SHMEM_PTR(BIGD, 1)     ! get address of PE 1's BIGD
  62.                                           !   array
  63.              DO I=1,100
  64.                   POINTEE(I) = I
  65.              ENDDO
  66.           ENDIF
  67.  
  68.           CALL SHMEM_BARRIER_ALL
  69.  
  70.           IF (MY_PE() .EQ. 1) THEN
  71.              PRINT*,'BIGD on PE 1 is: '
  72.              PRINT*,BIGD
  73.           ENDIF
  74.           END
  75.  
  76.      This two-PE C program calls sssshhhhmmmmeeeemmmm____ppppttttrrrr:
  77.  
  78.           #include <mpp/shmem.h>
  79.           main()
  80.           {
  81.                   static int bigd[100];
  82.                   int *ptr;
  83.                   int i;
  84.  
  85.                   start_pes(2);
  86.  
  87.                   if (_my_pe() == 0) {
  88.                           /* initialize PE 1's bigd array */
  89.                           ptr = shmem_ptr(bigd, 1);
  90.                           for (i=0; i<100; i++)
  91.                                   *ptr++ = i+1;
  92.                   }
  93.  
  94.                   shmem_barrier_all();
  95.  
  96.                   if (_my_pe() == 1) {
  97.                           printf("bigd on PE 1 is:\n");
  98.                           for (i=0; i<100; i++)
  99.                                   printf(" %d",bigd[i]);
  100.                           printf("\n");
  101.                   }
  102.           }
  103.  
  104. NNNNOOOOTTTTEEEESSSS
  105.      The sssshhhhmmmmeeeemmmm____ppppttttrrrr function is available only on systems where ordinary
  106.      memory loads and stores are used to implement SHMEM put and get
  107.      operations.
  108.  
  109. RRRREEEETTTTUUUURRRRNNNN VVVVAAAALLLLUUUUEEEESSSS
  110.      sssshhhhmmmmeeeemmmm____ppppttttrrrr returns a pointer to the data object on the specified remote
  111.      PE.
  112.  
  113. SSSSEEEEEEEE AAAALLLLSSSSOOOO
  114.      iiiinnnnttttrrrroooo____sssshhhhmmmmeeeemmmm(3), sssshhhhmmmmeeeemmmm____ppppuuuutttt(3), sssshhhhmmmmeeeemmmm____ggggeeeetttt(3),
  115.