[Openmp-dev] issue with opennp and clang
Bataev, Alexey
a.bataev at hotmail.com
Wed Nov 26 00:10:18 PST 2014
Amir, just add "-fopenmp" to your "clang -v llvm_openmp.ll -lm" command.
Or add "-liomp5". It must solve your problems.
Best regards,
Alexey Bataev
=============
Software Engineer
Intel Compiler Team
26.11.2014 1:27, Amir H. Ashouri пишет:
> Jeremey,
>
> Could you let me know if in the LLVM-openMP project we have the same
> opt <flags> as the default llvm-opt <flags> ?
>
> as I am running these procedures:
>
> 1- clang(Openmp) -S -emit-llvm -fopenmp llvm_openmp.c
>
> 2- opt(Openmp) <some flags> -S -o hello_opt.ll hello.ll
>
> 3- clang(Openmp) hello_opt.ll -lm
>
> I am getting :
>
> [ashouri at savina openmp_power]$ clang -v llvm_openmp.ll -lm
>
> clang version 3.5.0 (https://github.com/clang-omp/clang
> 05ab95f7cb2779bbf20341ae6ed293106de5afda)
> (https://github.com/clang-omp/llvm
> e45b045553e027cbe400cbb8ac8c264abbbfaf83)
>
> Target: x86_64-unknown-linux-gnu
>
> Thread model: posix
>
> Found candidate GCC installation: /usr/lib/gcc/i686-redhat-linux/4.4.4
>
> Found candidate GCC installation: /usr/lib/gcc/i686-redhat-linux/4.4.7
>
> Found candidate GCC installation: /usr/lib/gcc/x86_64-redhat-linux/4.4.4
>
> Found candidate GCC installation: /usr/lib/gcc/x86_64-redhat-linux/4.4.7
>
> Selected GCC installation: /usr/lib/gcc/x86_64-redhat-linux/4.4.7
>
> Candidate multilib: .;@m64
>
> Candidate multilib: 32;@m32
>
> Selected multilib: .;@m64
>
> "~/llvm/build/Debug+Asserts/bin/clang" -cc1 -triple
> x86_64-unknown-linux-gnu -emit-obj -mrelax-all -disable-free
> -main-file-name llvm_openmp.ll -mrelocation-model static
> -mdisable-fp-elim -fmath-errno -masm-verbose -mconstructor-aliases
> -munwind-tables -target-cpu x86-64 -target-linker-version 2.20.51.0.2
> -v -dwarf-column-info -resource-dir
> ~llvm/build/Debug+Asserts/bin/../lib/clang/3.5.0
> -fdebug-compilation-dir /usa/ashouri/phase_ordering/openmp_power
> -ferror-limit 19 -fmessage-length 204 -mstackrealign
> -fobjc-runtime=gcc -fdiagnostics-show-option -fcolor-diagnostics -o
> /tmp/llvm_openmp-3af5c7.o -x ir llvm_openmp.ll
>
> clang -cc1 version 3.5.0 based upon LLVM 3.5.0 default target
> x86_64-unknown-linux-gnu
>
> "/usr/bin/ld" --eh-frame-hdr -m elf_x86_64 -dynamic-linker
> /lib64/ld-linux-x86-64.so.2 -o a.out
> /usr/lib/gcc/x86_64-redhat-linux/4.4.7/../../../../lib64/crt1.o
> /usr/lib/gcc/x86_64-redhat-linux/4.4.7/../../../../lib64/crti.o
> /usr/lib/gcc/x86_64-redhat-linux/4.4.7/crtbegin.o
> -L/usr/lib/gcc/x86_64-redhat-linux/4.4.7
> -L/usr/lib/gcc/x86_64-redhat-linux/4.4.7/../../../../lib64
> -L/lib/../lib64 -L/usr/lib/../lib64
> -L/usr/lib/gcc/x86_64-redhat-linux/4.4.7/../../..
> -L/~/llvm/build/Debug+Asserts/bin/../lib -L/lib -L/usr/lib
> /tmp/llvm_openmp-3af5c7.o -lm -L.
> -L/~/openmp/runtime/exports/lin_32e/lib
> -L~/openmp/runtime/exports/lin_32e/lib -lgcc --as-needed -lgcc_s
> --no-as-needed -lc -lgcc --as-needed -lgcc_s --no-as-needed
> /usr/lib/gcc/x86_64-redhat-linux/4.4.7/crtend.o
> /usr/lib/gcc/x86_64-redhat-linux/4.4.7/../../../../lib64/crtn.o
>
> /tmp/llvm_openmp-3af5c7.o: In function `main':
>
> llvm_openmp.ll:(.text+0x75): undefined reference to `__kmpc_fork_call'
>
> /tmp/llvm_openmp-3af5c7.o: In function `.omp_microtask.':
>
> llvm_openmp.ll:(.text+0xf1): undefined reference to `omp_get_thread_num'
>
> llvm_openmp.ll:(.text+0xf9): undefined reference to `omp_get_num_threads'
>
> llvm_openmp.ll:(.text+0x101): undefined reference to `omp_get_max_threads'
>
> llvm_openmp.ll:(.text+0x12d): undefined reference to
> `__kmpc_cancel_barrier'
>
>
> its strange cuz when I dont invoke -emit-llvm and just compiler and
> link at once with /clang(openmp) -fopenmp foo.c /the executable can be
> run with max threads.
>
>
> Appreciate any helps,
>
>
> -Amir
>
>
> On Wed, Nov 12, 2014 at 11:19 AM, Amir H. Ashouri
> <amirhossein.ashouri at gmail.com <mailto:amirhossein.ashouri at gmail.com>>
> wrote:
>
> Thanks all for their responses. I re-compile the clang with OpenMP
> support and the library files and set the library paths and it
> worked finally. I might think as Alexey mentioned, that the CentOS
> was using the default clang to that matter before head.
>
> Regards,
>
> -Amir
>
> On Wed, Nov 12, 2014 at 11:55 AM, Jack Howarth
> <howarth.mailing.lists at gmail.com
> <mailto:howarth.mailing.lists at gmail.com>> wrote:
>
> Amir,
> You didn't say what platform you are trying to use clang-omp
> on. If it is OS X, the llvm34-3.4.2-2 fink package
> (http://finkproject.org) has a port of the clang-omp
> changes at commit
> 13e28835a005b44481387a32666ed39a7db58eb6 over the llvm 3.4.2
> release. While the fink llvm35 packaging isn't released yet,
> you can obtain the necessary llvm35* packaging files to build
> it from
> http://fink.cvs.sourceforge.net/viewvc/fink/experimental/fangism/finkinfo/.
> This has a port of the clang-omp changes at commit
> 3f687cbc520a8b8f506d7941f0cebd6c5af1cef6 over llvm 3.5.0 with
> the openmp trunk changes at r219214.
> Jack
>
> On Fri, Nov 7, 2014 at 3:22 PM, Amir H. Ashouri
> <amirhossein.ashouri at gmail.com
> <mailto:amirhossein.ashouri at gmail.com>> wrote:
>
> I did that.
>
> Downloaded and compiled with gcc, then export all the
> PATHs. Otherwise, It would have given me compile error
> because the "omp.h" is different here.
>
> -Amir
>
> On Fri, Nov 7, 2014 at 3:13 PM, Millad Ghane
> <millad.mg at gmail.com <mailto:millad.mg at gmail.com>> wrote:
>
> Hi,
>
> You haven't imported the openmp library to Clang yet.
> It simply ignores the pragmas.
>
> Go to this link and follow the instructions.
> clang-omp.github.io <http://clang-omp.github.io>
>
>
> Best Regards,
> Millad
>
>
> On Friday, November 7, 2014, Amir H. Ashouri
> <amirhossein.ashouri at gmail.com
> <mailto:amirhossein.ashouri at gmail.com>> wrote:
>
> Greetings,
>
> so I tried to use opennp with one of the latest
> version of clang, |clang version 3.4.2
> (tags/RELEASE_34/dot2-final)|. Followed the
> procedure to compilre and export the library
> PATHs, Compiling my hello.c using :
>
> |clang-fopenmp hello.c|
>
> and then running it, still it can't use more than
> 1 thread:
>
> |Bash-4.1$./a.out
> Hello from thread0, nthreads1|
>
> I tried to manually export |export
> OMP_NUM_THREADS=8| but that didn't solve anything
> as well, As a workaround I define #pragma omp
> parallel num_threads(#noofthreads) inside the
> source code but still the issue is there.
>
> Any suggestions would be appreciated.
>
>
> -Amir
>
>
> p.sl <http://p.sl/>: This is the hello.c:
>
> |#include <omp.h>
> #include <stdio.h>
> int main() {
> #pragma omp parallel
> printf("Hello from thread %d, nthreads %d\n", omp_get_thread_num(), omp_get_num_threads|
>
>
>
> --
> Sent from my iPhone
>
>
>
> _______________________________________________
> Openmp-dev mailing list
> Openmp-dev at dcs-maillist2.engr.illinois.edu
> <mailto:Openmp-dev at dcs-maillist2.engr.illinois.edu>
> http://lists.cs.uiuc.edu/mailman/listinfo/openmp-dev
>
>
>
>
>
>
> _______________________________________________
> Openmp-dev mailing list
> Openmp-dev at dcs-maillist2.engr.illinois.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/openmp-dev
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/openmp-dev/attachments/20141126/0528d0a0/attachment.html>
More information about the Openmp-dev
mailing list