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());
}









share|improve this question


















  • 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

















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());
}









share|improve this question


















  • 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















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());
}









share|improve this question













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++






share|improve this question













share|improve this question











share|improve this question




share|improve this question










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
















  • 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



















active

oldest

votes











Your Answer






StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");

StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














 

draft saved


draft discarded


















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






























active

oldest

votes













active

oldest

votes









active

oldest

votes






active

oldest

votes
















 

draft saved


draft discarded



















































 


draft saved


draft discarded














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





















































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







Popular posts from this blog

Bressuire

Vorschmack

Quarantine