IntelLabs / ParallelAccelerator.jl

The ParallelAccelerator package, part of the High Performance Scripting project at Intel Labs
BSD 2-Clause "Simplified" License
294 stars 32 forks source link

transpose test failure when using OpenBLAS due to use of `domatcopy` #147

Open lkuper opened 7 years ago

lkuper commented 7 years ago

When using ParallelAccelerator with OpenBLAS on either Mac or Linux, ParallelAccelerator fails to compile one of the transpose tests. This is happening because ParallelAccelerator is generating code that uses domatcopy, which is a BLAS extension that is in MKL but not supported by OpenBLAS (there's an open issue about it here: xianyi/OpenBLAS#51).

On Mac the issue actually manifests as a linker error (this is under Julia 0.5.2 with GCC 7.1.0 and OpenBLAS):

julia> Pkg.test("ParallelAccelerator")
[lots of stuff elided]
testing transpose...
Undefined symbols for architecture x86_64:
  "_cblas_domatcopy", referenced from:
      pptranspose_tp1169(j2c_array<double>&, j2c_array<double>*) in cgen_output71.o
ld: symbol(s) not found for architecture x86_64
collect2: error: ld returned 1 exit status
OptFramework failed to optimize function TestTranspose.##transpose_t#1169 in optimization pass ParallelAccelerator.Driver.toCGen with error ErrorException("failed process: Process(`g++ -g -shared -fopenmp -std=c++11 -o /var/folders/jk/d5ymgqj577xdc5n_zcz6pzxr0000gq/T/tmpDPoGSE/libcgen_output71.so.1.0 /var/folders/jk/d5ymgqj577xdc5n_zcz6pzxr0000gq/T/tmpDPoGSE/cgen_output71.o -lblas -lm`, ProcessExited(1)) [1]")
Done testing transpose.
[etc.]

On Ubuntu it looks like a compiler error (this is under Julia 0.5.1 with GCC 5.4.0 and OpenBLAS):

julia> Pkg.test("ParallelAccelerator")
[lots of stuff elided]
testing transpose...
/tmp/tmp2b7M8Y/cgen_output71.cpp: In function ‘void pptranspose_tp1169(j2c_array<double>&, j2c_array<double>*)’:
/tmp/tmp2b7M8Y/cgen_output71.cpp:26:68: error: ‘cblas_domatcopy’ was not declared in this scope
              A.data, A.ARRAYSIZE(1), SSAValue0.data, A.ARRAYSIZE(2));
                                                                    ^
/tmp/tmp2b7M8Y/cgen_output71.cpp: In function ‘void pptranspose_tp1169_unaliased(j2c_array<double>&, j2c_array<double>*)’:
/tmp/tmp2b7M8Y/cgen_output71.cpp:37:68: error: ‘cblas_domatcopy’ was not declared in this scope
              A.data, A.ARRAYSIZE(1), SSAValue0.data, A.ARRAYSIZE(2));
                                                                    ^
OptFramework failed to optimize function TestTranspose.##transpose_t#1169 in optimization pass ParallelAccelerator.Driver.toCGen with error ErrorException("failed process: Process(`g++ -O3 -fopenmp -std=c++11 -g -fpic -c -o /tmp/tmp2b7M8Y/cgen_output71.o /tmp/tmp2b7M8Y/cgen_output71.cpp`, ProcessExited(1)) [1]")
Done testing transpose.
[etc.]

We should consider not generating code that uses domatcopy when MKL isn't available.

lkuper commented 7 years ago

Here's what the error looks like on Travis (Travis Linux builds are now using OpenBLAS): https://travis-ci.org/IntelLabs/ParallelAccelerator.jl/jobs/243061897#L546-L554