Comments (9)
Which version of clang/libcxx are you using? I cannot reproduce that on my machine with 3.6.2 and r253347:
$> clang++ -I../include -pthread -std=c++14 -o prime prime.cpp -pthread -stdlib=libc++ && echo $?
0
from parallelstl.
Thanks for the fast reply!
I have the problem with both libc++ in version 3.6.0 and 3.7.0. I think the order of the arguments do matter here, also the parameter -lc++abi
is needed to actually link against libc++, otherwise linking fails with libc++ in version 3.6.0 or 3.7.0. Also I believe that even if linking works without -lc++abi
strange things might happen at runtime if the headers from libc++ were used.
Please try again with -lc++abi
added and -stdlib=libc++
coming before -I../include
. I believe in this case libc++ is looked up before ParallelSTL and #include <experimental/algorithm>
will use the header from libcxx instead of the one from ParallelSTL.
Thanks for your help!
from parallelstl.
This works just as well:
clang++ -std=c++14 -stdlib=libc++ -lc++abi -pthread prime.cpp -o prime -I../include
The program runs just fine.
The -v
flag shows the include directories and their order:
#include "..." search starts here:
#include <...> search starts here:
../include
/usr/include/c++/v1
/usr/local/include
/home/tlutz/local/compilers/clang/3.6.2/bin/../lib/clang/3.6.2/include
/usr/include
End of search list.
from parallelstl.
Apparently I'm very stupid and forget the -I../include
, so the -I
switch always gets priority over the stdlib=libc++
. Still this makes it impossible to use experimental/algorithm
from libc++ in conjunction with ParallelSTL - which is not a problem for me. (At least when using grep
on the output of clang++ -std=c++11 -stdlib=libc++ -lc++abi -pthread prime.cpp -I../include -E
I do not get any matches for functions only defined in libc++'s experimental/algorithm
.)
The other problem still remains: std::sort
is a template in libc++ which makes it impossible to be passed as functor. This can be seen with
clang++ -std=c++14 -stdlib=libc++ -lc++abi -pthread sort.cpp -o sort -I../include
Which gives as output:
In file included from sort.cpp:6:
In file included from ../include/experimental/algorithm:7:
In file included from ../include/experimental/execution_policy:135:
In file included from ../include/experimental/bits/parallel/policy_parallel.h:607:
../include/experimental/bits/parallel/algos/par/sort.h:29:5: error: no matching function for call to 'diffract'
detail::diffract(first, last, std::sort<RandomAccessIterator, Compare>, comp);
^~~~~~~~~~~~~~~~
../include/experimental/bits/parallel/algos/par/sort.h:17:18: note: in instantiation of function template specialization 'std::experimental::parallel::v1::parallel_execution_policy::sort<std::__1::__wrap_iter<unsigned int *>, std::__1::less<unsigned int> >' requested here
return this->sort(first, last, std::less<typename iterator_traits<RandomAccessIterator>::value_type>());
^
../include/experimental/algorithm:701:10: note: in instantiation of function template specialization 'std::experimental::parallel::v1::parallel_execution_policy::sort<std::__1::__wrap_iter<unsigned int *> >' requested here
exec.sort(first, last);
^
sort.cpp:19:3: note: in instantiation of function template specialization 'std::experimental::parallel::v1::sort<const std::experimental::parallel::v1::parallel_execution_policy &, std::__1::__wrap_iter<unsigned int *> >' requested here
sort(policy, begin(copy), end(copy));
^
sort.cpp:43:19: note: in instantiation of function template specialization 'sort<const std::experimental::parallel::v1::parallel_execution_policy &>' requested here
auto time_par = sort(experimental::parallel::par, values);
^
../include/experimental/bits/parallel/algos/par/diffract.h:81:13: note: candidate template ignored: couldn't infer template argument '__Functor'
inline void diffract(__Iterator __first, __Iterator __last,
^
1 error generated.
from parallelstl.
experimental/algorithm
is not a standard header and it is probably shared by various proposals. I am not sure what libcxx implements there, but it is shouldn't be any standard function.
sort
is indeed a template function, but std::sort<RandomAccessIterator, Compare>
passed to diffract is a reference on an instance of this template, so this should be fine. Which version of clang are you using?
from parallelstl.
I tested it with clang 3.7.0 & libc++ 3.7.0, with clang 3.7.0 & libc++ 3.6.0 and with clang 3.5.2 and libc++ 3.7.0. With both clang 3.7.0 and 3.5.3 it works fine without compiling against libc++.
from parallelstl.
So you are having the problem with 3.6.0 or all versions when using libc++?
from parallelstl.
Right, I managed to reproduce it. This might be a bug in clang, which seems to need an explicit cast to instantiate the template.
from parallelstl.
I have the same problem with both version 3.6.0 and 3.7.0 of libc++ using clang 3.7.0 and also with clang 3.5.2 and libc++ 3.7.0. I have not tested clang 3.5.2 in conjunction with libc++ 3.6.0, as I have no machine with precompiled packages of 3.5.2 and libc++ 3.6.0 available, but I could also test this if needed, it just would take a bit longer as I'd have to compile them before testing.
from parallelstl.
Related Issues (18)
- Remove garbage files
- diffact_gather cannot handle init values
- std::is_heap_until not in the proposal HOT 1
- for_each_n now returns an iterator
- std::adjacent_difference has been removed HOT 1
- diffract requirements
- Compiling with clang fails HOT 1
- Parallel find_if returns wrong result HOT 1
- Modify experimental::parallel::rotate to support generic ForwardIterators HOT 1
- Is_heap implementation is flawed in certain cases HOT 1
- Missing test case for is_sorted_until HOT 1
- Keep up with C++14
- Implement dynamic execution policy
- Add std::is_heap HOT 1
- Add std::uninitialized_*
- Functions in <numeric> removed HOT 1
- return value of std::fill_n
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from parallelstl.