-
Notifications
You must be signed in to change notification settings - Fork 5
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
Minimal broadcasting engine for c++ #6
base: master
Are you sure you want to change the base?
Conversation
Yes, |
Pretty cool :) I'll look into it in more detail! |
Maybe we can develop an interface for the C++ solutions: #include "solution.cpp"
extern "C"
{
void benchmark_broadcast(){
auto op = make_lazy([](auto& out, auto x, auto y, auto z) { out = x + y - std::sin(z); });
materialize(op)
}
void benchmark_sum(){
...
}
} Not sure if we should generate the elements in |
And I would have access to the benchmark code in a more orderly manner ;) |
Well, that will generate a bunch of questions though. For example, if we pass pointers to the interface, C++ can't be sure that they don't alias so not all optimizations can be enabled an these kind of things. However, benchmarking the creation as well will require me to write more code (as we'll need to use a uninitialized vector type) and this kind of stuff. We might be able to develop an interface which initializes a couple of global C++ arrays, and then calls functions without parameters to bench. Also, I think this might be a bit overkill. I think the minimal time for one iteration gives a good indication of the quality of the generated code. |
Sounds good ;)
Yeah I guess ... I may, or may not, want to use the minimal C interface to further play around with it, though :P |
@SimonDanisch please tell me updated if you need more things in that example. I didn't add benchmark because there is no native 2D array in C++... |
This is somehow simpler (but probably less generic) than @wolfv solution. Probably a good starter before eating wolv's one :-)