Skip to content

Commit 3951085

Browse files
author
Colin Robertson
committed
Add /openmp:experimental for 2019
1 parent 322f632 commit 3951085

File tree

1 file changed

+31
-20
lines changed

1 file changed

+31
-20
lines changed

docs/build/reference/openmp-enable-openmp-2-0-support.md

Lines changed: 31 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,47 +1,57 @@
11
---
2-
title: "/openmp (Enable OpenMP 2.0 Support)"
3-
ms.date: "11/04/2016"
2+
title: "/openmp (Enable OpenMP Support)"
3+
ms.date: "04/15/2019"
44
f1_keywords: ["/openmp", "VC.Project.VCCLCompilerTool.OpenMP"]
55
helpviewer_keywords: ["/openmp compiler option [C++]", "-openmp compiler option [C++]"]
66
ms.assetid: 9082b175-18d3-4378-86a7-c0eb95664e13
77
---
8-
# /openmp (Enable OpenMP 2.0 Support)
8+
# /openmp (Enable OpenMP Support)
99

10-
Causes the compiler to process `#pragma`[omp](../../preprocessor/omp.md).
10+
Causes the compiler to process [`#pragma omp`](../../preprocessor/omp.md) directives in support of OpenMP.
1111

1212
## Syntax
1313

14-
```
15-
/openmp
16-
```
14+
::: moniker range=">= vs-2019"
15+
16+
> **/openmp**[**:**__experimental__]
17+
18+
::: moniker-end
19+
20+
::: moniker range="<= vs-2017"
21+
22+
> **/openmp**
23+
24+
::: moniker-end
1725

1826
## Remarks
1927

2028
`#pragma omp` is used to specify [Directives](../../parallel/openmp/reference/openmp-directives.md) and [Clauses](../../parallel/openmp/reference/openmp-clauses.md). If **/openmp** is not specified in a compilation, the compiler ignores OpenMP clauses and directives. [OpenMP Function](../../parallel/openmp/reference/openmp-functions.md) calls are processed by the compiler even if **/openmp** is not specified.
2129

22-
Applications compiled with **/openmp** and **/clr** can only be run in a single application domain process; multiple application domains are not supported. That is, when the module constructor (.cctor) is run, it will detect the process is compiled with **/openmp** and if the application is being loaded into a non-default runtime. For more information, see [appdomain](../../cpp/appdomain.md), [/clr (Common Language Runtime Compilation)](clr-common-language-runtime-compilation.md), and [Initialization of Mixed Assemblies](../../dotnet/initialization-of-mixed-assemblies.md).
30+
::: moniker range=">= vs-2019"
2331

24-
If you attempt to load an application compiled with **/openmp** and **/clr** into a non-default application domain, a <xref:System.TypeInitializationException> exception will be thrown outside the debugger and a OpenMPWithMultipleAppdomainsException exception will be thrown in the debugger.
32+
The C++ compiler currently supports the OpenMP 2.0 standard. However, Visual Studio 2019 also now offers SIMD functionality. To use SIMD, compile by using the **/openmp:experimental** option. This option enables both the usual OpenMP features, and additional OpenMP SIMD features not available when using the **/openmp** switch.
33+
34+
::: moniker-end
35+
36+
Applications compiled by using both **/openmp** and **/clr** can only be run in a single application domain process; multiple application domains are not supported. That is, when the module constructor (.cctor) is run, it detects if the process is compiled with **/openmp**, and if the application is loaded into a non-default runtime. For more information, see [appdomain](../../cpp/appdomain.md), [/clr (Common Language Runtime Compilation)](clr-common-language-runtime-compilation.md), and [Initialization of Mixed Assemblies](../../dotnet/initialization-of-mixed-assemblies.md).
37+
38+
If you attempt to load an application compiled with **/openmp** and **/clr** into a non-default application domain, a <xref:System.TypeInitializationException> exception is thrown outside the debugger, and a `OpenMPWithMultipleAppdomainsException` exception is thrown in the debugger.
2539

2640
These exceptions can also be raised in the following situations:
2741

28-
- If your application compiled with **/clr**, but not with **/openmp**, is loaded into a non-default application domain but where the process includes an application that was compiled with **/openmp**.
42+
- If your application is compiled with **/clr** but not **/openmp**, and is loaded into a non-default application domain, where the process includes an application that was compiled with **/openmp**.
2943

30-
- If you pass your **/clr** application to a utility, such as regasm.exe ([Regasm.exe (Assembly Registration Tool)](/dotnet/framework/tools/regasm-exe-assembly-registration-tool)), which loads its target assemblies into a non-default application domain.
44+
- If you pass your **/clr** application to a utility, such as [regasm.exe](/dotnet/framework/tools/regasm-exe-assembly-registration-tool), which loads its target assemblies into a non-default application domain.
3145

3246
The common language runtime's code access security doesn’t work in OpenMP regions. If you apply a CLR code access security attribute outside a parallel region, it won't be in effect in the parallel region.
3347

34-
Microsoft advises that you do not write **/openmp** applications that allows partially trusted callers, using <xref:System.Security.AllowPartiallyTrustedCallersAttribute>, or any CLR code access security attributes.
48+
Microsoft doesn't recommend that you write **/openmp** applications that allow partially trusted callers, using <xref:System.Security.AllowPartiallyTrustedCallersAttribute>, or any CLR code access security attributes.
3549

3650
### To set this compiler option in the Visual Studio development environment
3751

3852
1. Open the project's **Property Pages** dialog box. For details, see [Set C++ compiler and build properties in Visual Studio](../working-with-project-properties.md).
3953

40-
1. Expand the **Configuration Properties** node.
41-
42-
1. Expand the **C/C++** node.
43-
44-
1. Select the **Language** property page.
54+
1. Expand the **Configuration Properties** > **C/C++** > **Language** property page.
4555

4656
1. Modify the **OpenMP Support** property.
4757

@@ -57,7 +67,7 @@ When you compile with **/openmp**, the second call to test2 never runs any longe
5767

5868
So if you have only one loop in your application and it runs in less than 15ms (adjusted for the approximate overhead on your machine), **/openmp** may not be appropriate, but if it's anything more than that, you may want to consider using **/openmp**.
5969

60-
```
70+
```cpp
6171
// cpp_compiler_options_openmp.cpp
6272
#include <omp.h>
6373
#include <stdio.h>
@@ -103,5 +113,6 @@ int main(int argc, char* argv[]) {
103113
104114
## See also
105115
106-
[MSVC Compiler Options](compiler-options.md)<br/>
107-
[MSVC Compiler Command-Line Syntax](compiler-command-line-syntax.md)
116+
[MSVC Compiler Options](compiler-options.md) \
117+
[MSVC Compiler Command-Line Syntax](compiler-command-line-syntax.md) \
118+
[OpenMP in MSVC](../../parallel/openmp/openmp-in-visual-cpp.md)

0 commit comments

Comments
 (0)