Questions tagged [chapel]
Chapel (https://chapel-lang.org) is a portable, open-source programming language for parallel programming from the desktop to large-scale supercomputers. Use this tag to ask questions about the Chapel language or its implementation that are likely to be of use to a broad audience. To make user-specific bug reports or feature requests, please use Chapel's Github issues page instead (https://github.com/chapel-lang/chapel/issues).
chapel
251
questions
2
votes
1
answer
26
views
What is the task number specification on "begin" statements? (compared with cobegin, forall, and coforall)
Reading the documentation on Task Parallelism and Begin, I wondered what the specification for the number of tasks a "begin" statement or a "begin" block will create. "Cobegin&...
4
votes
1
answer
45
views
Is there a way to string.format a runtime-determined number of items in one call in Chapel?
Is there a way to use one string.format() call to format a runtime-determined number of items?
I wrote a program that generates a million md5sums and converts them to string with
md5.getDigest(input)...
0
votes
0
answers
55
views
Chapel container segfaults only when running on Windows
I was always under the impression that the beauty of docker is it eliminates the "it runs on my machine" result during deployments. I wrote a Dockerfile, based off the latest Arch Linux ...
2
votes
1
answer
38
views
The Chapel c_str() function seems to return a c_string
I'm new to the language, so perhaps I'm making a mistake, but this doesn't seem to work per the documentation. The documentation states:
proc string.c_str():c_ptrConst(c_char) Get a c_ptrConst(...
2
votes
2
answers
100
views
How the get the sizes of the dimensions of a multi-dimensional array in Chapel?
Consider that we have defined the array below in Chapel:
var arr : [1..10] [1..5] int;
How to get the size of the dimensions of this array? In other words, I need a procedure that gets arr as the ...
0
votes
1
answer
52
views
How should I resolve this domain error in Chapel?
Consider this code:
proc generateTuples(a: int, b: int, bNext: int): [] {
var tuples: [1..?] (int,int);
for q in (b+1)..(bNext-1) {
tuples.push([a, q]);
}
return tuples;
}
proc mergeLists(...
3
votes
1
answer
63
views
Chapel loop variable undeclared
When I try to compile the following program, the compiler complains that j and row are undeclared, which surprised me because a similar construction in Chapel - Ranges defined using bounds of type ...
2
votes
1
answer
67
views
Chapel - Ranges defined using bounds of type 'range(int(64),bounded,false)' are not currently supported
The title "Ranges defined using bounds of type 'range(int(64),bounded,false)' are not currently supported" shows up as error when I try to compile this 5-point stencil benchmark code. What ...
2
votes
1
answer
102
views
Increasing Transaction Size of Communication Operations
I'm (still) working on writing a reference distributed sort based on an old C+MPI Samplesort. The largest source of overhead is now the all-to-all communication step that happens in the middle of the ...
2
votes
1
answer
67
views
Compilation fails using Chapel on a mac
Using a stock install of Chapel (via Homebrew) on a Mac running Big Sur. Tried to compile one of the example programs:
chpl /usr/local/Cellar/chapel/1.27.0/libexec/examples/hello.chpl
followed with
mv:...
3
votes
2
answers
265
views
Parallel Writes to NFS-backed File
UPDATE: I had each node write to a separate file, and when the separate files were concatenated together the result was correct. I also updated the code to attempt a channel flush and file sync after ...
4
votes
1
answer
243
views
Distributed Array Access Communication Cost
I'm finishing up implementing a sort of "Terasort Lite" program in Chapel, based on a distributed bucket sort, and I'm noticing what seems to be significant performance bottlenecks around ...
3
votes
1
answer
31
views
What does the Chapel compiler error "use of [symbol] before encountering its definition, type unknown" mean?
When compiling my Chapel program, I see an error message like:
myProgram.chpl:42: error: use of 'symbol' before encountering its definition, type unknown
but I am unsure what this means or what I ...
4
votes
1
answer
191
views
Idiomatic Chapel Way to Create Uneven Distribution
I'm working on porting a distributed memory Samplesort from MPI+C to Chapel, and I've been unable to find an idiomatic/clean way to return the sorted data in a single distributed array.
The C ...
1
vote
1
answer
58
views
Where do you put the type in Chapel variable declarations?
Where do you put the type in Chapel variable declarations?
More specifically, what’s the difference between var a = 42: int; and var a: int = 42;?
1
vote
1
answer
547
views
How to access class or record field with the name of the field as a string?
Say you have a record or class:
record R {
var value: int;
}
How can I access the field value by using the string "value"?
For example, in Python, you can access fields using the getattr ...
1
vote
1
answer
90
views
Does Chapel have something similar to a Python context manager?
In Python, you can use context managers to allocate and release resources within a block of code, such as opening and closing a file handle within the scope of a with block in this example:
with open('...
2
votes
0
answers
66
views
Why execution time for reading a file in Chapel Language is different each time a file is read ? Can it be made same across several executions?
I am trying to analyse the performance of Chapel while doing serial I/O by reading a file with varying number of lines and measuring the time taken. I then plot this time on a graph. I find that each ...
2
votes
1
answer
109
views
How to create and pass a 128 bit variable from Chapel program to third-party C library?
I need to call a method from a third-party C library in my Chapel application, which requires a 128 bit integer variable to be passed by value. Chapel does not have a native 128 bit integral type ...
1
vote
0
answers
77
views
Multi-Locale Chapel Cluster Setup
I am new at the chapel Language and I want to set up a Chapel Multi-locale Cluster.
I have a LAN of computers with Windows installed on all of them. So my specific questions are
Should I install ...
1
vote
1
answer
65
views
Error on function call when captured as values
So I have a program in which I have a function that needs to be passed as an argument to another function call. So I was running a Test Case. Let's say there are two classes Abstract and Concrete, the ...
1
vote
1
answer
74
views
warning: implicitly reading from a sync is deprecated; apply a '.read??()' method
I just upgraded from chapel 1.23 to 1.24. Now the compiler screams at me;
warning: implicitly reading from a sync is deprecated; apply a
'.read??()' method
For example. the code block below lists ...
14
votes
3
answers
4k
views
How to make multi-threading in Julia scale with the number of threads?
I know that questions about multi-threading performance in Julia have already been asked (e.g. here), but they involve fairly complex code in which many things could be at play.
Here, I am running a ...
2
votes
1
answer
56
views
Bounds of 'low..high' must be integers of compatible types
I have just started to learn chapel and was trying a simple Sieve of Eratosthenes algorithm and was stuck at a point where I am not able to pass an array into a procedure.
Below is the implementation
...
2
votes
1
answer
104
views
AWS multilocale Installation Seems incorrect
I set up a 12 EC2 instance "cluster" on AWS running CentOS 7. The nodes share a common NFS file-system, and have separate boot volumes where their home directories reside. I installed ...
6
votes
1
answer
147
views
Multilocale Chapel: make check fails (GASNet: Invalid number of nodes: -nl)
I'm trying to run Chapel in multi-locale mode with Slurm.
However, 'make check' fails.
Could someone help me with that?
I used Chapel 1.23.0. Here are the actual commands I used:
cd chapel-1.23.0/
...
4
votes
1
answer
122
views
How do I efficiently scatter distributed array elements in Chapel?
Consider the following scatter operation :
var A : [DomA] EltType;
var Indices : [DomA] IndexType;
var B : [DomB] EltType;
[(iSrc, iDst) in zip(DomA, Indices)] B[iDst] = A[iSrc];
where the domains ...
2
votes
0
answers
184
views
Trying to set up multi-locale Chapel on a Raspberry Pi cluster
I am wondering if anyone could provide me with guidance on how to set up multi-locale on a cluster of Raspberry Pi -- a procedure or walk through or even just hints would be welcome.
Chapel compiles ...
4
votes
1
answer
131
views
Transferring arrays/classes/records between locales
In a typical N-Body simulation, at the end of each epoch, each locale would need to share its own portion of the world (i.e. all bodies) to the rest of the locales. I am working on this with a local-...
3
votes
2
answers
69
views
Why did I get this behaviour?
I was going through the specification of Chapel and was reading on Task Level Parallelism, in particular the synchronization variables (sync and single) and the logical state of them and how they go ...
2
votes
1
answer
118
views
How to use the Chapel parallel IO? [closed]
I have been exploring parallel IO in Chapel. The Chapel documentation mentions a parallel IO flag, and that channels can work in parallel. But, I don't see anything else.
I don't have a particular ...
1
vote
2
answers
198
views
Unexpected result from i == j == k?
In this code I am looping over all indices in a 3D domain, and printing the "diagonal" part as
for (i, j, k) in {0..9, 0..9, 0..9}
{
if i == j == k // (1)
//if (i == j) &...
3
votes
1
answer
79
views
How to read an environment variable from a Chapel program?
How can one read an environment variable within a Chapel program?
2
votes
1
answer
54
views
SysCTypes errors when using NetCDF.chpl?
I have a simple Chapel program to test the NetCDF module:
use NetCDF;
use NetCDF.C_NetCDF;
var f: int = ncopen("ppt2020_08_20.nc", NC_WRITE);
var status: int = nc_close(f);
and when I ...
4
votes
1
answer
228
views
Is there a convenient way to fill a sparse array with random values in Chapel?
I am working on comparing matrix multiplication with and without locales and I am trying to use sparse matrices to work with the linear algebra module. I am planning on using blockdist and breaking it ...
1
vote
1
answer
477
views
Using square brackets for the output of array elements
This code creates one record variable (r) and one tuple variable (t) that contain several arrays and prints them to stdout:
const N = 5;
record Myrec {
var a: [1..N] int = (for i in 1..N do i);
...
3
votes
0
answers
102
views
Difference between "for" and "forall" on the right-hand side of assignment
In the following code, I am assigning some dummy (test) values to all the elements of a 2-dimensional array (a[][]) and then checking whether the array is filled as expected. When using the line (A), ...
3
votes
1
answer
106
views
Is there a way to print a formatted table from an array in chapel?
I am working on a heat transfer problem in chapel, and while I understand that I'm not going to be able to get a nice GUI I can work with, I would like to have something I can print that allows me to ...
3
votes
1
answer
90
views
Pip Install Arkouda fails even when Chapel installed
I'm attempting to install the PyPi client to Arkouda
> pip install arkouda
...
File "/usr/lib/python3.7/distutils/cmd.py", line 313, in run_command
self.distribution....
5
votes
1
answer
117
views
What is the best way to check/ensure that two arrays have the same domain and distribution?
A nice feature in Chapel is that it distinguishes between the domain of an array and its distribution. What is the best way to check that two arrays have the same domain and distribution (which one ...
4
votes
1
answer
180
views
Efficient collection and transfer of scattered sub-arrays in Chapel
Recently, I came across Chapel. I liked the examples given in the tutorials but many of them were embarrassingly parallel in my eyes. I'm working on Scattering Problems in Many-Body Quantum Physics ...
4
votes
1
answer
68
views
What is the best way to constrain the type of an array to be a local array with contiguous data in Chapel?
Consider the following Chapel function:
proc myfunc(arr : []?T) {}
I'd like to guarantee the array (at compile time) to be
local
the underlying data is stored in a contiguous memory block.
What ...
5
votes
2
answers
79
views
Callback functions in Chapel
I have the following Chapel code.
proc update(x: int(32)) {
return 2*x;
}
proc dynamics(x: int(32)) {
return update(x);
}
writeln(dynamics(7));
I would like to send some kind of callback to ...
3
votes
1
answer
80
views
Equivalent of Octave's `meshgrid` in Chapel
Octave provides a utility function called meshgrid that generates point fields. This is very useful in large scale simulations for evaluating functions at certain points. With Chapels Domain feature,...
2
votes
1
answer
52
views
How to yield a nilable shared object in Chapel?
Currently, I am working on Chapel Data Objects and I am facing some issues. I have a class named Row which can be nil.
I have these three methods:
override iter these()ref {
for row in this....
3
votes
1
answer
92
views
Is there an option for multi-processor compilation with the Chapel compiler?
During compilation, I see that only one processor is used for compilation. I was wondering to speed up the compilation process if there is an option to add multi processor compilation ?
4
votes
1
answer
294
views
Generating random integer and real numbers in a given range
According the man page of getNext in the PCGRandom module, we can generate random numbers in a given range, for example:
use Random;
var rng1 = new owned RandomStream( eltType= real, seed= 100 );
var ...
3
votes
1
answer
57
views
Unexpected result for inner product using reduce
In this code, I am calculating the angle between two vectors (xvec and yvec) by the usual inner-product relation:
var ang = 30.0 * (pi / 180.0);
var xvec = [3.0, 0.0],
yvec = [cos(ang), sin(ang)]...
3
votes
1
answer
207
views
Is casting an array to string "special" among other types?
In this code, I am casting an integer array arr to several different types. When casting to real, the result is an array obtained by casting each element to real. And the same happens for complex. But ...
3
votes
1
answer
392
views
Assignment of scalar to a tuple
For a tuple such as x : 2*real, it seems to support various element-wise operations, for example
var t = (1.0, 2.0); // type = (real,real) or 2*real
writeln( t ); // (1.0, 2.0)
...