OpenCoarrays in Fedora workstation 35?

Hi all,
I was wondering if anyone here uses OpenCoarrays on Fedora workstation 35 ?
As it stands there is no package maintainer for the official repos. So if anyone uses it on Fedora I’d like to know how they got started.

Thank you

I use GFortran on F35 but have never tried the coarray features. I thought GFortran natively supports coarray since it is part of the Fortran standard.

Summoning the lead dev for OpenCoarrays @rouson to this thread.

Gfortran does support coarray syntax on plain Windows and I assume any OS. For the code

program main
  implicit none
  write (*,*) "Hello from image", this_image(), "of", num_images()
end program main

compiling with gfortran -fcoarray=single xcoarray.f90 and running gives output

Hello from image 1 of 1

Compiling with ifort -Qcoarray -Qcoarray-num-images:4 xcoarray.f90 and running gave

 Hello from image           2 of           4
 Hello from image           3 of           4
 Hello from image           4 of           4
 Hello from image           1 of           4

The image numbers can be printed in any order. Gfortran on WSL does support coarrays with more than one image.

do you mean it supports coarrays w/o OpenCoarrays? I guess not. AFAIK WSL uses Ubuntu by default and Ubuntu has opencoarrays in its repo.
Unless it has changed (again) recently, RHEL-like OSes abandoned OpenCoarrays quite a while ago. It used to be available in older Fedoras.
For now, I think the only solution for these OSes is Homebrew for Linux which also has it.

@Aurelius_Nero I’m using it with F33. There is no rpm available that I know of, but they have good instructions for doing a manual install. It’s quite easy and fast – I don’t recall running into any issues whatsoever, and I doubt you will either. But I did already have MPICH installed.

1 Like

Good to know, thank you @nncarlson. If I recall it well, a few years ago, for environments not having the package in their repos, there was only an option to install from source. I then tried it, it started to compile the whole GCC suite as a prerequisite and never completed.

That sounds like spack :scream:, and that may indeed still be the case if you use their script. I went back and looked at what I did, and I actually just cloned the repo and built it following the advanced instructions in the section following the one I linked to above (my bad). If you’ve already got CMake and MPICH installed on your system it’s dead easy. “Advanced instructions” sounds scary, but in reality I think it’s the easiest thing if your system is already setup for doing code development.

@nncarlson I tried installing it and had some problems. Just out of curiosity what was your install path ?

Which installation method did you try? Running or the “advanced” method where you build it from source using cmake? It shouldn’t matter where you install it as long as you have write permission on the directory, and add its bin directory to your PATH. If you give more details you’re doing (e.g., the commands) and what the error messages are we might be able to help better.

@nncarlson I basically used the method. I got not error during the whole process. however when i tried to compile a file using caf file.f90 -o file i get an error saying “caf command not found”.

That’s probably an easy fix. Do you know where it is installed? Looking at the script, if you didn’t specify a location with the --install-prefix option then it put it in down in a subdirectory prerequisites/installations/.../.../ of where the script is. (You may want to reinstall and specify a more sensible installation location.) But the solution to your error is to add its bin directory to your PATH variable so that the caf program is found: something like

export PATH=/<your-opencoarray-install-directory>/bin:$PATH

@nncarlson i reinstalled into a new directory and i put this command into my terminal but nothing happened (along with the proper path)

I managed to get the files to compile however i get an error when trying to run a file compiled by caf
However I now get this error when trying to use cafrun

[agnelo@fedora fortran experiment]$ cafrun -n 2 xcoarray
[proxy:0:0@fedora] HYDU_create_process (/home/agnelo/Documents/OpenCoarrays/OpenCoarrays-2.9.2/prerequisites/downloads/mpich-3.2/src/pm/hydra/utils/launch/launch.c:74): execvp error on file xcoarray (No such file or directory)
[proxy:0:0@fedora] HYDU_create_process (/home/agnelo/Documents/OpenCoarrays/OpenCoarrays-2.9.2/prerequisites/downloads/mpich-3.2/src/pm/hydra/utils/launch/launch.c:74): execvp error on file xcoarray (No such file or directory)
Error: Command:
   `/home/agnelo/Documents/OpenCoarrays/OpenCoarrays-2.9.2/prerequisites/installations/mpich/3.2/bin/mpiexec -n 2 xcoarray`
failed to run.
[agnelo@fedora fortran experiment]$ 

Try this instead:

cafrun -n 2 ./xcoarray


it works !! Thank you so much !!

Thanks to @nncarlson for the solution !
For anyone else who is wondering, here is what I did:
step 1:
Download the latest release along with the sha256 checksum and check the validity of the download.

Step 2:
Follow the steps here and install the package in a very specific folder:

Step 3:
After the installation you need to edit the .bash_profile hidden file in your home folder. Where it says “user specific environment and startup programs” add,

export PATH=/<your-opencoarray-install-directory>/bin:$PATH
source <your-opencoarray-install-directory>/

Note: The source line should be provided to you at the end of your installation process DO NOT GLOSS OVER IT
step 4: Compile with

caf <your-file>.f90 -o <output-file-name>

Step 5: run with

cafrun -n (number of threads) ./<output-file-name>

note: please take care to include the./ when trying to run your code.

With all that, mods please feel free to edit if any steps have mistakes in them

Happy parallelization with OpenCoarrays everyone !! And thanks for the help !