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).

Filter by
Sorted by
Tagged with
2 votes
2 answers
28 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
27 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
49 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
61 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
77 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 ...
  • 157
2 votes
1 answer
50 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
120 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 ...
  • 157
4 votes
1 answer
136 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 ...
  • 157
3 votes
1 answer
27 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 ...
  • 3,822
4 votes
1 answer
150 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 ...
  • 157
1 vote
1 answer
55 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,775
1 vote
1 answer
276 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,775
1 vote
1 answer
68 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('...
  • 1,775
2 votes
0 answers
61 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
87 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 ...
  • 21
1 vote
0 answers
69 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
48 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
63 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 ...
  • 11
14 votes
3 answers
3k 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 ...
  • 6,469
2 votes
1 answer
49 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
83 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 ...
  • 87
6 votes
1 answer
130 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/ ...
  • 63
4 votes
1 answer
108 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
174 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
118 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-...
  • 1,355
3 votes
2 answers
66 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
104 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
186 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) &...
  • 263
3 votes
1 answer
73 views

How to read an environment variable from a Chapel program?

How can one read an environment variable within a Chapel program?
  • 1,775
2 votes
1 answer
52 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
190 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
328 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); ...
  • 263
3 votes
0 answers
86 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), ...
  • 263
3 votes
1 answer
93 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
79 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....
  • 3,066
5 votes
1 answer
85 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
141 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 ...
  • 152
4 votes
1 answer
60 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
73 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,066
3 votes
1 answer
74 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,...
  • 3,066
2 votes
1 answer
51 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
86 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 ?
  • 65
4 votes
1 answer
231 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 ...
  • 263
3 votes
1 answer
55 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)]...
  • 263
3 votes
1 answer
128 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 ...
  • 263
3 votes
1 answer
262 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) ...
  • 263
4 votes
1 answer
124 views

How to append data to an existing file

In Chapel, we can open a file for writing by using open() + iomode.cw, e.g., var fout = open( "foo.dat", iomode.cw ); // create a file for writing var cout = fout.writer(); // make ...
  • 263
2 votes
1 answer
159 views

Chapel LinearAlgebra reports an error on a call to eig( csrA, left = true, right = true );

Using the chapel code inside online IDE for prototyping, an example2.chpl from Documentation about how to use the LinearAlgebra module proc eig(…) failed to operate on CSR-sparse matrix of complex ...
3 votes
1 answer
45 views

Running into a error when trying to sum up all the elements in a matrix using a forall loop

While trying to add up all the elements in a matrix I keep getting an error when I use a forall loop, it works using a for loop I'm not sure why. Here is the error: error: illegal lvalue in ...
  • 301
4 votes
1 answer
103 views

Running into a unresolved access error using Block distribution

I've been running into an error when trying to compile with Block distribution. This is the error: error: unresolved access of '[BlockDom(3,int(64),false,unmanaged DefaultDist)] real(64)' by '[int(64)...
  • 301

1
2 3 4 5