pghysels / STRUMPACK

Structured Matrix Package (LBNL)
http://portal.nersc.gov/project/sparse/strumpack/
Other
168 stars 40 forks source link

Hanging omp pragmas in BLRMatrixMPI.cpp and LLVM compilers #41

Open mcordery opened 3 years ago

mcordery commented 3 years ago

Hi, just wanted to apprise you of an issue I ran into using an LLVM based compiler (Intel). In the file BLRMatrixMPI.cpp, there are a number of code segments with openmp pragmas such as

505 for (std::size_t j=i+1; j<B1; j++) 506 if (g->is_local_col(j) && adm(i, j)) 507 #pragma omp task default(shared) firstprivate(i,j) 508 A11.compress_tile(i, j, opts);

This may be ok in gcc but in llvm this creates an issue where the pragma is the line following the if and line 508 is left orphaned from the for-if block. This creates a compiler error where the variable j is left undefined. There's probably about a 10-12 instances of this in this file and is fixed by doing something like

505 for (std::size_t j=i+1; j<B1; j++) 506 if (g->is_local_col(j) && adm(i, j)) { 507 #pragma omp task default(shared) firstprivate(i,j) 508 A11.compress_tile(i, j, opts); }

Once that's fixed, the code based compiles fine

pghysels commented 3 years ago

Thank you for reporting, it's really appreciated. I hope this fixes the issue: https://github.com/pghysels/STRUMPACK/commit/5cd7f6d6490a53f16dd62e5de219308dbda50fba

However, I could not reproduce the issue with: -- The CXX compiler identification is Intel 19.0.0.20190206 -- Found OpenMP_CXX: -qopenmp (found version "5.0")

or with -- The CXX compiler identification is Clang 10.0.0 -- Found OpenMP_CXX: -fopenmp=libomp (found version "4.5")

What compiler did you use?

I am currently having some problems with the Travis testing script. I plan to set that up to also test with clang compilers. That should catch this type of errors.