Closed wbernoudy closed 8 years ago
Does that macro calculate four exponentials? If we don't care about non-GCC compilers, we can use expression macros to avoid that, something like:
({ float _a = exp(x), _b = exp(-x); ((_a - _b) / (_a + _b)) })
Yup, that makes a lot of sense. It's quite inefficient for a simple function being called so much. I'm a C noob, I didn't know you could use macros like that.
I couldn't actually get it to work within the macro. However, I just declared a new function in cl/activation.cl
and used that in the other macros which seems to work fine.
I just realized I accidentally made this PR for the master branch when it should be for clover-compatibility. Is there a way to change it? Or should I make a new PR? Thanks!
Apparently you cant create a PR to a non-existent branch, so I've pushed your branch directly to a new branch at https://github.com/hughperkins/DeepCL/tree/clover-compatibility
(I've also removed static from the cl files in 92bb336
(By the way, William, you might want to check that your email address in your ~/.gitconfig matches with your github email address, that way your account shows up as a contributor and so on)
This is to avoid the tanh function which the Clover driver for OpenCL 1.1 doesn't seem to provide.