18.2.166. shmem_longlong_put

shmem_character_put(3), shmem_complex_put(3), shmem_double_put(3), shmem_float_put(3), shmem_int_put(3), shmem_integer_put(3), shmem_logical_put(3), shmem_long_put(3), shmem_longdouble_put(3), shmem_longlong_put(3), shmem_put4(3), shmem_put8(3), shmem_put32(3), shmem_put64(3), shmem_put128(3), shmem_putmem(3), shmem_real_put(3), shmem_short_put(3) - 将数据传输到指定的处理单元(PE)

18.2.166.1. 概述

C或C++:

#include <mpp/shmem.h>

void shmem_double_put(double *target, const double *source,
  size_t len, int pe)

void shmem_float_put(float *target, const float *source,
  size_t len, int pe)

void shmem_int_put(int *target, const int *source, size_t len,
  int pe)

void shmem_long_put(long *target, const long *source,
  size_t len, int pe)

void shmem_longdouble_put(long double *target,
  const long double *source, size_t len, int pe)

void shmem_longlong_put(long long *target,
  const long long *source, size_t len, int pe)

void shmem_put32(void *target, const void *source, size_t len,
  int pe)

void shmem_put64(void *target, const void *source, size_t len,
  int pe)

void shmem_put128(void *target, const void *source, size_t len,
  int pe)

void shmem_putmem(void *target, const void *source, size_t len,
  int pe)

void shmem_short_put(short *target, const short *source,
  size_t len, int pe)

Fortran语言:

INCLUDE "mpp/shmem.fh"

INTEGER len, pe

CALL SHMEM_CHARACTER_PUT(target, source, len, pe)

CALL SHMEM_COMPLEX_PUT(target, source, len, pe)

CALL SHMEM_DOUBLE_PUT(target, source, len, pe)

CALL SHMEM_INTEGER_PUT(target, source, len, pe)

CALL SHMEM_LOGICAL_PUT(target, source, len, pe)

CALL SHMEM_PUT(target, source, len, pe)

CALL SHMEM_PUT4(target, source, len, pe)

CALL SHMEM_PUT8(target, source, len, pe)

CALL SHMEM_PUT32(target, source, len, pe)

CALL SHMEM_PUT64(target, source, len, pe)

CALL SHMEM_PUT128(target, source, len, pe)

CALL SHMEM_PUTMEM(target, source, len, pe)

CALL SHMEM_REAL_PUT(target, source, len, pe)

18.2.166.2. 描述

这些例程将调用PE上地址source处的数据对象的nelems个元素,传输到远程PE pe上地址target处的数据对象。这些例程会启动远程传输,并可能在数据送达远程PE之前就返回。

从不同的put调用向目标PE的数据对象传递数据可能以任意顺序发生。因此,两个连续的put操作可能导致数据传递顺序错乱,除非在这两个调用之间插入对shmem_fence(3)的调用。

参数如下:

target

需要在远程PE上更新的数据对象。该数据对象必须能够远程访问。

source

包含待复制数据的数据对象。

len

目标数组和源数组中的元素数量。len必须是整数类型。如果使用Fortran,它必须是默认整数类型的常量、变量或数组元素。

pe

远程PE的编号。pe必须为整数类型。如果使用Fortran,它必须是默认整数类型的常量、变量或数组元素。

目标与源数据对象必须符合以下类型约束条件:

shmem_putmem: Fortran: Any noncharacter type. C: Any data type. len is scaled in

字节。

shmem_put4, shmem_put32:** Any noncharacter type that has a storage size

等于32位。

shmem_put8, shmem_put64:** Any noncharacter type that has a storage size

等于64位。

shmem_put128:** Any noncharacter type that has a storage size equal to 128

位。

shmem_short_put:** 短整型元素。

shmem_int_put:** int类型的元素。

shmem_long_put:** 长整型元素。

shmem_longlong_put:** 长整型(long long)元素。

shmem_float_put:** 浮点型元素。

shmem_double_put:** 双精度浮点类型的元素。

shmem_longdouble_put:** 长双精度类型的元素。

SHMEM_CHARACTER_PUT: Elements of type character. len is the number of

要传输的字符数。源变量和目标变量的实际字符长度将被忽略。

SHMEM_COMPLEX_PUT: 默认大小的复数类型元素。

SHMEM_DOUBLE_PUT: (Fortran) 双精度类型的元素。

SHMEM_INTEGER_PUT: 整数类型的元素。

SHMEM_LOGICAL_PUT: 逻辑类型的元素。

SHMEM_REAL_PUT: Elements of type real.

如果您使用Fortran语言,数据类型必须采用默认大小。例如,实数变量必须声明为REAL、REAL*4或REAL(KIND=4)。

18.2.166.3. 示例

以下shmem_put示例适用于C/C++程序:

#include <stdio.h>
#include <mpp/shmem.h>

main()
{
  long source[10] = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 };
  static long target[10];
  shmem_init();

  if (shmem_my_pe() == 0) {
    /* put 10 words into target on PE 1 */
    shmem_long_put(target, source, 10, 1);
  }
  shmem_barrier_all();  /* sync sender and receiver */
  if (shmem_my_pe() == 1)
    shmem_udcflush();  /* not required on Altix systems */
  printf("target[0] on PE %d is %d\n", shmem_my_pe(), target[0]);
}

另请参阅

intro_shmem(3) shmem_iput(3) shmem_quiet(3)