OpenMP 3.0 for Visual Studio - c++

Currently I am developing a cross-plattform framework where I want to use actuall features of openmp.
I would like to make use of the "new features" of openmp 3.0 (or later).
(Such like unsigned parallel for loops or tasks etc.,
I haven't developed on a windows plattform for quite a while and
as I have seen for now even Visual Studio 2015 does only support openmp 2.0 (At least when using msvc, see e.g. All OpenMP Tasks running on the same thread or https://blogs.msdn.microsoft.com/vcblog/2014/11/12/visual-studio-2015-preview-is-now-available/) So my questions are:
Is there any sane reason to not support openmp3.0 in Visual Studio?
Is there any way to get it work under Visual Studio?
I am aware, that I could use the Intel C++ compiler, but unfortunately i do not have access to one. So is there a free alternative to the Intel compiler with openmp3.0 support?
Thanks in advance

Well, you might try GCC ports for Windows, native (mingw64) and on top of cygwin.
Try to install msys2 and you'll get ming64 as well as cygwin compilers with OpenMP support

You can try cygwin.
cygwin is gcc compiler by GNU for windows.

Related

How do I use other c++ compilers with CUDA on Windows?

I'm trying to build a simple application with CUDA and I've been trying for hours on end and I just can't make it work on windows. nvcc absolutely refuses to compile without Visual Studio's compiler which doesn't support things I need. I tried building using nvcc with clang but It just asks me to use Visual Studio's compiler. I've also tried using clang directly since it now supports CUDA but I receive this error:
clang++.exe: error: Unsupported CUDA gpu architecture: compute_52
This makes no sense to me because I have the CUDA toolkit version 7.5 and my graphics card is a GTX 970 (two of them). I have googled this extensively and everywhere I come across the error the person always has is their CUDA toolkit is < 7.5. I'm on the brink of tears right now trying to get something as simple as VLA to work on this CUDA application and I just can't achieve it...
The CUDA windows toolchain requires the Visual Studio C++ compiler. You cannot use anything else on that platform. If the VS compiler doesn't support the language features you need within CUDA host code, you have no choice but to change platforms, or your expectations.
You can still potentially compile non-CUDA host code using another compiler and then link that code using NVCC and the VS toolchain.
Try to use clang-cl, --cubin=clang-cl.exe
It may be worth to work on a Linux VM or WSL2 within windows. As per the CUDA docs.
To compile new CUDA applications, a CUDA Toolkit for Linux x86 is
needed. CUDA Toolkit support for WSL is still in preview stage as
developer tools such as profilers are not available yet. However, CUDA
application development is fully supported in the WSL2 environment, as
a result, users should be able to compile new CUDA Linux applications
with the latest CUDA Toolkit for x86 Linux.
https://docs.nvidia.com/cuda/wsl-user-guide/index.html#:~:text=However%2C%20CUDA%20application%20development%20is,becomes%20available%20within%20WSL%202.

What tool exists to compile C++2011 code for Windows target?

I created a program in C++2011 that actually uses features of C++2011: mutex, unique_lock, condition_variable, future and async.
I've tested it on Debian Linux 64 bits box, and it compiles and runs like a charm.
Now, I want to compile it for Windows.
I tried Visual C++ Express 2010, but it does not have support for the new features of C++. (The Beta for Visual C++/Studio 2012 only runs on Windows 8.)
I tried cross compiling with mingw-g++ (4.6), but it looks like these new features are not supported for the Windows target. (Although they are supported for g++-4.6 for Linux target).
Is there any (free?) solution as of today to compile a C++2011 program for Windows target?
My (commercial) Just::Thread library provides std::thread, std::mutex and friends for MSVC 2005/2008/2010 and the TDM port of mingw-gcc 4.5/4.6 on Windows. It's not free, though.
Alternatively, look for a build of gcc 4.7 for mingw. Support for the thread library on Windows is supposed to be available out-of-the-box with gcc 4.7, but it's not officially released yet.
I have not tried it yet, but this quote from the project site sounds promising:
"Builds support the following technologies:
OpenMP
LTO
Graphite
std_threads
std_atomics
..."
http://code.google.com/p/mingw-builds/
hope this helps

C++11 compiler for windows

I was just watching a few videos on Channel9. I found things like lambdas really cool. when I tried to copy the example, it failed. auto didn't work either.
I'm using Nokia's qtcreator which ships with gcc-4.4.0.
I wanted to know which compiler has the fun features implemented so I could play around and learn. I'm not anti MS or anyhting so I don't mind trying Visual Studio if it has those features.
Nearly all C++11 features are implemented in the GCC 4.6.x . A good place to get latest GCC builds (MinGW) is the TDM website - http://tdm-gcc.tdragon.net/download . It should be easy to replace your current GCC with TDM GCC by overwriting files...
A special version of MinGW:
MinGW-Builds gives you everything gcc offers (currently 4.7.2)
That is: Including support for std::thread, std::async, std::future and friends.
As far as I know that's by far the most complete C++11 you can get on Windows.
You just get the MinGW-build binaries here. Unlike other gcc-based installations it supports posix threads, which are currently key to getting the gcc support for C++11 threads and friends working on Windows.
Extract the directory mingw to any location and add the following two paths to your PATH environment variable: (well, change F:\coding ...)
F:\coding\MinGW\bin
F:\coding\MinGW\msys\1.0\bin
Add both, separated by semi colon. You will need to log out or reboot. To verify that you got it right, you can open a command prompt, and write
g++ --version
You should get a response like this, mentioning MinGW-builds:
g++ (Built by MinGW-builds project) 4.7.2
Copyright (C) 2012 Free Software Foundation, Inc. ...
I wrote a more complete instruction for getting this going with Eclipse, here: http://scrupulousabstractions.tumblr.com/post/36441490955/eclipse-mingw-builds
For playing around and learning C++11 on Windows, I recommend MinGW Distro by Stephan T. Lavavej. The newest version contains GCC 4.8.2 and Boost 1.55.0.
Take a look at MinGW-w64 if you're looking for a gcc-compatible compiler on Windows that supports a number of C++11 features.
Also if you're just looking for lambas and auto, as well as some other C++11 features like decltype, etc., (again, not as many feature are implemented compared to the latest stable gcc branch) then you can also use the free Visual Studio 2010 Express for C++ on Windows.
See here for an overview of the compilers and the supported C++11 features.
Scott Meyers maintains a webpage here:
C++11FeatureAvailability
The First link on the Webpage is:
Apache Wiki Overview of C++11 Support in Several Compilers is what you should have a look at.It doccuments in detail C++11 features supported by all popular compilers.
The Visual Studio 11 preview also supports lambdas.
Visual Studio 2017 has support in C++11, C++14, & C++17. + some of the Modern C++ "experimental" modules. If you decide on Visual Studio, you set the C++ standard at the project properties. C++11 is by default, but you can set it to C++14, C++17, or latest draft.
As regards g++, C++0x feature support should be detailed here: C++0x/C++11 Support in GCC - GNU Project - Free Software Foundation (FSF)
If you want to test most of the C++11 syntax using a Windows machine you have two options:
Install Cygwin and compile from sources gcc-4.7 (latest snapshot) and clang++ with libstdc++. However it is not guaranteed that this will work.
Safest bet: Install a modern Linux (such as Ubuntu if you are a Linux newbie) in a virtual machine (VirtualBox is a free virtual machine application) and in this virtual machine compile gcc-4.7 and clang++. I was able to successfully compile both of them on Ubuntu 11.10 following the instructions from this website.
Best option, as of 2014, is to use Visual Studio 2013 updated with the latest CTP (this will work even for the Express edition).
Few Min-GW Compilers do not support C++ Version 11 or later. This version is required for thread in OpenCV. So I will suggest using TDM-GCC Compiler instead of MinGW Compiler. Install this compiler and set path C:\TDM-GCC-64\bin to the system's environmental variable.

I'm starting my C++ learning, using CodeBlocks and windows, what compiler should I use?

I'm under the impression certain compilers only work for making windows applications.
If you want to develop GUI applications and/or go for maximum portability, go for MinGW for compiler, and Qt Creator for IDE (it comes with MinGW bundled).
If you want to stick to Windows, and don't mind coding UI directly using Win32 API, then Visual C++ Express would do the trick.
If you care about portability to Unix, use the mingw compilers which are based on gcc. Gcc is widely available on a lot of architectures and OS. If you only work for Windows, Visual Studio Express might be a better choice in comparison to Codeblocks.
How about Visual Studio Express? This is a complete package with a very nice IDE.
Codeblocks supports many compilers. I recommend using CB with mingw for general purpose usage.
Depends what you want to do. If you want to use POSIX APIs you may want to use mingw. If you distribute to Windows folks, you probably want to use Visual Studio since its compiler is usually better at producing optimized code.
CMake might be something you want to use if you want multiple platforms - it'll create your CodeBlocks/Eclipse/Visual Studio/GNU Make projects for you w/ all the correct settings.
If you are keen on using Codeblocks mingw is a good choice. But C++ is not like Java. It is not write once run everywhere. Also it is not write once compile on different platforms and run everywhere.
You have to change your code for different platforms (win/unix etc...) (eg: socket programming differs on Windows and Linux)
This means that you are not platform independent. So I recommend you to go for a better one. Eclipse is good, community is great but for me QT or Visual Studio (6.0 or 2008 for .Net) would be better.

Are the C++ ARM compilers bundled along with VS2008 redistributable?

Are the VS2008 C++ ARM compilers targeting the WinCE operating system redistributable? Or does Microsoft provide a separate redistributable package (SDK?) ? I am looking for a C++ ARM compiler (actually a complete build environment) for WinCE which I can distribute along with my application for free. What are my options here?
I'd be rather suprised if it were, your use case is rather uncommon. I don't remember seeing them in the redist.txt file, either.
My first instinct would be GCC, as it can target ARM and is also redistributable under GPL.
Microsoft's eMbedded Visual C++ 4.0 is specifically targeted for WinCE and it's a free download. I'm not sure about redistributing it tho. Also it's getting old.