Why does the compiler say my execution policy is undefined?
up vote
0
down vote
favorite
I'm trying to do a parallel STL sort but I get a compiler error when I specify the execution policy:
1>c:usersdavemcdocumentsgpu-ray-traversal-cudasrcrttesttestcpp.cpp(14): error C2039: 'execution': is not a member of 'std'
I am including and in the GUI I see items from the execution namespace listed as possible completions of "std::". I am using Visual Studio 2017 version 15.8.9, which supports execution policies.
Here is my code:
#include <vector>
#include <execution>
#include <algorithm>
void testHostSort(size_t N)
{
std::vector<float> a(N);
std::generate(a.begin(), a.end(), () {return (float)rand(); });
std::sort(std::execution::par, a.begin(), a.end());
}
c++
|
show 2 more comments
up vote
0
down vote
favorite
I'm trying to do a parallel STL sort but I get a compiler error when I specify the execution policy:
1>c:usersdavemcdocumentsgpu-ray-traversal-cudasrcrttesttestcpp.cpp(14): error C2039: 'execution': is not a member of 'std'
I am including and in the GUI I see items from the execution namespace listed as possible completions of "std::". I am using Visual Studio 2017 version 15.8.9, which supports execution policies.
Here is my code:
#include <vector>
#include <execution>
#include <algorithm>
void testHostSort(size_t N)
{
std::vector<float> a(N);
std::generate(a.begin(), a.end(), () {return (float)rand(); });
std::sort(std::execution::par, a.begin(), a.end());
}
c++
4
Are you compiling with/std:c++17
or/std:c++latest
switch? Otherwise it defaults to C++14
– UnholySheep
Nov 10 at 17:59
I wasn't. Thanks for that. However, I just added /std:c++latest and rebuilt all but I'm getting the same result.
– All the Rage
Nov 10 at 18:06
1
Cannot reproduce, it works fine with the switch enabled: godbolt.org/z/tLd_C7
– UnholySheep
Nov 10 at 18:08
I try it in an isolated project and it works, as you point out, but it doesn't work as part of my whole codebase. I wonder what I'm missing.
– All the Rage
Nov 10 at 18:36
1
Could be various things: Something overwriting your C++ standard setting, maybe the project is targeting an older Windows runtime that doesn't support C++17 execution policies. However it's not related to the code, but your project settings
– UnholySheep
Nov 10 at 18:37
|
show 2 more comments
up vote
0
down vote
favorite
up vote
0
down vote
favorite
I'm trying to do a parallel STL sort but I get a compiler error when I specify the execution policy:
1>c:usersdavemcdocumentsgpu-ray-traversal-cudasrcrttesttestcpp.cpp(14): error C2039: 'execution': is not a member of 'std'
I am including and in the GUI I see items from the execution namespace listed as possible completions of "std::". I am using Visual Studio 2017 version 15.8.9, which supports execution policies.
Here is my code:
#include <vector>
#include <execution>
#include <algorithm>
void testHostSort(size_t N)
{
std::vector<float> a(N);
std::generate(a.begin(), a.end(), () {return (float)rand(); });
std::sort(std::execution::par, a.begin(), a.end());
}
c++
I'm trying to do a parallel STL sort but I get a compiler error when I specify the execution policy:
1>c:usersdavemcdocumentsgpu-ray-traversal-cudasrcrttesttestcpp.cpp(14): error C2039: 'execution': is not a member of 'std'
I am including and in the GUI I see items from the execution namespace listed as possible completions of "std::". I am using Visual Studio 2017 version 15.8.9, which supports execution policies.
Here is my code:
#include <vector>
#include <execution>
#include <algorithm>
void testHostSort(size_t N)
{
std::vector<float> a(N);
std::generate(a.begin(), a.end(), () {return (float)rand(); });
std::sort(std::execution::par, a.begin(), a.end());
}
c++
c++
asked Nov 10 at 17:56
All the Rage
16411
16411
4
Are you compiling with/std:c++17
or/std:c++latest
switch? Otherwise it defaults to C++14
– UnholySheep
Nov 10 at 17:59
I wasn't. Thanks for that. However, I just added /std:c++latest and rebuilt all but I'm getting the same result.
– All the Rage
Nov 10 at 18:06
1
Cannot reproduce, it works fine with the switch enabled: godbolt.org/z/tLd_C7
– UnholySheep
Nov 10 at 18:08
I try it in an isolated project and it works, as you point out, but it doesn't work as part of my whole codebase. I wonder what I'm missing.
– All the Rage
Nov 10 at 18:36
1
Could be various things: Something overwriting your C++ standard setting, maybe the project is targeting an older Windows runtime that doesn't support C++17 execution policies. However it's not related to the code, but your project settings
– UnholySheep
Nov 10 at 18:37
|
show 2 more comments
4
Are you compiling with/std:c++17
or/std:c++latest
switch? Otherwise it defaults to C++14
– UnholySheep
Nov 10 at 17:59
I wasn't. Thanks for that. However, I just added /std:c++latest and rebuilt all but I'm getting the same result.
– All the Rage
Nov 10 at 18:06
1
Cannot reproduce, it works fine with the switch enabled: godbolt.org/z/tLd_C7
– UnholySheep
Nov 10 at 18:08
I try it in an isolated project and it works, as you point out, but it doesn't work as part of my whole codebase. I wonder what I'm missing.
– All the Rage
Nov 10 at 18:36
1
Could be various things: Something overwriting your C++ standard setting, maybe the project is targeting an older Windows runtime that doesn't support C++17 execution policies. However it's not related to the code, but your project settings
– UnholySheep
Nov 10 at 18:37
4
4
Are you compiling with
/std:c++17
or /std:c++latest
switch? Otherwise it defaults to C++14– UnholySheep
Nov 10 at 17:59
Are you compiling with
/std:c++17
or /std:c++latest
switch? Otherwise it defaults to C++14– UnholySheep
Nov 10 at 17:59
I wasn't. Thanks for that. However, I just added /std:c++latest and rebuilt all but I'm getting the same result.
– All the Rage
Nov 10 at 18:06
I wasn't. Thanks for that. However, I just added /std:c++latest and rebuilt all but I'm getting the same result.
– All the Rage
Nov 10 at 18:06
1
1
Cannot reproduce, it works fine with the switch enabled: godbolt.org/z/tLd_C7
– UnholySheep
Nov 10 at 18:08
Cannot reproduce, it works fine with the switch enabled: godbolt.org/z/tLd_C7
– UnholySheep
Nov 10 at 18:08
I try it in an isolated project and it works, as you point out, but it doesn't work as part of my whole codebase. I wonder what I'm missing.
– All the Rage
Nov 10 at 18:36
I try it in an isolated project and it works, as you point out, but it doesn't work as part of my whole codebase. I wonder what I'm missing.
– All the Rage
Nov 10 at 18:36
1
1
Could be various things: Something overwriting your C++ standard setting, maybe the project is targeting an older Windows runtime that doesn't support C++17 execution policies. However it's not related to the code, but your project settings
– UnholySheep
Nov 10 at 18:37
Could be various things: Something overwriting your C++ standard setting, maybe the project is targeting an older Windows runtime that doesn't support C++17 execution policies. However it's not related to the code, but your project settings
– UnholySheep
Nov 10 at 18:37
|
show 2 more comments
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53241841%2fwhy-does-the-compiler-say-my-execution-policy-is-undefined%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
4
Are you compiling with
/std:c++17
or/std:c++latest
switch? Otherwise it defaults to C++14– UnholySheep
Nov 10 at 17:59
I wasn't. Thanks for that. However, I just added /std:c++latest and rebuilt all but I'm getting the same result.
– All the Rage
Nov 10 at 18:06
1
Cannot reproduce, it works fine with the switch enabled: godbolt.org/z/tLd_C7
– UnholySheep
Nov 10 at 18:08
I try it in an isolated project and it works, as you point out, but it doesn't work as part of my whole codebase. I wonder what I'm missing.
– All the Rage
Nov 10 at 18:36
1
Could be various things: Something overwriting your C++ standard setting, maybe the project is targeting an older Windows runtime that doesn't support C++17 execution policies. However it's not related to the code, but your project settings
– UnholySheep
Nov 10 at 18:37