使用多个语言环境的矩阵乘法

问题描述 投票:0回答:1

[嗨,我想看看是否有人可以看到我的代码有任何明显的问题。我试图在两个Nvidia Jetson板上运行我的代码,以利用8个内核来加快速度。我想比较使用一块板与两块板的速度。我将Chapel环境设置为允许执行多个区域设置。这是我的实现:

use LinearAlgebra, Norm, Random, Time;
var t : Timer;

writeln("Size of your matrix?");
var size = read(int);

var grid : [1..size, 1..size] uint(8);
var grid2 : [1..size, 1..size] uint(8);
var grid3 : [1..size, 1..size] int;

fillRandom(grid);
fillRandom(grid2);

t.start();
forall loc in Locales do
  on loc do
    forall i in 1..size do
        forall j in 1..size do
            forall k in 1..size do
                grid3[i,j] += grid[i,k] * grid2[k,j];
t.stop();
writeln("Done!:");
writeln(t.elapsed(),"seconds");
t.clear();

我不断得到:

error: Only 1 locale may be used for CHPL_COMM layer 'none'
To use multiple locales, see $CHPL_HOME/doc/rst/usingchapel/multilocale.rst

当我运行具有以下内容的cores.chpl文件时:

coforall loc in Locales do
  on loc do
    writeln("locale ", here.id, " named ", here.name, " has ", here.numPUs(), " cores.");

这是输出:

locale 0 named JetsonNano has 4 cores.
locale 1 named JetsonNano2 has 4 cores.

所以我知道环境设置正确。

我只是不确定是否要在多个语言环境中正确设置矩阵乘法代码。

chapel
1个回答
0
投票

消息:

error: Only 1 locale may be used for CHPL_COMM layer 'none'
To use multiple locales, see $CHPL_HOME/doc/rst/usingchapel/multilocale.rst

表示在编译Chapel程序时,您未设置CHPL_COMM,或者在进行编译的会话中将其设置为none。尝试在当前会话中设置CHPL_COMM=gasnet(或等效地,使用--comm=gasnet进行编译),重新编译,然后使用-nl 2运行。

在给定的会话中,您可以运行$CHPL_HOME/util/printchplenv以查看当前的设置和/或推断的环境变量是什么。对于给定的Chapel程序,可以运行./myChapelProgram --about以在编译时获取有关设置的信息。

如果您打算在大多数时间使用CHPL_COMM=gasnet,则可以使用Chapel configuration files来避免一遍又一遍地重新设置。

© www.soinside.com 2019 - 2024. All rights reserved.