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

max with conflicting types #178

Closed
chsigg opened this issue Feb 11, 2019 · 6 comments
Closed

max with conflicting types #178

chsigg opened this issue Feb 11, 2019 · 6 comments

Comments

@chsigg
Copy link
Contributor

chsigg commented Feb 11, 2019

Compiling gives an error 'deduced conflicting types for parameter '_Tp' ('unsigned int' vs. 'unsigned short')' at

info->comm->myParams->blockDim.x = max(info->comm->myParams->blockDim.x, coll.args.nThreads);

@sjeaugey
Copy link
Member

Would a cast solve the issue ? e.g. (uint32_t)coll.args.nThreads ?

@chsigg
Copy link
Contributor Author

chsigg commented Feb 11, 2019 via email

@sjeaugey
Copy link
Member

sjeaugey commented Feb 11, 2019

Actually, these kind of issues tend to happen frequently, so I was considering replacing all std::min and std::max by macros :

#define MIN(a, b) ((a)<(b) ? (a) : (b))
#define MAX(a, b) ((a)>(b) ? (a) : (b))

Do you see an advantage of using std:: functions instead of those trivial macros ?

@chsigg
Copy link
Contributor Author

chsigg commented Feb 11, 2019 via email

@sjeaugey
Copy link
Member

sjeaugey commented Feb 11, 2019

Actually those macros would evaluate the selected expression twice. I guess that's the main problem with that approach since it could cause weird bugs.

For example, a = MAX(b, ++a); might make a equal to a+1 or a+2 if a+1 is larger than b.

@AddyLaddy
Copy link
Collaborator

Fixes for this issue have been made to NCCL 2.4.6. Please re-open if the issue is not resolved.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants