-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
[POC] Adds TH_TENSOR_APPLY2_PARALLEL #395
base: master
Are you sure you want to change the base?
Conversation
Just a quick heads up on this PR. |
break; \ | ||
} \ | ||
} \ | ||
} \ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Feels like there's a lot of code duplication here. Can't we just call THTensor_isContiguous
? Same for counting the number of elements. We'd need the tensor type as parameter to the macro (in addition to the value type), but that can be easily added.
Sorry for the delay in getting back. It looks good to me in principle, but we should try to reduce the amount of code duplication. |
Hi Dominik, I'll replace those repetitive parts by their respective function calls. |
Hi @dominikgrewe , I was thinking again about this again, and I'm not sure we would like to have a different interface than the one in I agree though that there are lots of code duplication, making the compilation time quite long. What do you think ? @soumith @andresy @koraykv @dominikgrewe |
Following the discussion in #323, I've tried to add a macro
TH_TENSOR_APPLY2_PARALLEL
, which uses omp if both tensors are contiguous. For the moment, I haven't set a threshold to use omp or not.As a proof of concept, I added it to the unary operations implemented by
LAB_IMPLEMENT_BASIC_FUNCTION
(likeabs
,tan
, etc).Any thoughts ?
cc @dominikgrewe