replication - 如何在 Chapel 的多个语言环境中复制变量

标签 replication hpc chapel

我想知道是否有一种简单的方法可以在每个区域设置上制作全局变量的副本,以便以后每个区域设置都可以直接访问其本地副本,而不是访问存储在 locale0 中的原始变量?

谢谢

最佳答案

您可以使用 ReplicatedDist distribution 以获取每个语言环境的变量副本。有一个模块 UtilReplicatedVar以简化其使用。

use UtilReplicatedVar;

var regularInt = 42;

// rcDomain is declared in UtilReplicatedVar.  It maps
// one int value to each locale
var repInt: [rcDomain] int;

// Other types can be replicated as well.  Here a
// heterogeneous tuple containing an integer,
// real, and complex is replicated
var repTuple: [rcDomain] (int, real, complex);

// Assign 42 to the replicated int on all locales
rcReplicate(repVar, regularInt);

// Access the local copy of the replicated var.
// The first form must use 1 as the index.
repVar[1] = 0;
writeln(rcLocal(repVar));

// Access the local complex component of the tuple
writeln(repTuple[1](3));

// Access a remote copy.
rcRemote(repVar, remoteLocale);

关于replication - 如何在 Chapel 的多个语言环境中复制变量,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45575091/

相关文章:

performance - CyclicDist 在多个语言环境中变慢

parallel-processing - 为什么我会出现这种行为?

java - MySQL数据库管理

sql-server - 从一个 SQL Server Express 复制到另一个

cassandra - 当复制因子 == 集群大小时,Cassandra 分区如何工作?

python-3.x - 用于大数组计算的多处理池映射比预期慢

c - 2 个 AVX-512 vector 元素的交错合并 - C 内在函数

python - 使用Python的高性能计算项目

mysql - 杀死 'copying to tmp table' 的复制 MySQL 进程是否安全?

multithreading - 如果运行 "inside"VM,我们会在 Chapel 中看到预期的加速吗?