You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Mar 21, 2024. It is now read-only.
With Visual Studio 2015 and thrust version 1.8.3, it is impossible to compile to following code sample. I believe this is due to the implementation of OpenMP in Visual Studio. If this is confirmed by other users, it might be interesting to check which compiler is used in any OpenMP implementation of thrust functions. This way it would be possible to inform the user that this is a known bug and that CPP execution policy must be used instead with Visual Studio, at least for current versions of this compiler.
# include<thrust/sort.h>
# include<thrust/system/omp/execution_policy.h>
# include<chrono>
# include<random>
# include<vector>doubleunit_random()
{
static std::default_random_engine generator(std::chrono::system_clock::now().time_since_epoch().count());
static std::uniform_real_distribution<double> distribution(double(0), double(1));
returndistribution(generator);
}
intmain(int argc, char* argv[])
{
constexprsize_t input_size = 100000;
std::vector< double > input(input_size, 0);
for ( size_t i = 0; i < input_size; ++i)
input[i] = unit_random() * 1000;
thrust::sort(thrust::omp::par, input.begin(), input.end());
//of course, we get the same error for the following line compiled with /DTHRUST_HOST_SYSTEM=THRUST_HOST_SYSTEM_OMP//thrust::sort( input.begin(), input.end());return0;
}
Here is the compilation output in the Visual Studio 2015 console:
thrust/system/omp/detail/sort.inl(136): error C2146: syntax error: missing ';' before identifier 'nseg'
thrust/detail/sort.inl(83): note: see reference to function template instantiation 'void thrust::system::omp::detail::stable_sort<thrust::system::omp::detail::par_t,RandomAccessIterator,StrictWeakOrdering>(thrust::system::omp::detail::execution_policy<thrust::system::omp::detail::par_t> &,RandomAccessIterator,RandomAccessIterator,StrictWeakOrdering)' being compiled
with
[
RandomAccessIterator=std::_Vector_iterator<std::_Vector_val<std::_Simple_types<double>>>,
StrictWeakOrdering=thrust::less<value_type>
]
thrust/system/detail/generic/sort.inl(63): note: see reference to function template instantiation 'void thrust::stable_sort<DerivedPolicy,RandomAccessIterator,StrictWeakOrdering>(const thrust::detail::execution_policy_base<DerivedPolicy> &,RandomAccessIterator,RandomAccessIterator,StrictWeakOrdering)' being compiled
with
[
DerivedPolicy=thrust::system::omp::detail::par_t,
RandomAccessIterator=std::_Vector_iterator<std::_Vector_val<std::_Simple_types<double>>>,
StrictWeakOrdering=thrust::less<value_type>
]
thrust/detail/sort.inl(56): note: see reference to function template instantiation 'void thrust::system::detail::generic::sort<Derived,RandomAccessIterator,StrictWeakOrdering>(thrust::execution_policy<Derived> &,RandomAccessIterator,RandomAccessIterator,StrictWeakOrdering)' being compiled
with
[
Derived=thrust::system::omp::detail::par_t,
RandomAccessIterator=std::_Vector_iterator<std::_Vector_val<std::_Simple_types<double>>>,
StrictWeakOrdering=thrust::less<value_type>
]
thrust/system/detail/generic/sort.inl(49): note: see reference to function template instantiation 'void thrust::sort<DerivedPolicy,RandomAccessIterator,thrust::less<value_type>>(const thrust::detail::execution_policy_base<DerivedPolicy> &,RandomAccessIterator,RandomAccessIterator,StrictWeakOrdering)' being compiled
with
[
DerivedPolicy=thrust::system::omp::detail::par_t,
RandomAccessIterator=std::_Vector_iterator<std::_Vector_val<std::_Simple_types<double>>>,
StrictWeakOrdering=thrust::less<value_type>
]
thrust/detail/sort.inl(41): note: see reference to function template instantiation 'void thrust::system::detail::generic::sort<Derived,RandomAccessIterator>(thrust::execution_policy<Derived> &,RandomAccessIterator,RandomAccessIterator)' being compiled
with
[
Derived=thrust::system::omp::detail::par_t,
RandomAccessIterator=std::_Vector_iterator<std::_Vector_val<std::_Simple_types<double>>>
]
windows_cuda_thrust_error.cc(24): note: see reference to function template instantiation 'void thrust::sort<DerivedPolicy,std::_Vector_iterator<std::_Vector_val<std::_Simple_types<double>>>>(const thrust::detail::execution_policy_base<DerivedPolicy> &,RandomAccessIterator,RandomAccessIterator)' being compiled
with
[
DerivedPolicy=thrust::system::omp::detail::par_t,
RandomAccessIterator=std::_Vector_iterator<std::_Vector_val<std::_Simple_types<double>>>
]
thrust/system/omp/detail/sort.inl(136): error C2275: 'IndexType': illegal use of this type as an expression
thrust/system/omp/detail/sort.inl(113): note: see declaration of 'IndexType'
thrust/system/omp/detail/sort.inl(136): error C2065: 'nseg': undeclared identifier
thrust/system/omp/detail/sort.inl(142): error C2065: 'nseg': undeclared identifier
thrust/system/omp/detail/sort.inl(159): error C2065: 'nseg': undeclared identifier
========== Build: 0 succeeded, 1 failed, 1 up-to-date, 0 skipped ==========
The text was updated successfully, but these errors were encountered:
@egaburov: I think I have a workaround in my branch issue-817. I'd like to schedule this for version 1.8.3 if you think we can fit it in. Otherwise, I'll push it to master. What do you think?
Sounds good, we will target this bugfix for 1.8.3. I'll use issue-817 branch for the integration purpose. I plan to get it done by end of the next week at the latest, and will submit PR to 1.8.3 then.
With Visual Studio 2015 and thrust version 1.8.3, it is impossible to compile to following code sample. I believe this is due to the implementation of OpenMP in Visual Studio. If this is confirmed by other users, it might be interesting to check which compiler is used in any OpenMP implementation of thrust functions. This way it would be possible to inform the user that this is a known bug and that CPP execution policy must be used instead with Visual Studio, at least for current versions of this compiler.
Here is the compilation output in the Visual Studio 2015 console:
The text was updated successfully, but these errors were encountered: