Installing Chapel

Chapel runs in a Unix-based environment, including Mac OS X and Windows systems running Cygwin. The Windows and Cygwin instructions are at the end. To install it, you need to download the current version from http://chapel.cray.com/download.html. Uncompress and untar the result, placing it in some appropriate place on your system (/usr/local/???). The chapel subdirectory in this tarball is the chapel home directory.

Use the command make or gmake in the chapel home directory. This will build the compiler and runtime libraries.

To make the installation usable by others, you need to change the permissions. The following three lines, which should be run in the chapel home directory, set the permissions appropriately (make everything readable, make directories "executable" and make executables so that anyone can use them):

chmod -R ugo+r .
find . -type d -exec chmod 755 {} +
find . -executable -exec chmod 755 {} +

Next, you need to initialize some environment variables. There are scripts to do this; simply go to the chapel home directory and run them. For csh or tcsh, the correct procedure is
cd chapel_home_dir
source util/setchplenv.csh

For bash it is

cd chapel_home_dir
source util/setchplenv.bash
These scripts are less convenient if you plan to use Chapel a lot because you need to rerun them each time you login or open a new shell. Instead, you can modify your shell's configuration files. Here is what you can add to your .cshrc if you use csh or tcsh:
setenv CHPL_HOME your_chapel_home_dir
if (-d $CHPL_HOME) then
set CHPL_BIN_SUBDIR = `"$CHPL_HOME"/util/chplenv/chpl_bin_subdir.py`
setenv PATH "$CHPL_HOME/bin/$CHPL_BIN_SUBDIR":"$CHPL_HOME/util":"$PATH"
if ($?MANPATH) then
setenv MANPATH "$MANPATH":"$CHPL_HOME"/man
else
setenv MANPATH "$CHPL_HOME"/man
endif
endif

For bash, add the following to your .bashrc:

export CHPL_HOME your_chapel_home_dir
export CHPL_BIN_SUBDIR=`"$CHPL_HOME"/util/chplenv/chpl_bin_subdir.py`
export PATH=$PATH:$CHPL_HOME/bin/$CHPL_BIN_SUBDIR:$CHPL_HOME/util
export MANPATH=$MANPATH:$CHPL_HOME/man

We based these on the Chapel-provided scripts mentioned above; versions for other shells can be constructed similarly by referring to the appropriate script.

Installing Chapel on Windows

In order to use chapel on Windows, you have to use Cygwin. The instructions below will walk you through how to install both on a Windows system.

First you will need to install Cygwin. This needs to be done every time you add packages to Cygwin as well. You want to run the setup-x86_64.exe from the linked page which should bring up the installer. Click next until it brings you to the page allowing you to select packages. Find the + next to All and use the dropdown menu to change the default to install next to the following from each package listed below:

Devel: gcc and gcc-g++, make
Perl: perl
Python: install all of the python packages
Utils: diffutils

If you would also like to install emacs to create and edit files you can search for emacs and expand the interpreter, editor, and debugger to get the emacs packages and emacs-common packages and install them.

Now that you have Cygwin installed you can install Chapel. Using that link, find and download chapel-1.22.0.tar.gz. Move this file into the user folder in your Cygwin folder: cygwin64 >> home >> your computer name

The next step is to make Chapel. First, open the Cygwin terminal and type in:
tar xzf chapel-1.22.0.tar.gz

Wait for it to expand the source and then navigate to the folder containing the makefile. If chapel-1.22.0 is not what your install is called you can use ls to see what the name is.
cd chapel-1.22.0

Then to set up your environment type in the following:
source util/setchplenv.bash
make

After that is finished (it may take a bit), check that it was done correctly by typing:
make check

Wait for this to make any changes and verify your Chapel build and then run your own check by compiling an example program:
chpl -o hello examples/hello.chpl

Run this by typing:
./hello

If working, it should print "Hello, world!"
Now you need to set up your install so that it works when you reopen it. Start by closing Cygwin, reopening it, and navigating to the chapel-1.22.0 folder. Then type:
source util/setchplenv.bash ./configure

Make sure all the information there looks right and matches your machine and then type:
make install

Now when you open Cygwin all you have to do is navigate to the Chapel folder in order to use it. If you also installed emacs, you can create new files by typing:
emacs filename.chpl

Then you are able to edit them in emacs, or by opening the file in notepad from your chapel-1.22.0 folder.


Back to the tutorial