Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

co-array fortran...with g95

Status
Not open for further replies.

salgerman

Programmer
Jan 14, 2010
520
US
So, I was curious about co-arrays and wanted to give it a try.

Read up a bit on it, downloaded one of the g95 versions (latest) that is supposed to be co-array enabled.
Wrote the following program
Code:
program coco
  integer me,img,num[*]
  integer numbers(10)
    
  me  = this_image() 
  num = 2*me
  
  sync all  
  do img = 2, num_images()
    numbers(img) = num[img]
  end do  
  sync all
    
  if ( me == 1) then
    write(*,*) 'numbers = ', numbers
  end if   
end program coco

Executed the program with
a.out --g95 images=5

Got the following message:
ERROR STOP image 4 caught signal SIGSEGV

Could use a few hints.

Germán
 
O.k., got the trivial thing working.

Now I need to understand how to use this concept in a real life program.

Code:
program coco

  integer me,img,num[*]
  integer numbers(10)
  
  numbers=0
    
  me  = this_image() 
  num = 2*me
  write(*,*) num
  
  sync all
  
  if ( me == 1) then
      do img = 1, num_images()
        numbers(img) = num[img]
      end do  
    write(*,*) 'numbers = ', numbers
  end if
   
end program coco
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top