Chapel Quickstart Instructions¶
These instructions are designed to help users get started with a single-locale (shared-memory) implementation of Chapel from the source distribution of the release as quickly as possible. If you want to understand Chapel’s configuration options, build process, and installation more thoroughly, please refer to Setting up Your Environment for Chapel and Building Chapel instead.
These instructions first have you build a minimal, low-performance configuration of Chapel to reduce build times and the potential for third-party portability issues. Once you are interested in getting better performance or using a full-featured version of Chapel, refer to Using Chapel in its Preferred Configuration below.
See Chapel Prerequisites for information about system tools and packages you should have available to build and run Chapel.
If you don’t already have the Chapel 1.32 source release, see https://chapel-lang.org/download.html.
Build Chapel in its ‘Quickstart’ configuration:
Unpack the source release if you haven’t already:
tar xzf chapel-1.32.0.tar.gz
Make sure that you are in the directory that was created when unpacking the source release, for example:
cd chapel-1.32.0
Set up your environment for Chapel’s Quickstart mode. If you are using a shell other than
bash
orzsh
, see Quickstart with Other Shells below.source util/quickstart/setchplenv.bash
Use GNU make to build Chapel. On some systems, you may have to use
gmake
ifmake
is not a GNU version.make
Compile an example program, which uses a
forall
loop to print messages:chpl examples/hello3-datapar.chpl
Run the resulting executable, which will print 100 messages in parallel:
./hello3-datapar
Experiment with Chapel in this Quickstart mode to your heart’s content. If you’d like to use this build of Chapel in a different shell / terminal session, see Using Chapel in a Different Shell or Terminal below. Once you are comfortable with Chapel and interested in using a full-featured version in the preferred configuration, see the next section.
Using Chapel in its Preferred Configuration¶
To use Chapel in its preferred, full-featured mode, you will need to rebuild Chapel from source in a different configuration:
Open up a new shell to avoid inheriting the previous environment settings.
The Quickstart configuration attempts to detect if you have a compatible system installation of LLVM and clang. If you do not, it will set
CHPL_LLVM=none
for simplicity and to save time. This causes the Chapel compiler to use its C back-end, which is not the preferred option; LLVM is the default back-end, which needs to be available for full functionality. There are a few options for using LLVM:Ensure that you have a compatible version of LLVM installed on your system and set
CHPL_LLVM=system
. Once you have it working, you can leaveCHPL_LLVM
unset and Chapel should detect it if it is in your path. See Chapel Prerequisites for details on the currently supported LLVM versions.Or, set
CHPL_LLVM=bundled
to have Chapel build and use the bundled version of LLVM. Note that building the bundled version of LLVM can take a long time and requires CMake version 3.13.4 or higher.set
CHPL_LLVM=none
to continue using the C back-end rather than LLVM
If you are interested in building Chapel to support multiple compute nodes (locales), refer to Multilocale Chapel Execution for other settings to enable that.
Repeat steps 2-5 above, but in step 2, source
util/setchplenv.bash
instead ofutil/quickstart/setchplenv.bash
. This will set up your environment to use Chapel in the preferred configuration. Note that building this configuration involves compiling third-party packages, which will increase the overall build time.# Set environment variables to preferred configuration source util/setchplenv.bash # re-build Chapel make # compile a sample program chpl examples/hello3-datapar.chpl # run the sample program ./hello3-datapar
If you run into any portability issues, please see Reporting Chapel Issues.
Using Chapel in a Different Shell or Terminal¶
Note that in both the Quickstart and preferred modes above, any
environment settings made by setchplenv.bash
will not persist
beyond your current shell/terminal session. One easy way to use
Chapel from a different shell or terminal is to re-source
the
setchplenv.bash
script that you used when building Chapel.
However since this can quickly become annoying, other strategies are
available including a ./configure
+ make install
option. See
Using Chapel in a Different Shell / Terminal / Session for details.
Using Chapel in Multi-Locale Mode¶
All of the instructions above describe how to run Chapel programs in a single-locale (shared-memory) mode. To run using multiple locales (multiple compute nodes with distributed memory), please refer to Multilocale Chapel Execution.
Notes on Performance¶
If you plan to do performance studies of Chapel programs, be sure to
use the full-featured version above, to compile with --fast
once
your program is correct, and to refer to
https://chapel-lang.org/perf-tips.html for other tips.
Quickstart with Other Shells¶
Use the table below to identify the location of an appropriate
Quickstart setchplenv
script, based on the shell you use.
If you use: |
then type: |
a bash-compatible shell (bash/zsh) |
|
a csh-compatible shell (csh/tcsh) |
|
the fish shell (fish) |
|
the Bourne shell (sh) |
|
Scripts that set the preferred environment for each shell can be
located by removing quickstart/
from the paths above.
What’s next?¶
For further information about Chapel, refer to the following resources:
Online documentation: |
|
Platform-specific notes: |
|
Example Chapel programs: |
|
Setting Chapel env vars: |
|
Building the compiler: |
|
Compiling Chapel programs: |
|
Executing Chapel programs: |
|
Debugging Chapel programs: |
|
Reporting bugs: |
|
Performance: |
|
Chapel modes for emacs/vim: |
|
Chapel’s file/dir structure: |
|
Changes since last release: |
|