Intel® C++ Compiler
Community support and assistance for creating C++ code that runs on platforms based on Intel® processors.
7932 Discussions

Problem compiling Eigen library (GPU offload) in a self-contained mini-app.

Christos_Kotsalos
1,000 Views

Hello,

I have a mini-app (see below) that calls an Eigen solver from a GPU accelerated region, but the compiler fails to compile it (probably compiler bug).

 

#include <stdio.h>
#include "Eigen/Core"
#include "Eigen/Dense"
#include "Eigen/LU"
#include <random>

// for DIM 17 and above : stack size issues
#define DIM 16

using namespace Eigen;
using MatType = Matrix<double, DIM, DIM>;
using VecType = Matrix<double, DIM, 1>;

void print_solution(VecType x, int dim)
{
    printf("\n");
    printf("x = ");
    for (int i = 0; i < dim; i++)
        printf("%.3f ", x(i));
    printf("\n\n");
}

#if defined(USE_OPENACC)
#pragma acc routine seq
#endif
#if defined(USE_OPENMP)
#pragma omp declare target
#endif
#if defined __NVCC__
__host__ __device__
#endif
void solve_offload(MatType *A, VecType *b, int dim)
{
    VecType x = A->partialPivLu().solve(*b);
    #if defined(USE_OPENACC)
    printf("[OpenACC]");
    #endif
    #if defined(USE_OPENMP)
    printf("[OpenMP]");
    #endif
    print_solution(x,dim);
}
#if defined(USE_OPENMP)
#pragma omp end declare target
#endif


int main() 
{
    std::random_device rd; // seeding
    std::mt19937 mt(rd());
    std::uniform_real_distribution<double> nums(-10, 10);

    MatType *A = (MatType*)malloc(sizeof(MatType));
    VecType *b = (VecType*)malloc(sizeof(VecType));

    do
    {
        // initialization
        for(int r = 0; r < DIM; r++) {
            for(int c = 0; c < DIM; c++) {
                (*A)(r,c) = nums(mt);
            }
            (*b)(r) = nums(mt);
        }
    } while (!A->fullPivLu().isInvertible()); // Checking Invertibility

    VecType x = A->partialPivLu().solve(*b);
    printf("\n");
    printf("[Host]");
    print_solution(x,DIM);

    #if defined(USE_OPENACC)
    #pragma acc data copyin(A[0:DIM*DIM],b[0:DIM])
    #endif
    #if defined(USE_OPENMP)
    #pragma omp target data map(to:A[0:DIM*DIM],b[0:DIM])
    #endif
    {
        #if defined(USE_OPENACC)
        #pragma acc kernels present(A,b)
        #endif
        #if defined(USE_OPENMP)
        #pragma omp target
        #endif
        {
            solve_offload(A, b, DIM);
            // We need to wrap it around `omp declare target` or
            // `acc routine seq` to work!
            // A->partialPivLu().solve(*b);
        }
    }

    return 0;
}

 

To reporduce the error, I follow these steps:

  1. git clone --branch olupton/nvc++-cuda https://github.com/BlueBrain/eigen.git
  2. icpx -Ieigen -DEIGEN_DONT_VECTORIZE=1 -DEIGEN_DONT_PARALLELIZE=1 -DEIGEN_NO_CPUID -DUSE_OPENMP -qopenmp -fopenmp-targets=spir64 -o eigen_offload eigen.cpp
