Skip to content

OpenMP nested parallelism bug in BLIS #267

Closed
@jkd2016

Description

@jkd2016

There appears to be an threading issue with BLIS compiled with OpenMP and run inside a parallel nested loop.

It crashes the Elk code with a segmentation fault.

I can't reproduce the seg. fault with a small example, but the following program never terminates on our AMD machine:

program test
implicit none
integer, parameter :: n=20
integer i
real(8), allocatable :: a(:,:),b(:,:),c(:,:)

!$OMP PARALLEL DEFAULT(SHARED) &
!$OMP PRIVATE(a,b,c)
!$OMP DO
do i=1,100
  allocate(a(n,n),b(n,n),c(n,n))
  a=1.d0
  b=1.d0
  call dgemm('N','N',n,n,n,1.d0,a,n,b,n,0.d0,c,n)
  deallocate(a,b,c)
end do
!$OMP END DO
!$OMP END PARALLEL

end program

The above code has to be compiled with

gfortran -fopenmp test.f90 lapack.a libblis.a

Both the number of OpenMP and BLIS threads have to be larger than 1:

export OMP_NUM_THREADS=2
export BLIS_NUM_THREADS=2

If either OMP_NUM_THREADS=1 or BLIS_NUM_THREADS=1 then the code runs fine.

If BLIS is compiled with pthreads:

./configure -t pthreads zen

then the code also runs fine.

The official AMD release (https://developer.amd.com/amd-cpu-libraries/blas-library/) was compiled with OpenMP and therefore also has the bug.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions