Use OpenMP with Xeon Phi using k1om-mpss-linux-gcc compiler - openmp

I am trying to use OpenMP with k1om-mpss-linux-gcc compiler for Xeon Phi cards. I tried a simple example, but I got this error:
fatal error: omp.h: No such file or directory
How can I solve this issue?? Have anybody experienced with k1om-mpss-linux-gcc compiler?
Thanks

I'm not sure how standard that is, bit on my own MIC node, I have MPSS version 3.6 installed, which comes with GCC 5.1.1.
And calling:
/opt/mpss/3.6/sysroots/x86_64-mpsssdk-linux/usr/bin/k1om-mpss-linux/k1om-mpss-linux-gcc -v
gives amongst many other things:
Configured with: [...] --disable-libgomp [...]
So it looks like OpenMP isn't supported by the version of GCC that comes with MPSS. That said, maybe you can compile it yourself with this support enabled (I have no idea how simple that would be).

Related

how to use gcc 4.4.7 to compile C++ code with the C++11 features

I am studying a algorithm code which uses some c++11 features, however my linux system only has the gcc4.4.7 and I donot have permission to update this version. I was told that by running some kind of scripts can solve this problem, that means using gcc4.4.7 can still compile the c++ code which has the c++11 features.
my problem is that currently I only have gcc4.4.7 in linux system, so I wander if there is a solution that can help me compile a algorithm code which uses the c++11 features like the keyword "nullptr","constexpr" and so on, just using gcc4.4.7.
By the way,I have already know that gcc4.7 and above can support c++11.
Thank you very much!
If the compiler doesn't support a language feature, there is no magic "script" to run to alter the compiler's understanding of the code. As seen here some core C++11 features are not available in gcc 4.4.
So what can you do?
Ask your sysadmin to give you temporary permission to install, or ask him to install it.
You could install the latest gcc locally on your account. This needs less permissions than the classical install.
Alternately, you can install gcc from source in a local directory. This should be 100% doable without any special permission (other than write on your home dir)
Alternately, if the algorithm you are studying doesn't have many sources and doesn't use any library other than boost, you can compile and run it online. You can search for yourself, there are many C++ online compilers. http://melpon.org/wandbox/ is great because it supports multiple source files, the boost libraries and even development versions of future versions of gcc and clang.

What it takes to make OpenACC/OpenMP4.0 offloading to nvidia/mic work om GCC?

I am trying to understand how exactly I can use OpenACC to offload computation to my nvidia GPU on GCC 5.3. The more I google things the more confused I become. All the guides I find, they involve recompiling the entire gcc along with two libs called nvptx-tools and nvptx-newlib. Other sources say that OpenACC is part of GOMP library. Other sources say that the development for OpenACC support will continue only on GCC 6.x. Also I have read that support for OpenACC is in the main brunch of GCC. However if I compile a program with -fopenacc and -foffload=nvptx-non is just wont work. Can someone explain to me what exactly it takes to compiler and run OpenACC code with gcc 5.3+?
Why some guides seem to require (re)compilation of nvptx-tools, nvptx-newlib, and GCC, if, as some internet sources say, OpenACC support is part of GCC's main branch?
What is the role of the GOMP library in all this?
Is it true that development for OpenACC support will only be happening for GCC 6+ from now on?
When OpenACC support matures, is it the goal to enable it in a similar way we enable OpenMP (i.e., by just adding a couple of compiler flags)?
Can someone also provide answers to all the above after replacing "OpenACC" with "OpenMP 4.0 GPU/MIC offload capability"?
Thanks in advance
The link below contains a script that will compile gcc for OpenACC support.
https://github.com/olcf/OLCFHack15/blob/master/GCC5OffloadTest/auto-gcc5-offload-openacc-build-install.sh
OpenACC is part of GCC's main branch now, but there are some points to note. Even if there are libraries that are part of gcc, when you compile gcc, you have to specify which libraries to compile. Not all of them will be compiled by default. For OpenACC there's an additional problem. Since, NVIDIA drivers are not open source, GCC cannot compile OpenACC directly to binaries. It needs to compile OpenACC to the intermediate NVPTX instructions which the Nvidia runtime will handle. Therefore you also need to install nvptx libs.
GOMP library is the intermediate library that handles both OpenMP and OpenACC
Yes, I think OpenACC development will only be happening in GCC 6, but it may still be backported to GCC 5. But your best best would be to use GCC 6.
While I cannot comment on what GCC developers decide to do, I think in the first point I have already stated what the problems are. Unless NVIDIA make their drivers open source, I think an extra step will always be necessary.
I believe right now OpenMP is planned only for CPU's and MIC. I believe OpenMP support for both will probably become default behavior. I am not sure whether OpenMP targeting NVIDIA GPU's are immediately part of their target, but since GCC is using GOMP for both OpenMP and OpenACC, I believe eventually they might be able to do it. Also, GCC is also targeting HSA using OpenMP, so basically AMD APU's. I am not sure whether AMD GPU's will work the same way, but it maybe possible. Since, AMD is making their drivers open source, I believe they maybe easier to integrate into default behavior.

Compiling for Cortex M3 bare metal

