Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reducers not available when using c++17? #89

Closed
alejandroarmas opened this issue Apr 11, 2022 · 2 comments
Closed

Reducers not available when using c++17? #89

alejandroarmas opened this issue Apr 11, 2022 · 2 comments
Labels
bug Something isn't working

Comments

@alejandroarmas
Copy link

Describe the bug

Hi I was wondering if Reducers are depreciated because when I compiled with c++17, I got an error.

Expected behavior

Compiled Program when using the -std=c++17 flag.

OpenCilk version

Built from source.

clang version 12.0.0 (git@github.com:OpenCilk/opencilk-project.git 5d2851d)
Target: arm64-apple-darwin21.4.0
Thread model: posix
InstalledDir: /Users/alejandro/Downloads/opencilk-project/llvm/build/bin

However, my source does not compile if I include the header:

#include <cilk/reducer.h>

This leads to the following message.

(base) alejandro@Voyager NeuralNetworkPlusPlus % make
clang++ -Werror -I include -fopencilk -std=c++17 -pthread -Wall -O3 -gdwarf-3  -c m_algorithms.cpp -o m_algorithms.o
In file included from m_algorithms.cpp:4:
In file included from /Users/alejandro/Downloads/opencilk-project/llvm/build/lib/clang/12.0.0/include/cilk/reducer.h:64:
/Users/alejandro/Downloads/opencilk-project/llvm/build/lib/clang/12.0.0/include/cilk/metaprogramming.h:225:18: error: no template named 'pointer_to_binary_function' in namespace 'std'
    typedef std::pointer_to_binary_function<A, B, R> type;
            ~~~~~^

I noticed that std::pointer_to_binary_function is depreciated in c++17, how should I proceed? Thanks!

@alejandroarmas alejandroarmas added the bug Something isn't working label Apr 11, 2022
@neboat
Copy link
Collaborator

neboat commented Apr 11, 2022

Thanks for reporting the bug.

Can you try the following change and let me know if it works for you?

  • Replace lines 225 and 233 in opencilk-project/cheetah/include/cilk/metaprogramming.h with the following:
typedef std::function<R(A,B)> type;
  • Inside your build directory, run cmake --build . (to update your build to reflect the change above).

Assuming that works, I'll queue up this change for the next OpenCilk release.

@neboat
Copy link
Collaborator

neboat commented Jul 22, 2022

We have completely changed the implementation for reducers in the latest release. The relevant header file is no longer part of OpenCilk.

The new implementation of reducers should work with C++17. There is some minimal documentation about using the new reducer syntax and implementation in the release notes. We are preparing more complete user documentation on reducers, which we plan to post on the OpenCilk website, www.opencilk.org.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants