Full WSL to OpenCoArrays install story.

41 views
Skip to first unread message

Frank Meyer

unread,
Dec 7, 2021, 1:17:31 AM12/7/21
to OpenCoarrays
Hello all!

Just finished getting caf ParallelHello.f90 to run using cafrun -n 50 ./a.out which took me 10hrs from start to finish. Most of that time was googling garbage which had nothing to do with the issues. What was really required can be summed up as this;

Install Windows Subsystem for Linux with the command;
wsl --install

Find the wsl in your start menu and run the Out Of Box Experience setting up your user and password.

Find and run the new Ubuntu app in your start menu. You now have a bash prompt.
This does not come with anything, but pretends that it does. So now you need;
vcxsrv-64.1.20.9.0.installer   # for an x-windows environment

To get into the x-windows environment you type;
startxfce4
and then double click the xserver icon on your desktop. The first time through I suggest you chose one large window, leave the -1, start no client, disable access control, and save this config as a desktop icon. You could remove the other icon, or leave it. This now gives you a desktop to hammer away from.

If you get no fun, add this to the end of your .bashrc file like I had to;
export DISPLAY=$(awk '/nameserver / {print $2; exit}' /etc/resolv.conf 2>/dev/n\
ull):0
export LIBGL_ALWAYS_INDIRECT=1

This didn't help me much as I like command line but you might like the pretty pictures.
To continue, you need to update and upgrade the current environment;
sudo apt-get update
sudo apt-get upgrade

Now comes the part that should be unelephant;
sudo apt-get gcc
sudo apt-get make
sudo apt-get make-esentials
sudo apt-get cmake
sudo apt-get bison
sudo apt-get flex
sudo apt-get m4
sudo apt-get (missing something here, watch further down for more)

I also wanted my usual text editor;
sudo apt-get emacs
Which works, but only with either the x-windows loaded or with emacs -nw.

At this point you can download the latest OpenCoarrays tar ball from;

Open the tarball with;
tar -zxf OpenCoarrays....tar.gz   # Your version numbers may be different.

And now start the make with;
cd OpenCoarrays...
./install.sh

There is no warning that something is wrong! It just dumps back to bash with no blatant warning or help text. You will have to hope that all the apt-get commands previous will work. It SHOULD try to rebuild everything you just apt-get got, and after 40mins on an i7 I finally got an actual "you should do this one last thing" message. So add this next line to the end of your .bashrc file;

source /home/YOURNAMEHERE/OpenCoarrays-2.9.2/prerequisites/installations//opencoarrays/2.9.2/setup.sh

From there emacs  -nw ParallelHello.f90
and copy this test;

PROGRAM helloWorld
  implicit none

  integer :: i_loop[*]

  i_loop = this_image()
  print *, "hello, world! I am ", i_loop, "!"

END PROGRAM helloWorld

Now test compile and run with;
caf ParallelHello.f90
cafrun -n 50 ./a.out

You should get a bunch of badly formatted text with a bunch of numbers. Congratulations!

Hope that helps someone else!

Frank / Knarfnarf

Frank Meyer

unread,
Dec 7, 2021, 1:28:45 AM12/7/21
to OpenCoarrays
Ooopps!

Three addendums;
Use power shell for the wsl -install command
The xwindows settings are multiple windows, -1, start no client, disable access control, save that to desktop.
Still can't remember what else I had to install.

Still hope that helps someone else!

Frank / Knarfnarf

Frank Meyer

unread,
Jan 10, 2022, 1:07:22 AM1/10/22
to OpenCoarrays
Hello all!

Bad news; it seems that some library call is failing far in the background so all calls to sync are failing. In fact; sync all does nothing. It doesn't even ensure that the current thread stops and waits for other threads!

This is a deal breaker as even multi-threading with Apple Soft basic would be better than this!

I'm at a stand still until someone or some tutorial out there can help me.

This is unfortunately as broken as most Microsoft platforms are but I was hoping for more from the open source community.

Knarfnarf

Frank Meyer

unread,
Jan 10, 2022, 1:37:43 AM1/10/22
to OpenCoarrays
Example;

  ! Program Paratest
  ! Written by Frank Meyer
  ! Created Jan 9, 2022
  ! Version 0.1a
  ! Description: Testing some sync issues.
program Paratest
  implicit none

  ! Create co-arrays for testing
  integer :: i_test1[*]

  ! Other variables for testing purposes.
  integer :: i_loop1, i_loop2, i_me, i_all
 
  ! Set variable for work
  i_loop1 = 1
  i_loop2 = 2
  i_me = this_image()
  i_all = num_images()

  print *, i_me, " says; ", i_loop1    ! Does printing work? Good...
     
  sync all

  i_loop2 = i_me + 1                   ! Can we access the coarray?
  if (i_loop2 .gt. i_all) then
     i_loop2 = 1
  end if

  i_test1[i_loop2] = i_me              ! Put our number over one.

  sync all

  print *, i_me, " now says;", i_test1 ! Did it get here?

  do i_loop1 = 1, i_all                ! Add a dynamic value to it.
     i_test1[i_loop1] = i_test1[i_loop1] + 1
  end do                                     ! Equiv to i_test1 += i_all

  sync all
 
  print *, i_me, " finally says;", i_test1 ! See the failure...

end program Paratest


Output is;

           2  says;            1
           3  says;            1
           4  says;            1
           7  says;            1
          10  says;            1
          11  says;            1
          12  says;            1
          14  says;            1
          15  says;            1
           8  says;            1
          16  says;            1
           1  says;            1
           6  says;            1
           9  says;            1
          13  says;            1
           5  says;            1
           1  now says;          16
           2  now says;           1
           5  now says;           4
           6  now says;           5
           7  now says;           6
           8  now says;           7
           9  now says;           8
          10  now says;           9
          13  now says;          12
           3  now says;           6
          11  now says;          10
          12  now says;          11
          14  now says;          13
          15  now says;          14
          16  now says;          15
           4  now says;           5
           1  finally says;          22
           2  finally says;           5
           3  finally says;          12
           5  finally says;          16
           7  finally says;          19
           8  finally says;          19
           9  finally says;          21
          10  finally says;          23
          11  finally says;          18
          13  finally says;          26
           4  finally says;          10
           6  finally says;          13
          14  finally says;          27
          12  finally says;          27
          15  finally says;          24
          16  finally says;          30

Note that 3 says 6 early in the run proving that sync all did not stop thread 3 from reaching past the sync all before the rest of the threads.

Knarfnarf.

Erin Hodgess

unread,
Jan 10, 2022, 2:01:22 AM1/10/22
to Frank Meyer, OpenCoarrays
This is great!

I just got OpenCoarrays working in conjunction with R on the Raspberry Pi.  It turned out pretty well.

Take care,
Erin 

--
You received this message because you are subscribed to the Google Groups "OpenCoarrays" group.
To unsubscribe from this group and stop receiving emails from it, send an email to opencoarrays...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/opencoarrays/9b8edb23-24a1-4111-9cfb-b9dd8a399338n%40googlegroups.com.
--
Erin Hodgess, PhD

Frank Meyer

unread,
Jan 13, 2022, 12:36:34 AM1/13/22
to OpenCoarrays
Ahh! An answer has arrived via another forum: 

call atomic_add(i_coarray,[i_remoteimage], value) 

This seems to fix this issue, but it was NEVER mentioned in any demo code anywhere... But it gives me a thought about another project...

Knarfnarf

Nathan Weeks

unread,
Jan 15, 2022, 5:37:04 PM1/15/22
to Frank Meyer, OpenCoarrays
Hi Frank,

In addition, there should be synchronization between the 'print ... " now says;" ....' and the subsequent loop in which the atomic_add() is called, to ensure that each image has printed its coarray i_test1 value before it is modified by another image; i.e.

...
  print *, i_me, " now says;", i_test1 ! Did it get here?

! SYNC ALL !should go here

  do i_loop1 = 1, i_all                ! Add a dynamic value to it.
...

Regards,

--
Nathan


--
You received this message because you are subscribed to the Google Groups "OpenCoarrays" group.
To unsubscribe from this group and stop receiving emails from it, send an email to opencoarrays...@googlegroups.com.

Frank Meyer

unread,
Feb 24, 2022, 2:31:29 AM2/24/22
to OpenCoarrays
Hello!

I thought about this too, but even when a sync all is added where you said it still didn't work truly right... When I switched to using a type with a data integer and a round number it always works. Just putting code like this works so well I've almost sworn off sync all statements!

type :: t_datapoint
   integer :: i_data, i_round
end type
type(t_datapoint) :: t_datapoints[*]
type(t_datapoint), pointer :: t_localpoint

...

allocate(t_localpoint)
t_localpoint = t_datapoints[i_remoteinstance]
do while (t_localpoint%i_round .ne. i_roundnumber)
   deallocate(t_localpoint)
   call sleep(1)
   allocate(t_localpoint)
   t_localpoint = t_datapoints[i_remoteinstance]
end do

There is a chance that this loop will not exit if this thread falls too far behind, but it hasn't failed in code yet... You could use .ge. instead if that did happen. 

Knarfnarf

Reply all
Reply to author
Forward
0 new messages