In title, I am specific about the task that I want to achieve. I want to utilize the c++17 features such as parallel STL etc. On visual studio 2017, I configure to c++17 under project properties for language. Even after doing this I get the error with #include that no execution file. I am just starting with simple example of array addition in parallel with C++ 17 algorithms. How do I resolve this?
Source:
#include <stddef.h>
#include <stdio.h>
#include <algorithm>
#include <execution>
#include <chrono>
#include <random>
#include <ratio>
#include <vector>
using std::chrono::duration;
using std::chrono::duration_cast;
using std::chrono::high_resolution_clock;
using std::milli;
using std::random_device;
using std::sort;
using std::vector;
const size_t testSize = 1'000'000;
const int iterationCount = 5;
void print_results(const char *const tag, const vector<double>& sorted,
high_resolution_clock::time_point startTime,
high_resolution_clock::time_point endTime) {
printf("%s: Lowest: %g Highest: %g Time: %fms\n", tag, sorted.front(),
sorted.back(),
duration_cast<duration<double, milli>>(endTime - startTime).count());
}
int main() {
random_device rd;
// generate some random doubles:
printf("Testing with %zu doubles...\n", testSize);
vector<double> doubles(testSize);
for (auto& d : doubles) {
d = static_cast<double>(rd());
}
// time how long it takes to sort them:
for (int i = 0; i < iterationCount; ++i)
{
vector<double> sorted(doubles);
const auto startTime = high_resolution_clock::now();
sort(sorted.begin(), sorted.end());
const auto endTime = high_resolution_clock::now();
print_results("Serial", sorted, startTime, endTime);
}
}
and this is error: Error C1083 Cannot open include file: 'execution': No such file or directory
Task that I want to achieve is that C++17 with CUDA GPU. Both new to me although not c++ in itself. But I am interested in parallel STL of C++17 with CUDA. I want to start from base. Any suggestions will help me?
Thanks, Govind