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

support for math_functions.h #28

Open
mxmlnkn opened this issue Mar 2, 2016 · 0 comments
Open

support for math_functions.h #28

mxmlnkn opened this issue Mar 2, 2016 · 0 comments

Comments

@mxmlnkn
Copy link
Contributor

mxmlnkn commented Mar 2, 2016

I got the following when porting by search and replace from CUDA to cupla:

error: there are no arguments to ‘max’ that depend on a template parameter, so a declaration of ‘max’ must be available

cupla should provide such a function (also simple min was missing). CUDA provides this in math_functions.h which is included by common_functions.h which is included by cuda_runtime.h. I didn't include this manually, but I guess nvcc did include this for me just like it is unnecessary to write #include <cuda.h> in a .cu file.

I guess min and max are not the only missing functions, henceforth the title.

The problem is, that std::max and so on can't be called from a device function.

Current workaround:

#ifndef max
#   define max( a, b ) ( ((a) > (b)) ? (a) : (b) )
#endif
#ifndef min
#   define min( a, b ) ( ((a) < (b)) ? (a) : (b) )
#endif
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants