Skip to content

Race Condition in OpenBLAS on IBM OpenPower 8 #1191

Description

@grisuthedragon

This issue is an follow up to #1071 which extends the problem and gives a clearer example. I consider a code computing the TILE-QR decomposition using OpenMP 4 task depend paralleization. The code, including a makefile to reproduce the errors presented here is available at: https://github.com/grisuthedragon/openblas-tileqr. Details about the algorithm can be found here.

System Details:

  • CentOS 7.3 litle endian
  • IBM Power8 (SL822C) (20 Cores, 160 Threads)
  • GCC 5.4.1

For the first experiment I compiled OpenBLAS in single-thread mode using

make USE_OPENMP=0 USE_THREAD=0 NO_CBLAS=1 NO_LAPACKE=1 

and compiled and executed the example code via

gfortran -o tileqr_serial -fopenmp tileqr.f90 libopenblas_serial.a -lgomp 
OMP_NUM_THREADS=20 ./tileqr_serial 5120 5120 256 32

and I obtained:

LAPACK   -- Time:    8.576    Gflops/s:   20.867
Tiled    -- Time:    0.930    Gflops/s:  192.450
 
Max diff between R from tiled   and LAPACK is: 0.2E+09

which is the wrong result because the code has the provide the same result as LAPACK.

Compiling OpenBLAS with

make USE_OPENMP=1 USE_THREAD=1 NO_CBLAS=1 NO_LAPACKE=1 

and compiled and executed the example code via

gfortran -o tileqr_openmp -fopenmp tileqr.f90 libopenblas_openmp.a -lgomp 
OMP_NUM_THREADS=20 ./tileqr_openmp 5120 5120 256 32

and I obtained:

LAPACK   -- Time:    6.553    Gflops/s:   27.310
Tiled    -- Time:    1.120    Gflops/s:  159.760
 
Max diff between R from tiled   and LAPACK is: 0.1E+04

which is also wrong.

Finally I used the old threading implementation for level-3 operations by compiling OpenBLAS via:

make USE_OPENMP=1 USE_THREAD=1 USE_SIMPLE_THREADED_LEVEL3=1 NO_CBLAS=1 NO_LAPACKE=1

and for the example

gfortran -o tileqr_openmp_simple -fopenmp tileqr.f90 libopenblas_openmp_simple.a -lgomp 
OMP_NUM_THREADS=20 ./tileqr_openmp_simple 5120 5120 256 32

I get

LAPACK   -- Time:    7.574    Gflops/s:   23.627
Tiled    -- Time:    1.138    Gflops/s:  157.312
 
Max diff between R from tiled   and LAPACK is: 0.5E+07

If I compile the example using pure Netlib BLAS and Netlib LAPACK I obtain the correct results as well.

On an Ubuntu 16.04 - x86_64 with a 4 core Intel(R) Core(TM) i7-6700 CPU I got the following correct results:

./tileqr_serial 5120 5120 256 32
LAPACK   -- Time:    7.577    Gflops/s:   23.620
Tiled    -- Time:    3.499    Gflops/s:   51.145
 
Max diff between R from tiled   and LAPACK is: 0.2E-16

for the serial OpenBLAS variant, and for the OpenMP multithreaded version:

./tileqr_openmp 5120 5120 256 32
LAPACK   -- Time:    6.133    Gflops/s:   29.177
Tiled    -- Time:    4.047    Gflops/s:   44.220
 
Max diff between R from tiled   and LAPACK is: 0.2E-16

and even with the old threading scheme I get

./tileqr_openmp_simple 5120 5120 256 32
LAPACK   -- Time:    8.444    Gflops/s:   21.194
Tiled    -- Time:    3.752    Gflops/s:   47.701
 
Max diff between R from tiled   and LAPACK is: 0.2E-16

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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