thrust
thrust copied to clipboard
Provide better error message when OpenMP is required but not found
Ideally, we want a human-readable compiler error. When we have static_assert, we can guard just the function bodies and do something like static_assert(_OPENMP, "Did you forget -fopenmp?")
Forwarded from http://code.google.com/p/thrust/issues/detail?id=94
Need to see how this fails today.
The current failure mode looks pretty reasonable: https://godbolt.org/z/zTPeTTj1z
If you forget the -fopenmp flag in the following code
#define THRUST_HOST_SYSTEM THRUST_HOST_SYSTEM_OMP
#include <thrust/reduce.h>
#include <thrust/host_vector.h>
#include <thrust/execution_policy.h>
#include <iostream>
int main(){
thrust::host_vector<int> v(10, 1);
auto r = thrust::reduce(thrust::host, v.begin(), v.end());
std::cout << r << std::endl;
}
you get:
error: static assertion failed with "OpenMP compiler support is not enabled"