1[This document is formatted with GitHub-Flavored Markdown. ]:# 2[For better viewing, including hyperlinks, read it online at ]:# 3[https://github.com/sourceryinstitute/OpenCoarrays/blob/master/INSTALL.md]:# 4 5<a name="top"> </a> 6 7# Installing OpenCoarrays # 8 9[![GitHub release][GH release badge]][latest release] 10[![Github All Releases][GH all releases badge]][latest release] 11[![Download as PDF][pdf img]][INSTALL.pdf] 12 13Download this file as a PDF document 14[here][INSTALL.pdf]. 15 16* [Developer Build and Install] 17* [End-User Installation] 18 * [macOS] 19 * [Windows] 20 * [Linux] 21 * [FreeBSD] 22 * [Virtual machine] 23 * [Installation Script] 24* [Advanced Installation from Source] 25 * [Prerequisites] 26 * [CMake] 27 * [Make] 28 29## Developer Build and Install ## 30 31If you are a GCC developer, a package maintainer building OpenCoarrays 32for distribution, or an advanced user who is comfortable building 33software from source (using cmake), then we recommend installing 34OpenCoarrays directly via CMake. If you do not fit into one of these 35categories, we encourage you to skip ahead to review installation 36options via Linux or MacOS package management software, or the 37[`install.sh`] script. The text below is a condensed version of the 38content available in [`INSTALL`]: plain text instructions for installing 39OpenCoarrays in a canonical CMake way. 40 41Prerequites for direct CMake installation: 42 43* An MPI 3 implementation (MPICH is preferred, OpenMPI works too) 44* A recent version of GCC with GFortran version 6.1 or newer 45* CMake version 3.4 or newer 46 47After obtaining the OpenCoarrays source (from git or our [latest release]) 48the following commands to build and install OpenCoarrays from source 49using CMake: 50 51```bash 52mkdir opencoarrays-build 53cd opencoarrays-build 54export FC=/path/to/gfortran 55export CC=/path/to/gcc 56cmake /path/to/OpenCoarrays/source \ 57 -DCMAKE_INSTALL_PREFIX=/path/to/desired/installation/location 58make 59make test # optional; verify build works 60make install 61``` 62 63If you have either of the CMake gui tools installed, `ccmake` or 64`cmake-gui` you may explore different configuration options and/or try 65to locate/change which MPI version is found by repeating the steps 66above and simply replacing `cmake` with `ccmake` or `cmake-gui`. 67 68Please keep in mind that CMake cache variables are sticky and, once 69set, can only be changed by using `ccmake`, `cmake-gui`, or explicitly 70setting them on the command line: `cmake ../path/to/src -DVAR=VALUE` 71If the wrong compiler or MPI implementation is being used and you 72cannot determine why, you can try deleting the entire build directly 73and re-running CMake. 74 75## End-User Installation ## 76 77Most users will find it easiest and fastest to use package management 78software to install OpenCoarrays. Below is the status of OpenCoarrays 79in various package managers. If you do not see your favorite package 80manager listed or it is badly out of date, please reach out and ask 81for it to be included or updated, or contribute it yourself. We are 82happy to work with package managers to resolve issues, and adapt our 83build system to play nicely so they don't have to maintain patches. 84 85[![Packaging status][repology-badge]][OC-on-repology] 86 87Package management options for 88macOS, Windows, and Linux are described first below. Also described 89below are options for installing via the Sourcery Institute virtual 90machine or via the bash scripts included that are in the OpenCoarrays 91source. 92 93[top] 94 95### macOS ### 96 97* [Homebrew]: 98 [![homebrew][Homebrew badge]][braumeister link] 99 This is the recommended OpenCoarrays installation method on macOS. 100 Basic Homebrew installation steps: 101 102 ``` 103 brew update 104 brew install opencoarrays 105 ``` 106 107 OpenCoarrays also ships with a [`Brewfile`][Brewfile] 108 that will make it easier to install opencoarrays using MPICH built 109 with the GNU Compiler Collection ([GCC]). To install using the 110 [`Brewfile`][Brewfile] with MPICH wrapping GCC, follow these steps: 111 112 ``` 113 brew tap homebrew/bundle 114 brew update 115 brew bundle 116 ``` 117 118* [MacPorts]: 119 An unmaintained [OpenCoarrays Portfile] exists for the [MacPorts] package 120 manager. Although the current OpenCoarrays contributors have no plans to 121 update the portfile, new contributors are welcome to asssume the port 122 maintainer role and to submit a pull request to update this [INSTALL.md] file. 123 124[top] 125 126### Windows ### 127 128Windows users may run the [`install.sh`] script inside the Windows Subsystem 129for Linux ([WSL]). The script uses Ubuntu's [APT] package manager to build 130[GCC] 5.4.0, [CMake], and [MPICH]. Windows users who desire a newer version 131of GCC are welcome to submit a request via our [Issues] page and suggest a 132method for updating. Previously attempted upgrade methods are described in 133the discussion thread starting with [commit comment 20539810]. 134 135[top] 136 137### Linux ### 138 139Access OpenCoarrays on Linux via any of the following package managers 140or pre-installed copies: 141 142* The [linuxbrew] package manager installs OpenCoarrays on all Linux distributions. 143* Debian-based distributions such as Ubuntu provide an "open-coarrays" [APT package]. 144* [Arch Linux] provides an [aur package]. 145* An [HPCLinux] installation script is in the [developer-scripts] subdirectory (available 146 via git clone only). 147* [EasyBuild] can install OpenCoarrays on Linux distributions 148* [Spack], a multiplatform package manager, can also install OpenCoarrays on Linux 149 distributions 150 151[linuxbrew] does not require `sudo` privileges and will generally 152provide the most up-to-date OpenCoarrays release because linuxbrew 153pulls directly from macOS homebrew, which updates automatically. 154 155Note that distributions are often split into two parts: a "binary" package with the 156runtime libraries and a "development" package for developing programs yourself. 157Be sure to install both packages. 158 159<a name="easybuild"></a> 160With [EasyBuild], the following bash commands install OpenCoarrays: 161 162```bash 163# Search available specification files (also known as easyconfigs) for OpenCoarrays 164eb --search OpenCoarrays 165 166# Automatically download prerequisites (with the --robot flag) and install OpenCoarrays 167# with the desired easyconfig, e.g., OpenCoarrays-1.9.0-gompi-2017a.eb 168eb OpenCoarrays-1.9.0-gompi-2017a.eb --robot 169``` 170 171Once installed, use OpenCoarrays by loading the newly created environment 172module `OpenCoarrays/1.9.0-gompi-2017a`: 173 174``` 175module load OpenCoarrays/1.9.0-gompi-2017a 176``` 177 178<a name="spack"></a> 179With [Spack], the following commands install OpenCoarrays in a bash shell: 180 181```bash 182# Check build information for OpenCoarrays in the default specification file 183spack spec opencoarrays 184 185# To automatically download prerequisites and install OpenCoarrays with the default 186# specification. 187# (Note: In addition to its own prerequisites, Spack requires gfortran compiler 188# to be installed to compile OpenMPI) 189spack install opencoarrays 190 191# Or, To install with customisations (e.g., to install OpenCoarrays [version 2.2.0] 192# with MPICH [version default] and GCC [version 7.1.0]). 193spack install opencoarrays@2.2.0 ^mpich %gcc@7.1.0 194``` 195 196In the previous example, it was assumed that GCC [version 7.1.0] is 197already installed, and is available as a compiler to Spack. Otherwise, 198[add a new compiler to Spack]. Once installed, OpenCoarrays can be 199used by [loading the environment modules with Spack], e.g. 200 201``` 202spack module loads --dependencies opencoarrays 203``` 204 205[top] 206 207### FreeBSD ### 208 209Use the OpenCoarrays FreeBSD, Port to install OpenCoarrays by 210executing the following commands as root: 211 212``` 213pkg install opencoarrays 214``` 215 216For more information, please review the [FreeBSD ports/packages installation information]. 217 218[top] 219 220## Virtual machine ## 221 222Users of macOS, Windows, or Linux have the option to use OpenCoarrays 223by installing the Lubuntu Linux virtual machine from the 224[Sourcery Institute Store]. The virtual machine boots inside the 225open-source [VirtualBox] virtualization package. In addition to 226containing [GCC], [MPICH], and OpenCoarrays, the virtual machine 227contains dozens of other open-source software packages that support 228modern Fortran software development. See the 229[download and installation instructions] for a partial list of the 230included packages. 231 232[top] 233 234## Installation Script ## 235 236If the above package management or virtualization options are 237infeasible or unavailable, Linux, macOS, and [WSL] users may also install 238OpenCoarrays by downloading and uncompressing our [latest release] and 239running our installation script in the top-level OpenCoarrays source 240directory (see above for the corresponding [Windows] script): 241 242``` 243tar xvzf OpenCoarrays-x.y.z.tar.gz 244cd OpenCoarrays-x.y.z 245./install.sh 246``` 247 248where `x.y.z` should be replaced with the appropriate version numbers. 249A complete installation should result in the creation of the following 250directories inside the installation path (.e.g, inside `build` in the 251above example): 252 253* `bin`: contains the compiler wrapper (`caf`) and program launcher 254 (`cafun`). 255* `mod`: contains the `opencoarrays.mod` module file for use with 256 non-OpenCoarrays-aware compilers 257* `lib`: contains the `libcaf_mpi.a` static library to which codes 258 link for CAF support 259 260### Example script invocations ### 261 262Execute `./install.sh --help` or `./install.sh -h` to see a list of flags 263that can be passed to the installer. Below are examples of useful combinations 264of flags. Each flag also has a single-character version not shown here. 265 2661. If you don't care about tailoring installation locations,use 267 268 ``` 269 ./install.sh 270 ``` 271 2722. Or build faster by multithreading, skipping user queries, and also specify 273 an installation destination for all packages that must be built: 274 275 ``` 276 ./install.sh \ 277 --prefix-root ${HOME}/software \ 278 --num-threads 4 \ 279 --yes-to-all 280 ``` 281 2823. Specify the compilers to be used (overriding what is in your `PATH`) as follows: 283 284 ``` 285 ./install.sh --with-fortran <path-to-gcc-bin>/gfortran \ 286 --with-cxx <path-to-gcc-bin>/g++ \ 287 --with-c <path-to-gcc-bin>/gcc 288 ``` 289 2904. Install only a specific prerequisite package (the default version): 291 292 ``` 293 ./install.sh --package mpich 294 ``` 295 2965. Install a specific version of a prerequisite: 297 298 ``` 299 ./install.sh --package cmake --install-version 3.7.0 300 ``` 301 3026. Download a prerequisite package (e.g., gcc/gfortran/g++ below) but 303 don't build or install it: 304 305 ``` 306 ./install.sh --only-download gcc 307 ``` 308 3097. Print the default URL, version, or download mechanism that the 310 script will use for a given prerequisite package (e.g., mpich 311 below) on this system: 312 313 ``` 314 ./install.sh --print-url mpich 315 ./install.sh --print-version mpich 316 ./install.sh --print-downloader mpich 317 ``` 318 3198. Install a prerelease branch (e.g., trunk below) of the GCC repository: 320 321 ``` 322 ./install.sh --package gcc --install-branch trunk 323 ``` 324 325[top] 326 327## Advanced Installation from Source ## 328 329### Prerequisites ### 330 331Package managers and the [`install.sh`] attempt to handle the installation 332of all OpenCoarrays prerequisites automatically. Installing with CMake 333or the provided, static Makefile burdens the person installing with the 334need to ensure that all prerequisites have been built and are in the 335expected or specified locations prior to building OpenCoarrays. The 336prerquisite package/version dependency tree is as follows: 337 338```text 339opencoarrays 340├── cmake-3.4.0 341└── mpich-3.2 342 └── gcc-6.1.0 343 ├── flex-2.6.0 344 │ └── bison-3.0.4 345 │ └── m4-1.4.17 346 ├── gmp 347 ├── mpc 348 └── mpfr 349``` 350 351[top] 352 353### CMake ### 354 355On most platforms, the [`install.sh`] script ultimately invokes [CMake] after 356performing numerous checks, customizations, and installations of any missing 357prerequisites. Users wishing to install OpenCoarrays directly with CMake should 358have a look at the documentation in the [`./INSTALL`] file if they encounter 359issues or need further guidance. A brief summary is also given at the top of 360this document [here][Developer Build and Install]. 361 362[top] 363 364### Make ### 365 366Unlike the Makefiles that CMake generates automatically for the chosen 367platform, static Makefiles require a great deal more maintenance and are 368less portable. Also, the static Makefiles provided in [src] lack several 369important capabilities. In particular, they will not build the tests; 370they will not generate the `caf` compiler wrapper that ensures correct linking 371and `cafrun` program launcher that ensures support for advanced features such 372as Fortran 2015 failed images; they will not build the [opencoarrays] module 373that can be used to provide some Fortran 2015 features with non-Fortran-2015 374compilers; nor do the static Makefiles provide a `make install` option so you 375will need to manually move the resultant library from the build location to your 376chosen installation location. 377 378If none of the installation methods mentioned higher in this document are 379work on your platform and if CMake is unavailable, build and install the 380OpenCoarrays parallel runtime library as follows: 381 382``` 383tar xvzf opencoarrays.tar.gz 384cd opencoarray/src 385make 386mv mpi/libcaf_mpi.a <insert-install-path> 387``` 388 389replacing the angular-bracketed text with your desired install path. 390 391For the above steps to succeed, you might need to edit the [make.inc] 392file to match your system settings. For example, you might need to 393remove the `-Werror` option from the compiler flags or name a 394different compiler. In order to activate efficient strided-array 395transfer support, uncomment the `-DSTRIDED` flag inside the [make.inc] 396file. 397 398[top] 399 400--- 401 402<div align="center"> 403 404[![GitHub forks][fork badge]][fork url] 405[![GitHub stars][star badge]][star url] 406[![GitHub watchers][watch badge]][star url] 407[![Twitter URL][twitter badge]][twitter url] 408 409</div> 410 411[Internal document links]: # 412 413[top]: #top 414[Developer Build and Install]: #developer-build-and-install 415[End-User Installation]: #end-user-installation 416[macOS]: #macos 417[Windows]: #windows 418[Linux]: #linux 419[FreeBSD]: #freebsd 420[Virtual machine]: #virtual-machine 421[Installation Script]: #installation-script 422 423[Advanced Installation from Source]: #advanced-installation-from-source 424[Prerequisites]: #prerequisites 425[CMake]: #cmake 426[Make]: #make 427 428[Links to source]: # 429 430[`install.sh`]: ./install.sh 431[`INSTALL`]: ./INSTALL 432 433[URLs]: # 434 435[OC-on-repology]: https://repology.org/project/opencoarrays/versions 436[repology-badge]: https://repology.org/badge/vertical-allrepos/opencoarrays.svg 437 438[FreeBSD ports/packages installation information]: https://www.freebsd.org/doc/en_US.ISO8859-1/books/handbook/ports.html 439[GH all releases badge]: https://img.shields.io/github/downloads/sourceryinstitute/OpenCoarrays/total.svg?style=flat-square 440[GH release badge]: https://img.shields.io/github/release/sourceryinstitute/OpenCoarrays.svg?style=flat-square 441[Homebrew badge]: https://img.shields.io/homebrew/v/opencoarrays.svg?style=flat-square 442[linuxbrew]: http://linuxbrew.sh 443[braumeister link]: http://braumeister.org/formula/opencoarrays 444[APT package]: https://qa.debian.org/popcon.php?package=open-coarrays 445[APT]: https://en.wikipedia.org/wiki/APT_(Debian) 446[HPCLinux]: http://www.paratools.com/hpclinux/ 447[Brewfile]: https://github.com/sourceryinstitute/OpenCoarrays/blob/master/Brewfile 448[INSTALL.pdf]: https://md2pdf.herokuapp.com/sourceryinstitute/OpenCoarrays/blob/master/INSTALL.pdf 449[INSTALL.md]: https://github.com/sourceryinstitute/OpenCoarrays/blob/master/INSTALL.md 450[CMake]: https://cmake.org 451[Sourcery Institute Store]: http://www.sourceryinstitute.org/store/c1/Featured_Products.html 452[VirtualBox]: https://www.virtualbox.org 453[download and installation instructions]: http://www.sourceryinstitute.org/uploads/4/9/9/6/49967347/overview.pdf 454[yum]: http://yum.baseurl.org 455[apt-get]: https://en.wikipedia.org/wiki/Advanced_Packaging_Tool 456[Issues]: https://github.com/sourceryinstitute/OpenCoarrays/issues 457[make.inc]: ./src/make.inc 458[opencoarrays]: ./src/extensions/opencoarrays.F90 459[prerequisites]: #prerequisites 460[MPICH]: http://www.mpich.org 461[MVAPICH]:http://mvapich.cse.ohio-state.edu 462[MacPorts]: https://www.macports.org 463[GCC]: http://gcc.gnu.org 464[TS18508 Additional Parallel Features in Fortran]: https://isotc.iso.org/livelink/livelink/nfetch/-8919044/8919782/8919787/17001078/ISO%2DIECJTC1%2DSC22%2DWG5_N2056_Draft_TS_18508_Additional_Paralle.pdf?nodeid=17181227&vernum=0 465[GFortran Binaries]: https://gcc.gnu.org/wiki/GFortranBinaries#FromSource 466[Installing GCC]: https://gcc.gnu.org/install/ 467[Arch Linux]: https://www.archlinux.org 468[aur package]: https://aur.archlinux.org/packages/opencoarrays/ 469[latest release]: https://github.com/sourceryinstitute/OpenCoarrays/releases/latest 470[pdf img]: https://img.shields.io/badge/PDF-INSTALL.md-6C2DC7.svg?style=flat-square 471[commit comment 20539810]: https://github.com/sourceryinstitute/OpenCoarrays/commit/26e99919fe732576f7277a0e1b83f43cc7c9d749#commitcomment-20539810 472[Homebrew]: https://brew.sh 473[dnf]: https://github.com/rpm-software-management/dnf 474[port details]: https://www.freshports.org/lang/opencoarrays 475[port search]: https://www.freebsd.org/cgi/ports.cgi?query=opencoarrays 476[EasyBuild]: https://github.com/easybuilders/easybuild 477[Spack]: https://github.com/spack/spack 478[add a new compiler to Spack]: http://spack.readthedocs.io/en/latest/tutorial_modules.html#add-a-new-compiler 479[loading the environment modules with Spack]: http://spack.readthedocs.io/en/latest/module_file_support.html#cmd-spack-module-loads 480[OpenCoarrays Portfile]: https://www.macports.org/ports.php?by=name&substr=opencoarrays 481[WSL]: https://blogs.msdn.microsoft.com/commandline/2017/07/10/ubuntu-now-available-from-the-windows-store/ 482[developer-scripts]: https://github.com/sourceryinstitute/OpenCoarrays/tree/master/developer-scripts 483[src]: https://github.com/sourceryinstitute/OpenCoarrays/tree/master/src 484[fork badge]: https://img.shields.io/github/forks/sourceryinstitute/OpenCoarrays.svg?style=social&label=Fork 485[fork url]: https://github.com/sourceryinstitute/OpenCoarrays/fork 486[star badge]: https://img.shields.io/github/stars/sourceryinstitute/OpenCoarrays.svg?style=social&label=Star 487[star url]: https://github.com/sourceryinstitute/OpenCoarrays 488[watch badge]: https://img.shields.io/github/watchers/sourceryinstitute/OpenCoarrays.svg?style=social&label=Watch 489[twitter badge]: https://img.shields.io/twitter/url/http/shields.io.svg?style=social 490[twitter url]: https://twitter.com/intent/tweet?hashtags=HPC,Fortran,PGAS&related=zbeekman,gnutools,HPCwire,HPC_Guru,hpcprogrammer,SciNetHPC,DegenerateConic,jeffdotscience,travisci&text=Stop%20programming%20w%2F%20the%20%23MPI%20docs%20in%20your%20lap%2C%20try%20Coarray%20Fortran%20w%2F%20OpenCoarrays%20%26%20GFortran!&url=https%3A//github.com/sourceryinstitute/OpenCoarrays 491