Conversation
|
Just a quick heads up on this PR. |
There was a problem hiding this comment.
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