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)
Related
I am novice at cmake, so please be gentle.
I have a medium sized project that has been using visual studio with cmake. I would like to use the build/install features that I currently use in visual studio, but with cmake in the terminal.
Currently the project uses a cmakesettings.json to switch between the different builds and locations. When I searched this though, it seems to be specific to visual studio?
https://github.com/microsoft/CmakeSettings
Is there a tool or easy way to use these settings with cmake instead of visual studio?
Note that in VS2019, the correct way to do this is to use CMakePresets.json and then you can build in a VS2019 or higher, VS2022, or in a CI using cmake from the cmd.exe. CMakeSettings.json is deprecated. To enabled support for them, there is an option that needs to be enabled. See this link https://learn.microsoft.com/en-us/cpp/build/cmake-presets-vs?view=msvc-160 for more information.
This question already has answers here:
How does CMake specify "Platform Toolset" for a Visual Studio 2015 project?
(4 answers)
Closed 4 years ago.
We're using CMake for our C++ project. On Windows we generate a Visual Studio project from our CMakeLists.txt. This works nicely, however we need to set an Intel Compiler specific option called BasePlatformToolset.
The option can be set in Visual Studio's GUI, after which an entry is added to the .vcxproj file. However every time we generate the project again from CMakeLists.txt the option is of course reset to the default value.
Is there a way to specify this option from the CMakeLists.txt file?
To clarify: this is not the same as setting the platform toolset. Since we're using the Intel compiler and not the default compiler, the platform toolset is specified as "Intel C++ Compiler 17.0". "Base Platform Toolset" is then an Intel compiler specific setting.
You should be able to use a generator expression that drops in for your compiler id:
target_compile_options(yourTarget
PRIVATE
$<$<CXX_COMPILER_ID:Intel>:/p:BasePlatformToolset=v120>)
I am using Intel opencl SDK on Windows with Intel HD graphics. Would like to compile my kernel offline then use in host code:
clCreateProgramFromBinary(…)
This link says :
OpenCL™ API Offline Compiler plug-in for Microsoft Visual Studio* IDE enables you to develop OpenCL applications with Visual Studio IDE.
The plug-in supports the following features:
New project templates
New OpenCL file (*.cl) template
Syntax highlighting
Types and functions auto-completion
Offline compilation and build of OpenCL kernels
LLVM code view
Assembly code view
program IR generation
Selection of target OpenCL device – CPU or Intel Graphics
NOTE
To work with the plug-in features, create an OpenCL project template \or convert an existing project into the OpenCL project.
I want to use this feature, so I wanted to know what all I have to install?
As per the note above I should create an OpenCL project template. How do I do this? Also what do we mean by "or convert an existing project into the OpenCL project"
In order to use the feature you just need to have the SDK installed on your system.
To create a new Empty OpenCL project template:
Go to: File > New > Project...
Look for OpenCL group under Templates\Visual C++ section and select Empty OpenCL Project for Windows
Once project created you can add a new OpenCL Code File (Project > Add New Item... > OpenCL > Intel SDK for OpenCL Application File) or add an exisitin *.cl file to the project
Configure the project's options to generate binary file (instructions here): Project > Properties > Intel SDK for OpenCL Applications > General > Generate binary file
Whenever you build the project, the OpenCL compiler will build all attached .cl files and generate for them program binaries.
To convert an existing Visual Studio project (instructions here), do the following:
Right-click on the project you want to convert in the Solution Explorer.
In the project menu click Convert to a project for OpenCL API
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
I am trying to use CMake for compiling CUDA based application on Windows (Visual Studio 2005). Here is an example stripped down CMake file:
cmake_minimum_required (VERSION 2.6)
project (HELLO)
#Support for CUDA Integration
FIND_PACKAGE(CUDA)
if(CUDA_FOUND)
SET(CUDA_NVCC_FLAGS "-arch;sm_13")
CUDA_ADD_EXECUTABLE(Hello hello.cu)
else(CUDA_FOUND)
message("CUDA is not installed on this system.")
endif()
There are a few issues I wish to understand with this.
When I open the solution file (Hello.sln), I don't see any custom build rule setup for the project (Right click on Project -> Custom build rules)
I do see a "Hello_generated_hello.cu.obj" added to my project in Visual Studio. What is this file and why is it added to the project?
By default CUDA Runtime API section doesn't come in Project properties.
If I enable an appropriate custom build rule (NvCudaRuntimeApi.rules), I can now see CUDA runtime API section. If I now go to GPU subsection, I see the GPU architecture still set to be sm_10.
Even if I use CUDA_INCLUDE_DIRECTORIES() Macro to add some directories for CUDA compilation, I won't see these settings in Project Properties -> CUDA Runtime API -> General -> Additional Include Directories.
I wish to know if FindCUDA() package is very able to properly configure VS 2005 project for CUDA based compilation. May be I need to specify additional options to properly configure the project. I would certainly wish to know that. I wish to make sure that whatever options I have specified through CMakeLists file, I should be able to review them easily in my generated VS 2005 project.
What is appropriate way to configure this?
CMake does not support custom build rules (like the CUDA runtime API .rules file), and therefore you cannot edit the CUDA property sheets that the .rules files provide if you use CMake to configure your project. However you can set any CUDA settings directly in the CMakeLists.txt that generates the project, and rebuilding your project will detect these changes and regenerate and reload the project files automatically.
The additional benefit of FindCUDA (besides being cross-platform) is proper dependency analysis so that you never end up with stale builds like you normally do when using CUDA .cu files in Visual Studio (with or without .rules files).
You can find an examples of using CMake with CUDA in the CUDPP project in the following files:
Top-level CMakeLists for the whole library and sample apps:
http://code.google.com/p/cudpp/source/browse/trunk/CMakeLists.txt
Project-specific CMakeLists file for a library: http://code.google.com/p/cudpp/source/browse/trunk/src/cudpp/CMakeLists.txt
Project-specific CMakeLists file for an executable: http://code.google.com/p/cudpp/source/browse/trunk/apps/simpleCUDPP/CMakeLists.txt
Hope that helps.