Fortran: segmentation fault when using OMP WORKSHARE

General OpenMP discussion

Fortran: segmentation fault when using OMP WORKSHARE

Postby bbyingto » Tue Feb 19, 2013 5:53 pm

Hello,

I'm having a spot of trouble making some vector operations in a code of mine parallelized with openmp. I have the following stripped down test case that exhibits the problem for me:

Code: Select all
Program main
    Use omp_lib

    Type group
        Real(8), Pointer ::  a(:),b(:)
    End Type group
    type(group) :: test

    allocate(test%a(100),test%b(100))


    !$OMP PARALLEL
    !$OMP WORKSHARE
      test%a = 2 *test%b
    !$OMP END WORKSHARE
    !!$OMP DO SCHEDULE(STATIC)
    !Do i=1,100
    !  test%a(i) = 2 *test%b(i)
    !end do
    !!$OMP END DO
    !$OMP END PARALLEL


end Program Main


As you can see, the code contains two versions of the same formula, one using OMP WORKSHARE and the other using OMP DO. If I let things run as is, then I get a segmentation fault. If I comment out the workshare and enable the parallel do, then it runs without error. I do not have this problem if my arrays a and b are 'loose' rather than contained in the type 'group', but in my main code I am forced to use the type declaration so changing that is not an option. Unfortunately, in my real code the arrays are also either of dimension 2 or 3, so changing the syntax to use explicit loops throughout 10k lines is not a desirable solution either. Fortran is not my native programing language though, so I'm hoping there is something subtle (or not so subtle!) here that I'm missing. I'm not compiling with any special options, save the -mp that enables openmp, and handing the --version flag to my compiler gives me 'pgf90 11.9-0 64-bit target on x86-64 Linux -tp k8e'. If there is any other information that would be useful for me to provide please let me know!

Thanks in advance!
bbyingto
 
Posts: 2
Joined: Tue Feb 19, 2013 5:23 pm

Re: Fortran: segmentation fault when using OMP WORKSHARE

Postby MarkB » Wed Feb 20, 2013 4:08 am

Hi there,

I can't see anything wrong with your code, so this does look like it might be a compiler bug. It would be worth trying a more recent version of pgf90, or a different compiler, if that is possible. Does it still fail if the arrays are declared as ALLOCATABLE instead of POINTER?

Hope that helps,
Mark.
MarkB
 
Posts: 487
Joined: Thu Jan 08, 2009 10:12 am
Location: EPCC, University of Edinburgh

Re: Fortran: segmentation fault when using OMP WORKSHARE

Postby kazempour » Wed Feb 20, 2013 2:07 pm

Hi there,

I also run the same code on my PC and I didn't get any error. I used Intel Parallel Studio XE 2013 and its FORTRAN COMPILER to run your code and every thing was ok.
Here is the output of my test:

[mahdi@hpcn00 OpenMP]$ ifort -openmp -o WORKSHARE WORKSHARE.f90
[mahdi@hpcn00 OpenMP]$ ./WORKSHARE
[mahdi@hpcn00 OpenMP]$

Regards,
Mahdi
kazempour
 
Posts: 13
Joined: Wed Jul 25, 2012 4:11 am

Re: Fortran: segmentation fault when using OMP WORKSHARE

Postby bbyingto » Thu Feb 21, 2013 12:52 pm

Thanks all,

I still get this problem with all versions of pgi compilers I could get my hands on, but the problem does not exist if I use intel or gnu compilers. The problem also goes away if I use allocatables instead of pointers, as MarkB suggested. Not sure if that is an option in my code, but regardless it looks that moving forward I'm going to have to talk to the group supporting my hardware and/or the pgi people. (I'd just switch compilers, but Intel *might* be having issues of it's own on this specific machine, and gnu lagged behind the others the last time I benchmarked everything)

Thanks again!

~Ben
bbyingto
 
Posts: 2
Joined: Tue Feb 19, 2013 5:23 pm

Re: Fortran: segmentation fault when using OMP WORKSHARE

Postby MarkB » Fri Feb 22, 2013 4:07 am

Hi Ben,

It would be worth submitting a bug report to Portland Group on this.

bbyingto wrote:Thanks again!


You're welcome!

Mark.
MarkB
 
Posts: 487
Joined: Thu Jan 08, 2009 10:12 am
Location: EPCC, University of Edinburgh


Return to Using OpenMP

Who is online

Users browsing this forum: Google [Bot] and 10 guests