Is there a guide somewhere that describes how to get LLVM to emit a binary for Cortex-M3 that I can massage into running bare metal? I've spent considerable time playing with LLVM on Windows and Ubuntu to no avail. I can get ARM-like assembly out. I can get bit code out, but what I really need is ELF, DWARF, Hobbit, Gandalf or any other Lord of the Rings critter that has a file format specification. Any and all help appreciated! I'm compiling LLVM 3.4 with CLANG on Ubuntu, Windows and/or OS X.
I created a firmware framework - PolyMCU https://github.com/labapart/polymcu - that is based on CMake that support GCC and LLVM. Because it is based on CMake you can build your firmware on Linux/Windows/MacOS.
It also uses Newlib and supports Baremetal/CMSIS RTOS (RTX)/FreeRTOS.
The benefit of using PolyMCU is this framework does not add any software layer on top of the libc and the MCU vendor's SDKs.
Another benefit is you can easily switch toolchains. I used this feature to get more feedback on my code by testing it with many compilers.
I also wrote a blog where I compared GCC and LLVM build size on ARM Cortex-M: http://labapart.com/blogs/3-the-importance-of-the-toolchain-version-in-embedded-space Interesting results, Clang generated code is not much bigger than GCC on Cortex-M...
The best guide that I know of is here: http://wiki.osdev.org/LLVM_Cross-Compiler. It's mostly about building an LLVM cross-compiler, but it does show a "Usage" section. However, that section specifically shows an example for a Cortex-A processor, but you should be able to get the general idea.
I have created an simple clang bare metal Cortex-M3 "hello world" program, but I don't have it in front of me. IIRC, the only options I needed were -march=thumb -mcpu=cortex-m3 as long as the LLVM compiler backend was built with the ARM thumb backend support (Again, see http://wiki.osdev.org/LLVM_Cross-Compiler). I did, however, need to link with arm-none-eabi-ld from the GCC toolchain here (http://launchpad.net/gcc-arm-embedded), and I believe that is how you can get your ELF binary.
I've since moved on to the D programming language, and I have a simple example using LDC (The LLVM D compiler) here (http://wiki.dlang.org/Extremely_minimal_semihosted_%22Hello_World%22)
So, I believe compiling bare metal ARM Cortex-M3 software with LLVM can be done, but it seems not many people have tried.
It is possible to use clang++ pulled from http://llvm.org/builds with https://launchpad.net/gcc-arm-embedded as a base, at least for the compile step.
Required extra arguments are the include paths hardcoded into gcc and certain arm-none-eabi defaults:
--target=arm-none-eabi -fshort-enums -isystem "../arm-none-eabi/include/c++/5.2.1" [-isystem ...]

gcc 4.6 on mac, how do I get it to work?

I am having problems getting gcc 4.6 to run on Mac 10.8.5.
My experience with such matters is very limited and I have been searching around and trying different things to get this to work, but to no avail. I am sorry if the answer to this problem is really simple (I actually hope that it is!)
This is my problem:
I need to run a bit of software to do an analysis, called Bayescan. This bit of software requires a library found as part of gcc4.6 to run on a MacOSX. They say so on their distribution pages (http://cmpg.unibe.ch/software/BayeScan/download.html)
I have now installed gcc4.6 using homebrew*.
However, this does not solve my problem. As I still get the following error message when I try to run the software:
dyld: Library not loaded: /usr/local/lib/libgomp.1.dylib
Google tells me that libgomp.1.dylib is part of gcc46.
When I type: gcc --version, I get:
Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr --with-gxx-include-dir=/usr/include/c++/4.2.1
Apple LLVM version 5.0 (clang-500.2.79) (based on LLVM 3.3svn)
Target: x86_64-apple-darwin12.5.0
This leaves me to believe that when my computer is looking for gcc, it looks for the old version which lacks the required library. Or gcc4.6 is not installed correctly.
So I have two questions:
1) Is my assumption/conclusion correct?
2) How do get my computer to point to gcc4.6?
Thank you in advance for any help that you can provide. This issue is driving me a little crazy.
Is there a good resource for learning how to build environments and organise dependencies, as it is a problem that I often encounter?
(*I was advised to use homebrew but I think its a bit of a waste of time for me as my computing knowledge is not sufficient for it to be a useful tool for me as the documentation is pretty limited).
You need to point your software to use the right GCC. The gcc46 installation probably put the compiler binary at /usr/local/opt/gcc46/bin/gcc-4.6 or perhaps at /usr/local/bin/gcc-4.6, depending on installation options, so use whatever option is available to make it use that compiler.
Thank you for your answers.
I managed to find out the problem and have the software running. I did two things:
1) As suggested, alter my $PATH so that it pointed at the correct gcc compiler, which was a matter of finding where homebrew had placed the link usr/local/lib/ so I pushed that to the front of $PATH
2) Also, I had to locate where homebrew had installed the library libgomp.1.dylib, and I then made a link to that within usr/local/lib
Thanks again!

How to get Cuda to use gcc 4.6

I am trying to install Cuda on my machine and as usual it causes problem with gcc 4.7 when trying to run the installer.
I have now installed gcc 4-6 which should work and I am now thinking about the best way to install CUDA.
I have thought about creating a symlink to gcc-4.6 so that the installer uses version 4.6 instead of 4.7.
Do you have any suggestions to do that or is there a better solution? It feels a bit stupid erase 4.7 from the machine in order to use cuda.
Thanks in advance!
/ Erik
Another solution to your problem is to download CUDA 5.5, which works with gcc 4.7. It is currently only available to CUDA registered developers: link to forum announcement
Create alternatives so that you can switch between versions at any time check out this helpful page:
How to change the default GCC compiler in Ubuntu?

Resources