I am using VS2010 and the Intel C++ compiler (Intel Composer XE 2013 SP1.) When I try to parallellize a for-loop using OpenMP I get the following warning:
warning #3180: unrecognized OpenMP #pragma
Looking at http://software.intel.com/en-us/articles/getting-started-with-openmp it seems I should pass /Qopenmp as a command line option, but I am not entirely sure where to do this in VS.
Where in VS do I activate OpenMP support for the Intel C++ compiler?
Right click project, then go to Properties, then Configuration Properties -> C/C++ -> Language [Intel C++] -> OpenMP Support
Related
After installing Intel Performance Library (IPP) on Windows 10 a new option appears in Visual Studio -> Properties called Intel Performance Libraries. This makes it very easy to add IPP to a project.
Is there a way to adjust settings here with Cmake?
To enable IPP in VS project you can use the built-in property VS_GLOBAL_UseIntelIPP of a target.
You can define the following macro and use it for all the targets:
macro(setup_intel_ipp_windows TARGET_NAME)
if(MSVC)
set_target_properties(${TARGET_NAME} PROPERTIES VS_GLOBAL_UseIntelIPP "Sequential") # Parallel_Static
endif(MSVC)
endmacro(setup_intel_ipp_windows)
I have a fairly large CUDA/C++ project that compiles to a static library. The toolchain is CUDA Toolkit 9.0/9.2 and VS 2017. I cannot change the company toolchain. Our most expensive kernel was hit by a nvcc compiler regression introduced in the 9.0 Toolkit. I have filed this with the Nvidia developer's website, and received confirmation of the regression. That was about a year ago, and the ticket is still open. Maybe the 10.0 Toolkit will fix it.
But I cannot wait. So my plan is to compile just this one specific kernel using the 8.0 nvcc compiler and v140 (VS 2015) compiler. It is a single .hpp file with __device__ decorator for the kernel declaration, and a .cu file with the definition. The kernel does not call other kernels; it is a rather simple kernel.
From the v140 Native Tools Command Prompt, I executed:
nvcc -x cu -arch=sm_61 -dc kernel.cu
And obtained a kernel.obj file. I have read the NVCC documentation on CUDA Compiler Driver NVCC. I confess to not entirely understanding. There are several compilation phases, and I do not see which is the correct course for my case.
My question is how to link this object file into my greater static library? If someone could point me to the correct series of commands, or better yet, how to include this into the VS Project, presumably with kernel.hpp and kernel.obj, I would be most grateful.
Following Njuffa's comment above, the simplest solution is create a static library using the earlier, performant toolchain for that kernel (VS 2015 & CUDA 8.0 Tookit). Then link that library into the greater project with the later toolchain. I did so with success.
I created a CUDA 8.0 template project in VS 2015 with only the kernel source and header. The compilation target set to static library. This created a .lib file. The .lib file and header are then added to the C++ linker settings of the greater project, using VS 2017 and CUDA 9.0. All test executables using this static library pass. This is a much simpler solution than trying to recompile using an intermediate compilation format ( ptx, cubin, etc.)
Although ultimately, the real solution was to refactor the kernel to use shared memory more efficiently, negating the need for the older nvcc version.
Visual Studio 2017 RC includes much tighter CMake integration, allowing one to skip the intermediate step of generating project/solution files and use CMake effectively as the project file itself. There is sufficient documentation from Microsoft for using these features with regular C++ files, and there is sufficient documentation on this website (example) for making CUDA and Cmake play nicely, when it comes to linking CUDA code to C++ code.
What I can't find information on is how to make CMake, Visual Studio 2017 RC, and CUDA 8.0 all play nicely. This is a difficult problem, because 2017RC has no integration for the CUDA SDK anyways, and I was hoping to use 2017RC so that my C++ interface to the CUDA code could use C++14 and/or C++17. I'm working on the beginning of a large project that will primarily involve writing a static CUDA library that is accessed through C++: so, I'd like to get the CMake to take care of compiling my CUDA sources into a static library, and for it to help with feeding the linking information to Visual Studio. So far, I haven't had any success with using FindCUDA's various features to accomplish this, but I'm assuming that's due to a misunderstanding on my part. I've read through the documentation on separable compilation from Nvidia, but that wasn't helpful for figuring out CMake.
Further, whenever I try to use CMake in VS2017RC, I still end up with the various vcxproj files that CMake likes to spit out. Is this due to an error on my part? How do I edit the build command arguments, or CMakeLists.txt, to get the functionality demonstrated here to work?
The very short (and only at the time of writing) answer is that you can't. CUDA 8 doesn't support VS2017. Only VS2015 is presently supported.
You can always find the compiler/IDE versions which the release version of CUDA supports here
Edit to add that the CUDA 9 release will add official support for VS2017.
All you need to do is set the CUDA_HOST_COMPILER variable to a supported compiler for example the visual studio 2015 compiler.
In my case this is:
C:/Program Files (x86)/Microsoft Visual Studio 14.0/VC/bin/amd64/cl.exe
As both runtime libraries are binary compatible you can use the 2015 compiler within CUDA and compile all the rest of the application with the 2017 compiler.
I am looking for a way to program for MIPS assembly using VS2013 - but there is no assembly type project.
Is there a way to do this and get the .s output files of MIPS so I can later run them on other machines, and if I can't do this on VS2013 than how do I program MIPS on Windows 7?
Thanks
The assembler used in visual studio is Microsoft assembler (MASM), and yes you can program assembly language on it.
select an "Empty Project" then configure the "Build Customizations" of the project to use MASM, after that add a new c++ source file and rename it to any name .asm
Here are the detailed steps:
http://kipirvine.com/asm/gettingStartedVS2013/index.htm
And as for assembling your code to run on MIPS, I guess you can't do that with MASM, because it's a x86 assembler,
here is a list of the supported processor types directives on masm
.386
.386P
.387
.486
.486P
.586
.586P
.686
.686P
.K3D
.MMX
.XMM
Refer to
https://msdn.microsoft.com/en-us/library/vstudio/8t163bt0%28v=vs.100%29.aspx
the processor section.
Nevertheless, there is an option in the project "Properties" > "Linker" > "advanced" that let you chose between different machines, including Mips, but I guess this will merely set the Machine Flag in the PE header to MIPS and when the assembler try to build your module it will find a conflict between the machine type flag and the code in the module. But I'm not sure If you can build codes for MIPS.
To run MIPS programs on Windows 7, you need some type of emulator and a corresponding tool set. In the case of ARM processors, there are emulators that include a source level debugger and tool sets, including compilers, assemblers, linkers, and binary image output utilities for embedded systems. There's also a debugger for embedded systems that is run from Windows and some type of connection to the embedded system. The tool set runs on Windows, but targets the emulator or an actual embedded system. I don't know if there's a equivalent tool set and emulator like this for the MIPS processor.
My C++11 project is currently using CMAKE, XCODE, CLANG on OSX. I wish to compile this code on Windows.
Plan is to use the same cmake settings files on windows. Best case would be to use CMAKE to generate VS projects which uses Clang or gcc for C++11 .
Seems to me, that Visual Studio is just not going to fully support C++11 for a while. So we should all try to find a general solution for cross platform C++11.
How would one use CMAKE to generate projects/makefiles which would compile C++11 code on windows?
CMake's Visual Studio generator will always use the cl compiler of Visual C++.
What you request would require writing a new Generator for CMake. That is, the problem cannot be solved by writing a clever CMakeLists.txt, but has to be solved by adding a feature to the CMake core binary itself. I agree that this could be useful once Clang achieves a suitable level of Windows support, but at the point of this writing, it is probably too early for that.
You might want to take a look at the experimental compile-features mechanism for CMake. This is not yet part of CMake 3.0, but is planned to be integrated with one of the next releases. The idea is that you just specify which C++11 features you need and CMake takes care of configuring the compiler accordingly (or gives an error if the compiler does not support the feature at all).
You can create VS projects which use clang by specifying the LLVM toolset when you generate.
http://public.kitware.com/Bug/view.php?id=14863
Eg:
cmake.exe .. -T LLVM-vs2010