Skip to content

Latest commit

 

History

History
52 lines (35 loc) · 2.59 KB

README.md

File metadata and controls

52 lines (35 loc) · 2.59 KB

'Hello, world!' in Chapel

Chapel is a programming language for productive parallel computing. This repository contains starter code for a Chapel project. Please see the Learning Chapel page to learn more of the language's features.

To get started with this template, you can either use GitHub Codespaces or your own machine.

For more code samples, consider trying out the Primers, or the many programs from a past Chapel tutorial.

Using a Codespace

⚠️ Because Codespaces are a virtualized environment running on shared hardware with a modest core count, don't expect parallelism or performance observed here to be reflective of what a native installation of Chapel can achieve.

The chapel-hello-world repo includes a devcontainer.json file, making it usable from GitHub Codespaces. When viewing this repository from GitHub's UI, click Use this template > Open in a codespace to get started. The codespace includes the Visual Studio Code extension for Chapel, and tools such as chpl-language-server and chplcheck.

In the Codespace, compile Chapel programs using the Terminal tab by using the chpl compiler:

chpl hello.chpl
./hello

Although the Codespace is set to a single-locale (single-node) mode by default, you can simulate multiple nodes by setting the CHPL_COMM environment variable to gasnet when compiling.

# Compile a program that distributes computation to multiple nodes
CHPL_COMM=gasnet chpl examples/hello4-datapar-dist.chpl

# Run hello using two simulated nodes
./hello4-datapar-dist -nl 2 

To avoid having to include CHPL_COMM in each compilation command, you can export it:

export CHPL_COMM=gasnet
chpl examples/hello4-datapar-dist.chpl
./hello4-datapar-dist -nl 2 

Using Your Machine

Please follow the instructions on the Download Chapel page to get set up with the Chapel compiler chpl. From there, you can compile and run the hello.chpl file in this repository as follows:

chpl hello.chpl
./hello

To make use of multiple nodes (or to simulate multi-node execution), please refer to Multilocale Chapel Execution.