This forum has been archived. All content is frozen. Please use KDE Discuss instead.

apple clang and OpenMP

Tags: None
(comma "," separated)
mathieuc
Registered Member
Posts
4
Karma
0

apple clang and OpenMP

Mon Aug 26, 2019 7:14 pm
Hi,

I am facing a problem using the apple clang compiler

Code: Select all
mathieu@balboa:test$ clang --version
Apple LLVM version 10.0.1 (clang-1001.0.46.4)
Target: x86_64-apple-darwin18.7.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin


trying to compile that 'main.cpp' (actually the compiler lamentably crashes):

Code: Select all
#include <Eigen/Dense>
#include <iostream>
#include "omp.h"

using namespace    std;

int main(void)
{
    omp_set_num_threads(4);
   
#pragma omp parallel for
    for (size_t k = 0; k < 5; ++k)
        cout << k;
    cout << endl;

    return 0;
}


Compilation command:

Code: Select all
clang++ -std=c++14 -O3 -o main -I/opt/local/include/libomp -Ieigen/ /opt/local/lib/libomp/libomp.dylib -Xclang -fopenmp main.cpp


Output:

Code: Select all
clang: error: unable to execute command: Illegal instruction: 4
clang: error: clang frontend command failed due to signal (use -v to see invocation)
Apple LLVM version 10.0.1 (clang-1001.0.46.4)
Target: x86_64-apple-darwin18.7.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin
clang: note: diagnostic msg: PLEASE submit a bug report to http://developer.apple.com/bugreporter/ and include the crash backtrace, preprocessed source, and associated run script.
clang: note: diagnostic msg:
********************

PLEASE ATTACH THE FOLLOWING FILES TO THE BUG REPORT:
Preprocessed source(s) and associated run script(s) are located at:
clang: note: diagnostic msg: /var/folders/44/503js_8s57l64ntjz8wg12t40000gn/T/main-ea555c.cpp
clang: note: diagnostic msg: /var/folders/44/503js_8s57l64ntjz8wg12t40000gn/T/main-ea555c.sh
clang: note: diagnostic msg: Crash backtrace is located in
clang: note: diagnostic msg: /Users/mathieu/Library/Logs/DiagnosticReports/clang_<YYYY-MM-DD-HHMMSS>_<hostname>.crash
clang: note: diagnostic msg: (choose the .crash file that corresponds to your crash)
clang: note: diagnostic msg:


Replacing -std=c++14 with -std=c++11 does the trick (http://eigen.tuxfamily.org/bz/show_bug.cgi?id=1734) but isn't a solution for me as my code requires some c++14 features. The compilation works with the c++14 switch if the #include<Eigen/dense> instruction is commented.

Is that a known issue and is there an eigen library version that fixes that problem?

Many thanks

Mathieu


Bookmarks



Who is online

Registered users: Bing [Bot], Evergrowing, Google [Bot], rblackwell