Using NVIDIA compilers I have managed to successfully compile this miniapp, though with Intel-oneAPI (tried it in iIntel DevCloud) I get the error below:
344 warnings generated.
LLVM ERROR: Type mismatch in constant table!
PLEASE submit a bug report to https://software.intel.com/en-us/support/priority-support and include the crash backtrace.
Stack dump:
0.      Program arguments: /glob/development-tools/versions/oneapi/2022.1.2/oneapi/compiler/2022.0.2/linux/bin-llvm/llvm-link /tmp/eigen-660a10.bc /tmp/libomp-spirvdevicertl-0fd3f3.o -o /tmp/spir64-linkomp-2d06f8.bc --suppress-warnings
Stack dump without symbol names (ensure you have llvm-symbolizer in your PATH or set the environment var `LLVM_SYMBOLIZER_PATH` to point to it):
/glob/development-tools/versions/oneapi/2022.1.2/oneapi/compiler/2022.0.2/linux/bin-llvm/llvm-link(+0x311bba)[0x55ecac9b4bba]
/glob/development-tools/versions/oneapi/2022.1.2/oneapi/compiler/2022.0.2/linux/bin-llvm/llvm-link(+0x30fd90)[0x55ecac9b2d90]
/glob/development-tools/versions/oneapi/2022.1.2/oneapi/compiler/2022.0.2/linux/bin-llvm/llvm-link(+0x31201d)[0x55ecac9b501d]
/lib/x86_64-linux-gnu/libpthread.so.0(+0x12890)[0x7f2ad16b2890]
/lib/x86_64-linux-gnu/libc.so.6(gsignal+0xc7)[0x7f2ad12ede97]
/lib/x86_64-linux-gnu/libc.so.6(abort+0x141)[0x7f2ad12ef801]
/glob/development-tools/versions/oneapi/2022.1.2/oneapi/compiler/2022.0.2/linux/bin-llvm/llvm-link(+0x2e62d4)[0x55ecac9892d4]
/glob/development-tools/versions/oneapi/2022.1.2/oneapi/compiler/2022.0.2/linux/bin-llvm/llvm-link(+0x2e6165)[0x55ecac989165]
/glob/development-tools/versions/oneapi/2022.1.2/oneapi/compiler/2022.0.2/linux/bin-llvm/llvm-link(+0x1c3792)[0x55ecac866792]
/glob/development-tools/versions/oneapi/2022.1.2/oneapi/compiler/2022.0.2/linux/bin-llvm/llvm-link(+0x1a01a5)[0x55ecac8431a5]
/glob/development-tools/versions/oneapi/2022.1.2/oneapi/compiler/2022.0.2/linux/bin-llvm/llvm-link(+0x197d13)[0x55ecac83ad13]
/glob/development-tools/versions/oneapi/2022.1.2/oneapi/compiler/2022.0.2/linux/bin-llvm/llvm-link(+0x196a62)[0x55ecac839a62]
/glob/development-tools/versions/oneapi/2022.1.2/oneapi/compiler/2022.0.2/linux/bin-llvm/llvm-link(+0x27e125)[0x55ecac921125]
/glob/development-tools/versions/oneapi/2022.1.2/oneapi/compiler/2022.0.2/linux/bin-llvm/llvm-link(+0x2530d0)[0x55ecac8f60d0]
/glob/development-tools/versions/oneapi/2022.1.2/oneapi/compiler/2022.0.2/linux/bin-llvm/llvm-link(+0x2b767c)[0x55ecac95a67c]
/glob/development-tools/versions/oneapi/2022.1.2/oneapi/compiler/2022.0.2/linux/bin-llvm/llvm-link(+0x2b4e32)[0x55ecac957e32]
/glob/development-tools/versions/oneapi/2022.1.2/oneapi/compiler/2022.0.2/linux/bin-llvm/llvm-link(+0x314454)[0x55ecac9b7454]
/glob/development-tools/versions/oneapi/2022.1.2/oneapi/compiler/2022.0.2/linux/bin-llvm/llvm-link(+0x314df7)[0x55ecac9b7df7]
/glob/development-tools/versions/oneapi/2022.1.2/oneapi/compiler/2022.0.2/linux/bin-llvm/llvm-link(+0x3156dc)[0x55ecac9b86dc]
/glob/development-tools/versions/oneapi/2022.1.2/oneapi/compiler/2022.0.2/linux/bin-llvm/llvm-link(+0x314009)[0x55ecac9b7009]
/glob/development-tools/versions/oneapi/2022.1.2/oneapi/compiler/2022.0.2/linux/bin-llvm/llvm-link(+0x31413a)[0x55ecac9b713a]
/glob/development-tools/versions/oneapi/2022.1.2/oneapi/compiler/2022.0.2/linux/bin-llvm/llvm-link(+0x2b2e31)[0x55ecac955e31]
/glob/development-tools/versions/oneapi/2022.1.2/oneapi/compiler/2022.0.2/linux/bin-llvm/llvm-link(+0x2b24dc)[0x55ecac9554dc]
/glob/development-tools/versions/oneapi/2022.1.2/oneapi/compiler/2022.0.2/linux/bin-llvm/llvm-link(+0x2bce3f)[0x55ecac95fe3f]
/glob/development-tools/versions/oneapi/2022.1.2/oneapi/compiler/2022.0.2/linux/bin-llvm/llvm-link(+0x2bc458)[0x55ecac95f458]
/glob/development-tools/versions/oneapi/2022.1.2/oneapi/compiler/2022.0.2/linux/bin-llvm/llvm-link(+0x18e63c)[0x55ecac83163c]
/glob/development-tools/versions/oneapi/2022.1.2/oneapi/compiler/2022.0.2/linux/bin-llvm/llvm-link(+0x18c1f0)[0x55ecac82f1f0]
/lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0xe7)[0x7f2ad12d0b97]
/glob/development-tools/versions/oneapi/2022.1.2/oneapi/compiler/2022.0.2/linux/bin-llvm/llvm-link(+0x18b6a9)[0x55ecac82e6a9]
clang++: error: unable to execute command: Aborted
clang++: error: sycl-link command failed due to signal (use -v to see invocation)
Intel(R) oneAPI DPC++/C++ Compiler 2022.0.0 (2022.0.0.20211123)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /glob/development-tools/versions/oneapi/2022.1.2/oneapi/compiler/2022.0.2/linux/bin-llvm
clang++: note: diagnostic msg: Error generating preprocessed source(s).

Any feedback would be really appreciated.

Best,

Christos

0 Kudos
6 Replies
VarshaS_Intel
Moderator
950 Views

Hi,


Thanks for posting in Intel Communities.


We were able to reproduce your issue on Intel DevCloud using the ICPX compiler. We are working on your issue and we will get back to you soon.


Thanks & Regards,

Varsha


0 Kudos
Christos_Kotsalos
916 Views

Hi Varsha,

Thank you very much for your quick response.

I am looking forward to hearing from you regarding this compiler issue.

Best,

Christos

0 Kudos
VarshaS_Intel
Moderator
896 Views

Hi,


Thanks for reporting the bug.


We have reported this issue. And, the development team is looking into the issue.


Thanks & Regards,

Varsha


0 Kudos
VarshaS_Intel
Moderator
784 Views

Hi,


Thank you for your patience. The issue raised by you has been fixed in Intel oneAPI Base Toolkit and HPC Toolkit version(2022.3) and ICPX(2022.2). Please download and let us know if this resolves your issue.


Thanks & Regards,

Varsha


0 Kudos
Christos_Kotsalos
769 Views

Hi Varsha,

 

Thank you very much for letting me know. Indeed, I am now able to compile the mini-app.

Therefore, we can close this issue.

 

Best,

Christos

0 Kudos
VarshaS_Intel
Moderator
754 Views

Hi,


>>I am now able to compile the mini-app.

Glad to know that your issue is resolved.


>>Therefore, we can close this issue.

Thanks for the confirmation. If you need any additional information, please post a new question as this thread will no longer be monitored by Intel.


Have a good day!


Thanks & Regards,

Varsha


0 Kudos
Reply